summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
Diffstat (limited to 'chart2')
-rw-r--r--chart2/chartview.pmk30
-rw-r--r--chart2/inc/makefile.mk47
-rw-r--r--chart2/inc/pch/precompiled_chart2.cxx29
-rw-r--r--chart2/inc/pch/precompiled_chart2.hxx275
-rw-r--r--chart2/prj/build.lst26
-rw-r--r--chart2/prj/d.lst27
-rw-r--r--chart2/qa/TestCaseOldAPI.java1033
-rw-r--r--chart2/qa/data.chd14
-rw-r--r--chart2/qa/makefile.mk70
-rw-r--r--chart2/qa/unoapi/Test.java51
-rw-r--r--chart2/qa/unoapi/knownissues.xcl40
-rw-r--r--chart2/qa/unoapi/makefile.mk48
-rw-r--r--chart2/qa/unoapi/sch.sce26
-rw-r--r--chart2/qa/unoapi/testdocuments/TransparencyChart.sxsbin0 -> 10810 bytes
-rw-r--r--chart2/qa/unoapi/testdocuments/emptyChart.sdsbin0 -> 44544 bytes
-rw-r--r--chart2/qa/unoapi/testdocuments/space-metal.jpgbin0 -> 4313 bytes
-rw-r--r--chart2/source/controller/accessibility/AccStatisticsObject.cxx81
-rw-r--r--chart2/source/controller/accessibility/AccStatisticsObject.hxx68
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx1010
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.cxx332
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.hxx142
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.cxx289
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.hxx104
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartView.cxx416
-rw-r--r--chart2/source/controller/accessibility/AccessibleTextHelper.cxx203
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.cxx116
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.hxx65
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.cxx145
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.hxx48
-rw-r--r--chart2/source/controller/accessibility/makefile.mk54
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.cxx207
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.hxx105
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.cxx596
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.hxx140
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx319
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx169
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx633
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx149
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx1623
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx887
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx160
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx2148
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx319
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.cxx211
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.hxx103
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.cxx459
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.hxx113
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx435
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx139
-rw-r--r--chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx48
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.cxx566
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.hxx136
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx402
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx137
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx192
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx89
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx158
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx111
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx156
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx49
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx448
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx76
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx172
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx102
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx193
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx61
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx201
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx87
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx199
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx92
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx511
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx92
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx167
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx54
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx131
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx82
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx70
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx60
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx189
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx287
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx59
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx1154
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx57
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx330
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx59
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx593
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx61
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx87
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx58
-rw-r--r--chart2/source/controller/chartapiwrapper/makefile.mk77
-rw-r--r--chart2/source/controller/chartcontroller.component56
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc216
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src543
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc213
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src543
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.cxx56
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.hxx63
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx1285
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx317
-rw-r--r--chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx53
-rw-r--r--chart2/source/controller/dialogs/CommonResources.hrc79
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx1364
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx204
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx1000
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.hxx181
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx849
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx197
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx852
-rw-r--r--chart2/source/controller/dialogs/RangeEdit.cxx70
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionButton.cxx56
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionHelper.cxx198
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionListener.cxx75
-rw-r--r--chart2/source/controller/dialogs/ResourceIds.hrc86
-rw-r--r--chart2/source/controller/dialogs/Strings.src608
-rw-r--r--chart2/source/controller/dialogs/Strings_AdditionalControls.src57
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src153
-rw-r--r--chart2/source/controller/dialogs/Strings_Scale.src44
-rw-r--r--chart2/source/controller/dialogs/Strings_Statistic.src72
-rw-r--r--chart2/source/controller/dialogs/TabPages.hrc172
-rw-r--r--chart2/source/controller/dialogs/TextDirectionListBox.cxx60
-rw-r--r--chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx70
-rw-r--r--chart2/source/controller/dialogs/TitleDialogData.cxx124
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.cxx78
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.hrc35
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType.src57
-rw-r--r--chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx139
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx267
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.hrc32
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.src39
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx433
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.cxx363
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.hrc47
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.src148
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx253
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.hrc33
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.src48
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx164
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc46
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src99
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx74
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc32
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.src42
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx134
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc31
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.src43
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.cxx78
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.hrc31
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertLegend.src47
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.cxx67
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.hrc31
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTitle.src42
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.cxx114
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.hrc31
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.src48
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx86
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.hxx54
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx652
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.src39
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeFont.cxx92
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeFont.src62
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx93
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeParagraph.src67
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx118
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.hrc40
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.src49
-rw-r--r--chart2/source/controller/dialogs/hidother.src113
-rw-r--r--chart2/source/controller/dialogs/makefile.mk205
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.cxx112
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.hxx67
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.src49
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx419
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx104
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_IDs.hrc45
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc169
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar.cxx787
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc63
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc228
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx265
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.hxx90
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc32
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc80
-rw-r--r--chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc59
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.cxx155
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.hxx75
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.src49
-rw-r--r--chart2/source/controller/dialogs/res_Titles.cxx224
-rw-r--r--chart2/source/controller/dialogs/res_Titles.hrc47
-rw-r--r--chart2/source/controller/dialogs/res_Titles.hxx77
-rw-r--r--chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc149
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx282
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx83
-rw-r--r--chart2/source/controller/dialogs/res_Trendline_IDs.hrc44
-rw-r--r--chart2/source/controller/dialogs/res_Trendline_tmpl.hrc123
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx363
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc38
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx99
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.src102
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx296
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc40
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx112
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.src154
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx650
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc46
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx145
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.src175
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx323
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx99
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.src194
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx498
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx112
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.src308
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx1183
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hrc62
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx125
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.src273
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.cxx74
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.hxx64
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.src42
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx1076
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hrc50
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx179
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.src180
-rw-r--r--chart2/source/controller/dialogs/tp_DataSourceControls.cxx57
-rw-r--r--chart2/source/controller/dialogs/tp_DataSourceControls.hxx70
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.cxx100
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.hxx65
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.src38
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx88
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx69
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.src66
-rw-r--r--chart2/source/controller/dialogs/tp_Location.cxx71
-rw-r--r--chart2/source/controller/dialogs/tp_Location.hrc32
-rw-r--r--chart2/source/controller/dialogs/tp_Location.hxx76
-rw-r--r--chart2/source/controller/dialogs/tp_Location.src75
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx104
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.hxx58
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.src36
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx126
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hrc40
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx67
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.src91
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx414
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hrc40
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx124
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.src101
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx518
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx126
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.src203
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx313
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hrc45
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx95
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.src186
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx126
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx69
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.src93
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.cxx77
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.hxx59
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.src38
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx187
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc50
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx93
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src93
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx445
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx274
-rw-r--r--chart2/source/controller/drawinglayer/makefile.mk49
-rw-r--r--chart2/source/controller/inc/AccessibleBase.hxx379
-rw-r--r--chart2/source/controller/inc/AccessibleChartView.hxx155
-rw-r--r--chart2/source/controller/inc/AccessibleTextHelper.hxx113
-rw-r--r--chart2/source/controller/inc/AxisItemConverter.hxx92
-rw-r--r--chart2/source/controller/inc/CharacterPropertyItemConverter.hxx84
-rw-r--r--chart2/source/controller/inc/ChartDocumentWrapper.hxx235
-rw-r--r--chart2/source/controller/inc/ChartRenderer.hxx76
-rw-r--r--chart2/source/controller/inc/ConfigurationAccess.hxx59
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx110
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx112
-rwxr-xr-xchart2/source/controller/inc/ErrorBarItemConverter.hxx84
-rw-r--r--chart2/source/controller/inc/GraphicPropertyItemConverter.hxx85
-rw-r--r--chart2/source/controller/inc/HelpIds.hrc162
-rw-r--r--chart2/source/controller/inc/ItemConverter.hxx215
-rw-r--r--chart2/source/controller/inc/ItemPropertyMap.hxx90
-rw-r--r--chart2/source/controller/inc/LegendItemConverter.hxx79
-rw-r--r--chart2/source/controller/inc/MenuResIds.hrc41
-rw-r--r--chart2/source/controller/inc/MultipleChartConverters.hxx130
-rw-r--r--chart2/source/controller/inc/MultipleItemConverter.hxx60
-rw-r--r--chart2/source/controller/inc/ObjectHierarchy.hxx120
-rw-r--r--chart2/source/controller/inc/ObjectNameProvider.hxx87
-rw-r--r--chart2/source/controller/inc/PositionAndSizeHelper.hxx60
-rwxr-xr-xchart2/source/controller/inc/RangeEdit.hxx56
-rw-r--r--chart2/source/controller/inc/RangeSelectionButton.hxx55
-rwxr-xr-xchart2/source/controller/inc/RangeSelectionHelper.hxx87
-rw-r--r--chart2/source/controller/inc/RangeSelectionListener.hxx79
-rw-r--r--chart2/source/controller/inc/RegressionCurveItemConverter.hxx82
-rw-r--r--chart2/source/controller/inc/RegressionEquationItemConverter.hxx83
-rw-r--r--chart2/source/controller/inc/SchSlotIds.hxx234
-rw-r--r--chart2/source/controller/inc/SeriesOptionsItemConverter.hxx102
-rw-r--r--chart2/source/controller/inc/ShapeController.hrc50
-rw-r--r--chart2/source/controller/inc/StatisticsItemConverter.hxx75
-rw-r--r--chart2/source/controller/inc/TabPageNotifiable.hxx51
-rw-r--r--chart2/source/controller/inc/TextDirectionListBox.hxx49
-rw-r--r--chart2/source/controller/inc/TimerTriggeredControllerLock.hxx63
-rw-r--r--chart2/source/controller/inc/TitleDialogData.hxx67
-rw-r--r--chart2/source/controller/inc/TitleItemConverter.hxx80
-rw-r--r--chart2/source/controller/inc/ViewElementListProvider.hxx70
-rw-r--r--chart2/source/controller/inc/dlg_ChartType.hxx76
-rw-r--r--chart2/source/controller/inc/dlg_ChartType_UNO.hxx86
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx105
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx129
-rw-r--r--chart2/source/controller/inc/dlg_DataEditor.hxx121
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx100
-rw-r--r--chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx101
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataLabel.hxx72
-rw-r--r--chart2/source/controller/inc/dlg_InsertErrorBars.hxx78
-rw-r--r--chart2/source/controller/inc/dlg_InsertLegend.hxx72
-rw-r--r--chart2/source/controller/inc/dlg_InsertTitle.hxx64
-rw-r--r--chart2/source/controller/inc/dlg_InsertTrendline.hxx68
-rw-r--r--chart2/source/controller/inc/dlg_ObjectProperties.hxx155
-rw-r--r--chart2/source/controller/inc/dlg_ShapeFont.hxx59
-rw-r--r--chart2/source/controller/inc/dlg_ShapeParagraph.hxx54
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx84
-rw-r--r--chart2/source/controller/inc/res_ErrorBar.hxx155
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx835
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx518
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx700
-rwxr-xr-xchart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx456
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx809
-rw-r--r--chart2/source/controller/itemsetwrapper/ItemConverter.cxx269
-rw-r--r--chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx236
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx233
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx84
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx276
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx187
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx254
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx453
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx697
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx245
-rw-r--r--chart2/source/controller/itemsetwrapper/makefile.mk60
-rw-r--r--chart2/source/controller/main/ChartController.cxx1603
-rw-r--r--chart2/source/controller/main/ChartController.hxx737
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx80
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx946
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx191
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx860
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx271
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx919
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx2029
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.cxx204
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.hxx69
-rw-r--r--chart2/source/controller/main/ChartFrameloader.cxx208
-rw-r--r--chart2/source/controller/main/ChartFrameloader.hxx91
-rw-r--r--chart2/source/controller/main/ChartRenderer.cxx178
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx172
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx67
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx271
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx88
-rw-r--r--chart2/source/controller/main/CommandDispatch.cxx211
-rw-r--r--chart2/source/controller/main/CommandDispatch.hxx151
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx216
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.hxx160
-rw-r--r--chart2/source/controller/main/ConfigurationAccess.cxx120
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx805
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.hxx136
-rw-r--r--chart2/source/controller/main/DragMethod_Base.cxx93
-rw-r--r--chart2/source/controller/main/DragMethod_Base.hxx69
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.cxx163
-rw-r--r--chart2/source/controller/main/DragMethod_PieSegment.hxx64
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.cxx237
-rw-r--r--chart2/source/controller/main/DragMethod_RotateDiagram.hxx92
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx674
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.hrc50
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.hxx93
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx344
-rw-r--r--chart2/source/controller/main/ElementSelector.hxx123
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.cxx114
-rw-r--r--chart2/source/controller/main/FeatureCommandDispatchBase.hxx115
-rw-r--r--chart2/source/controller/main/ImplUndoManager.cxx505
-rw-r--r--chart2/source/controller/main/ImplUndoManager.hxx227
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx862
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx189
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx685
-rw-r--r--chart2/source/controller/main/SelectionHelper.hxx139
-rw-r--r--chart2/source/controller/main/ShapeController.cxx738
-rw-r--r--chart2/source/controller/main/ShapeController.hxx100
-rw-r--r--chart2/source/controller/main/ShapeToolbarController.cxx298
-rw-r--r--chart2/source/controller/main/ShapeToolbarController.hxx103
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.cxx156
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.hxx110
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx147
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.hxx86
-rw-r--r--chart2/source/controller/main/UndoGuard.cxx143
-rw-r--r--chart2/source/controller/main/UndoManager.cxx440
-rw-r--r--chart2/source/controller/main/_serviceregistration_controller.cxx118
-rw-r--r--chart2/source/controller/main/makefile.mk84
-rw-r--r--chart2/source/controller/makefile.mk136
-rw-r--r--chart2/source/controller/menus/ShapeContextMenu.src124
-rw-r--r--chart2/source/controller/menus/ShapeEditContextMenu.src65
-rw-r--r--chart2/source/controller/menus/makefile.mk63
-rw-r--r--chart2/source/inc/AxisHelper.hxx247
-rw-r--r--chart2/source/inc/AxisIndexDefines.hxx38
-rw-r--r--chart2/source/inc/BaseGFXHelper.hxx102
-rw-r--r--chart2/source/inc/CachedDataSequence.hxx192
-rw-r--r--chart2/source/inc/CharacterProperties.hxx147
-rw-r--r--chart2/source/inc/ChartDebugTrace.hxx69
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx115
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx104
-rw-r--r--chart2/source/inc/ChartViewHelper.hxx51
-rw-r--r--chart2/source/inc/CloneHelper.hxx124
-rw-r--r--chart2/source/inc/ColorPerPointHelper.hxx65
-rw-r--r--chart2/source/inc/CommonConverters.hxx279
-rw-r--r--chart2/source/inc/CommonFunctors.hxx228
-rw-r--r--chart2/source/inc/ConfigColorScheme.hxx94
-rw-r--r--chart2/source/inc/ConfigItemListener.hxx45
-rw-r--r--chart2/source/inc/ContainerHelper.hxx181
-rw-r--r--chart2/source/inc/ControllerLockGuard.hxx93
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx213
-rw-r--r--chart2/source/inc/DataSource.hxx83
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx164
-rw-r--r--chart2/source/inc/DiagramHelper.hxx350
-rw-r--r--chart2/source/inc/DisposeHelper.hxx101
-rw-r--r--chart2/source/inc/ErrorBar.hxx160
-rw-r--r--chart2/source/inc/EventListenerHelper.hxx222
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx108
-rw-r--r--chart2/source/inc/ExponentialRegressionCurveCalculator.hxx74
-rw-r--r--chart2/source/inc/FastPropertyIdRanges.hxx57
-rw-r--r--chart2/source/inc/FillProperties.hxx91
-rw-r--r--chart2/source/inc/FormattedStringHelper.hxx57
-rwxr-xr-xchart2/source/inc/InternalData.hxx109
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx246
-rw-r--r--chart2/source/inc/LabeledDataSequence.hxx115
-rw-r--r--chart2/source/inc/LegendHelper.hxx78
-rw-r--r--chart2/source/inc/LifeTime.hxx255
-rw-r--r--chart2/source/inc/LineProperties.hxx77
-rw-r--r--chart2/source/inc/LinearRegressionCurveCalculator.hxx74
-rw-r--r--chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx74
-rw-r--r--chart2/source/inc/MeanValueRegressionCurveCalculator.hxx73
-rw-r--r--chart2/source/inc/MediaDescriptorHelper.hxx207
-rw-r--r--chart2/source/inc/ModifyListenerCallBack.hxx68
-rw-r--r--chart2/source/inc/ModifyListenerHelper.hxx307
-rw-r--r--chart2/source/inc/MutexContainer.hxx50
-rw-r--r--chart2/source/inc/NameContainer.hxx104
-rw-r--r--chart2/source/inc/NamedFillProperties.hxx75
-rw-r--r--chart2/source/inc/NamedLineProperties.hxx75
-rw-r--r--chart2/source/inc/NamedProperties.hxx62
-rw-r--r--chart2/source/inc/NoWarningThisInCTOR.hxx46
-rw-r--r--chart2/source/inc/OPropertySet.hxx319
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx278
-rw-r--r--chart2/source/inc/PotentialRegressionCurveCalculator.hxx76
-rw-r--r--chart2/source/inc/PropertyHelper.hxx197
-rw-r--r--chart2/source/inc/RangeHighlighter.hxx116
-rw-r--r--chart2/source/inc/ReferenceSizeProvider.hxx145
-rw-r--r--chart2/source/inc/RegressionCurveCalculator.hxx93
-rw-r--r--chart2/source/inc/RegressionCurveHelper.hxx241
-rw-r--r--chart2/source/inc/RelativePositionHelper.hxx120
-rw-r--r--chart2/source/inc/RelativeSizeHelper.hxx59
-rw-r--r--chart2/source/inc/ResId.hxx48
-rw-r--r--chart2/source/inc/RessourceManager.hxx53
-rw-r--r--chart2/source/inc/Scaling.hxx210
-rw-r--r--chart2/source/inc/SceneProperties.hxx96
-rw-r--r--chart2/source/inc/ServiceMacros.hxx146
-rw-r--r--chart2/source/inc/StackMode.hxx47
-rw-r--r--chart2/source/inc/StatisticsHelper.hxx133
-rw-r--r--chart2/source/inc/Strings.hrc409
-rw-r--r--chart2/source/inc/ThreeDHelper.hxx159
-rw-r--r--chart2/source/inc/TitleHelper.hxx101
-rw-r--r--chart2/source/inc/TrueGuard.hxx48
-rw-r--r--chart2/source/inc/UncachedDataSequence.hxx206
-rw-r--r--chart2/source/inc/UndoGuard.hxx120
-rw-r--r--chart2/source/inc/UndoManager.hxx180
-rw-r--r--chart2/source/inc/UserDefinedProperties.hxx69
-rw-r--r--chart2/source/inc/WeakListenerAdapter.hxx127
-rw-r--r--chart2/source/inc/WrappedDefaultProperty.hxx66
-rw-r--r--chart2/source/inc/WrappedDirectStateProperty.hxx53
-rw-r--r--chart2/source/inc/WrappedIgnoreProperty.hxx81
-rw-r--r--chart2/source/inc/WrappedProperty.hxx86
-rw-r--r--chart2/source/inc/WrappedPropertySet.hxx145
-rw-r--r--chart2/source/inc/XMLRangeHelper.hxx74
-rw-r--r--chart2/source/inc/charttoolsdllapi.hxx41
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx262
-rw-r--r--chart2/source/inc/chartview/DataPointSymbolSupplier.hxx59
-rw-r--r--chart2/source/inc/chartview/DrawModelWrapper.hxx114
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx119
-rw-r--r--chart2/source/inc/chartview/NumberFormatterWrapper.hxx82
-rw-r--r--chart2/source/inc/chartview/chartviewdllapi.hxx41
-rw-r--r--chart2/source/inc/chartview/servicenames_charttypes.hxx47
-rw-r--r--chart2/source/inc/exports.dxp2
-rw-r--r--chart2/source/inc/macros.hxx53
-rw-r--r--chart2/source/inc/servicenames.hxx71
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx49
-rw-r--r--chart2/source/inc/servicenames_coosystems.hxx43
-rw-r--r--chart2/source/inc/servicenames_dlwrapper.hxx41
-rw-r--r--chart2/source/model/chartmodel.component150
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx873
-rw-r--r--chart2/source/model/filter/makefile.mk49
-rw-r--r--chart2/source/model/inc/BaseCoordinateSystem.hxx190
-rw-r--r--chart2/source/model/inc/CartesianCoordinateSystem.hxx93
-rw-r--r--chart2/source/model/inc/ChartTypeManager.hxx92
-rw-r--r--chart2/source/model/inc/DataSeries.hxx230
-rw-r--r--chart2/source/model/inc/DataSeriesTree.hxx91
-rw-r--r--chart2/source/model/inc/Diagram.hxx241
-rw-r--r--chart2/source/model/inc/PolarCoordinateSystem.hxx93
-rw-r--r--chart2/source/model/inc/StockBar.hxx119
-rw-r--r--chart2/source/model/inc/XMLFilter.hxx223
-rw-r--r--chart2/source/model/inc/_serviceregistration_charttypes.hxx40
-rw-r--r--chart2/source/model/main/Axis.cxx646
-rw-r--r--chart2/source/model/main/Axis.hxx184
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx409
-rw-r--r--chart2/source/model/main/CartesianCoordinateSystem.cxx155
-rwxr-xr-xchart2/source/model/main/ChartModel.cxx1379
-rw-r--r--chart2/source/model/main/ChartModel.hxx609
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx860
-rw-r--r--chart2/source/model/main/DataPoint.cxx319
-rw-r--r--chart2/source/model/main/DataPoint.hxx143
-rw-r--r--chart2/source/model/main/DataPointProperties.cxx438
-rw-r--r--chart2/source/model/main/DataPointProperties.hxx101
-rw-r--r--chart2/source/model/main/DataSeries.cxx624
-rw-r--r--chart2/source/model/main/DataSeriesProperties.cxx98
-rw-r--r--chart2/source/model/main/DataSeriesProperties.hxx63
-rw-r--r--chart2/source/model/main/Diagram.cxx713
-rw-r--r--chart2/source/model/main/FormattedString.cxx263
-rw-r--r--chart2/source/model/main/FormattedString.hxx140
-rw-r--r--chart2/source/model/main/GridProperties.cxx273
-rw-r--r--chart2/source/model/main/GridProperties.hxx128
-rw-r--r--chart2/source/model/main/LayoutContainer.cxx138
-rw-r--r--chart2/source/model/main/LayoutContainer.hxx90
-rw-r--r--chart2/source/model/main/Legend.cxx369
-rw-r--r--chart2/source/model/main/Legend.hxx154
-rw-r--r--chart2/source/model/main/PageBackground.cxx255
-rw-r--r--chart2/source/model/main/PageBackground.hxx132
-rw-r--r--chart2/source/model/main/PolarCoordinateSystem.cxx155
-rw-r--r--chart2/source/model/main/StockBar.cxx267
-rw-r--r--chart2/source/model/main/Title.cxx412
-rw-r--r--chart2/source/model/main/Title.hxx147
-rw-r--r--chart2/source/model/main/Wall.cxx260
-rw-r--r--chart2/source/model/main/Wall.hxx127
-rw-r--r--chart2/source/model/main/_serviceregistration_model.cxx210
-rw-r--r--chart2/source/model/main/makefile.mk67
-rw-r--r--chart2/source/model/makefile.mk108
-rw-r--r--chart2/source/model/template/AreaChartType.cxx77
-rw-r--r--chart2/source/model/template/AreaChartType.hxx64
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx281
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.hxx103
-rw-r--r--chart2/source/model/template/BarChartType.cxx78
-rw-r--r--chart2/source/model/template/BarChartType.hxx64
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx353
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.hxx121
-rw-r--r--chart2/source/model/template/BubbleChartType.cxx242
-rw-r--r--chart2/source/model/template/BubbleChartType.hxx86
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx314
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx101
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx308
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.hxx61
-rw-r--r--chart2/source/model/template/CandleStickChartType.cxx355
-rw-r--r--chart2/source/model/template/CandleStickChartType.hxx90
-rw-r--r--chart2/source/model/template/ChartType.cxx325
-rw-r--r--chart2/source/model/template/ChartType.hxx183
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx619
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx933
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.hxx299
-rw-r--r--chart2/source/model/template/ColumnChartType.cxx202
-rw-r--r--chart2/source/model/template/ColumnChartType.hxx74
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx453
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.hxx119
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.cxx101
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.hxx59
-rw-r--r--chart2/source/model/template/DataInterpreter.cxx461
-rw-r--r--chart2/source/model/template/DataInterpreter.hxx100
-rw-r--r--chart2/source/model/template/FilledNetChartType.cxx94
-rw-r--r--chart2/source/model/template/FilledNetChartType.hxx63
-rw-r--r--chart2/source/model/template/LineChartType.cxx214
-rw-r--r--chart2/source/model/template/LineChartType.hxx75
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx412
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.hxx109
-rw-r--r--chart2/source/model/template/NetChartType.cxx180
-rw-r--r--chart2/source/model/template/NetChartType.hxx93
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx229
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.hxx87
-rw-r--r--chart2/source/model/template/PieChartType.cxx239
-rw-r--r--chart2/source/model/template/PieChartType.hxx81
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx661
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.hxx140
-rw-r--r--chart2/source/model/template/ScatterChartType.cxx296
-rw-r--r--chart2/source/model/template/ScatterChartType.hxx91
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx432
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.hxx110
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx560
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.hxx138
-rw-r--r--chart2/source/model/template/StockDataInterpreter.cxx344
-rw-r--r--chart2/source/model/template/StockDataInterpreter.hxx69
-rw-r--r--chart2/source/model/template/XYDataInterpreter.cxx273
-rw-r--r--chart2/source/model/template/XYDataInterpreter.hxx61
-rw-r--r--chart2/source/model/template/_serviceregistration_charttypes.cxx138
-rw-r--r--chart2/source/model/template/makefile.mk82
-rw-r--r--chart2/source/tools/AxisHelper.cxx976
-rw-r--r--chart2/source/tools/BaseGFXHelper.cxx222
-rw-r--r--chart2/source/tools/CachedDataSequence.cxx409
-rw-r--r--chart2/source/tools/CharacterProperties.cxx608
-rw-r--r--chart2/source/tools/ChartDebugTrace.cxx417
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx267
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx685
-rw-r--r--chart2/source/tools/ChartViewHelper.cxx72
-rw-r--r--chart2/source/tools/ColorPerPointHelper.cxx97
-rw-r--r--chart2/source/tools/CommonConverters.cxx549
-rw-r--r--chart2/source/tools/ConfigColorScheme.cxx202
-rw-r--r--chart2/source/tools/ControllerLockGuard.cxx89
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx918
-rw-r--r--chart2/source/tools/DataSource.cxx91
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx552
-rw-r--r--chart2/source/tools/DiagramHelper.cxx1559
-rw-r--r--chart2/source/tools/ErrorBar.cxx363
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx422
-rw-r--r--chart2/source/tools/ExponentialRegressionCurveCalculator.cxx183
-rw-r--r--chart2/source/tools/FillProperties.cxx277
-rw-r--r--chart2/source/tools/FormattedStringHelper.cxx80
-rw-r--r--chart2/source/tools/ImplOPropertySet.cxx207
-rw-r--r--chart2/source/tools/ImplOPropertySet.hxx96
-rwxr-xr-xchart2/source/tools/InternalData.cxx530
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx1314
-rw-r--r--chart2/source/tools/LabeledDataSequence.cxx179
-rw-r--r--chart2/source/tools/LegendHelper.cxx147
-rw-r--r--chart2/source/tools/LifeTime.cxx546
-rw-r--r--chart2/source/tools/LineProperties.cxx185
-rw-r--r--chart2/source/tools/LinearRegressionCurveCalculator.cxx179
-rw-r--r--chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx191
-rw-r--r--chart2/source/tools/MeanValueRegressionCurveCalculator.cxx143
-rw-r--r--chart2/source/tools/MediaDescriptorHelper.cxx221
-rw-r--r--chart2/source/tools/ModifyListenerCallBack.cxx134
-rw-r--r--chart2/source/tools/ModifyListenerHelper.cxx213
-rw-r--r--chart2/source/tools/MutexContainer.cxx43
-rw-r--r--chart2/source/tools/NameContainer.cxx189
-rw-r--r--chart2/source/tools/NamedFillProperties.cxx114
-rw-r--r--chart2/source/tools/NamedLineProperties.cxx99
-rw-r--r--chart2/source/tools/NamedProperties.cxx59
-rw-r--r--chart2/source/tools/OPropertySet.cxx530
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx1491
-rw-r--r--chart2/source/tools/PotentialRegressionCurveCalculator.cxx177
-rw-r--r--chart2/source/tools/PropertyHelper.cxx314
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx406
-rw-r--r--chart2/source/tools/ReferenceSizeProvider.cxx378
-rw-r--r--chart2/source/tools/RegressionCalculationHelper.hxx131
-rw-r--r--chart2/source/tools/RegressionCurveCalculator.cxx168
-rw-r--r--chart2/source/tools/RegressionCurveHelper.cxx736
-rw-r--r--chart2/source/tools/RegressionCurveModel.cxx441
-rw-r--r--chart2/source/tools/RegressionCurveModel.hxx259
-rw-r--r--chart2/source/tools/RegressionEquation.cxx362
-rw-r--r--chart2/source/tools/RegressionEquation.hxx143
-rw-r--r--chart2/source/tools/RelativePositionHelper.cxx399
-rw-r--r--chart2/source/tools/RelativeSizeHelper.cxx100
-rw-r--r--chart2/source/tools/ResId.cxx47
-rw-r--r--chart2/source/tools/RessourceManager.cxx49
-rw-r--r--chart2/source/tools/Scaling.cxx271
-rw-r--r--chart2/source/tools/SceneProperties.cxx382
-rw-r--r--chart2/source/tools/StatisticsHelper.cxx403
-rw-r--r--chart2/source/tools/ThreeDHelper.cxx1527
-rw-r--r--chart2/source/tools/TitleHelper.cxx378
-rw-r--r--chart2/source/tools/TrueGuard.cxx47
-rw-r--r--chart2/source/tools/UncachedDataSequence.cxx379
-rw-r--r--chart2/source/tools/UserDefinedProperties.cxx73
-rw-r--r--chart2/source/tools/WeakListenerAdapter.cxx76
-rw-r--r--chart2/source/tools/WrappedDefaultProperty.cxx92
-rw-r--r--chart2/source/tools/WrappedDirectStateProperty.cxx59
-rw-r--r--chart2/source/tools/WrappedIgnoreProperty.cxx148
-rw-r--r--chart2/source/tools/WrappedProperty.cxx150
-rw-r--r--chart2/source/tools/WrappedPropertySet.cxx495
-rw-r--r--chart2/source/tools/XMLRangeHelper.cxx418
-rw-r--r--chart2/source/tools/_serviceregistration_tools.cxx193
-rw-r--r--chart2/source/tools/charttools.component92
-rw-r--r--chart2/source/tools/exports.flt3
-rw-r--r--chart2/source/tools/makefile.mk197
-rw-r--r--chart2/source/view/axes/MinimumAndMaximumSupplier.cxx201
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx760
-rw-r--r--chart2/source/view/axes/TickmarkHelper.cxx937
-rw-r--r--chart2/source/view/axes/TickmarkHelper.hxx276
-rw-r--r--chart2/source/view/axes/TickmarkProperties.hxx53
-rw-r--r--chart2/source/view/axes/VAxisBase.cxx253
-rw-r--r--chart2/source/view/axes/VAxisBase.hxx107
-rw-r--r--chart2/source/view/axes/VAxisOrGridBase.cxx98
-rw-r--r--chart2/source/view/axes/VAxisOrGridBase.hxx83
-rw-r--r--chart2/source/view/axes/VAxisProperties.cxx486
-rw-r--r--chart2/source/view/axes/VAxisProperties.hxx168
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx1600
-rw-r--r--chart2/source/view/axes/VCartesianAxis.hxx146
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.cxx250
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.hxx64
-rw-r--r--chart2/source/view/axes/VCartesianGrid.cxx339
-rw-r--r--chart2/source/view/axes/VCartesianGrid.hxx71
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx598
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.cxx234
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.hxx66
-rw-r--r--chart2/source/view/axes/VPolarAxis.cxx83
-rw-r--r--chart2/source/view/axes/VPolarAxis.hxx71
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.cxx211
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.hxx68
-rw-r--r--chart2/source/view/axes/VPolarGrid.cxx273
-rw-r--r--chart2/source/view/axes/VPolarGrid.hxx96
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.cxx186
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.hxx98
-rw-r--r--chart2/source/view/axes/makefile.mk66
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx1005
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx134
-rwxr-xr-xchart2/source/view/charttypes/BarChart.cxx1019
-rw-r--r--chart2/source/view/charttypes/BarChart.hxx110
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.cxx138
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.hxx76
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx417
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx94
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx398
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.hxx89
-rw-r--r--chart2/source/view/charttypes/CategoryPositionHelper.cxx100
-rw-r--r--chart2/source/view/charttypes/CategoryPositionHelper.hxx68
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx897
-rw-r--r--chart2/source/view/charttypes/PieChart.hxx145
-rw-r--r--chart2/source/view/charttypes/Splines.cxx545
-rw-r--r--chart2/source/view/charttypes/Splines.hxx61
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx2110
-rw-r--r--chart2/source/view/charttypes/makefile.mk55
-rw-r--r--chart2/source/view/chartview.component34
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx811
-rw-r--r--chart2/source/view/diagram/makefile.mk48
-rw-r--r--chart2/source/view/exports.flt4
-rw-r--r--chart2/source/view/inc/Clipping.hxx70
-rw-r--r--chart2/source/view/inc/LabelAlignment.hxx41
-rw-r--r--chart2/source/view/inc/LabelPositionHelper.hxx86
-rw-r--r--chart2/source/view/inc/LegendEntryProvider.hxx63
-rw-r--r--chart2/source/view/inc/Linear3DTransformation.hxx67
-rw-r--r--chart2/source/view/inc/MinimumAndMaximumSupplier.hxx100
-rw-r--r--chart2/source/view/inc/PlotterBase.hxx126
-rw-r--r--chart2/source/view/inc/PlottingPositionHelper.hxx406
-rw-r--r--chart2/source/view/inc/PolarLabelPositionHelper.hxx76
-rw-r--r--chart2/source/view/inc/PropertyMapper.hxx133
-rw-r--r--chart2/source/view/inc/ScaleAutomatism.hxx119
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx254
-rw-r--r--chart2/source/view/inc/Stripe.hxx89
-rw-r--r--chart2/source/view/inc/VCoordinateSystem.hxx212
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx264
-rw-r--r--chart2/source/view/inc/VDiagram.hxx136
-rw-r--r--chart2/source/view/inc/VLegendSymbolFactory.hxx77
-rw-r--r--chart2/source/view/inc/VLineProperties.hxx61
-rw-r--r--chart2/source/view/inc/VPolarTransformation.hxx67
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx453
-rw-r--r--chart2/source/view/inc/ViewDefines.hxx47
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx258
-rw-r--r--chart2/source/view/main/ChartItemPool.hxx58
-rw-r--r--chart2/source/view/main/ChartView.cxx3187
-rw-r--r--chart2/source/view/main/ChartView.hxx261
-rw-r--r--chart2/source/view/main/Clipping.cxx304
-rw-r--r--chart2/source/view/main/DataPointSymbolSupplier.cxx66
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx411
-rw-r--r--chart2/source/view/main/LabelPositionHelper.cxx488
-rw-r--r--chart2/source/view/main/Linear3DTransformation.cxx107
-rw-r--r--chart2/source/view/main/NumberFormatterWrapper.cxx169
-rw-r--r--chart2/source/view/main/PlotterBase.cxx135
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx667
-rw-r--r--chart2/source/view/main/PolarLabelPositionHelper.cxx188
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx539
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx2111
-rw-r--r--chart2/source/view/main/Stripe.cxx360
-rw-r--r--chart2/source/view/main/VDataSeries.cxx986
-rw-r--r--chart2/source/view/main/VLegend.cxx834
-rw-r--r--chart2/source/view/main/VLegend.hxx111
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx374
-rw-r--r--chart2/source/view/main/VLineProperties.cxx109
-rw-r--r--chart2/source/view/main/VPolarTransformation.cxx94
-rw-r--r--chart2/source/view/main/VTitle.cxx299
-rw-r--r--chart2/source/view/main/VTitle.hxx83
-rw-r--r--chart2/source/view/main/_serviceregistration_view.cxx64
-rw-r--r--chart2/source/view/main/makefile.mk68
-rw-r--r--chart2/source/view/makefile.mk128
-rw-r--r--chart2/uiconfig/accelerator/en-US/default.xml30
-rw-r--r--chart2/uiconfig/menubar/menubar.xml156
-rw-r--r--chart2/uiconfig/statusbar/statusbar.xml6
-rw-r--r--chart2/uiconfig/toolbar/arrowshapes.xml34
-rw-r--r--chart2/uiconfig/toolbar/basicshapes.xml29
-rw-r--r--chart2/uiconfig/toolbar/calloutshapes.xml11
-rw-r--r--chart2/uiconfig/toolbar/drawbar.xml20
-rw-r--r--chart2/uiconfig/toolbar/flowchartshapes.xml36
-rw-r--r--chart2/uiconfig/toolbar/standardbar.xml22
-rw-r--r--chart2/uiconfig/toolbar/starshapes.xml17
-rw-r--r--chart2/uiconfig/toolbar/symbolshapes.xml24
-rw-r--r--chart2/uiconfig/toolbar/toolbar.xml15
-rw-r--r--chart2/util/makefile.mk60
-rw-r--r--chart2/util/makefile.pmk46
-rw-r--r--chart2/util/target.pmk32
-rw-r--r--chart2/workbench/addin/exports.dxp3
-rw-r--r--chart2/workbench/addin/makefile.mk86
-rw-r--r--chart2/workbench/addin/sampleaddin.cxx716
-rw-r--r--chart2/workbench/addin/sampleaddin.def7
-rw-r--r--chart2/workbench/addin/sampleaddin.hxx161
786 files changed, 177338 insertions, 0 deletions
diff --git a/chart2/chartview.pmk b/chart2/chartview.pmk
new file mode 100644
index 000000000000..eee577e42287
--- /dev/null
+++ b/chart2/chartview.pmk
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+VISIBILITY_HIDDEN = TRUE
+
+CDEFS += -DOOO_DLLIMPLEMENTATION_CHARTVIEW
diff --git a/chart2/inc/makefile.mk b/chart2/inc/makefile.mk
new file mode 100644
index 000000000000..e3e7d19cd3ed
--- /dev/null
+++ b/chart2/inc/makefile.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=chart2
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/chart2/inc/pch/precompiled_chart2.cxx b/chart2/inc/pch/precompiled_chart2.cxx
new file mode 100644
index 000000000000..a1ea4db5fe99
--- /dev/null
+++ b/chart2/inc/pch/precompiled_chart2.cxx
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+
diff --git a/chart2/inc/pch/precompiled_chart2.hxx b/chart2/inc/pch/precompiled_chart2.hxx
new file mode 100644
index 000000000000..199564a9f024
--- /dev/null
+++ b/chart2/inc/pch/precompiled_chart2.hxx
@@ -0,0 +1,275 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:33.249162
+
+#ifdef PRECOMPILED_HEADERS
+//---MARKER---
+#include "sal/config.h"
+#include "sal/types.h"
+
+#include "com/sun/star/awt/CharSet.hpp"
+#include "com/sun/star/awt/FontFamily.hpp"
+#include "com/sun/star/awt/FontPitch.hpp"
+#include "com/sun/star/awt/FontSlant.hpp"
+#include "com/sun/star/awt/FontUnderline.hpp"
+#include "com/sun/star/awt/FontWeight.hpp"
+#include "com/sun/star/awt/Gradient.hpp"
+#include "com/sun/star/awt/Point.hpp"
+#include "com/sun/star/awt/Rectangle.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "com/sun/star/awt/XBitmap.hpp"
+#include "com/sun/star/beans/Property.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertyStates.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/chart2/data/XDataProvider.hpp"
+#include "com/sun/star/chart2/data/XDataReceiver.hpp"
+#include "com/sun/star/chart2/data/XDataSequence.hpp"
+#include "com/sun/star/chart2/data/XDataSink.hpp"
+#include "com/sun/star/chart2/data/XDataSource.hpp"
+#include "com/sun/star/chart2/data/XNumericalDataSequence.hpp"
+#include "com/sun/star/chart2/data/XTextualDataSequence.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/container/XContentEnumerationAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/document/XDocumentInfoSupplier.hpp"
+#include "com/sun/star/document/XEventBroadcaster.hpp"
+#include "com/sun/star/document/XEventsSupplier.hpp"
+#include "com/sun/star/document/XViewDataSupplier.hpp"
+#include "com/sun/star/drawing/BitmapMode.hpp"
+#include "com/sun/star/drawing/CircleKind.hpp"
+#include "com/sun/star/drawing/Direction3D.hpp"
+#include "com/sun/star/drawing/DoubleSequence.hpp"
+#include "com/sun/star/drawing/FillStyle.hpp"
+#include "com/sun/star/drawing/FlagSequence.hpp"
+#include "com/sun/star/drawing/Hatch.hpp"
+#include "com/sun/star/drawing/HomogenMatrix.hpp"
+#include "com/sun/star/drawing/HomogenMatrix3.hpp"
+#include "com/sun/star/drawing/LineDash.hpp"
+#include "com/sun/star/drawing/LineJoint.hpp"
+#include "com/sun/star/drawing/LineStyle.hpp"
+#include "com/sun/star/drawing/NormalsKind.hpp"
+#include "com/sun/star/drawing/PointSequence.hpp"
+#include "com/sun/star/drawing/PointSequenceSequence.hpp"
+#include "com/sun/star/drawing/PolyPolygonBezierCoords.hpp"
+#include "com/sun/star/drawing/PolyPolygonShape3D.hpp"
+#include "com/sun/star/drawing/PolygonKind.hpp"
+#include "com/sun/star/drawing/Position3D.hpp"
+#include "com/sun/star/drawing/ProjectionMode.hpp"
+#include "com/sun/star/drawing/RectanglePoint.hpp"
+#include "com/sun/star/drawing/ShadeMode.hpp"
+#include "com/sun/star/drawing/TextFitToSizeType.hpp"
+#include "com/sun/star/drawing/TextHorizontalAdjust.hpp"
+#include "com/sun/star/drawing/TextVerticalAdjust.hpp"
+#include "com/sun/star/drawing/XDrawPage.hpp"
+#include "com/sun/star/drawing/XDrawPageSupplier.hpp"
+#include "com/sun/star/drawing/XDrawPagesSupplier.hpp"
+#include "com/sun/star/drawing/XShape.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/embed/Aspects.hpp"
+#include "com/sun/star/embed/EmbedStates.hpp"
+#include "com/sun/star/embed/XComponentSupplier.hpp"
+#include "com/sun/star/embed/XEmbedObjectCreator.hpp"
+#include "com/sun/star/embed/XEmbedPersist.hpp"
+#include "com/sun/star/embed/XEmbeddedClient.hpp"
+#include "com/sun/star/embed/XEmbeddedObject.hpp"
+#include "com/sun/star/embed/XVisualObject.hpp"
+#include "com/sun/star/frame/XController.hpp"
+#include "com/sun/star/frame/XDispatch.hpp"
+#include "com/sun/star/frame/XDispatchProvider.hpp"
+#include "com/sun/star/frame/XLoadable.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XStorable.hpp"
+#include "com/sun/star/frame/XSynchronousFrameLoader.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/IndexOutOfBoundsException.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
+#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/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XServiceName.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/sheet/XRangeSelection.hpp"
+#include "com/sun/star/sheet/XSheetCellRangeContainer.hpp"
+#include "com/sun/star/sheet/XSpreadsheet.hpp"
+#include "com/sun/star/sheet/XSpreadsheetDocument.hpp"
+#include "com/sun/star/sheet/XSpreadsheets.hpp"
+#include "com/sun/star/style/CaseMap.hpp"
+#include "com/sun/star/style/ParagraphAdjust.hpp"
+#include "com/sun/star/style/XStyle.hpp"
+#include "com/sun/star/style/XStyleFamiliesSupplier.hpp"
+#include "com/sun/star/text/ControlCharacter.hpp"
+#include "com/sun/star/text/FontEmphasis.hpp"
+#include "com/sun/star/text/FontRelief.hpp"
+#include "com/sun/star/text/RubyAdjust.hpp"
+#include "com/sun/star/text/WritingMode.hpp"
+#include "com/sun/star/text/WritingMode2.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/text/XTextCursor.hpp"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/ui/XContextMenuInterception.hpp"
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "com/sun/star/uno/Type.hxx"
+#include "com/sun/star/uno/XAggregation.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/XWeak.hpp"
+#include "com/sun/star/util/CloseVetoException.hpp"
+#include "com/sun/star/util/URL.hpp"
+#include "com/sun/star/util/XCloneable.hpp"
+#include "com/sun/star/util/XCloseListener.hpp"
+#include "com/sun/star/util/XCloseable.hpp"
+#include "com/sun/star/util/XModifiable.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+#include "com/sun/star/util/XURLTransformer.hpp"
+#include "com/sun/star/view/XPrintable.hpp"
+#include "com/sun/star/view/XSelectionSupplier.hpp"
+
+#include "comphelper/broadcasthelper.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/propertycontainer.hxx"
+#include "comphelper/uno3.hxx"
+
+#include "cppu/macros.hxx"
+#include "cppu/unotype.hxx"
+
+#include "cppuhelper/component_context.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/interfacecontainer.hxx"
+#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/queryinterface.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+
+#include "i18npool/mslangid.hxx"
+
+#include "osl/conditn.hxx"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "osl/getglobalmutex.hxx"
+#include "osl/mutex.hxx"
+
+#include "rtl/math.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+
+#include "sfx2/sfxdefs.hxx"
+
+#include "sot/clsids.hxx"
+
+#include "svl/eitem.hxx"
+#include "svl/intitem.hxx"
+#include "svl/itemiter.hxx"
+#include "svl/itempool.hxx"
+#include "svl/itemset.hxx"
+#include "unotools/pathoptions.hxx"
+#include "svl/poolitem.hxx"
+#include "svl/stritem.hxx"
+#include "unotools/syslocale.hxx"
+#include "svl/urihelper.hxx"
+#include "svl/whiter.hxx"
+
+#include "editeng/brshitem.hxx"
+#include "editeng/crsditem.hxx"
+#include "editeng/eeitem.hxx"
+#include "editeng/fhgtitem.hxx"
+#include "svx/flagsdef.hxx"
+#include "editeng/flstitem.hxx"
+#include "editeng/forbiddencharacterstable.hxx"
+#include "svx/ofaitem.hxx"
+#include "editeng/postitem.hxx"
+#include "svx/svddef.hxx"
+#include "svx/svditer.hxx"
+#include "svx/svdtypes.hxx"
+#include "editeng/udlnitem.hxx"
+#include "svx/unomodel.hxx"
+#include "editeng/unoprnms.hxx"
+#include "editeng/wghtitem.hxx"
+#include "svx/xdef.hxx"
+#include "svx/xflbmtit.hxx"
+#include "svx/xflbstit.hxx"
+#include "svx/xflclit.hxx"
+#include "svx/xflftrit.hxx"
+#include "svx/xflgrit.hxx"
+#include "svx/xflhtit.hxx"
+#include "svx/xgrscit.hxx"
+#include "svx/xlnclit.hxx"
+#include "svx/xlndsit.hxx"
+#include "editeng/xmlcnitm.hxx"
+#include "svx/xpoly.hxx"
+
+
+#include "tools/color.hxx"
+#include "tools/debug.hxx"
+#include "tools/link.hxx"
+#include "tools/resid.hxx"
+#include "tools/resmgr.hxx"
+#include "tools/solar.h"
+#include "tools/string.hxx"
+#include "tools/table.hxx"
+#include "tools/urlobj.hxx"
+
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+
+#include "unotools/configitem.hxx"
+#include "unotools/eventlisteneradapter.hxx"
+
+#include "vcl/fldunit.hxx"
+
+#include "vos/mutex.hxx"
+//---MARKER---
+#endif
diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst
new file mode 100644
index 000000000000..3cdc9a26e3f5
--- /dev/null
+++ b/chart2/prj/build.lst
@@ -0,0 +1,26 @@
+ch chart2 : l10n comphelper cppu cppuhelper sal svtools svx tools vcl toolkit unotools sfx2 NULL
+ch chart2 usr1 - all ch_mkout NULL
+ch chart2\inc nmake - all ch_inc NULL
+ch chart2\source\inc get - all ch_source_inc NULL
+ch chart2\source\inc\chartview get - all ch_source_inc_chartview NULL
+ch chart2\source\tools nmake - all ch_source_tools ch_inc NULL
+ch chart2\source\model nmake - all ch_source_model ch_source_tools ch_source_model_main ch_source_model_template ch_source_model_filter ch_inc NULL
+ch chart2\source\model\main nmake - all ch_source_model_main ch_inc NULL
+ch chart2\source\model\template nmake - all ch_source_model_template ch_inc NULL
+ch chart2\source\model\filter nmake - all ch_source_model_filter ch_inc NULL
+ch chart2\source\view nmake - all ch_source_view ch_source_tools ch_source_view_charttypes ch_source_view_axes ch_source_view_diagram ch_source_view_main ch_inc NULL
+ch chart2\source\view\inc get - all ch_source_view_inc NULL
+ch chart2\source\view\axes nmake - all ch_source_view_axes ch_source_tools ch_inc NULL
+ch chart2\source\view\charttypes nmake - all ch_source_view_charttypes ch_inc NULL
+ch chart2\source\view\diagram nmake - all ch_source_view_diagram ch_inc NULL
+ch chart2\source\view\main nmake - all ch_source_view_main ch_inc NULL
+ch chart2\source\controller nmake - all ch_source_controller ch_source_tools ch_source_view ch_source_controller_drawinglayer ch_source_controller_itemsetwrapper ch_source_controller_dialogs ch_source_controller_main ch_source_controller_chartapiwrapper ch_source_controller_accessibility ch_inc ch_source_controller_menus NULL
+ch chart2\source\controller\inc get - all ch_source_controller_inc NULL
+ch chart2\source\controller\accessibility nmake - all ch_source_controller_accessibility ch_inc NULL
+ch chart2\source\controller\dialogs nmake - all ch_source_controller_dialogs ch_inc NULL
+ch chart2\source\controller\drawinglayer nmake - all ch_source_controller_drawinglayer ch_inc NULL
+ch chart2\source\controller\itemsetwrapper nmake - all ch_source_controller_itemsetwrapper ch_inc NULL
+ch chart2\source\controller\chartapiwrapper nmake - all ch_source_controller_chartapiwrapper ch_inc NULL
+ch chart2\source\controller\main nmake - all ch_source_controller_main ch_inc NULL
+ch chart2\source\controller\menus nmake - all ch_source_controller_menus ch_inc NULL
+ch chart2\prj get - all ch_prj NULL
diff --git a/chart2/prj/d.lst b/chart2/prj/d.lst
new file mode 100644
index 000000000000..bf1085336c05
--- /dev/null
+++ b/chart2/prj/d.lst
@@ -0,0 +1,27 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+mkdir: %_DEST%\xml%_EXT%\uiconfig
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\schart
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\schart\menubar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\schart\toolbar
+mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\schart\statusbar
+
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+..\%__SRC%\bin\*.rdb %_DEST%\rdb%_EXT%\*.rdb
+
+..\uiconfig\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\schart\menubar\*.xml
+..\uiconfig\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\schart\toolbar\*.xml
+..\uiconfig\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\schart\statusbar\*.xml
+
+mkdir: %_DEST%\inc%_EXT%\chart2
+..\%__SRC%\misc\chartcontroller.component %_DEST%\xml%_EXT%\chartcontroller.component
+..\%__SRC%\misc\chartmodel.component %_DEST%\xml%_EXT%\chartmodel.component
+..\%__SRC%\misc\charttools.component %_DEST%\xml%_EXT%\charttools.component
+..\%__SRC%\misc\chartview.component %_DEST%\xml%_EXT%\chartview.component
diff --git a/chart2/qa/TestCaseOldAPI.java b/chart2/qa/TestCaseOldAPI.java
new file mode 100644
index 000000000000..26de0ba61e0b
--- /dev/null
+++ b/chart2/qa/TestCaseOldAPI.java
@@ -0,0 +1,1033 @@
+// package name: as default, start with complex
+package qa;
+
+// imports
+import complexlib.ComplexTestCase;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.XComponentContext;
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.star.lang.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.*;
+import com.sun.star.chart.*;
+import com.sun.star.drawing.*;
+import com.sun.star.awt.*;
+import com.sun.star.container.*;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.CloseVetoException;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.comp.helper.ComponentContext;
+
+/**
+ * The following Complex Test will test the
+ * com.sun.star.document.IndexedPropertyValues
+ * service
+ */
+
+public class TestCaseOldAPI extends ComplexTestCase {
+
+ // The name of the tested service
+ private final String testedServiceName =
+ "com.sun.star.chart.ChartDocument";
+
+ // The first of the mandatory functions:
+ /**
+ * Return the name of the test.
+ * In this case it is the actual name of the service.
+ * @return The tested service.
+ */
+ public String getTestObjectName() {
+ return testedServiceName;
+ }
+
+ // The second of the mandatory functions: return all test methods as an
+ // array. There is only one test function in this example.
+ /**
+ * Return all test methods.
+ * @return The test methods.
+ */
+ public String[] getTestMethodNames() {
+ // For some tests a view needs to be created. Accessing the model via
+ // this program and the view may lead to problems
+ boolean bAvoidViewCreation = false;
+
+ if( bAvoidViewCreation )
+ return new String[] {
+ "testData",
+ "testChartType",
+ "testArea",
+ "testAggregation",
+ "testFactory",
+ "testDataSeriesAndPoints",
+ "testStatistics",
+ "testStockProperties"
+ };
+
+ return new String[] {
+ "testData",
+ "testChartType",
+ "testTitle",
+ "testSubTitle",
+ "testDiagram",
+ "testAxis",
+ "testLegend",
+ "testArea",
+ "testAggregation",
+ "testFactory",
+ "testDataSeriesAndPoints",
+ "testStatistics",
+ "testStockProperties"
+ };
+ }
+
+ // ____________
+
+ public void before()
+ {
+ // set to "true" to get a view
+ mbCreateView = true;
+
+ if( mbCreateView )
+ mxChartModel = createDocument( "schart" );
+ else
+ mxChartModel = createChartModel();
+
+ mxOldDoc = (XChartDocument) UnoRuntime.queryInterface(
+ XChartDocument.class, mxChartModel );
+ }
+
+ // ____________
+
+ public void after()
+ {
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, mxChartModel );
+ assure( "document is no XCloseable", xCloseable != null );
+
+ // do not close document if there exists a view
+ if( ! mbCreateView )
+ {
+ try
+ {
+ xCloseable.close( true );
+ }
+ catch( CloseVetoException ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+ }
+
+ // ____________
+
+ public void testTitle()
+ {
+ try
+ {
+ XPropertySet xDocProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, mxOldDoc );
+ assure( "Chart Document is no XPropertySet", xDocProp != null );
+ xDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
+ assure( "Property HasMainTitle", AnyConverter.toBoolean(
+ xDocProp.getPropertyValue( "HasMainTitle" )));
+
+ XShape xTitleShape = mxOldDoc.getTitle();
+ XPropertySet xTitleProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xTitleShape );
+
+ // set property via old API
+ if( xTitleProp != null )
+ {
+ String aTitle = " Overwritten by Old API ";
+ float fHeight = (float)17.0;
+
+ xTitleProp.setPropertyValue( "String", aTitle );
+ xTitleProp.setPropertyValue( "CharHeight", new Float( fHeight ) );
+
+ float fNewHeight = AnyConverter.toFloat( xTitleProp.getPropertyValue( "CharHeight" ) );
+ assure( "Changing CharHeight via old API failed", fNewHeight == fHeight );
+
+ String aNewTitle = AnyConverter.toString( xTitleProp.getPropertyValue( "String" ) );
+ assure( "Property \"String\" failed", aNewTitle.equals( aTitle ));
+ }
+
+ // move title
+ Point aSetPos = new Point();
+ aSetPos.X = 1000;
+ aSetPos.Y = 200;
+ xTitleShape.setPosition( aSetPos );
+
+ Point aNewPos = xTitleShape.getPosition();
+ assure( "Title Position X", approxEqual( aNewPos.X, aSetPos.X, 1 ));
+ assure( "Title Position Y", approxEqual( aNewPos.Y, aSetPos.Y, 1 ));
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ____________
+
+ public void testSubTitle()
+ {
+ try
+ {
+ XPropertySet xDocProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, mxOldDoc );
+ assure( "Chart Document is no XPropertySet", xDocProp != null );
+ xDocProp.setPropertyValue( "HasSubTitle", new Boolean( true ));
+ assure( "Property HasSubTitle", AnyConverter.toBoolean(
+ xDocProp.getPropertyValue( "HasSubTitle" )));
+
+ XShape xTitleShape = mxOldDoc.getSubTitle();
+ XPropertySet xTitleProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xTitleShape );
+
+ // set Property via old API
+ if( xTitleProp != null )
+ {
+ int nColor = 0x009acd; // DeepSkyBlue3
+ float fWeight = FontWeight.BOLD;
+ float fHeight = (float)14.0;
+
+ xTitleProp.setPropertyValue( "CharColor", new Integer( nColor ) );
+ xTitleProp.setPropertyValue( "CharWeight", new Float( fWeight ));
+ xTitleProp.setPropertyValue( "CharHeight", new Float( fHeight ) );
+
+ int nNewColor = AnyConverter.toInt( xTitleProp.getPropertyValue( "CharColor" ) );
+ assure( "Changing CharColor via old API failed", nNewColor == nColor );
+
+ float fNewWeight = AnyConverter.toFloat( xTitleProp.getPropertyValue( "CharWeight" ) );
+ assure( "Changing CharWeight via old API failed", fNewWeight == fWeight );
+
+ float fNewHeight = AnyConverter.toFloat( xTitleProp.getPropertyValue( "CharHeight" ) );
+ assure( "Changing CharHeight via old API failed", fNewHeight == fHeight );
+ }
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testDiagram()
+ {
+ try
+ {
+ // testing wall
+ XDiagram xDia = mxOldDoc.getDiagram();
+ if( xDia != null )
+ {
+ X3DDisplay xDisp = (X3DDisplay) UnoRuntime.queryInterface(
+ X3DDisplay.class, xDia );
+ assure( "X3DDisplay not supported", xDisp != null );
+
+ // Wall
+ XPropertySet xProp = xDisp.getWall();
+ if( xProp != null )
+ {
+ int nColor = 0xffe1ff; // thistle1
+ xProp.setPropertyValue( "FillColor", new Integer( nColor ) );
+ int nNewColor = AnyConverter.toInt( xProp.getPropertyValue( "FillColor" ) );
+ assure( "Changing FillColor via old API failed", nNewColor == nColor );
+ }
+
+ assure( "Wrong Diagram Type", xDia.getDiagramType().equals(
+ "com.sun.star.chart.BarDiagram" ));
+
+ // Diagram properties
+ xProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xDia );
+ assure( "Diagram is no property set", xProp != null );
+
+ // y-axis
+ boolean bFirstYAxisText = false;
+ xProp.setPropertyValue( "HasYAxisDescription", new Boolean( bFirstYAxisText ));
+ boolean bNewFirstYAxisText = AnyConverter.toBoolean(
+ xProp.getPropertyValue( "HasYAxisDescription" ));
+ assure( "Removing description of first y-axis", bNewFirstYAxisText == bFirstYAxisText );
+
+// boolean bYAxisTitle = true;
+// xProp.setPropertyValue( "HasYAxisTitle", new Boolean( bYAxisTitle ));
+// boolean bNewYAxisTitle = AnyConverter.toBoolean(
+// xProp.getPropertyValue( "HasYAxisTitle" ));
+// assure( "Adding y-axis title", bNewYAxisTitle == bYAxisTitle );
+
+ // set title text
+// XAxisYSupplier xYAxisSuppl = (XAxisYSupplier) UnoRuntime.queryInterface(
+// XAxisYSupplier.class, mxOldDoc.getDiagram() );
+// assure( "Diagram is no y-axis supplier", xYAxisSuppl != null );
+// XPropertySet xAxisTitleProp = (XPropertySet) UnoRuntime.queryInterface(
+// XPropertySet.class, xYAxisSuppl.getYAxisTitle() );
+// assure( "Y-Axis Title is no XPropertySet", xAxisTitleProp != null );
+// xAxisTitleProp.setPropertyValue( "String", "New y axis title" );
+
+ // second y-axis
+ boolean bSecondaryYAxis = true;
+ xProp.setPropertyValue( "HasSecondaryYAxis", new Boolean( bSecondaryYAxis ));
+ boolean bNewSecYAxisValue = AnyConverter.toBoolean(
+ xProp.getPropertyValue( "HasSecondaryYAxis" ));
+ assure( "Adding a second y-axis does not work", bNewSecYAxisValue == bSecondaryYAxis );
+
+ XTwoAxisYSupplier xSecYAxisSuppl = (XTwoAxisYSupplier) UnoRuntime.queryInterface(
+ XTwoAxisYSupplier.class, xDia );
+ assure( "XTwoAxisYSupplier not implemented", xSecYAxisSuppl != null );
+ assure( "No second y-axis found", xSecYAxisSuppl.getSecondaryYAxis() != null );
+ }
+
+ // move diagram
+ {
+ XShape xDiagramShape = (XShape) UnoRuntime.queryInterface(
+ XShape.class, xDia );
+
+ Point aOldPos = xDiagramShape.getPosition();
+ int xDiff = 20;
+ int yDiff = 20;
+ Point aSetPos = new Point();
+ aSetPos.X = aOldPos.X + xDiff;
+ aSetPos.Y = aOldPos.Y + yDiff;
+ xDiagramShape.setPosition( aSetPos );
+
+ Point aNewPos = xDiagramShape.getPosition();
+ //System.out.println( "set X = " + aSetPos.X + ", new X = " + aNewPos.X );
+ //System.out.println( "set Y = " + aSetPos.Y + ", new Y = " + aNewPos.Y );
+ assure( "Diagram Position X", approxEqual( aNewPos.X, aSetPos.X, 1 ));
+ assure( "Diagram Position Y", approxEqual( aNewPos.Y, aSetPos.Y, 1 ));
+ }
+
+ // size diagram
+ {
+ XShape xDiagramShape = (XShape) UnoRuntime.queryInterface(
+ XShape.class, xDia );
+
+ Size aOldSize = xDiagramShape.getSize();
+ int xDiff = aOldSize.Width/2+2;
+ int yDiff = aOldSize.Height/2+2;
+ Size aSetSize = new Size();
+ aSetSize.Width = aOldSize.Width - xDiff;
+ aSetSize.Height = aOldSize.Height - yDiff;
+ xDiagramShape.setSize( aSetSize );
+
+ Size aNewSize = xDiagramShape.getSize();
+ //System.out.println( "set width = " + aSetSize.Width + ", new width = " + aNewSize.Width );
+ //System.out.println( "set height = " + aSetSize.Height + ", new height = " + aNewSize.Height );
+ assure( "Diagram Width", approxEqual( aNewSize.Width, aSetSize.Width, 2 ));
+ assure( "Diagram Height", approxEqual( aNewSize.Height, aSetSize.Height, 2 ));
+ }
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testAxis()
+ {
+ try
+ {
+ XAxisYSupplier xYAxisSuppl = (XAxisYSupplier) UnoRuntime.queryInterface(
+ XAxisYSupplier.class, mxOldDoc.getDiagram() );
+ assure( "Diagram is no y-axis supplier", xYAxisSuppl != null );
+
+ XPropertySet xProp = xYAxisSuppl.getYAxis();
+ assure( "No y-axis found", xProp != null );
+
+ double fMax1, fMax2;
+ Object oMax = xProp.getPropertyValue( "Max" );
+ assure( "No Maximum set", AnyConverter.isDouble( oMax ));
+ fMax1 = AnyConverter.toDouble( oMax );
+ log.println( "Maximum retrieved: " + fMax1 );
+ //todo: the view has to be built before there is an explicit value
+// assure( "Max is 0.0", fMax1 > 0.0 );
+ xProp.setPropertyValue( "AutoMax", new Boolean( false ));
+ oMax = xProp.getPropertyValue( "Max" );
+ assure( "No Maximum set", AnyConverter.isDouble( oMax ));
+ fMax2 = AnyConverter.toDouble( oMax );
+ log.println( "Maximum with AutoMax off: " + fMax2 );
+ assure( "maxima differ", fMax1 == fMax2 );
+
+ double nNewMax = 12.3;
+ double nNewOrigin = 2.7;
+
+ xProp.setPropertyValue( "Max", new Double( nNewMax ));
+ assure( "AutoMax is on", ! AnyConverter.toBoolean( xProp.getPropertyValue( "AutoMax" )) );
+
+ assure( "Maximum value invalid",
+ approxEqual(
+ AnyConverter.toDouble( xProp.getPropertyValue( "Max" )),
+ nNewMax ));
+
+ xProp.setPropertyValue( "AutoMin", new Boolean( true ));
+ assure( "AutoMin is off", AnyConverter.toBoolean( xProp.getPropertyValue( "AutoMin" )) );
+
+ xProp.setPropertyValue( "Origin", new Double( nNewOrigin ));
+ assure( "Origin invalid",
+ approxEqual(
+ AnyConverter.toDouble( xProp.getPropertyValue( "Origin" )),
+ nNewOrigin ));
+ xProp.setPropertyValue( "AutoOrigin", new Boolean( true ));
+ assure( "AutoOrigin is off", AnyConverter.toBoolean( xProp.getPropertyValue( "AutoOrigin" )) );
+ Object oOrigin = xProp.getPropertyValue( "Origin" );
+ assure( "No Origin set", AnyConverter.isDouble( oOrigin ));
+ log.println( "Origin retrieved: " + AnyConverter.toDouble( oOrigin ));
+
+ xProp.setPropertyValue( "Logarithmic", new Boolean( true ));
+ assure( "Scaling is not logarithmic",
+ AnyConverter.toBoolean( xProp.getPropertyValue( "Logarithmic" )) );
+ xProp.setPropertyValue( "Logarithmic", new Boolean( false ));
+ assure( "Scaling is not logarithmic",
+ ! AnyConverter.toBoolean( xProp.getPropertyValue( "Logarithmic" )) );
+
+ int nNewColor = 0xcd853f; // peru
+ xProp.setPropertyValue( "LineColor", new Integer( nNewColor ));
+ assure( "Property LineColor",
+ AnyConverter.toInt( xProp.getPropertyValue( "LineColor" )) == nNewColor );
+ float fNewCharHeight = (float)(16.0);
+ xProp.setPropertyValue( "CharHeight", new Float( fNewCharHeight ));
+ assure( "Property CharHeight",
+ AnyConverter.toFloat( xProp.getPropertyValue( "CharHeight" )) == fNewCharHeight );
+
+ int nNewTextRotation = 700; // in 1/100 degrees
+ xProp.setPropertyValue( "TextRotation", new Integer( nNewTextRotation ));
+ assure( "Property TextRotation",
+ AnyConverter.toInt( xProp.getPropertyValue( "TextRotation" )) == nNewTextRotation );
+
+ double fStepMain = 10.0;
+ xProp.setPropertyValue( "StepMain", new Double( fStepMain ));
+ assure( "Property StepMain",
+ AnyConverter.toDouble( xProp.getPropertyValue( "StepMain" )) == fStepMain );
+
+ // note: fStepHelp must be a divider of fStepMain, because
+ // internally, the help-step is stored as an integer number of
+ // substeps
+ double fStepHelp = 5.0;
+ xProp.setPropertyValue( "StepHelp", new Double( fStepHelp ));
+ assure( "Property StepHelp",
+ AnyConverter.toDouble( xProp.getPropertyValue( "StepHelp" )) == fStepHelp );
+
+ xProp.setPropertyValue( "DisplayLabels", new Boolean( false ));
+ assure( "Property DisplayLabels", ! AnyConverter.toBoolean(
+ xProp.getPropertyValue( "DisplayLabels" )));
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testLegend()
+ {
+ XShape xLegend = mxOldDoc.getLegend();
+ assure( "No Legend returned", xLegend != null );
+
+ XPropertySet xLegendProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xLegend );
+ assure( "Legend is no property set", xLegendProp != null );
+
+ try
+ {
+ ChartLegendPosition eNewPos = ChartLegendPosition.BOTTOM;
+ xLegendProp.setPropertyValue( "Alignment", eNewPos );
+ assure( "Property Alignment",
+ AnyConverter.toObject(
+ new Type( ChartLegendPosition.class ),
+ xLegendProp.getPropertyValue( "Alignment" )) == eNewPos );
+
+ float fNewCharHeight = (float)(11.0);
+ xLegendProp.setPropertyValue( "CharHeight", new Float( fNewCharHeight ));
+ assure( "Property CharHeight",
+ AnyConverter.toFloat( xLegendProp.getPropertyValue( "CharHeight" )) == fNewCharHeight );
+
+ // move legend
+ {
+ Point aOldPos = xLegend.getPosition();
+ int xDiff = 20;
+ int yDiff = 20;
+ Point aSetPos = new Point();
+ aSetPos.X = aOldPos.X + xDiff;
+ aSetPos.Y = aOldPos.Y + yDiff;
+ xLegend.setPosition( aSetPos );
+
+ Point aNewPos = xLegend.getPosition();
+ assure( "Legend Position X", approxEqual( aNewPos.X, aSetPos.X, 1 ));
+ assure( "Legend Position Y", approxEqual( aNewPos.Y, aSetPos.Y, 1 ));
+ }
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testArea()
+ {
+ XPropertySet xArea = mxOldDoc.getArea();
+ assure( "No Area", xArea != null );
+
+ try
+ {
+ int nColor = 0xf5fffa; // mint cream
+ xArea.setPropertyValue( "FillColor", new Integer( nColor ) );
+ xArea.setPropertyValue( "FillStyle", FillStyle.SOLID );
+// XPropertySetInfo xInfo = xArea.getPropertySetInfo();
+// assure( "Area does not support ChartUserDefinedAttributes",
+// xInfo.hasPropertyByName( "ChartUserDefinedAttributes" ));
+
+// String aTestAttributeName = "test:foo";
+// String aTestAttributeValue = "content";
+// XNameContainer xUserDefAttributes = (XNameContainer) AnyConverter.toObject(
+// new Type( XNameContainer.class ), xArea.getPropertyValue( "ChartUserDefinedAttributes" ));
+// xUserDefAttributes.insertByName( aTestAttributeName, aTestAttributeValue );
+
+// String aContent = AnyConverter.toString( xUserDefAttributes.getByName( aTestAttributeName ));
+// assure( "Wrong content in UserDefinedAttributes container",
+// aContent.equals( aTestAttributeValue ));
+
+ int nNewColor = AnyConverter.toInt( xArea.getPropertyValue( "FillColor" ) );
+ assure( "Changing FillColor of Area failed", nNewColor == nColor );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testChartType()
+ {
+ XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, mxOldDoc );
+ assure( "document is no factory", xFact != null );
+
+ try
+ {
+ String aMyServiceName = new String( "com.sun.star.chart.BarDiagram" );
+ String aServices[] = xFact.getAvailableServiceNames();
+ boolean bServiceFound = false;
+ for( int i = 0; i < aServices.length; ++i )
+ {
+ if( aServices[ i ].equals( aMyServiceName ))
+ {
+ bServiceFound = true;
+ break;
+ }
+ }
+ assure( "getAvailableServiceNames did not return " + aMyServiceName, bServiceFound );
+
+ if( bServiceFound )
+ {
+ XDiagram xDia = (XDiagram) UnoRuntime.queryInterface(
+ XDiagram.class, xFact.createInstance( aMyServiceName ));
+ assure( aMyServiceName + " could not be created", xDia != null );
+
+ mxOldDoc.setDiagram( xDia );
+
+ XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xDia );
+ assure( "Diagram is no XPropertySet", xDiaProp != null );
+
+ xDiaProp.setPropertyValue( "Stacked", new Boolean( true ));
+ assure( "StackMode could not be set correctly",
+ AnyConverter.toBoolean(
+ xDiaProp.getPropertyValue( "Stacked" )));
+
+ xDiaProp.setPropertyValue( "Dim3D", new Boolean( false ));
+ assure( "Dim3D could not be set correctly",
+ ! AnyConverter.toBoolean(
+ xDiaProp.getPropertyValue( "Dim3D" )));
+
+ xDiaProp.setPropertyValue( "Vertical", new Boolean( true ));
+ assure( "Vertical could not be set correctly",
+ AnyConverter.toBoolean(
+ xDiaProp.getPropertyValue( "Vertical" )));
+ }
+
+ // reset to bar-chart
+// aMyServiceName = new String( "com.sun.star.chart.BarDiagram" );
+// XDiagram xDia = (XDiagram) UnoRuntime.queryInterface(
+// XDiagram.class, xFact.createInstance( aMyServiceName ));
+// assure( aMyServiceName + " could not be created", xDia != null );
+
+// mxOldDoc.setDiagram( xDia );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testAggregation()
+ {
+ // query to new type
+ XChartDocument xDiaProv = (XChartDocument) UnoRuntime.queryInterface(
+ XChartDocument.class, mxOldDoc );
+ assure( "query to new interface failed", xDiaProv != null );
+
+ com.sun.star.chart.XChartDocument xDoc = (com.sun.star.chart.XChartDocument) UnoRuntime.queryInterface(
+ com.sun.star.chart.XChartDocument.class, xDiaProv );
+ assure( "querying back to old interface failed", xDoc != null );
+ }
+
+ // ------------
+
+ public void testDataSeriesAndPoints()
+ {
+ try
+ {
+ XDiagram xDia = mxOldDoc.getDiagram();
+ assure( "Invalid Diagram", xDia != null );
+ XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, mxOldDoc );
+ assure( "document is no factory", xFact != null );
+
+ // FillColor
+ XPropertySet xProp = xDia.getDataRowProperties( 0 );
+ int nColor = 0xffd700; // gold
+ xProp.setPropertyValue( "FillColor", new Integer( nColor ));
+ int nNewColor = AnyConverter.toInt( xProp.getPropertyValue( "FillColor" ) );
+ assure( "Changing FillColor of Data Series failed", nNewColor == nColor );
+
+ // Gradient
+ assure( "No DataRowProperties for series 0", xProp != null );
+
+ // note: the FillGradient property is optional, however it was
+ // supported in the old chart's API
+ XNameContainer xGradientTable = (XNameContainer) UnoRuntime.queryInterface(
+ XNameContainer.class,
+ xFact.createInstance( "com.sun.star.drawing.GradientTable" ));
+ assure( "no gradient table", xGradientTable != null );
+ String aGradientName = "NewAPITestGradient";
+ Gradient aGradient = new Gradient();
+ aGradient.Style = GradientStyle.LINEAR;
+ aGradient.StartColor = 0xe0ffff; // light cyan
+ aGradient.EndColor = 0xff8c00; // dark orange
+ aGradient.Angle = 300; // 30 degrees
+ aGradient.Border = 15;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 80;
+ aGradient.StepCount = 23;
+
+ xGradientTable.insertByName( aGradientName, aGradient );
+ xProp.setPropertyValue( "FillStyle", FillStyle.GRADIENT );
+ xProp.setPropertyValue( "FillGradientName", aGradientName );
+ String aNewGradientName = AnyConverter.toString( xProp.getPropertyValue( "FillGradientName" ));
+ assure( "GradientName", aNewGradientName.equals( aGradientName ));
+ Gradient aNewGradient = (Gradient) AnyConverter.toObject(
+ new Type( Gradient.class ),
+ xGradientTable.getByName( aNewGradientName ));
+ assure( "Gradient Style", aNewGradient.Style == aGradient.Style );
+ assure( "Gradient StartColor", aNewGradient.StartColor == aGradient.StartColor );
+ assure( "Gradient EndColor", aNewGradient.EndColor == aGradient.EndColor );
+ assure( "Gradient Angle", aNewGradient.Angle == aGradient.Angle );
+ assure( "Gradient Border", aNewGradient.Border == aGradient.Border );
+ assure( "Gradient XOffset", aNewGradient.XOffset == aGradient.XOffset );
+ assure( "Gradient YOffset", aNewGradient.YOffset == aGradient.YOffset );
+ assure( "Gradient StartIntensity", aNewGradient.StartIntensity == aGradient.StartIntensity );
+ assure( "Gradient EndIntensity", aNewGradient.EndIntensity == aGradient.EndIntensity );
+ assure( "Gradient StepCount", aNewGradient.StepCount == aGradient.StepCount );
+
+ // Hatch
+ xProp = xDia.getDataPointProperties( 1, 0 );
+ assure( "No DataPointProperties for (1,0)", xProp != null );
+
+ // note: the FillHatch property is optional, however it was
+ // supported in the old chart's API
+ XNameContainer xHatchTable = (XNameContainer) UnoRuntime.queryInterface(
+ XNameContainer.class,
+ xFact.createInstance( "com.sun.star.drawing.HatchTable" ));
+ assure( "no hatch table", xHatchTable != null );
+ String aHatchName = "NewAPITestHatch";
+ Hatch aHatch = new Hatch();
+ aHatch.Style = HatchStyle.DOUBLE;
+ aHatch.Color = 0xd2691e; // chocolate
+ aHatch.Distance = 200; // 2 mm (?)
+ aHatch.Angle = 230; // 23 degrees
+
+ xHatchTable.insertByName( aHatchName, aHatch );
+ xProp.setPropertyValue( "FillHatchName", aHatchName );
+ xProp.setPropertyValue( "FillStyle", FillStyle.HATCH );
+ xProp.setPropertyValue( "FillBackground", new Boolean( true ));
+ String aNewHatchName = AnyConverter.toString( xProp.getPropertyValue( "FillHatchName" ));
+ assure( "HatchName", aNewHatchName.equals( aHatchName ));
+ Hatch aNewHatch = (Hatch) AnyConverter.toObject(
+ new Type( Hatch.class ),
+ xHatchTable.getByName( aNewHatchName ));
+ assure( "Hatch Style", aNewHatch.Style == aHatch.Style );
+ assure( "Hatch Color", aNewHatch.Color == aHatch.Color );
+ assure( "Hatch Distance", aNewHatch.Distance == aHatch.Distance );
+ assure( "Hatch Angle", aNewHatch.Angle == aHatch.Angle );
+ assure( "FillBackground", AnyConverter.toBoolean( xProp.getPropertyValue( "FillBackground" )) );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testStatistics()
+ {
+ try
+ {
+ XDiagram xDia = mxOldDoc.getDiagram();
+ assure( "Invalid Diagram", xDia != null );
+
+ XPropertySet xProp = xDia.getDataRowProperties( 0 );
+ assure( "No DataRowProperties for first series", xProp != null );
+
+ xProp.setPropertyValue( "MeanValue", new Boolean( true ));
+ assure( "No MeanValue", AnyConverter.toBoolean( xProp.getPropertyValue( "MeanValue" )) );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void setStockData_Type4()
+ {
+ try
+ {
+ XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, mxOldDoc.getDiagram() );
+
+ ChartDataRowSource eNewSource = ChartDataRowSource.ROWS;
+ xDiaProp.setPropertyValue( "DataRowSource", eNewSource );
+ assure( "Couldn't set \"DataRowSource\" property at Diagram",
+ AnyConverter.toObject(
+ new Type( ChartDataRowSource.class ),
+ xDiaProp.getPropertyValue( "DataRowSource" )) == eNewSource );
+
+ double aData[][] =
+ {
+ { 100.0, 200.0, 300.0, 250.0, 300.0 },
+ { 6.5, 4.5, 6.0, 5.5, 3.5 },
+ { 1.0, 1.5, 2.0, 2.5, 3.0 },
+ { 6.0, 6.5, 7.0, 6.5, 5.0 },
+ { 6.0, 5.5, 4.0, 4.5, 4.0 }
+ };
+
+ String[] aRowDescriptions =
+ {
+ "Volume", "Open", "Min", "Max", "Close"
+ };
+
+ String[] aColumnDescriptions =
+ {
+ "First Row", "Second Row", "Third Row", "Fourth Row", "Fifth Row"
+ };
+
+
+ XChartData xData = mxOldDoc.getData();
+ XChartDataArray xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
+ XChartDataArray.class, xData );
+ assure( "document has no XChartDataArray", xDataArray != null );
+
+ xDataArray.setData( aData );
+ xDataArray.setRowDescriptions( aRowDescriptions );
+ xDataArray.setColumnDescriptions( aColumnDescriptions );
+
+ mxOldDoc.attachData( xData );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testStockProperties()
+ {
+ try
+ {
+ setStockData_Type4();
+
+ XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, mxOldDoc );
+ assure( "document is no factory", xFact != null );
+
+ String aMyServiceName = new String( "com.sun.star.chart.StockDiagram" );
+ XDiagram xDia = (XDiagram) UnoRuntime.queryInterface(
+ XDiagram.class, xFact.createInstance( aMyServiceName ));
+ assure( aMyServiceName + " could not be created", xDia != null );
+
+ mxOldDoc.setDiagram( xDia );
+
+ XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xDia );
+ assure( "Diagram is no XPropertySet", xDiaProp != null );
+
+ xDiaProp.setPropertyValue( "Volume", new Boolean( true ));
+ assure( "Has Volume", AnyConverter.toBoolean( xDiaProp.getPropertyValue( "Volume" )));
+
+ xDiaProp.setPropertyValue( "UpDown", new Boolean( true ));
+ assure( "Has UpDown", AnyConverter.toBoolean( xDiaProp.getPropertyValue( "UpDown" )));
+
+ // MinMaxLine
+ XStatisticDisplay xMinMaxProvider = (XStatisticDisplay) UnoRuntime.queryInterface(
+ XStatisticDisplay.class, xDia );
+ assure( "Diagram is no XStatisticDisplay", xMinMaxProvider != null );
+ XPropertySet xMinMaxProp = xMinMaxProvider.getMinMaxLine();
+ assure( "No MinMaxLine", xMinMaxProp != null );
+
+ int nLineColor = 0x458b00; // chartreuse4
+ xMinMaxProp.setPropertyValue( "LineColor", new Integer( nLineColor ));
+ int nNewColor = AnyConverter.toInt( xMinMaxProp.getPropertyValue( "LineColor" ) );
+ assure( "Changing LineColor of MinMax Line", nNewColor == nLineColor );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testFactory()
+ {
+ try
+ {
+ XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, mxOldDoc );
+ assure( "document is no factory", xFact != null );
+
+ Object aTestTable = xFact.createInstance( "com.sun.star.drawing.GradientTable" );
+ assure( "Couldn't create gradient table via factory", aTestTable != null );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ------------
+
+ public void testData()
+ {
+ try
+ {
+ // set data
+ double aData[][] = {
+ { 1.0, 1.5, 2.0, 2.5, 3.0 },
+ { 2.0, 2.5, 3.0, 3.5, 4.0 },
+ { 3.0, 3.5, 4.0, 4.5, 5.0 }
+ };
+
+ String[] aColumnDescriptions = {
+ "First Column", "Second Column", "Third Column",
+ "Fourth Column", "Fifth Column"
+ };
+
+ String[] aRowDescriptions = {
+ "First Row", "Second Row", "Third Row"
+ };
+
+ XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, mxOldDoc.getDiagram() );
+ ChartDataRowSource eNewSource = ChartDataRowSource.ROWS;
+ xDiaProp.setPropertyValue( "DataRowSource", eNewSource );
+ assure( "Couldn't set \"DataRowSource\" property at Diagram",
+ AnyConverter.toObject(
+ new Type( ChartDataRowSource.class ),
+ xDiaProp.getPropertyValue( "DataRowSource" )) == eNewSource );
+
+ XChartData xData = mxOldDoc.getData();
+ XChartDataArray xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
+ XChartDataArray.class, xData );
+ assure( "document has no XChartDataArray", xDataArray != null );
+
+ xDataArray.setData( aData );
+ xDataArray.setRowDescriptions( aRowDescriptions );
+ xDataArray.setColumnDescriptions( aColumnDescriptions );
+
+ mxOldDoc.attachData( xData );
+
+ // get data
+ double aReadData[][];
+ String[] aReadColumnDescriptions;
+ String[] aReadRowDescriptions;
+
+ // refetch data
+ xData = mxOldDoc.getData();
+ xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
+ XChartDataArray.class, xData );
+ assure( "document has no XChartDataArray", xDataArray != null );
+
+ aReadData = xDataArray.getData();
+ aReadRowDescriptions = xDataArray.getRowDescriptions();
+ aReadColumnDescriptions = xDataArray.getColumnDescriptions();
+
+ // compare to values set before
+ assure( "Data size differs", aData.length == aReadData.length );
+ for( int i=0; i<aReadData.length; ++i )
+ {
+ assure( "Data size differs", aData[i].length == aReadData[i].length );
+ for( int j=0; j<aReadData[i].length; ++j )
+ assure( "Data differs", aData[i][j] == aReadData[i][j] );
+ }
+
+ assure( "Column Description size differs", aColumnDescriptions.length == aReadColumnDescriptions.length );
+ for( int i=0; i<aReadColumnDescriptions.length; ++i )
+ assure( "Column Descriptions differ", aColumnDescriptions[i].equals( aReadColumnDescriptions[i] ));
+
+ assure( "Row Description size differs", aRowDescriptions.length == aReadRowDescriptions.length );
+ for( int i=0; i<aReadRowDescriptions.length; ++i )
+ assure( "Row Descriptions differ", aRowDescriptions[i].equals( aReadRowDescriptions[i] ));
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+ }
+
+ // ================================================================================
+
+ private XModel mxChartModel;
+ private XChartDocument mxOldDoc;
+ private boolean mbCreateView;
+
+ // --------------------------------------------------------------------------------
+
+ private XModel createDocument( String sDocType )
+ {
+ XModel aResult = null;
+ try
+ {
+ XComponentLoader aLoader = (XComponentLoader) UnoRuntime.queryInterface(
+ XComponentLoader.class,
+ ((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.frame.Desktop" ) );
+
+ aResult = (XModel) UnoRuntime.queryInterface(
+ XModel.class,
+ aLoader.loadComponentFromURL( "private:factory/" + sDocType,
+ "_blank",
+ 0,
+ new PropertyValue[ 0 ] ) );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+
+ return aResult;
+ }
+
+ // ------------
+
+ public XModel createChartModel()
+ {
+ XModel aResult = null;
+ try
+ {
+ aResult = (XModel) UnoRuntime.queryInterface(
+ XModel.class,
+ ((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.comp.chart2.ChartModel" ) );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+
+ return aResult;
+ }
+
+ // ------------
+
+ private XComponentContext getComponentContext( XMultiServiceFactory xFact )
+ {
+ XComponentContext xResult = null;
+
+ XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xFact );
+ if( xProp != null )
+ try
+ {
+ xResult = (XComponentContext)
+ AnyConverter.toObject(
+ new Type( XComponentContext.class ),
+ xProp.getPropertyValue( "DefaultContext" ) );
+ }
+ catch( Exception ex )
+ {
+ failed( ex.getMessage() );
+ ex.printStackTrace( (PrintWriter)log );
+ }
+
+ return xResult;
+ }
+
+ // ------------
+
+ private void printInterfacesAndServices( Object oObj )
+ {
+ log.println( "Services:" );
+ util.dbg.getSuppServices( oObj );
+ log.println( "Interfaces:" );
+ util.dbg.printInterfaces( (XInterface)oObj, true );
+ }
+
+ // ------------
+
+ /// see rtl/math.hxx
+ private boolean approxEqual( double a, double b )
+ {
+ if( a == b )
+ return true;
+ double x = a - b;
+ return (x < 0.0 ? -x : x)
+ < ((a < 0.0 ? -a : a) * (1.0 / (16777216.0 * 16777216.0)));
+ }
+
+ // ------------
+ /** returns true if a and b differ no more than tolerance.
+
+ @param tolerance
+ must be non-negative
+ */
+ private boolean approxEqual( int a, int b, int tolerance )
+ {
+ if( a != b )
+ log.println( "Integer values differ by " + java.lang.Math.abs( a-b ));
+ return ( ( a - tolerance <= b ) ||
+ ( a + tolerance >= b ));
+ }
+}
diff --git a/chart2/qa/data.chd b/chart2/qa/data.chd
new file mode 100644
index 000000000000..01888e4c19ff
--- /dev/null
+++ b/chart2/qa/data.chd
@@ -0,0 +1,14 @@
+# Series Labels
+Column_1 Column_2 Column_3
+
+# Categories
+Row_1 Row_2 Row_3 Row_4
+
+# Column 1
+9.1 2.4 3.1 4.3
+
+# Column 2
+3.2 8.8 1.5 9.02
+
+# Column 3
+4.54 9.65 3.7 6.2
diff --git a/chart2/qa/makefile.mk b/chart2/qa/makefile.mk
new file mode 100644
index 000000000000..0471e10e11a4
--- /dev/null
+++ b/chart2/qa/makefile.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJNAME = chart2
+PRJ = ..
+TARGET = chart_qa
+
+PACKAGE = qa
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+MAXLINELENGTH = 100000
+
+# - rdb ----
+
+RDB = $(SOLARBINDIR)$/types.rdb
+JAVADIR = $(OUT)$/misc$/java
+JARFILES = ridl.jar
+
+# --- Files --------------------------------------------------------
+
+JAVACLASSFILES = \
+ $(CLASSDIR)$/$(PACKAGE)$/TestCaseOldAPI.class
+
+JARFILES = ridl.jar jurt.jar unoil.jar juh.jar OOoRunner.jar
+JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES)))
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# --- Dependencies -------------------------------------------------
+
+# Note: define dependencies after including target.mk (otherwise no targets are
+# defined)
+
+ALLTAR: runtest
+
+# --- Rules --------------------------------------------------------
+
+runtest: $(subst,.class,.run $(JAVACLASSFILES))
+
+%.run: %.class
+ +@java -classpath $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -o $(subst,$(CLASSDIR)$/$(PACKAGE)$/,$(PACKAGE). $(subst,.class, $<))
diff --git a/chart2/qa/unoapi/Test.java b/chart2/qa/unoapi/Test.java
new file mode 100644
index 000000000000..c1b6fd05983d
--- /dev/null
+++ b/chart2/qa/unoapi/Test.java
@@ -0,0 +1,51 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+package org.openoffice.chart2.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", "sch.sce", "-xcl", "knownissues.xcl", "-tdoc",
+ "testdocuments", "-cs", connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/chart2/qa/unoapi/knownissues.xcl b/chart2/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..155132922661
--- /dev/null
+++ b/chart2/qa/unoapi/knownissues.xcl
@@ -0,0 +1,40 @@
+#i83851
+sch.ChXChartDocument::com::sun::star::frame::XModel
+#i83833
+sch.ChXChartDocument::com::sun::star::chart::XChartDocument
+#i83834
+sch.ChXChartDocument::com::sun::star::chart::ChartTableAddressSupplier
+
+#i83852
+sch.ChXChartView::com::sun::star::view::XSelectionSupplier
+
+#i83855
+sch.ChXDiagram::com::sun::star::chart::LineDiagram
+#i83853
+sch.ChXDiagram::com::sun::star::beans::XPropertySet
+#i83854
+sch.ChXDiagram::com::sun::star::chart::ChartAxisXSupplier
+sch.ChXDiagram::com::sun::star::chart::ChartAxisYSupplier
+sch.ChXDiagram::com::sun::star::chart::ChartAxisZSupplier
+#i83856
+sch.ChXDiagram::com::sun::star::chart::StockDiagram
+
+sch.ChartLegend::com::sun::star::drawing::XShape
+#i83830
+sch.ChartTitle::com::sun::star::drawing::XShape
+
+#i78867
+sch.ChXChartDocument::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChXChartAxis::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChXDiagram::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChartArea::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChartGrid::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChartLegend::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChartLine::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChartTitle::com::sun::star::xml::UserDefinedAttributeSupplier
+sch.ChXDataPoint::com::sun::star::xml::UserDefinedAttributeSupplier
+
+#i83865
+sch.ChXDataPoint::com::sun::star::drawing::LineProperties
+#112078
+sch.ChartLegend::com::sun::star::beans::XPropertySet
diff --git a/chart2/qa/unoapi/makefile.mk b/chart2/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..de494ead5449
--- /dev/null
+++ b/chart2/qa/unoapi/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = chart2
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/chart2/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
diff --git a/chart2/qa/unoapi/sch.sce b/chart2/qa/unoapi/sch.sce
new file mode 100644
index 000000000000..b35dec7c2ef4
--- /dev/null
+++ b/chart2/qa/unoapi/sch.sce
@@ -0,0 +1,26 @@
+-o sch.ChXChartDocument
+#i79073 -o sch.AccArea
+#i79073 -o sch.AccAxis
+#i79073 -o sch.AccDataPoint
+#i79073 -o sch.AccDataSeries
+#i79073 -o sch.AccDiagram
+#i79073 -o sch.AccFloor
+#i79073 -o sch.AccGrid
+#i79073 -o sch.AccLegend
+#i79073 -o sch.AccLegendEntry
+#i79073 -o sch.AccStatisticsObject
+#i79073 -o sch.AccTitle
+#i79073 -o sch.AccWall
+#i79073 -o sch.AccessibleDocumentView
+-o sch.ChXChartAxis
+-o sch.ChXChartData
+-o sch.ChXChartDataArray
+-o sch.ChXChartView
+-o sch.ChXDataPoint
+#i83868 -o sch.ChXDataRow
+-o sch.ChXDiagram
+-o sch.ChartArea
+-o sch.ChartGrid
+-o sch.ChartLegend
+-o sch.ChartLine
+-o sch.ChartTitle
diff --git a/chart2/qa/unoapi/testdocuments/TransparencyChart.sxs b/chart2/qa/unoapi/testdocuments/TransparencyChart.sxs
new file mode 100644
index 000000000000..c3a5833ae27a
--- /dev/null
+++ b/chart2/qa/unoapi/testdocuments/TransparencyChart.sxs
Binary files differ
diff --git a/chart2/qa/unoapi/testdocuments/emptyChart.sds b/chart2/qa/unoapi/testdocuments/emptyChart.sds
new file mode 100644
index 000000000000..853a44a12cf8
--- /dev/null
+++ b/chart2/qa/unoapi/testdocuments/emptyChart.sds
Binary files differ
diff --git a/chart2/qa/unoapi/testdocuments/space-metal.jpg b/chart2/qa/unoapi/testdocuments/space-metal.jpg
new file mode 100644
index 000000000000..d23344389073
--- /dev/null
+++ b/chart2/qa/unoapi/testdocuments/space-metal.jpg
Binary files differ
diff --git a/chart2/source/controller/accessibility/AccStatisticsObject.cxx b/chart2/source/controller/accessibility/AccStatisticsObject.cxx
new file mode 100644
index 000000000000..9028973936e0
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccStatisticsObject.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccStatisticsObject.hxx"
+#include <vcl/svapp.hxx>
+#include <svx/svditer.hxx>
+
+using ::rtl::OUString;
+
+namespace chart
+{
+
+AccStatisticsObject::AccStatisticsObject( const AccessibleElementInfo& rAccInfo )
+ : AccessibleChartElement( rAccInfo, false/*NoChildren*/, true/*AlwaysTransparent*/ )
+ //, m_eType( eType )
+ //, m_nSeriesIndex( nSeriesIndex )
+{
+// ChartModel * pModel = GetChartModel();
+// OSL_ASSERT( pModel );
+
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+/* switch( eType )
+ {
+ case MEAN_VAL_LINE:
+ SetItemSet( pModel->GetAverageAttr( m_nSeriesIndex ));
+ break;
+ case ERROR_BARS:
+ SetItemSet( pModel->GetErrorAttr( m_nSeriesIndex ));
+ break;
+ case REGRESSION:
+ SetItemSet( pModel->GetRegressAttr( m_nSeriesIndex ));
+ break;
+ }*/
+ // \-- solar
+}
+
+AccStatisticsObject::~AccStatisticsObject()
+{
+}
+
+OUString SAL_CALL AccStatisticsObject::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return getToolTipText();
+}
+
+OUString SAL_CALL AccStatisticsObject::getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "StatisticsObject" ));
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccStatisticsObject.hxx b/chart2/source/controller/accessibility/AccStatisticsObject.hxx
new file mode 100644
index 000000000000..da09342cd8b0
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccStatisticsObject.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCSTATISTICSOBJECT_HXX
+#define _CHART2_ACCSTATISTICSOBJECT_HXX
+
+#ifndef _CHART2_ACCESSIBLE_CHART_ELEMENT_HXX_
+#include "AccessibleChartElement.hxx"
+#endif
+
+#include "ObjectIdentifier.hxx"
+
+namespace chart
+{
+
+class AccStatisticsObject : public AccessibleChartElement
+{
+public:
+ /*
+ enum StatisticsObjectType
+ {
+ MEAN_VAL_LINE = OBJECTTYPE_AVERAGEVALUE,
+ ERROR_BARS = OBJECTTYPE_ERROR,
+ REGRESSION = OBJECTTYPE_REGRESSION
+ };
+ */
+
+ AccStatisticsObject( const AccessibleElementInfo& rAccInfo );
+
+ virtual ~AccStatisticsObject();
+
+ // ________ XAccessibleContext ________
+ virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //const StatisticsObjectType m_eType;
+ //const sal_uInt16 m_nSeriesIndex;
+};
+
+} // accessibility
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
new file mode 100644
index 000000000000..00335eab296e
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -0,0 +1,1010 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleBase.hxx"
+#include "AccessibleChartShape.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <comphelper/serviceinfohelper.hxx>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <rtl/ustrbuf.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/unofdesc.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoprov.hxx>
+#include <vcl/unohelp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+#include "ChartElementFactory.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::UNO_QUERY;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::osl::ResettableMutexGuard;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+
+namespace chart
+{
+
+/** @param bMayHaveChildren is false per default
+ */
+AccessibleBase::AccessibleBase(
+ const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent /* default: false */ ) :
+ impl::AccessibleBase_Base( m_aMutex ),
+ m_bIsDisposed( false ),
+ m_bMayHaveChildren( bMayHaveChildren ),
+ m_bChildrenInitialized( false ),
+ m_nEventNotifierId(0),
+ m_pStateSetHelper( new ::utl::AccessibleStateSetHelper() ),
+ m_aStateSet( m_pStateSetHelper ),
+ m_aAccInfo( rAccInfo ),
+ m_bAlwaysTransparent( bAlwaysTransparent ),
+ m_bStateSetInitialized( false )
+{
+ // initialize some states
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ m_pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ m_pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ m_pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ m_pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+}
+
+AccessibleBase::~AccessibleBase()
+{
+ OSL_ASSERT( m_bIsDisposed );
+}
+
+// ________ public ________
+
+bool AccessibleBase::CheckDisposeState( bool bThrowException /* default: true */ ) const
+ throw (lang::DisposedException)
+{
+ if( bThrowException &&
+ m_bIsDisposed )
+ {
+ throw lang::DisposedException(
+ C2U("component has state DEFUNC" ),
+ static_cast< uno::XWeak * >( const_cast< AccessibleBase * >( this )));
+ }
+ return m_bIsDisposed;
+}
+
+bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId & rId )
+{
+ if( GetId() == rId )
+ {
+ // event is addressed to this object
+
+ ::com::sun::star::uno::Any aEmpty;
+ ::com::sun::star::uno::Any aSelected;
+ aSelected <<= AccessibleStateType::SELECTED;
+ switch( eEventType )
+ {
+ case OBJECT_CHANGE:
+ {
+ BroadcastAccEvent( AccessibleEventId::VISIBLE_DATA_CHANGED, aEmpty, aEmpty );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Visible data event sent by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case GOT_SELECTION:
+ {
+ AddState( AccessibleStateType::SELECTED );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty );
+
+ AddState( AccessibleStateType::FOCUSED );
+ aSelected <<= AccessibleStateType::FOCUSED;
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty, true );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Selection acquired by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case LOST_SELECTION:
+ {
+ RemoveState( AccessibleStateType::SELECTED );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected );
+
+ AddState( AccessibleStateType::FOCUSED );
+ aSelected <<= AccessibleStateType::FOCUSED;
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected, true );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Selection lost by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case PROPERTY_CHANGE:
+ {
+ //not implemented --> rebuild all
+ }
+ break;
+ }
+ return true;
+ }
+ else if( m_bMayHaveChildren )
+ {
+ bool bStop = false;
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ // make local copy for notification
+ ChildListVectorType aLocalChildList( m_aChildList );
+ aGuard.clear();
+ // \--
+
+ ChildListVectorType::iterator aEndIter = aLocalChildList.end();
+ for( ChildListVectorType::iterator aIter = aLocalChildList.begin() ;
+ ( aIter != aEndIter ) && ( ! bStop ) ;
+ ++aIter )
+ {
+ // Note: at this place we must be sure to have an AccessibleBase
+ // object in the UNO reference to XAccessible !
+ bStop = (*static_cast< AccessibleBase * >
+ ( (*aIter).get() )).NotifyEvent( eEventType, rId );
+ }
+ return bStop;
+ }
+
+ return false;
+}
+
+void AccessibleBase::AddState( sal_Int16 aState )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->AddState( aState );
+}
+
+void AccessibleBase::RemoveState( sal_Int16 aState )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->RemoveState( aState );
+}
+
+// ________ protected ________
+
+bool AccessibleBase::UpdateChildren()
+{
+ bool bMustUpdateChildren = false;
+ {
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ if( ! m_bMayHaveChildren ||
+ m_bIsDisposed )
+ return false;
+
+ bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+ // \--
+ }
+
+ // update unguarded
+ if( bMustUpdateChildren )
+ m_bChildrenInitialized = ImplUpdateChildren();
+
+ return m_bChildrenInitialized;
+}
+
+bool AccessibleBase::ImplUpdateChildren()
+{
+ bool bResult = false;
+
+ if( m_aAccInfo.m_spObjectHierarchy )
+ {
+ ObjectHierarchy::tChildContainer aModelChildren(
+ m_aAccInfo.m_spObjectHierarchy->getChildren( GetId() ));
+ ::std::vector< ChildOIDMap::key_type > aAccChildren;
+ aAccChildren.reserve( aModelChildren.size());
+ ::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(),
+ ::std::back_inserter( aAccChildren ),
+ ::std::select1st< ChildOIDMap::value_type >());
+
+ ::std::sort( aModelChildren.begin(), aModelChildren.end());
+
+ ::std::vector< ObjectHierarchy::tOID > aChildrenToRemove, aChildrenToAdd;
+ ::std::set_difference( aModelChildren.begin(), aModelChildren.end(),
+ aAccChildren.begin(), aAccChildren.end(),
+ ::std::back_inserter( aChildrenToAdd ));
+ ::std::set_difference( aAccChildren.begin(), aAccChildren.end(),
+ aModelChildren.begin(), aModelChildren.end(),
+ ::std::back_inserter( aChildrenToRemove ));
+
+ ::std::vector< ObjectHierarchy::tOID >::const_iterator aIt( aChildrenToRemove.begin());
+ for( ; aIt != aChildrenToRemove.end(); ++aIt )
+ {
+ RemoveChildByOId( *aIt );
+ }
+
+ AccessibleElementInfo aAccInfo( GetInfo());
+ aAccInfo.m_pParent = this;
+
+ for( aIt = aChildrenToAdd.begin(); aIt != aChildrenToAdd.end(); ++aIt )
+ {
+ aAccInfo.m_aOID = *aIt;
+ if ( aIt->isAutoGeneratedObject() )
+ {
+ AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) );
+ }
+ else if ( aIt->isAdditionalShape() )
+ {
+ AddChild( new AccessibleChartShape( aAccInfo, true, false ) );
+ }
+ }
+ bResult = true;
+ }
+
+ return bResult;
+}
+
+void AccessibleBase::AddChild( AccessibleBase * pChild )
+{
+ OSL_ENSURE( pChild != NULL, "Invalid Child" );
+ if( pChild )
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ Reference< XAccessible > xChild( pChild );
+ m_aChildList.push_back( xChild );
+
+ m_aChildOIDMap[ pChild->GetId() ] = xChild;
+
+ // inform listeners of new child
+ if( m_bChildrenInitialized )
+ {
+ Any aEmpty, aNew;
+ aNew <<= xChild;
+
+ aGuard.clear();
+ // \-- (1st)
+ BroadcastAccEvent( AccessibleEventId::CHILD, aNew, aEmpty );
+ }
+ // \-- (2nd)
+ }
+}
+
+/** in this method we imply that the Reference< XAccessible > elements in the
+ vector are AccessibleBase objects !
+ */
+void AccessibleBase::RemoveChildByOId( const ObjectIdentifier& rOId )
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ ChildOIDMap::iterator aIt( m_aChildOIDMap.find( rOId ));
+ if( aIt != m_aChildOIDMap.end())
+ {
+ Reference< XAccessible > xChild( aIt->second );
+
+ // remove from map
+ m_aChildOIDMap.erase( aIt );
+
+ // search child in vector
+ ChildListVectorType::iterator aVecIter =
+ ::std::find( m_aChildList.begin(), m_aChildList.end(), xChild );
+
+ OSL_ENSURE( aVecIter != m_aChildList.end(),
+ "Inconsistent ChildMap" );
+
+ // remove child from vector
+ m_aChildList.erase( aVecIter );
+ bool bInitialized = m_bChildrenInitialized;
+
+ // call listeners unguarded
+ aGuard.clear();
+ // \-- (1st)
+
+ // inform listeners of removed child
+ if( bInitialized )
+ {
+ Any aEmpty, aOld;
+ aOld <<= xChild;
+
+ BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld );
+ }
+
+ // dispose the child
+ Reference< lang::XComponent > xComp( xChild, UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ }
+}
+
+awt::Point AccessibleBase::GetUpperLeftOnScreen() const
+{
+ awt::Point aResult;
+ if( m_aAccInfo.m_pParent )
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ AccessibleBase * pParent = m_aAccInfo.m_pParent;
+ aGuard.clear();
+ // \--
+
+ if( pParent )
+ {
+ aResult = pParent->GetUpperLeftOnScreen();
+ }
+ else
+ OSL_ENSURE( false, "Default position used is probably incorrect." );
+ }
+
+ return aResult;
+}
+
+void AccessibleBase::BroadcastAccEvent(
+ sal_Int16 nId,
+ const Any & rNew,
+ const Any & rOld,
+ bool bSendGlobally ) const
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ if ( !m_nEventNotifierId && !bSendGlobally )
+ 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 );
+
+ if ( m_nEventNotifierId ) // 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()
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ // make local copy for notification
+ ChildListVectorType aLocalChildList( m_aChildList );
+
+ // remove all children
+ m_aChildList.clear();
+ m_aChildOIDMap.clear();
+
+ aGuard.clear();
+ // \--
+
+ // call dispose for all children
+ // and notify listeners
+ Reference< lang::XComponent > xComp;
+ Any aEmpty, aOld;
+ ChildListVectorType::const_iterator aEndIter = aLocalChildList.end();
+ for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin();
+ aIter != aEndIter; ++aIter )
+ {
+ aOld <<= (*aIter);
+ BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld );
+
+ xComp.set( *aIter, UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ }
+ m_bChildrenInitialized = false;
+}
+
+AccessibleElementInfo AccessibleBase::GetInfo() const
+{
+ return m_aAccInfo;
+}
+
+void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo )
+{
+ m_aAccInfo = rNewInfo;
+ if( m_bMayHaveChildren )
+ {
+ KillAllChildren();
+ }
+ BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any(),
+ true /* global notification */ );
+}
+
+AccessibleUniqueId AccessibleBase::GetId() const
+{
+ return m_aAccInfo.m_aOID;
+}
+
+// ____________________________________
+// ____________________________________
+//
+// Interfaces
+// ____________________________________
+// ____________________________________
+
+// ________ (XComponent::dispose) ________
+void SAL_CALL AccessibleBase::disposing()
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ OSL_ENSURE( ! m_bIsDisposed, "dispose() called twice" );
+
+ // notify disposing to all AccessibleEvent listeners asynchron
+ if ( m_nEventNotifierId )
+ {
+ ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( m_nEventNotifierId, *this );
+ m_nEventNotifierId = 0;
+ }
+
+ // reset pointers
+ m_aAccInfo.m_pParent = NULL;
+
+ // invalidate implementation for helper, but keep UNO reference to still
+ // allow a tool to query the DEFUNC state.
+ // Note: The object will be deleted when the last reference is released
+ m_pStateSetHelper = NULL;
+
+ // 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_aStateSet.set( pHelper );
+
+ m_bIsDisposed = true;
+
+ // call listeners unguarded
+ aGuard.clear();
+ // \--
+
+ if( m_bMayHaveChildren )
+ {
+ KillAllChildren();
+ }
+ else
+ OSL_ENSURE( m_aChildList.empty(), "Child list should be empty" );
+}
+
+// ________ XAccessible ________
+Reference< XAccessibleContext > SAL_CALL AccessibleBase::getAccessibleContext()
+ throw (RuntimeException)
+{
+ return this;
+}
+
+// ________ AccessibleBase::XAccessibleContext ________
+sal_Int32 SAL_CALL AccessibleBase::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ if( ! m_bMayHaveChildren ||
+ m_bIsDisposed )
+ return 0;
+
+ bool bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+
+ aGuard.clear();
+ // \--
+
+ // update unguarded
+ if( bMustUpdateChildren )
+ UpdateChildren();
+
+ return ImplGetAccessibleChildCount();
+}
+
+sal_Int32 AccessibleBase::ImplGetAccessibleChildCount() const
+ throw (RuntimeException)
+{
+ return m_aChildList.size();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > xResult;
+
+ // /--
+ ResettableMutexGuard aGuard( GetMutex() );
+ bool bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+
+ aGuard.clear();
+ // \--
+
+ if( bMustUpdateChildren )
+ UpdateChildren();
+
+ xResult.set( ImplGetAccessibleChildById( i ));
+
+ return xResult;
+ // \--
+}
+
+Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xResult;
+ // /--
+ MutexGuard aGuard( GetMutex());
+ if( ! m_bMayHaveChildren ||
+ i < 0 ||
+ static_cast< ChildListVectorType::size_type >( i ) >= m_aChildList.size() )
+ {
+ OUStringBuffer aBuf;
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Index " ));
+ aBuf.append( i );
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " is invalid for range [ 0, " ));
+ aBuf.append( static_cast< sal_Int32 >( m_aChildList.size() - 1 ) );
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ]" ) );
+ lang::IndexOutOfBoundsException aEx( aBuf.makeStringAndClear(),
+ const_cast< ::cppu::OWeakObject * >(
+ static_cast< const ::cppu::OWeakObject * >( this )));
+ throw aEx;
+ }
+ else
+ xResult.set( m_aChildList[ i ] );
+
+ return xResult;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleParent()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > aResult;
+ if( m_aAccInfo.m_pParent )
+ aResult.set( m_aAccInfo.m_pParent );
+
+ return aResult;
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getAccessibleIndexInParent()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ if( m_aAccInfo.m_spObjectHierarchy )
+ return m_aAccInfo.m_spObjectHierarchy->getIndexInParent( GetId() );
+ return -1;
+}
+
+sal_Int16 SAL_CALL AccessibleBase::getAccessibleRole()
+ throw (RuntimeException)
+{
+ return AccessibleRole::LIST_ITEM; // #i73747# role SHAPE seems more appropriate, but is not read
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleBase::getAccessibleRelationSet()
+ throw (RuntimeException)
+{
+ Reference< XAccessibleRelationSet > aResult;
+ return aResult;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet()
+ throw (RuntimeException)
+{
+ if( ! m_bStateSetInitialized )
+ {
+ Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ if ( xSelSupp.is() )
+ {
+ ObjectIdentifier aOID( xSelSupp->getSelection() );
+ if ( aOID.isValid() && GetId() == aOID )
+ {
+ AddState( AccessibleStateType::SELECTED );
+ AddState( AccessibleStateType::FOCUSED );
+ }
+ }
+ m_bStateSetInitialized = true;
+ }
+
+ return m_aStateSet;
+}
+
+
+lang::Locale SAL_CALL AccessibleBase::getLocale()
+ throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ CheckDisposeState();
+
+ return Application::GetSettings().GetLocale();
+}
+
+// ________ AccessibleBase::XAccessibleComponent ________
+sal_Bool SAL_CALL AccessibleBase::containsPoint( const awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ awt::Rectangle aRect( getBounds() );
+
+ // contains() works with relative coordinates
+ aRect.X = 0;
+ aRect.Y = 0;
+
+ return ( aPoint.X >= aRect.X &&
+ aPoint.Y >= aRect.Y &&
+ aPoint.X < (aRect.X + aRect.Width) &&
+ aPoint.Y < (aRect.Y + aRect.Height) );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > aResult;
+ awt::Rectangle aRect( getBounds());
+
+ // children are positioned relative to this object, so translate bound rect
+ aRect.X = 0;
+ aRect.Y = 0;
+
+ // children must be inside the own bound rect
+ if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
+ ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ ChildListVectorType aLocalChildList( m_aChildList );
+ aGuard.clear();
+ // \--
+
+ Reference< XAccessibleComponent > aComp;
+ for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin();
+ aIter != aLocalChildList.end(); ++aIter )
+ {
+ aComp.set( *aIter, UNO_QUERY );
+ if( aComp.is())
+ {
+ aRect = aComp->getBounds();
+ if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
+ ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
+ {
+ aResult = (*aIter);
+ break;
+ }
+ }
+ }
+ }
+
+ return aResult;
+}
+
+awt::Rectangle SAL_CALL AccessibleBase::getBounds()
+ throw (RuntimeException)
+{
+ ExplicitValueProvider *pExplicitValueProvider(
+ ExplicitValueProvider::getExplicitValueProvider( m_aAccInfo.m_xView ));
+ if( pExplicitValueProvider )
+ {
+ Window* pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow ));
+ awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() ));
+ if( pWindow )
+ {
+ Rectangle aRect( aLogicRect.X, aLogicRect.Y,
+ aLogicRect.X + aLogicRect.Width,
+ aLogicRect.Y + aLogicRect.Height );
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ aRect = pWindow->LogicToPixel( aRect );
+
+ // aLogicRect ist relative to the page, but we need a value relative
+ // to the parent object
+ awt::Point aParentLocOnScreen;
+ uno::Reference< XAccessibleComponent > xParent( getAccessibleParent(), uno::UNO_QUERY );
+ if( xParent.is() )
+ aParentLocOnScreen = xParent->getLocationOnScreen();
+
+ // aOffset = aParentLocOnScreen - GetUpperLeftOnScreen()
+ awt::Point aULOnScreen = GetUpperLeftOnScreen();
+ 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());
+ // \-- solar
+ }
+ }
+
+ return awt::Rectangle();
+}
+
+awt::Point SAL_CALL AccessibleBase::getLocation()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ awt::Rectangle aBBox( getBounds() );
+ return awt::Point( aBBox.X, aBBox.Y );
+}
+
+awt::Point SAL_CALL AccessibleBase::getLocationOnScreen()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ if( m_aAccInfo.m_pParent != NULL )
+ {
+ AccessibleBase * pParent = m_aAccInfo.m_pParent;
+ awt::Point aLocThisRel( getLocation());
+ awt::Point aUpperLeft;
+
+ if( pParent != NULL )
+ aUpperLeft = pParent->getLocationOnScreen();
+
+ return awt::Point( aUpperLeft.X + aLocThisRel.X,
+ aUpperLeft.Y + aLocThisRel.Y );
+ }
+ else
+ return getLocation();
+}
+
+awt::Size SAL_CALL AccessibleBase::getSize()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ awt::Rectangle aBBox( getBounds() );
+ return awt::Size( aBBox.Width, aBBox.Height );
+}
+
+void SAL_CALL AccessibleBase::grabFocus()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ if ( xSelSupp.is() )
+ {
+ xSelSupp->select( GetId().getAny() );
+ }
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getForeground()
+ throw (RuntimeException)
+{
+ return getColor( ACC_BASE_FOREGROUND );
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getBackground()
+ throw (RuntimeException)
+{
+ return getColor( ACC_BASE_BACKGROUND );
+}
+
+sal_Int32 AccessibleBase::getColor( eColorType eColType )
+{
+ sal_Int32 nResult = static_cast< sal_Int32 >( Color( COL_TRANSPARENT ).GetColor());
+ if( m_bAlwaysTransparent )
+ return nResult;
+
+ ObjectIdentifier aOID( m_aAccInfo.m_aOID );
+ ObjectType eType( aOID.getObjectType() );
+ Reference< beans::XPropertySet > xObjProp;
+ OUString aObjectCID = aOID.getObjectCID();
+ if( eType == OBJECTTYPE_LEGEND_ENTRY )
+ {
+ // for colors get the data series/point properties
+ OUString aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ));
+ aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
+ }
+
+ xObjProp.set(
+ ObjectIdentifier::getObjectPropertySet(
+ aObjectCID, Reference< chart2::XChartDocument >( m_aAccInfo.m_xChartDocument )), uno::UNO_QUERY );
+ if( xObjProp.is())
+ {
+ try
+ {
+ OUString aPropName;
+ OUString aStylePropName;
+
+ switch( eType )
+ {
+ case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_POINT:
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ aPropName = C2U("BorderColor");
+ aStylePropName = C2U("BorderTransparency");
+ }
+ else
+ {
+ aPropName = C2U("Color");
+ aStylePropName = C2U("Transparency");
+ }
+ break;
+ default:
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ aPropName = C2U("LineColor");
+ aStylePropName = C2U("LineTransparence");
+ }
+ else
+ {
+ aPropName = C2U("FillColor");
+ aStylePropName = C2U("FillTransparence");
+ }
+ break;
+ }
+
+ bool bTransparent = m_bAlwaysTransparent;
+ Reference< beans::XPropertySetInfo > xInfo( xObjProp->getPropertySetInfo(), uno::UNO_QUERY );
+ if( xInfo.is() &&
+ xInfo->hasPropertyByName( aStylePropName ))
+ {
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ drawing::LineStyle aLStyle;
+ if( xObjProp->getPropertyValue( aStylePropName ) >>= aLStyle )
+ bTransparent = (aLStyle == drawing::LineStyle_NONE);
+ }
+ else
+ {
+ drawing::FillStyle aFStyle;
+ if( xObjProp->getPropertyValue( aStylePropName ) >>= aFStyle )
+ bTransparent = (aFStyle == drawing::FillStyle_NONE);
+ }
+ }
+
+ if( !bTransparent &&
+ xInfo.is() &&
+ xInfo->hasPropertyByName( aPropName ))
+ {
+ xObjProp->getPropertyValue( aPropName ) >>= nResult;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return nResult;
+}
+
+// ________ AccessibleBase::XServiceInfo ________
+OUString SAL_CALL AccessibleBase::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleBase" ));
+}
+
+sal_Bool SAL_CALL AccessibleBase::supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL AccessibleBase::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 2 );
+ ::rtl::OUString* pStr = aSeq.getArray();
+ pStr[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.Accessible" ));
+ pStr[ 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ));
+
+ return aSeq;
+}
+
+// ________ AccessibleBase::XEventListener ________
+void SAL_CALL AccessibleBase::disposing( const lang::EventObject& /*Source*/ )
+ throw (RuntimeException)
+{
+}
+
+// ________ XAccessibleEventBroadcasters ________
+void SAL_CALL AccessibleBase::addEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+
+ if ( xListener.is() )
+ {
+ if ( !m_nEventNotifierId )
+ m_nEventNotifierId = ::comphelper::AccessibleEventNotifier::registerClient();
+
+ ::comphelper::AccessibleEventNotifier::addEventListener( m_nEventNotifierId, xListener );
+ }
+}
+
+void SAL_CALL AccessibleBase::removeEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+
+ if ( xListener.is() )
+ {
+ sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( m_nEventNotifierId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ ::comphelper::AccessibleEventNotifier::revokeClient( m_nEventNotifierId );
+ m_nEventNotifierId = 0;
+ }
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
new file mode 100644
index 000000000000..2361cc62c389
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleChartElement.hxx"
+#include "CharacterProperties.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ObjectNameProvider.hxx"
+#include "servicenames.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// #ifndef _RTL_UUID_H_
+// #include <rtl/uuid.h>
+// #endif
+// #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+// #include <cppuhelper/queryinterface.hxx>
+// #endif
+// #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+// #include <toolkit/helper/vclunohelper.hxx>
+// #endif
+// #ifndef _SV_WINDOW_HXX
+// #include <vcl/window.hxx>
+// #endif
+
+// #ifndef _SVX_ACCESSILE_TEXT_HELPER_HXX_
+// #include <svx/AccessibleTextHelper.hxx>
+// #endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::UNO_QUERY;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::osl::ResettableMutexGuard;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+
+namespace chart
+{
+
+AccessibleChartElement::AccessibleChartElement(
+ const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent /* default: false */ ) :
+ impl::AccessibleChartElement_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent ),
+ m_bHasText( false )
+{
+ AddState( AccessibleStateType::TRANSIENT );
+}
+
+AccessibleChartElement::~AccessibleChartElement()
+{
+ OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
+}
+
+// ________ protected ________
+
+bool AccessibleChartElement::ImplUpdateChildren()
+{
+ bool bResult = false;
+ Reference< chart2::XTitle > xTitle(
+ ObjectIdentifier::getObjectPropertySet(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )),
+ uno::UNO_QUERY );
+ m_bHasText = xTitle.is();
+
+ if( m_bHasText )
+ {
+ InitTextEdit();
+ bResult = true;
+ }
+ else
+ bResult = AccessibleBase::ImplUpdateChildren();
+
+ return bResult;
+}
+
+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 );
+ }
+ }
+
+ if( m_xTextHelper.is())
+ 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 & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+// OSL_ASSERT( m_pTextHelper == 0 );
+
+// // /-- solar
+// ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+// Window* pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
+// if( pWindow )
+// {
+// // we need ChartController::m_pDrawViewWrapper here
+// SdrView * pView = 0;
+// if( pView )
+// {
+// SdrObject * pTextObj = m_pDrawViewWrapper->getTextEditObject();
+// if( pTextObj )
+// {
+// SvxEditSource * pEditSource = new SvxEditSource( pTextObj, pView, pWindow );
+// m_pTextHelper = new ::accessibility::AccessibleTextHelper(
+// ::std::auto_ptr< SvxEditSource >( pEditSource ));
+// if( m_pTextHelper )
+// m_pTextHelper->SetEventSource( this );
+// }
+// }
+// }
+// // \-- solar
+// }
+
+// ____________________________________
+// ____________________________________
+//
+// Interfaces
+// ____________________________________
+// ____________________________________
+
+// ________ AccessibleBase::XAccessibleContext ________
+Reference< XAccessible > AccessibleChartElement::ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xResult;
+
+ if( m_bHasText )
+ {
+ xResult.set( m_xTextHelper->getAccessibleChild( i ));
+ // /-- solar
+// ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+// if( m_pTextHelper )
+// xResult.set( m_pTextHelper->GetChild( i ) );
+ // \-- solar
+ }
+ else
+ xResult.set( AccessibleBase::ImplGetAccessibleChildById( i ));
+
+ return xResult;
+}
+
+sal_Int32 AccessibleChartElement::ImplGetAccessibleChildCount() const
+ throw (RuntimeException)
+{
+ if( m_bHasText )
+ {
+ if( m_xTextHelper.is())
+ return m_xTextHelper->getAccessibleChildCount();
+ return 0;
+ }
+
+ return AccessibleBase::ImplGetAccessibleChildCount();
+}
+
+// ________ XServiceInfo ________
+OUString SAL_CALL AccessibleChartElement::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartElement" ));
+}
+
+// ________ AccessibleChartElement::XAccessibleContext (overloaded) ________
+OUString SAL_CALL AccessibleChartElement::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ObjectNameProvider::getNameForCID(
+ GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument );
+}
+
+// ________ AccessibleChartElement::XAccessibleContext (overloaded) ________
+OUString SAL_CALL AccessibleChartElement::getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return getToolTipText();
+}
+
+// ________ AccessibleChartElement::XAccessibleExtendedComponent ________
+Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont()
+ throw (uno::RuntimeException)
+{
+ CheckDisposeState();
+
+ Reference< awt::XFont > xFont;
+ // using assignment for broken gcc 3.3
+ Reference< awt::XDevice > xDevice = Reference< awt::XDevice >(
+ Reference< awt::XWindow >( GetInfo().m_xWindow ), uno::UNO_QUERY );
+
+ if( xDevice.is())
+ {
+ Reference< beans::XMultiPropertySet > xObjProp(
+ ObjectIdentifier::getObjectPropertySet(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY );
+ awt::FontDescriptor aDescr(
+ CharacterProperties::createFontDescriptorFromPropertySet( xObjProp ));
+ xFont = xDevice->getFont( aDescr );
+ }
+
+ return xFont;
+}
+
+OUString SAL_CALL AccessibleChartElement::getTitledBorderText()
+ throw (uno::RuntimeException)
+{
+ return OUString();
+}
+
+OUString SAL_CALL AccessibleChartElement::getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ CheckDisposeState();
+
+ return ObjectNameProvider::getHelpText(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument ));
+}
+
+// ________ XAccessibleComponent ________
+sal_Bool SAL_CALL AccessibleChartElement::containsPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::containsPoint( aPoint );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getAccessibleAtPoint( aPoint );
+}
+
+awt::Rectangle SAL_CALL AccessibleChartElement::getBounds()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getBounds();
+}
+
+awt::Point SAL_CALL AccessibleChartElement::getLocation()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getLocation();
+}
+
+awt::Point SAL_CALL AccessibleChartElement::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getLocationOnScreen();
+}
+
+awt::Size SAL_CALL AccessibleChartElement::getSize()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getSize();
+}
+
+void SAL_CALL AccessibleChartElement::grabFocus()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::grabFocus();
+}
+
+sal_Int32 SAL_CALL AccessibleChartElement::getForeground()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getForeground();
+}
+
+sal_Int32 SAL_CALL AccessibleChartElement::getBackground()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getBackground();
+}
+
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.hxx b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
new file mode 100644
index 000000000000..d74b5d9d11b9
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLECHARTELEMENT_HXX_
+#define _CHART2_ACCESSIBLECHARTELEMENT_HXX_
+
+#include "AccessibleBase.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+class SfxItemSet;
+class SdrObject;
+
+namespace chart
+{
+
+/** Base class for all Chart Accessibility objects except the root node (see AccessibleChartView)
+
+ This class contains a reference to the ChartModel, thus, components can easily access all core functionality.
+
+ Usage Instructions:
+
+ <ul>
+ <li>define the getAccessibleName() method of XAccessibleContext</li>
+ <li>set the ChartModel using SetChartModel() for the first node before
+ creating any children</li>
+ <li>overload UpdateChildren()</li>
+ </ul>
+ */
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper1<
+ AccessibleBase,
+ ::com::sun::star::accessibility::XAccessibleExtendedComponent
+ > AccessibleChartElement_Base;
+}
+
+class AccessibleChartElement :
+ public impl::AccessibleChartElement_Base
+{
+public:
+ AccessibleChartElement( const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent = false );
+ virtual ~AccessibleChartElement();
+
+ // ________ AccessibleBase ________
+ virtual bool ImplUpdateChildren();
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 ImplGetAccessibleChildCount() const
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleExtendedComponent ________
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // the following interface is implemented in AccessibleBase, however it is
+ // also a (non-virtual) base class of XAccessibleExtendedComponent Thus
+ // these methods have to be overloaded and forward to AccessibleBase
+
+ // ________ XAccessibleComponent ________
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ bool m_bHasText;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext >
+ m_xTextHelper;
+
+ void InitTextEdit();
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
new file mode 100644
index 000000000000..bbf6176641da
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
@@ -0,0 +1,289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleChartShape.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+
+
+namespace chart
+{
+
+AccessibleChartShape::AccessibleChartShape(
+ const AccessibleElementInfo& rAccInfo,
+ bool bMayHaveChildren, bool bAlwaysTransparent )
+ :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent )
+ ,m_pAccShape( NULL )
+{
+ if ( rAccInfo.m_aOID.isAdditionalShape() )
+ {
+ Reference< drawing::XShape > xShape( rAccInfo.m_aOID.getAdditionalShape() );
+ Reference< XAccessible > xParent;
+ if ( rAccInfo.m_pParent )
+ {
+ xParent.set( rAccInfo.m_pParent );
+ }
+ sal_Int32 nIndex = -1;
+ if ( rAccInfo.m_spObjectHierarchy )
+ {
+ nIndex = rAccInfo.m_spObjectHierarchy->getIndexInParent( rAccInfo.m_aOID );
+ }
+ ::accessibility::AccessibleShapeInfo aShapeInfo( xShape, xParent, nIndex );
+
+ m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView );
+ m_aShapeTreeInfo.SetController( NULL );
+ m_aShapeTreeInfo.SetWindow( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) );
+ m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder );
+
+ ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
+ m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo );
+ if ( m_pAccShape )
+ {
+ m_pAccShape->acquire();
+ m_pAccShape->Init();
+ }
+ }
+}
+
+AccessibleChartShape::~AccessibleChartShape()
+{
+ OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
+
+ if ( m_pAccShape )
+ {
+ m_pAccShape->dispose();
+ m_pAccShape->release();
+ }
+}
+
+// ________ XServiceInfo ________
+::rtl::OUString AccessibleChartShape::getImplementationName()
+ throw (RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartShape" ) );
+}
+
+// ________ XAccessibleContext ________
+sal_Int32 AccessibleChartShape::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ sal_Int32 nCount(0);
+ if ( m_pAccShape )
+ {
+ nCount = m_pAccShape->getAccessibleChildCount();
+ }
+ return nCount;
+}
+
+Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xChild;
+ if ( m_pAccShape )
+ {
+ xChild = m_pAccShape->getAccessibleChild( i );
+ }
+ return xChild;
+}
+
+sal_Int16 AccessibleChartShape::getAccessibleRole()
+ throw (RuntimeException)
+{
+ sal_Int16 nRole(0);
+ if ( m_pAccShape )
+ {
+ nRole = m_pAccShape->getAccessibleRole();
+ }
+ return nRole;
+}
+
+::rtl::OUString AccessibleChartShape::getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aDescription;
+ if ( m_pAccShape )
+ {
+ aDescription = m_pAccShape->getAccessibleDescription();
+ }
+ return aDescription;
+}
+
+::rtl::OUString AccessibleChartShape::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aName;
+ if ( m_pAccShape )
+ {
+ aName = m_pAccShape->getAccessibleName();
+ }
+ return aName;
+}
+
+// ________ XAccessibleComponent ________
+sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bReturn = sal_False;
+ if ( m_pAccShape )
+ {
+ bReturn = m_pAccShape->containsPoint( aPoint );
+ }
+ return bReturn;
+}
+
+Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ Reference< XAccessible > xResult;
+ if ( m_pAccShape )
+ {
+ xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) );
+ }
+ return xResult;
+}
+
+awt::Rectangle AccessibleChartShape::getBounds()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds;
+ if ( m_pAccShape )
+ {
+ aBounds = m_pAccShape->getBounds();
+ }
+ return aBounds;
+}
+
+awt::Point AccessibleChartShape::getLocation()
+ throw (uno::RuntimeException)
+{
+ awt::Point aLocation;
+ if ( m_pAccShape )
+ {
+ aLocation = m_pAccShape->getLocation();
+ }
+ return aLocation;
+}
+
+awt::Point AccessibleChartShape::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ awt::Point aLocation;
+ if ( m_pAccShape )
+ {
+ aLocation = m_pAccShape->getLocationOnScreen();
+ }
+ return aLocation;
+}
+
+awt::Size AccessibleChartShape::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize;
+ if ( m_pAccShape )
+ {
+ aSize = m_pAccShape->getSize();
+ }
+ return aSize;
+}
+
+void AccessibleChartShape::grabFocus()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::grabFocus();
+}
+
+sal_Int32 AccessibleChartShape::getForeground()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nColor(0);
+ if ( m_pAccShape )
+ {
+ nColor = m_pAccShape->getForeground();
+ }
+ return nColor;
+}
+
+sal_Int32 AccessibleChartShape::getBackground()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nColor(0);
+ if ( m_pAccShape )
+ {
+ nColor = m_pAccShape->getBackground();
+ }
+ return nColor;
+}
+
+// ________ XAccessibleExtendedComponent ________
+Reference< awt::XFont > AccessibleChartShape::getFont()
+ throw (uno::RuntimeException)
+{
+ Reference< awt::XFont > xFont;
+ if ( m_pAccShape )
+ {
+ xFont.set( m_pAccShape->getFont() );
+ }
+ return xFont;
+}
+
+::rtl::OUString AccessibleChartShape::getTitledBorderText()
+ throw (uno::RuntimeException)
+{
+ ::rtl::OUString aText;
+ if ( m_pAccShape )
+ {
+ aText = m_pAccShape->getTitledBorderText();
+ }
+ return aText;
+}
+
+::rtl::OUString AccessibleChartShape::getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aText;
+ if ( m_pAccShape )
+ {
+ aText = m_pAccShape->getToolTipText();
+ }
+ return aText;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.hxx b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
new file mode 100644
index 000000000000..a1236b697a69
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLECHARTSHAPE_HXX_
+#define _CHART2_ACCESSIBLECHARTSHAPE_HXX_
+
+#include "AccessibleBase.hxx"
+
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+
+
+namespace accessibility
+{
+class AccessibleShape;
+}
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper1<
+ AccessibleBase,
+ ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleChartShape_Base;
+}
+
+class AccessibleChartShape :
+ public impl::AccessibleChartShape_Base
+{
+public:
+ AccessibleChartShape( const AccessibleElementInfo& rAccInfo,
+ bool bMayHaveChildren, bool bAlwaysTransparent = false );
+ virtual ~AccessibleChartShape();
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleComponent ________
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleExtendedComponent ________
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::accessibility::AccessibleShape* m_pAccShape;
+ ::accessibility::AccessibleShapeTreeInfo m_aShapeTreeInfo;
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx
new file mode 100644
index 000000000000..4833991ad7cc
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleChartView.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "servicenames.hxx"
+#include "macros.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "AccessibleViewForwarder.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+#include <tools/string.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+
+// header for typedef MutexGuard
+#include <osl/mutex.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::WeakReference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using osl::MutexGuard;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+AccessibleChartView::AccessibleChartView(
+ const Reference< uno::XComponentContext >& xContext, SdrView* pView ) :
+ impl::AccessibleChartView_Base(
+ AccessibleElementInfo(), // empty for now
+ true, // has children
+ true // always transparent
+ ),
+ m_xContext( xContext ),
+ m_pSdrView( pView ),
+ m_pViewForwarder( NULL )
+{
+ AddState( AccessibleStateType::OPAQUE );
+}
+
+AccessibleChartView::~AccessibleChartView()
+{
+ delete m_pViewForwarder;
+}
+
+
+awt::Rectangle AccessibleChartView::GetWindowPosSize() const
+{
+ Reference< awt::XWindow > xWindow( GetInfo().m_xWindow );
+ if( ! xWindow.is())
+ return awt::Rectangle();
+
+ // this should do, but it doesn't => HACK
+// return xWindow->getPosSize();
+
+ awt::Rectangle aBBox( xWindow->getPosSize() );
+
+ Window* pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
+ if( pWindow )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Point aVCLPoint( pWindow->OutputToAbsoluteScreenPixel( Point( 0, 0 ) ));
+ aBBox.X = aVCLPoint.getX();
+ aBBox.Y = aVCLPoint.getY();
+ // \-- solar
+ }
+
+ return aBBox;
+}
+
+awt::Point AccessibleChartView::GetUpperLeftOnScreen() const
+{
+ awt::Point aParentPosition;
+
+ awt::Rectangle aBBox( GetWindowPosSize() );
+ aParentPosition.X = aBBox.X;
+ aParentPosition.Y = aBBox.Y;
+
+ return aParentPosition;
+}
+
+// ________ XAccessibleContext ________
+OUString SAL_CALL AccessibleChartView::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ return OUString( String( SchResId( STR_OBJECT_DIAGRAM )));
+}
+
+OUString SAL_CALL AccessibleChartView::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ return getAccessibleName();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleChartView::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ return Reference< XAccessible >( m_xParent );
+}
+
+sal_Int32 SAL_CALL AccessibleChartView::getAccessibleIndexInParent()
+ throw (uno::RuntimeException)
+{
+ // the document is always the only child of the window
+ return 0;
+}
+
+sal_Int16 SAL_CALL AccessibleChartView::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ return AccessibleRole::DOCUMENT;
+}
+
+// ________ XAccessibleComponent ________
+awt::Rectangle SAL_CALL AccessibleChartView::getBounds()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aResult( GetWindowPosSize());
+ Reference< XAccessible > xParent( m_xParent );
+ if( xParent.is())
+ {
+ Reference< XAccessibleComponent > xContext( xParent->getAccessibleContext(), uno::UNO_QUERY );
+ if( xContext.is())
+ {
+ awt::Point aParentPosition = xContext->getLocationOnScreen();
+ aResult.X -= aParentPosition.X;
+ aResult.Y -= aParentPosition.Y;
+ }
+ }
+ return aResult;
+}
+
+awt::Point SAL_CALL AccessibleChartView::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds( getBounds());
+ awt::Point aResult;
+ Reference< XAccessible > xParent( m_xParent );
+ if( xParent.is())
+ {
+ Reference< XAccessibleComponent > xAccComp(
+ xParent->getAccessibleContext(), uno::UNO_QUERY );
+ aResult = xAccComp->getLocationOnScreen();
+ aResult.X += aBounds.X;
+ aResult.Y += aBounds.Y;
+ }
+ return aResult;
+}
+
+//-----------------------------------------------------------------
+// lang::XInitialization
+//-----------------------------------------------------------------
+
+void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ //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;
+ bool bNewInvalid = false;
+
+ Reference< view::XSelectionSupplier > xSelectionSupplier;
+ Reference< frame::XModel > xChartModel;
+ Reference< uno::XInterface > xChartView;
+ Reference< XAccessible > xParent;
+ Reference< awt::XWindow > xWindow;
+ {
+ MutexGuard aGuard( GetMutex());
+ xSelectionSupplier.set( m_xSelectionSupplier );
+ xChartModel.set( m_xChartModel );
+ xChartView.set( m_xChartView );
+ xParent.set( m_xParent );
+ xWindow.set( m_xWindow );
+ }
+
+ if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ {
+ bOldInvalid = true;
+ }
+
+ if( rArguments.getLength() > 1 )
+ {
+ Reference< frame::XModel > xNewChartModel;
+ rArguments[1] >>= xNewChartModel;
+ if( xNewChartModel != xChartModel )
+ {
+ xChartModel = xNewChartModel;
+ bChanged = true;
+ }
+ }
+ else if( xChartModel.is() )
+ {
+ bChanged = true;
+ xChartModel = 0;
+ }
+
+ if( rArguments.getLength() > 2 )
+ {
+ Reference< uno::XInterface > xNewChartView;
+ rArguments[2] >>= xNewChartView;
+ if( xNewChartView != xChartView )
+ {
+ xChartView = xNewChartView;
+ bChanged = true;
+ }
+ }
+ else if( xChartView.is() )
+ {
+ bChanged = true;
+ xChartView = 0;
+ }
+
+ if( rArguments.getLength() > 3 )
+ {
+ Reference< XAccessible > xNewParent;
+ rArguments[3] >>= xNewParent;
+ if( xNewParent != xParent )
+ {
+ xParent = xNewParent;
+ bChanged = true;
+ }
+ }
+
+ if( rArguments.getLength() > 4 )
+ {
+ Reference< awt::XWindow > xNewWindow;
+ rArguments[4] >>= xNewWindow;
+ if( xNewWindow != xWindow )
+ {
+ xWindow.set( xNewWindow );
+ bChanged = true;
+ }
+ }
+
+ if( rArguments.getLength() > 0 && 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;
+ }
+ }
+ else if( xSelectionSupplier.is() )
+ {
+ bChanged = true;
+ xSelectionSupplier->removeSelectionChangeListener(this);
+ xSelectionSupplier = 0;
+ }
+
+ if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ {
+ if(xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(this);
+ xSelectionSupplier = 0;
+ xChartModel.clear();
+ xChartView.clear();
+ xParent.clear();
+ xWindow.clear();
+
+ bNewInvalid = true;
+ }
+
+ {
+ MutexGuard aGuard( GetMutex());
+ m_xSelectionSupplier = WeakReference< view::XSelectionSupplier >(xSelectionSupplier);
+ m_xChartModel = WeakReference< frame::XModel >(xChartModel);
+ m_xChartView = WeakReference< uno::XInterface >(xChartView);
+ m_xParent = WeakReference< XAccessible >(xParent);
+ m_xWindow = WeakReference< awt::XWindow >(xWindow);
+ }
+
+ if( bOldInvalid && bNewInvalid )
+ bChanged = false;
+
+ if( bChanged )
+ {
+ {
+ //before notification we prepare for creation of new context
+ //the old context will be deleted after notification than
+ MutexGuard aGuard( GetMutex());
+ Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is())
+ m_spObjectHierarchy.reset( new ObjectHierarchy( xChartDoc, getExplicitValueProvider() ));
+ else
+ m_spObjectHierarchy.reset();
+ }
+
+ {
+ AccessibleElementInfo aAccInfo;
+ aAccInfo.m_aOID = ObjectIdentifier( C2U( "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_xView = m_xChartView;
+ aAccInfo.m_xWindow = m_xWindow;
+ aAccInfo.m_pParent = 0;
+ aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy;
+ aAccInfo.m_pSdrView = m_pSdrView;
+ Window* pWindow = VCLUnoHelper::GetWindow( m_xWindow );
+ if ( m_pViewForwarder )
+ {
+ delete m_pViewForwarder;
+ }
+ m_pViewForwarder = new AccessibleViewForwarder( this, pWindow );
+ aAccInfo.m_pViewForwarder = m_pViewForwarder;
+ // broadcasts an INVALIDATE_ALL_CHILDREN event globally
+ SetInfo( aAccInfo );
+ }
+ }
+}
+
+ExplicitValueProvider* AccessibleChartView::getExplicitValueProvider()
+{
+ return ExplicitValueProvider::getExplicitValueProvider(m_xChartView);
+}
+
+//-------------------------------------------------------------------------
+// view::XSelectionChangeListener
+//-------------------------------------------------------------------------
+
+void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /*rEvent*/ )
+ throw (uno::RuntimeException)
+{
+ Reference< view::XSelectionSupplier > xSelectionSupplier;
+ {
+ MutexGuard aGuard( GetMutex());
+ xSelectionSupplier = Reference< view::XSelectionSupplier >(m_xSelectionSupplier);
+ }
+
+ if( xSelectionSupplier.is() )
+ {
+ ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() );
+ if ( m_aCurrentSelectionOID.isValid() )
+ {
+ NotifyEvent( LOST_SELECTION, m_aCurrentSelectionOID );
+ }
+ if( aSelectedOID.isValid() )
+ {
+ NotifyEvent( GOT_SELECTION, aSelectedOID );
+ }
+ m_aCurrentSelectionOID = aSelectedOID;
+ }
+}
+
+//-------------------------------------------------------------------------
+// lang::XComponent::dispose()
+//-------------------------------------------------------------------------
+void SAL_CALL AccessibleChartView::disposing()
+{
+ AccessibleBase::disposing();
+}
+
+//-------------------------------------------------------------------------
+// XEventListener
+//-------------------------------------------------------------------------
+void SAL_CALL AccessibleChartView::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
new file mode 100644
index 000000000000..0ba078e82886
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleTextHelper.hxx"
+#include "DrawViewWrapper.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <svx/AccessibleTextHelper.hxx>
+#include <svx/unoshtxt.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+AccessibleTextHelper::AccessibleTextHelper(
+ DrawViewWrapper * pDrawViewWrapper ) :
+ impl::AccessibleTextHelper_Base( m_aMutex ),
+ m_pTextHelper( 0 ),
+ m_pDrawViewWrapper( pDrawViewWrapper )
+{}
+
+AccessibleTextHelper::~AccessibleTextHelper()
+{
+ if( m_pTextHelper )
+ delete m_pTextHelper;
+}
+
+// ____ XInitialization ____
+void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ 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.getLength() > 0, "Empty CID" );
+ OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
+ OSL_ENSURE( xWindow.is(), "Empty Window" );
+ if( !xEventSource.is() || aCID.getLength() == 0 )
+ return;
+
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( m_pTextHelper )
+ delete m_pTextHelper;
+
+ Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
+ if( pWindow )
+ {
+ SdrView * pView = m_pDrawViewWrapper;
+ if( pView )
+ {
+ SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
+ if( pTextObj )
+ {
+ SvxEditSource * pEditSource = new SvxTextEditSource( *pTextObj, 0, *pView, *pWindow );
+ m_pTextHelper = new ::accessibility::AccessibleTextHelper(
+ ::std::auto_ptr< SvxEditSource >( pEditSource ));
+ if( m_pTextHelper )
+ m_pTextHelper->SetEventSource( xEventSource );
+ }
+ }
+ }
+
+ OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" );
+ // \-- solar
+}
+
+// ____ XAccessibleContext ____
+::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
+ throw (uno::RuntimeException)
+{
+ if( m_pTextHelper )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ return m_pTextHelper->GetChildCount();
+ // \-- solar
+ }
+ return 0;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( m_pTextHelper )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ return m_pTextHelper->GetChild( i );
+ // \-- solar
+ }
+ return Reference< XAccessible >();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessible >();
+}
+
+::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return -1;
+}
+
+::sal_Int16 SAL_CALL AccessibleTextHelper::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return AccessibleRole::UNKNOWN;
+}
+
+OUString SAL_CALL AccessibleTextHelper::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return OUString();
+}
+
+OUString SAL_CALL AccessibleTextHelper::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return OUString();
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessibleRelationSet()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessibleRelationSet >();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessibleStateSet >();
+}
+
+lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
+ throw (IllegalAccessibleComponentStateException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return lang::Locale();
+}
+
+
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
new file mode 100644
index 000000000000..5014198761f8
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AccessibleViewForwarder.hxx"
+#include "AccessibleChartView.hxx"
+
+#include <vcl/window.hxx>
+
+using namespace ::com::sun::star;
+
+
+namespace chart
+{
+
+AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow )
+ :m_pAccChartView( pAccChartView )
+ ,m_pWindow( pWindow )
+ ,m_aMapMode( MAP_100TH_MM )
+{
+}
+
+AccessibleViewForwarder::~AccessibleViewForwarder()
+{
+}
+
+// ________ IAccessibleViewforwarder ________
+
+BOOL AccessibleViewForwarder::IsValid() const
+{
+ return sal_True;
+}
+
+Rectangle AccessibleViewForwarder::GetVisibleArea() const
+{
+ Rectangle aVisibleArea;
+ if ( m_pWindow )
+ {
+ aVisibleArea.SetPos( Point( 0, 0 ) );
+ aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() );
+ aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode );
+ }
+ return aVisibleArea;
+}
+
+Point AccessibleViewForwarder::LogicToPixel( const Point& rPoint ) const
+{
+ Point aPoint;
+ if ( m_pAccChartView && m_pWindow )
+ {
+ awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
+ Point aTopLeft( aLocation.X, aLocation.Y );
+ aPoint = m_pWindow->LogicToPixel( rPoint, m_aMapMode ) + aTopLeft;
+ }
+ return aPoint;
+}
+
+Size AccessibleViewForwarder::LogicToPixel( const Size& rSize ) const
+{
+ Size aSize;
+ if ( m_pWindow )
+ {
+ aSize = m_pWindow->LogicToPixel( rSize, m_aMapMode );
+ }
+ return aSize;
+}
+
+Point AccessibleViewForwarder::PixelToLogic( const Point& rPoint ) const
+{
+ Point aPoint;
+ if ( m_pAccChartView && m_pWindow )
+ {
+ awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
+ Point aTopLeft( aLocation.X, aLocation.Y );
+ aPoint = m_pWindow->PixelToLogic( rPoint - aTopLeft, m_aMapMode );
+ }
+ return aPoint;
+}
+
+Size AccessibleViewForwarder::PixelToLogic( const Size& rSize ) const
+{
+ Size aSize;
+ if ( m_pWindow )
+ {
+ aSize = m_pWindow->PixelToLogic( rSize, m_aMapMode );
+ }
+ return aSize;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
new file mode 100644
index 000000000000..e70aa58b8df7
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLEVIEWFORWARDER_HXX_
+#define _CHART2_ACCESSIBLEVIEWFORWARDER_HXX_
+
+#include <vcl/mapmod.hxx>
+#include <svx/IAccessibleViewForwarder.hxx>
+
+class Window;
+
+namespace chart
+{
+
+class AccessibleChartView;
+
+class AccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder
+{
+public:
+ AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow );
+ virtual ~AccessibleViewForwarder();
+
+ // ________ IAccessibleViewforwarder ________
+ virtual BOOL IsValid() const;
+ virtual Rectangle GetVisibleArea() const;
+ virtual Point LogicToPixel( const Point& rPoint ) const;
+ virtual Size LogicToPixel( const Size& rSize ) const;
+ virtual Point PixelToLogic( const Point& rPoint ) const;
+ virtual Size PixelToLogic( const Size& rSize ) const;
+
+private:
+ AccessibleViewForwarder( AccessibleViewForwarder& );
+ AccessibleViewForwarder& operator=( AccessibleViewForwarder& );
+
+ AccessibleChartView* m_pAccChartView;
+ Window* m_pWindow;
+ MapMode m_aMapMode;
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.cxx b/chart2/source/controller/accessibility/ChartElementFactory.cxx
new file mode 100644
index 000000000000..b2599fec0c74
--- /dev/null
+++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartElementFactory.hxx"
+#include "ObjectIdentifier.hxx"
+#include "AccessibleChartElement.hxx"
+
+namespace chart
+{
+
+AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo )
+{
+ ObjectIdentifier aOID( rAccInfo.m_aOID );
+ ObjectType eType( aOID.getObjectType() );
+
+ switch( eType )
+ {
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_LEGEND_ENTRY:
+ return new AccessibleChartElement( rAccInfo, false, false );
+ case OBJECTTYPE_PAGE:
+ case OBJECTTYPE_TITLE:
+ case OBJECTTYPE_LEGEND:
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ case OBJECTTYPE_AXIS:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_CURVE: // e.g. a statistical method printed as line
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ return new AccessibleChartElement( rAccInfo, true, false );
+ case OBJECTTYPE_UNKNOWN:
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+
+ /*
+ sal_uInt16 nObjId = rId.GetObjectId();
+ switch( nObjId )
+ {
+ case CHOBJID_LEGEND:
+ return new AccLegend( pParent );
+ case AccLegendEntry::ObjectId:
+ return new AccLegendEntry( pParent, rId.GetIndex1() );
+
+ case CHOBJID_TITLE_MAIN:
+ return new AccTitle( pParent, Title::MAIN );
+ case CHOBJID_TITLE_SUB:
+ return new AccTitle( pParent, Title::SUB );
+ case CHOBJID_DIAGRAM_TITLE_X_AXIS:
+ return new AccTitle( pParent, Title::X_AXIS );
+ case CHOBJID_DIAGRAM_TITLE_Y_AXIS:
+ return new AccTitle( pParent, Title::Y_AXIS );
+ case CHOBJID_DIAGRAM_TITLE_Z_AXIS:
+ return new AccTitle( pParent, Title::Z_AXIS );
+
+ case CHOBJID_DIAGRAM:
+ return new AccDiagram( pParent );
+
+ // series
+ case CHOBJID_DIAGRAM_ROWGROUP:
+ return new AccDataSeries( pParent, rId.GetIndex1() );
+
+ // data points
+ case CHOBJID_DIAGRAM_DATA:
+ return new AccDataPoint( pParent, rId.GetIndex1(), rId.GetIndex2() );
+
+ case Axis::X_AXIS:
+ case Axis::Y_AXIS:
+ case Axis::Z_AXIS:
+ case Axis::SEC_X_AXIS:
+ case Axis::SEC_Y_AXIS:
+ return new AccAxis( pParent, static_cast< Axis::AxisType >( nObjId ) );
+
+ case Grid::X_MAJOR:
+ case Grid::Y_MAJOR:
+ case Grid::Z_MAJOR:
+ case Grid::X_MINOR:
+ case Grid::Y_MINOR:
+ case Grid::Z_MINOR:
+ return new AccGrid( pParent, static_cast< AccGrid::GridType >( nObjId ) );
+
+ case AccStatisticsObject::MEAN_VAL_LINE:
+ case AccStatisticsObject::ERROR_BARS:
+ case AccStatisticsObject::REGRESSION:
+ return new AccStatisticsObject( pParent,
+ static_cast< AccStatisticsObject::StatisticsObjectType >( nObjId ),
+ rId.GetIndex1() );
+
+ case CHOBJID_DIAGRAM_WALL:
+ return new AccWall( pParent );
+
+ case CHOBJID_DIAGRAM_FLOOR:
+ return new AccFloor( pParent );
+
+ case CHOBJID_DIAGRAM_AREA:
+ return new AccArea( pParent );
+ }
+ */
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.hxx b/chart2/source/controller/accessibility/ChartElementFactory.hxx
new file mode 100644
index 000000000000..399ba93c1b55
--- /dev/null
+++ b/chart2/source/controller/accessibility/ChartElementFactory.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACC_ELEMENTFACTORY_HXX_
+#define _CHART2_ACC_ELEMENTFACTORY_HXX_
+
+#include "AccessibleBase.hxx"
+
+namespace chart
+{
+
+class AccessibleBase;
+
+class ChartElementFactory
+{
+public:
+ /** @return a newly created object (using the new operator) that corresponds
+ to the given unique id
+ */
+ static AccessibleBase* CreateChartElement( const AccessibleElementInfo& rAccInfo );
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/makefile.mk b/chart2/source/controller/accessibility/makefile.mk
new file mode 100644
index 000000000000..44c816d90d0e
--- /dev/null
+++ b/chart2/source/controller/accessibility/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcaccessibility
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= $(SLO)$/AccessibleChartView.obj \
+ $(SLO)$/ChartElementFactory.obj \
+ $(SLO)$/AccessibleBase.obj \
+ $(SLO)$/AccessibleChartElement.obj \
+ $(SLO)$/AccessibleChartShape.obj \
+ $(SLO)$/AccessibleTextHelper.obj \
+ $(SLO)$/AccessibleViewForwarder.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
new file mode 100644
index 000000000000..2e1636b4406b
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AreaWrapper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+#include <algorithm>
+
+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;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Area" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+AreaWrapper::AreaWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+AreaWrapper::~AreaWrapper()
+{}
+
+// ____ XShape ____
+awt::Point SAL_CALL AreaWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return awt::Point(0,0);
+}
+
+void SAL_CALL AreaWrapper::setPosition( const awt::Point& /*aPosition*/ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set position of chart area" );
+}
+
+awt::Size SAL_CALL AreaWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+void SAL_CALL AreaWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of chart area" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+::rtl::OUString SAL_CALL AreaWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartArea" );
+}
+
+// ____ XComponent ____
+void SAL_CALL AreaWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL AreaWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL AreaWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() )
+ return xChartDoc->getPageBackground();
+ OSL_ENSURE(false,"AreaWrapper::getInnerPropertySet() is NULL");
+ return 0;
+}
+
+const Sequence< beans::Property >& AreaWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > AreaWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("LineStyle"), C2U("LineStyle") ) );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< ::rtl::OUString > AreaWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AreaWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
new file mode 100644
index 000000000000..ec888d6f8f8d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AREAWRAPPER_HXX
+#define CHART_AREAWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class AreaWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ AreaWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~AreaWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_AREAWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
new file mode 100644
index 000000000000..6d53fb8b01f6
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -0,0 +1,596 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "AxisWrapper.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include "WrappedGapwidthProperty.hxx"
+#include "WrappedScaleProperty.hxx"
+#include "WrappedDefaultProperty.hxx"
+#include "WrappedNumberFormatProperty.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Axis" ));
+
+enum
+{
+ PROP_AXIS_MAX,
+ PROP_AXIS_MIN,
+ PROP_AXIS_STEPMAIN,
+ PROP_AXIS_STEPHELP, //deprecated property use 'StepHelpCount' instead
+ PROP_AXIS_STEPHELP_COUNT,
+ PROP_AXIS_AUTO_MAX,
+ PROP_AXIS_AUTO_MIN,
+ PROP_AXIS_AUTO_STEPMAIN,
+ PROP_AXIS_AUTO_STEPHELP,
+ PROP_AXIS_LOGARITHMIC,
+ PROP_AXIS_REVERSEDIRECTION,
+ PROP_AXIS_VISIBLE,
+ PROP_AXIS_CROSSOVER_POSITION,
+ PROP_AXIS_CROSSOVER_VALUE,
+ PROP_AXIS_ORIGIN,
+ PROP_AXIS_AUTO_ORIGIN,
+ PROP_AXIS_MARKS,
+ PROP_AXIS_HELPMARKS,
+ PROP_AXIS_MARK_POSITION,
+ PROP_AXIS_DISPLAY_LABELS,
+ PROP_AXIS_NUMBERFORMAT,
+ PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+ PROP_AXIS_LABEL_POSITION,
+ PROP_AXIS_TEXT_ROTATION,
+ PROP_AXIS_ARRANGE_ORDER,
+ PROP_AXIS_TEXTBREAK,
+ PROP_AXIS_CAN_OVERLAP,
+ PROP_AXIS_STACKEDTEXT,
+ PROP_AXIS_OVERLAP,
+ PROP_AXIS_GAP_WIDTH
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ //Properties for scaling:
+ rOutProperties.push_back(
+ Property( C2U( "Max" ),
+ PROP_AXIS_MAX,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Min" ),
+ PROP_AXIS_MIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StepMain" ),
+ PROP_AXIS_STEPMAIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StepHelpCount" ),
+ PROP_AXIS_STEPHELP_COUNT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //deprecated property use 'StepHelpCount' instead
+ rOutProperties.push_back(
+ Property( C2U( "StepHelp" ),
+ PROP_AXIS_STEPHELP,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoMax" ),
+ PROP_AXIS_AUTO_MAX,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoMin" ),
+ PROP_AXIS_AUTO_MIN,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoStepMain" ),
+ PROP_AXIS_AUTO_STEPMAIN,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoStepHelp" ),
+ PROP_AXIS_AUTO_STEPHELP,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Logarithmic" ),
+ PROP_AXIS_LOGARITHMIC,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReverseDirection" ),
+ PROP_AXIS_REVERSEDIRECTION,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //todo: this property is missing in the API
+ rOutProperties.push_back(
+ Property( C2U( "Visible" ),
+ PROP_AXIS_VISIBLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverPosition" ),
+ PROP_AXIS_CROSSOVER_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverValue" ),
+ PROP_AXIS_CROSSOVER_VALUE,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+
+ rOutProperties.push_back(
+ Property( C2U( "Origin" ),
+ PROP_AXIS_ORIGIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoOrigin" ),
+ PROP_AXIS_AUTO_ORIGIN,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //Properties for interval marks:
+ rOutProperties.push_back(
+ Property( C2U( "Marks" ),
+ PROP_AXIS_MARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "HelpMarks" ),
+ PROP_AXIS_HELPMARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MarkPosition" ),
+ PROP_AXIS_MARK_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ //Properties for labels:
+ rOutProperties.push_back(
+ Property( C2U( "DisplayLabels" ),
+ PROP_AXIS_DISPLAY_LABELS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_AXIS_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPosition" ),
+ PROP_AXIS_LABEL_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_AXIS_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ArrangeOrder" ),
+ PROP_AXIS_ARRANGE_ORDER,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisArrangeOrderType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextBreak" ),
+ PROP_AXIS_TEXTBREAK,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextCanOverlap" ),
+ PROP_AXIS_CAN_OVERLAP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StackedText" ),
+ PROP_AXIS_STACKEDTEXT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // Properties related to bar charts:
+ rOutProperties.push_back(
+ Property( C2U( "Overlap" ),
+ PROP_AXIS_OVERLAP,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GapWidth" ),
+ PROP_AXIS_GAP_WIDTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+AxisWrapper::AxisWrapper(
+ tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eType( eType )
+{
+}
+
+AxisWrapper::~AxisWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL AxisWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ awt::Point aResult( m_spChart2ModelContact->GetAxisPosition( this->getAxis() ) );
+ return aResult;
+}
+
+void SAL_CALL AxisWrapper::setPosition( const awt::Point& /*aPosition*/ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set position of Axis" );
+}
+
+awt::Size SAL_CALL AxisWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize( m_spChart2ModelContact->GetAxisSize( this->getAxis() ) );
+ return aSize;
+}
+
+void SAL_CALL AxisWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of Axis" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL AxisWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartAxis" );
+}
+
+// ____ XNumberFormatsSupplier ____
+uno::Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getNumberFormatSettings()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
+ if( xNumSuppl.is() )
+ return xNumSuppl->getNumberFormatSettings();
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
+ if( xNumSuppl.is() )
+ return xNumSuppl->getNumberFormats();
+
+ return uno::Reference< util::XNumberFormats >();
+}
+
+// static
+void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis )
+{
+ switch( eType )
+ {
+ case X_AXIS:
+ rnDimensionIndex = 0; rbMainAxis = sal_True; break;
+ case Y_AXIS:
+ rnDimensionIndex = 1; rbMainAxis = sal_True; break;
+ case Z_AXIS:
+ rnDimensionIndex = 2; rbMainAxis = sal_True; break;
+ case SECOND_X_AXIS:
+ rnDimensionIndex = 0; rbMainAxis = sal_False; break;
+ case SECOND_Y_AXIS:
+ rnDimensionIndex = 1; rbMainAxis = sal_False; break;
+ }
+}
+
+// ____ XComponent ____
+void SAL_CALL AxisWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL AxisWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL AxisWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void AxisWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any AxisWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+ return aRet;
+}
+awt::Size AxisWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+Reference< chart2::XAxis > AxisWrapper::getAxis()
+{
+ Reference< chart2::XAxis > xAxis;
+ try
+ {
+ sal_Int32 nDimensionIndex = 0;
+ sal_Bool bMainAxis = sal_True;
+ AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
+
+ Reference< XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ 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( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xAxis;
+}
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( this->getAxis(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "Marks" ), C2U( "MajorTickmarks" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "HelpMarks" ), C2U( "MinorTickmarks" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "TextCanOverlap" ), C2U( "TextOverlap" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "ArrangeOrder" ), C2U( "ArrangeOrder" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "Visible" ), C2U( "Show" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "DisplayLabels" ), C2U( "DisplayLabels" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "TextBreak" ), C2U( "TextBreak" ) ) );
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedText" ), C2U( "StackCharacters" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "CrossoverPosition" ), C2U( "CrossoverPosition" ) ) );
+ {
+ WrappedGapwidthProperty* pWrappedGapwidthProperty( new WrappedGapwidthProperty( m_spChart2ModelContact ) );
+ WrappedBarOverlapProperty* pWrappedBarOverlapProperty( new WrappedBarOverlapProperty( m_spChart2ModelContact ) );
+ sal_Int32 nDimensionIndex = 0;
+ sal_Bool bMainAxis = sal_True;
+ sal_Int32 nAxisIndex = 0;
+ AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
+ if( !bMainAxis )
+ nAxisIndex = 1;
+ pWrappedGapwidthProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
+ pWrappedBarOverlapProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
+ aWrappedProperties.push_back( pWrappedGapwidthProperty );
+ aWrappedProperties.push_back( pWrappedBarOverlapProperty );
+ }
+
+ WrappedScaleProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > AxisWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartAxis" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 4 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AxisWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
new file mode 100644
index 000000000000..86bd52367bbe
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AXISWRAPPER_HXX
+#define CHART_AXISWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class AxisWrapper : public ::cppu::ImplInheritanceHelper4<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ , com::sun::star::util::XNumberFormatsSupplier
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ enum tAxisType
+ {
+ X_AXIS,
+ Y_AXIS,
+ Z_AXIS,
+ SECOND_X_AXIS,
+ SECOND_Y_AXIS
+ };
+
+ AxisWrapper( tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~AxisWrapper();
+
+ static void getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis );
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XNumberFormatsSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getNumberFormatSettings()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormats > SAL_CALL getNumberFormats()
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private: //methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > getAxis();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ tAxisType m_eType;
+ ::com::sun::star::uno::Any m_aTemporaryHelpStepValue;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_AXISWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
new file mode 100644
index 000000000000..1b0d8fb4889c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "Chart2ModelContact.hxx"
+#include "ChartModelHelper.hxx"
+#include "LegendHelper.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "ObjectIdentifier.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+namespace wrapper
+{
+
+Chart2ModelContact::Chart2ModelContact(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext ),
+ m_xChartModel( 0 ),
+ m_xChartView(0)
+{
+}
+
+Chart2ModelContact::~Chart2ModelContact()
+{
+ this->clear();
+}
+
+void Chart2ModelContact::setModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel )
+{
+ this->clear();
+ m_xChartModel = xChartModel;
+ uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartModel, uno::UNO_QUERY );
+ if( xTableFactory.is() )
+ {
+ uno::Reference< container::XNameContainer > xDashTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.DashTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xGradientTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xHatchTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.HatchTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xBitmapTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.BitmapTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xTransparencyGradientTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.TransparencyGradientTable" ) ), uno::UNO_QUERY );
+ //C2U( "com.sun.star.drawing.MarkerTable" )
+ m_aTableMap[ C2U( "LineDashName" ) ] = xDashTable;
+ m_aTableMap[ C2U( "FillGradientName" ) ] = xGradientTable;
+ m_aTableMap[ C2U( "FillHatchName" ) ] = xHatchTable;
+ m_aTableMap[ C2U( "FillBitmapName" ) ] = xBitmapTable;
+ m_aTableMap[ C2U( "FillTransparenceGradientName" ) ] = xTransparencyGradientTable;
+ }
+}
+
+void Chart2ModelContact::clear()
+{
+ m_xChartModel = uno::WeakReference< frame::XModel >(0);
+ m_xChartView.clear();
+}
+
+Reference< frame::XModel > Chart2ModelContact::getChartModel() const
+{
+ return Reference< frame::XModel >( m_xChartModel.get(), uno::UNO_QUERY );
+}
+
+Reference< chart2::XChartDocument > Chart2ModelContact::getChart2Document() const
+{
+ return Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY );
+}
+
+Reference< chart2::XDiagram > Chart2ModelContact::getChart2Diagram() const
+{
+ return ChartModelHelper::findDiagram( this->getChartModel() );
+}
+
+uno::Reference< lang::XUnoTunnel > 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 = Reference< lang::XUnoTunnel >( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ }
+ return m_xChartView;
+}
+
+ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const
+{
+ getChartView();
+ if(!m_xChartView.is())
+ return 0;
+
+ //obtain the ExplicitValueProvider from the chart view
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(m_xChartView->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ return pProvider;
+}
+
+uno::Reference< drawing::XDrawPage > Chart2ModelContact::getDrawPage()
+{
+ uno::Reference< drawing::XDrawPage > xResult;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ xResult.set( pProvider->getDrawModelWrapper()->getMainDrawPage() );
+ }
+ return xResult;
+}
+
+sal_Bool Chart2ModelContact::getExplicitValuesForAxis(
+ const Reference< XAxis > & xAxis,
+ ExplicitScaleData & rOutExplicitScale,
+ ExplicitIncrementData & rOutExplicitIncrement )
+{
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ return pProvider->getExplicitValuesForAxis(
+ xAxis, rOutExplicitScale, rOutExplicitIncrement );
+ }
+ return sal_False;
+}
+
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis )
+{
+ Reference< chart2::XCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis(
+ xAxis, ChartModelHelper::findDiagram( m_xChartModel ) ) );
+
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( xAxis, xCooSys
+ , Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
+}
+
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
+ const Reference< chart2::XDataSeries >& xSeries )
+{
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ),
+ xSeries,
+ -1 /*-1 for whole series*/,
+ ChartModelHelper::findDiagram( m_xChartModel )
+ );
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Size Chart2ModelContact::GetPageSize() const
+{
+ return ChartModelHelper::getPageSize(m_xChartModel);
+}
+
+awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const awt::Rectangle& rPositionRect )
+{
+ awt::Rectangle aRect = ExplicitValueProvider::substractAxisTitleSizes(
+ m_xChartModel, getChartView(), rPositionRect );
+ return aRect;
+}
+
+awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingTitle() const
+{
+ awt::Rectangle aRect( GetDiagramRectangleIncludingAxes() );
+
+ //add axis title sizes to the diagram size
+ aRect = ExplicitValueProvider::addAxisTitleSizes(
+ m_xChartModel, getChartView(), aRect );
+
+ return aRect;
+}
+
+awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingAxes() const
+{
+ awt::Rectangle aRect(0,0,0,0);
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+
+ if( DiagramPositioningMode_INCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram ) )
+ aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel);
+ else
+ {
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ aRect = pProvider->getRectangleOfObject( C2U("PlotAreaIncludingAxes") );
+ }
+ return aRect;
+}
+
+awt::Rectangle Chart2ModelContact::GetDiagramRectangleExcludingAxes() const
+{
+ awt::Rectangle aRect(0,0,0,0);
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+
+ if( DiagramPositioningMode_EXCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram ) )
+ aRect = DiagramHelper::getDiagramRectangleFromModel(m_xChartModel);
+ else
+ {
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ aRect = pProvider->getDiagramRectangleExcludingAxes();
+ }
+ return aRect;
+}
+
+awt::Size Chart2ModelContact::GetLegendSize() const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetLegendPosition() const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+awt::Size Chart2ModelContact::GetTitleSize( const uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xTitle.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetTitlePosition( const uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xTitle.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+awt::Size Chart2ModelContact::GetAxisSize( const uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xAxis.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetAxisPosition( const uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xAxis.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
new file mode 100644
index 000000000000..e20167e216c2
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHART2MODELCONTACT_HXX
+#define CHART_CHART2MODELCONTACT_HXX
+
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <map>
+
+namespace chart
+{
+class ExplicitValueProvider;
+
+namespace wrapper
+{
+
+class Chart2ModelContact
+{
+public:
+ Chart2ModelContact( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~Chart2ModelContact();
+
+public:
+ void setModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ void clear();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > getChartModel() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > getChart2Document() const;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > getChart2Diagram() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getDrawPage();
+
+ /** get the current values calculated for an axis in the current view in
+ case properties are 'auto'.
+ */
+ sal_Bool getExplicitValuesForAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis,
+ ::com::sun::star::chart2::ExplicitScaleData & rOutExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData & rOutExplicitIncrement );
+
+ sal_Int32 getExplicitNumberFormatKeyForAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+
+ sal_Int32 getExplicitNumberFormatKeyForSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+ /** Returns the size of the page in logic coordinates. This value is used
+ for setting an appropriate "ReferencePageSize" for FontHeights.
+ */
+ ::com::sun::star::awt::Size GetPageSize() const;
+
+ /** calculates the current axes title sizes and substract that space them from the given recangle
+ */
+ ::com::sun::star::awt::Rectangle SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle& rPositionRect );
+
+ /** Returns the position and size of the diagram in logic coordinates (100th mm) including
+ the space used for axes including axes titles.
+ */
+ ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingTitle() const;
+
+ /** Returns the position and size of the diagram in logic coordinates (100th mm) including
+ the space used for axes excluding axes titles.
+ */
+ ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingAxes() const;
+
+ /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
+ the space used for axes (inner plot area).
+ */
+ ::com::sun::star::awt::Rectangle GetDiagramRectangleExcludingAxes() const;
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetLegendSize() const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetLegendPosition() const;
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetTitleSize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetTitlePosition( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const;
+
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetAxisSize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetAxisPosition( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const;
+
+private: //methods
+ ExplicitValueProvider* getExplicitValueProvider() const;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel > getChartView() const;
+
+public: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+private: //member
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+
+ mutable ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel > m_xChartView;
+
+ typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > > tTableMap;//GradientTable, HatchTable etc.
+ tTableMap m_aTableMap;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHART2MODELCONTACT_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
new file mode 100644
index 000000000000..062dcc1a129d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -0,0 +1,633 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartDataWrapper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ChartModelHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "Chart2ModelContact.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+
+#include <map>
+#include <algorithm>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+using ::com::sun::star::chart::XComplexDescriptionAccess;
+using ::com::sun::star::chart::XChartData;
+using ::com::sun::star::chart::XChartDataArray;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartData" ));
+
+uno::Sequence< uno::Sequence< double > > lcl_getNANInsteadDBL_MIN( const uno::Sequence< uno::Sequence< double > >& rData )
+{
+ uno::Sequence< uno::Sequence< double > > aRet;
+ const sal_Int32 nOuterSize = rData.getLength();
+ aRet.realloc( nOuterSize );
+ for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
+ {
+ sal_Int32 nInnerSize = rData[nOuter].getLength();
+ aRet[nOuter].realloc( nInnerSize );
+ for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
+ {
+ aRet[nOuter][nInner] = rData[nOuter][nInner];
+ double& rValue = aRet[nOuter][nInner];
+ if( rValue == DBL_MIN )
+ ::rtl::math::setNan( &rValue );
+ }
+ }
+ return aRet;
+}
+
+uno::Sequence< uno::Sequence< double > > lcl_getDBL_MINInsteadNAN( const uno::Sequence< uno::Sequence< double > >& rData )
+{
+ uno::Sequence< uno::Sequence< double > > aRet;
+ const sal_Int32 nOuterSize = rData.getLength();
+ aRet.realloc( nOuterSize );
+ for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
+ {
+ sal_Int32 nInnerSize = rData[nOuter].getLength();
+ aRet[nOuter].realloc( nInnerSize );
+ for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
+ {
+ aRet[nOuter][nInner] = rData[nOuter][nInner];
+ double& rValue = aRet[nOuter][nInner];
+ if( ::rtl::math::isNan( rValue ) )
+ rValue = DBL_MIN;
+ }
+ }
+ return aRet;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+//--------------------------------------------------------------------------------------
+
+struct lcl_Operator
+{
+ lcl_Operator()
+ {
+ }
+ virtual ~lcl_Operator()
+ {
+ }
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) = 0;
+
+ virtual bool setsCategories( bool /*bDataInColumns*/ )
+ {
+ return false;
+ }
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_AllOperator : public lcl_Operator
+{
+ lcl_AllOperator( const Reference< XChartData >& xDataToApply )
+ : lcl_Operator()
+ , m_xDataToApply( xDataToApply )
+ {
+ }
+
+ virtual bool setsCategories( bool /*bDataInColumns*/ )
+ {
+ return true;
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( !xDataAccess.is() )
+ return;
+
+ Reference< XComplexDescriptionAccess > xNewComplex( m_xDataToApply, uno::UNO_QUERY );
+ if( xNewComplex.is() )
+ {
+ xDataAccess->setData( xNewComplex->getData() );
+ xDataAccess->setComplexRowDescriptions( xNewComplex->getComplexRowDescriptions() );
+ xDataAccess->setComplexColumnDescriptions( xNewComplex->getComplexColumnDescriptions() );
+ }
+ else
+ {
+ Reference< XChartDataArray > xNew( m_xDataToApply, uno::UNO_QUERY );
+ if( xNew.is() )
+ {
+ xDataAccess->setData( xNew->getData() );
+ xDataAccess->setRowDescriptions( xNew->getRowDescriptions() );
+ xDataAccess->setColumnDescriptions( xNew->getColumnDescriptions() );
+ }
+ }
+ }
+
+ Reference< XChartData > m_xDataToApply;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_DataOperator : public lcl_Operator
+{
+ lcl_DataOperator( const Sequence< Sequence< double > >& rData )
+ : lcl_Operator()
+ , m_rData( rData )
+ {
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setData( lcl_getNANInsteadDBL_MIN( m_rData ) );
+ }
+
+ const Sequence< Sequence< double > >& m_rData;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_RowDescriptionsOperator : public lcl_Operator
+{
+ lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions )
+ : lcl_Operator()
+ , m_rRowDescriptions( rRowDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setRowDescriptions( m_rRowDescriptions );
+ }
+
+ const Sequence< OUString >& m_rRowDescriptions;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator
+{
+ lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions )
+ : lcl_Operator()
+ , m_rComplexRowDescriptions( rComplexRowDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return !bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setComplexRowDescriptions( m_rComplexRowDescriptions );
+ }
+
+ const Sequence< Sequence< OUString > >& m_rComplexRowDescriptions;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_ColumnDescriptionsOperator : public lcl_Operator
+{
+ lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions )
+ : lcl_Operator()
+ , m_rColumnDescriptions( rColumnDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return !bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setColumnDescriptions( m_rColumnDescriptions );
+ }
+
+ const Sequence< OUString >& m_rColumnDescriptions;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator
+{
+ lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions )
+ : lcl_Operator()
+ , m_rComplexColumnDescriptions( rComplexColumnDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return !bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setComplexColumnDescriptions( m_rComplexColumnDescriptions );
+ }
+
+ const Sequence< Sequence< OUString > >& m_rComplexColumnDescriptions;
+};
+
+//--------------------------------------------------------------------------
+
+ChartDataWrapper::ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ initDataAccess();
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+ChartDataWrapper::ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ const Reference< XChartData >& xNewData ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ lcl_AllOperator aOperator( xNewData );
+ applyData( aOperator );
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+ChartDataWrapper::~ChartDataWrapper()
+{
+ // @todo: implement XComponent and call this in dispose(). In the DTOR the
+ // ref-count is 0, thus creating a stack reference to this calls the DTOR at
+ // the end of the block recursively
+// uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+// m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+}
+
+// ____ XChartDataArray (read)____
+Sequence< Sequence< double > > SAL_CALL ChartDataWrapper::getData()
+ throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return lcl_getDBL_MINInsteadNAN( m_xDataAccess->getData() );
+ return Sequence< Sequence< double > >();
+}
+Sequence< OUString > SAL_CALL ChartDataWrapper::getRowDescriptions()
+ throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getRowDescriptions();
+ return Sequence< OUString >();
+}
+Sequence< OUString > SAL_CALL ChartDataWrapper::getColumnDescriptions()
+ throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getColumnDescriptions();
+ return Sequence< OUString > ();
+}
+// ____ XComplexDescriptionAccess (read) ____
+Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexRowDescriptions() throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getComplexRowDescriptions();
+ return Sequence< Sequence< OUString > >();
+}
+Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexColumnDescriptions() throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getComplexColumnDescriptions();
+ return Sequence< Sequence< OUString > >();
+}
+
+// ____ XChartDataArray (write)____
+void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& rData )
+ throw (uno::RuntimeException)
+{
+ lcl_DataOperator aOperator( rData );
+ applyData( aOperator );
+}
+void SAL_CALL ChartDataWrapper::setRowDescriptions( const Sequence< OUString >& rRowDescriptions )
+ throw (uno::RuntimeException)
+{
+ lcl_RowDescriptionsOperator aOperator( rRowDescriptions );
+ applyData( aOperator );
+}
+void SAL_CALL ChartDataWrapper::setColumnDescriptions( const Sequence< OUString >& rColumnDescriptions )
+ throw (uno::RuntimeException)
+{
+ lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions );
+ applyData( aOperator );
+}
+
+// ____ XComplexDescriptionAccess (write) ____
+void SAL_CALL ChartDataWrapper::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rRowDescriptions ) throw (uno::RuntimeException)
+{
+ lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions );
+ applyData( aOperator );
+}
+void SAL_CALL ChartDataWrapper::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rColumnDescriptions ) throw (uno::RuntimeException)
+{
+ lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions );
+ applyData( aOperator );
+}
+
+//--------------------------------------------------------------------------------------
+
+// ____ XChartData (base of XChartDataArray) ____
+void SAL_CALL ChartDataWrapper::addChartDataChangeEventListener(
+ const uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( aListener );
+}
+
+void SAL_CALL ChartDataWrapper::removeChartDataChangeEventListener(
+ const uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+double SAL_CALL ChartDataWrapper::getNotANumber()
+ throw (uno::RuntimeException)
+{
+ return DBL_MIN;
+}
+
+sal_Bool SAL_CALL ChartDataWrapper::isNotANumber( double nNumber )
+ throw (uno::RuntimeException)
+{
+ return DBL_MIN == nNumber
+ || ::rtl::math::isNan( nNumber )
+ || ::rtl::math::isInf( nNumber );
+}
+
+// ____ XComponent ____
+void SAL_CALL ChartDataWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
+ m_xDataAccess=0;
+}
+
+void SAL_CALL ChartDataWrapper::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL ChartDataWrapper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+void SAL_CALL ChartDataWrapper::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+}
+
+// ::com::sun::star::chart::ChartDataChangeEvent aEvent;
+// aEvent.Type = chart::ChartDataChangeType_ALL;
+// aEvent.StartColumn = 0;
+// aEvent.EndColumn = 0;
+// aEvent.StartRow = 0;
+// aEvent.EndRow = 0;
+void ChartDataWrapper::fireChartDataChangeEvent(
+ ::com::sun::star::chart::ChartDataChangeEvent& aEvent )
+{
+ if( ! m_aEventListenerContainer.getLength() )
+ return;
+
+ uno::Reference< uno::XInterface > xSrc( static_cast< cppu::OWeakObject* >( this ));
+ OSL_ASSERT( xSrc.is());
+ if( xSrc.is() )
+ aEvent.Source = xSrc;
+
+ ::cppu::OInterfaceIteratorHelper aIter( m_aEventListenerContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ if( xListener.is() )
+ xListener->chartDataChanged( aEvent );
+ }
+}
+
+// --------------------------------------------------------------------------------
+
+void ChartDataWrapper::switchToInternalDataProvider()
+{
+ //create an internal data provider that is connected to the model
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() )
+ xChartDoc->createInternalDataProvider( true /*bCloneExistingData*/ );
+ initDataAccess();
+}
+
+void ChartDataWrapper::initDataAccess()
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return;
+ if( xChartDoc->hasInternalDataProvider() )
+ m_xDataAccess = Reference< XComplexDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
+ else
+ {
+ //create a separate "internal data provider" that is not connected to the model
+ m_xDataAccess = Reference< XComplexDescriptionAccess >( ChartModelHelper::createInternalDataProvider(
+ xChartDoc, false /*bConnectToModel*/ ), uno::UNO_QUERY_THROW );
+ }
+}
+
+void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
+{
+ //bool bSetValues, bool bSetRowDescriptions, bool bSetColumnDescriptions
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return;
+
+ // remember some diagram properties to reset later
+ sal_Bool bStacked = sal_False;
+ sal_Bool bPercent = sal_False;
+ sal_Bool bDeep = sal_False;
+ uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartDoc, uno::UNO_QUERY );
+ OSL_ASSERT( xOldDoc.is());
+ uno::Reference< beans::XPropertySet > xDiaProp( xOldDoc->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProp.is())
+ {
+ xDiaProp->getPropertyValue( C2U("Stacked")) >>= bStacked;
+ xDiaProp->getPropertyValue( C2U("Percent")) >>= bPercent;
+ xDiaProp->getPropertyValue( C2U("Deep")) >>= bDeep;
+ }
+
+ //detect arguments for the new data source
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ DataSourceHelper::detectRangeSegmentation(
+ uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ),
+ aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
+
+ if( !bHasCategories && rDataOperator.setsCategories( bUseColumns ) )
+ bHasCategories = true;
+
+ aRangeString = C2U("all");
+ uno::Sequence< beans::PropertyValue > aArguments( DataSourceHelper::createArguments(
+ aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories ) );
+
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+
+ // create and attach new data source
+ switchToInternalDataProvider();
+ rDataOperator.apply(m_xDataAccess);
+ uno::Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+ OSL_ASSERT( xDataProvider.is() );
+ if( !xDataProvider.is() )
+ return;
+ uno::Reference< chart2::data::XDataSource > xSource( xDataProvider->createDataSource( aArguments ) );
+
+ // determine a template
+ uno::Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDia, xFact );
+ ::rtl::OUString aServiceName( aTemplateAndService.second );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first;
+
+ // (fall-back)
+ if( ! xTemplate.is())
+ {
+ if( aServiceName.getLength() == 0 )
+ aServiceName = C2U("com.sun.star.chart2.template.Column");
+ xTemplate.set( xFact->createInstance( aServiceName ), uno::UNO_QUERY );
+ }
+ OSL_ASSERT( xTemplate.is());
+
+ if( xTemplate.is() && xSource.is())
+ {
+ // argument detection works with internal knowledge of the
+ // ArrayDataProvider
+ OSL_ASSERT( xDia.is());
+ xTemplate->changeDiagramData( xDia, xSource, aArguments );
+ }
+
+ //correct stacking mode
+ if( bStacked || bPercent || bDeep )
+ {
+ StackMode eStackMode = StackMode_Y_STACKED;
+ if( bDeep )
+ eStackMode = StackMode_Z_STACKED;
+ else if( bPercent )
+ eStackMode = StackMode_Y_STACKED_PERCENT;
+ DiagramHelper::setStackMode( xDia, eStackMode );
+ }
+
+ // notify listeners
+ ::com::sun::star::chart::ChartDataChangeEvent aEvent(
+ static_cast< ::cppu::OWeakObject* >( this ),
+ ::com::sun::star::chart::ChartDataChangeType_ALL, 0, 0, 0, 0 );
+ fireChartDataChangeEvent( aEvent );
+ // \-- locked controllers
+}
+
+// --------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > ChartDataWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDataArray" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart.ChartData" );
+
+ return aServices;
+}
+
+// ================================================================================
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartDataWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
new file mode 100644
index 000000000000..d56397953d79
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTDATAWRAPPER_HXX
+#define CHART_CHARTDATAWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class Chart2ModelContact;
+struct lcl_Operator;
+
+class ChartDataWrapper : public MutexContainer, public
+ ::cppu::WeakImplHelper4<
+ com::sun::star::chart::XComplexDescriptionAccess,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::lang::XEventListener,
+ com::sun::star::lang::XComponent >
+{
+public:
+ ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData >& xNewData );
+ virtual ~ChartDataWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XComplexDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexRowDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexColumnDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ double > > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ double > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getRowDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getColumnDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartData (base of XChartDataArray) ____
+ virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isNotANumber( double nNumber )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener ____
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ void fireChartDataChangeEvent( ::com::sun::star::chart::ChartDataChangeEvent& aEvent );
+
+private: //methods
+ void switchToInternalDataProvider();
+ void initDataAccess();
+ void applyData( lcl_Operator& rDataOperator );
+
+private: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XComplexDescriptionAccess > m_xDataAccess;
+
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHARTDATAWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
new file mode 100644
index 000000000000..d6487d425657
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -0,0 +1,1623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartDocumentWrapper.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "PropertyHelper.hxx"
+#include "TitleHelper.hxx"
+#include "LegendHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "DisposeHelper.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ThreeDHelper.hxx"
+
+#include "TitleWrapper.hxx"
+#include "ChartDataWrapper.hxx"
+#include "DiagramWrapper.hxx"
+#include "LegendWrapper.hxx"
+#include "AreaWrapper.hxx"
+#include "WrappedAddInProperty.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "ChartRenderer.hxx"
+#include "UndoManager.hxx"
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <comphelper/InlineContainer.hxx>
+// header for function SvxShapeCollection_NewInstance
+#include <svx/unoshcol.hxx>
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart;
+
+using ::com::sun::star::chart::XComplexDescriptionAccess;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+namespace
+{
+enum eServiceType
+{
+ SERVICE_NAME_AREA_DIAGRAM = 0,
+ SERVICE_NAME_BAR_DIAGRAM,
+ SERVICE_NAME_DONUT_DIAGRAM,
+ SERVICE_NAME_LINE_DIAGRAM,
+ SERVICE_NAME_NET_DIAGRAM,
+ SERVICE_NAME_FILLED_NET_DIAGRAM,
+ SERVICE_NAME_PIE_DIAGRAM,
+ SERVICE_NAME_STOCK_DIAGRAM,
+ SERVICE_NAME_XY_DIAGRAM,
+ SERVICE_NAME_BUBBLE_DIAGRAM,
+
+ SERVICE_NAME_DASH_TABLE,
+ SERVICE_NAME_GARDIENT_TABLE,
+ SERVICE_NAME_HATCH_TABLE,
+ SERVICE_NAME_BITMAP_TABLE,
+ SERVICE_NAME_TRANSP_GRADIENT_TABLE,
+ SERVICE_NAME_MARKER_TABLE,
+
+ SERVICE_NAME_NAMESPACE_MAP,
+ SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER,
+ SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER
+};
+
+typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap;
+typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap;
+
+tServiceNameMap & lcl_getStaticServiceNameMap()
+{
+ static tServiceNameMap aServiceNameMap(
+ tMakeServiceNameMap
+ ( C2U( "com.sun.star.chart.AreaDiagram" ), SERVICE_NAME_AREA_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BarDiagram" ), SERVICE_NAME_BAR_DIAGRAM )
+ ( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM )
+ ( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM )
+ ( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM )
+ ( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM )
+ ( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM )
+
+ ( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE )
+ ( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.HatchTable" ), SERVICE_NAME_HATCH_TABLE )
+ ( C2U( "com.sun.star.drawing.BitmapTable" ), SERVICE_NAME_BITMAP_TABLE )
+ ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ), SERVICE_NAME_TRANSP_GRADIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.MarkerTable" ), SERVICE_NAME_MARKER_TABLE )
+
+ ( C2U( "com.sun.star.xml.NamespaceMap" ), SERVICE_NAME_NAMESPACE_MAP )
+ ( C2U( "com.sun.star.document.ExportGraphicObjectResolver" ), SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER )
+ ( C2U( "com.sun.star.document.ImportGraphicObjectResolver" ), SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER )
+ );
+
+ return aServiceNameMap;
+}
+
+enum
+{
+ PROP_DOCUMENT_HAS_MAIN_TITLE,
+ PROP_DOCUMENT_HAS_SUB_TITLE,
+ PROP_DOCUMENT_HAS_LEGEND,
+ PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
+ PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
+ PROP_DOCUMENT_ADDIN,
+ PROP_DOCUMENT_BASEDIAGRAM,
+ PROP_DOCUMENT_ADDITIONAL_SHAPES,
+ PROP_DOCUMENT_UPDATE_ADDIN,
+ PROP_DOCUMENT_NULL_DATE,
+ PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
+ PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "HasMainTitle" ),
+ PROP_DOCUMENT_HAS_MAIN_TITLE,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSubTitle" ),
+ PROP_DOCUMENT_HAS_SUB_TITLE,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasLegend" ),
+ PROP_DOCUMENT_HAS_LEGEND,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // really needed?
+ rOutProperties.push_back(
+ Property( C2U( "DataSourceLabelsInFirstRow" ),
+ PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "DataSourceLabelsInFirstColumn" ),
+ PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //add-in
+ rOutProperties.push_back(
+ Property( C2U( "AddIn" ),
+ PROP_DOCUMENT_ADDIN,
+ ::getCppuType( reinterpret_cast< Reference< util::XRefreshable > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "BaseDiagram" ),
+ PROP_DOCUMENT_BASEDIAGRAM,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "AdditionalShapes" ),
+ PROP_DOCUMENT_ADDITIONAL_SHAPES,
+ ::getCppuType( reinterpret_cast< Reference< drawing::XShapes > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::READONLY ));
+ rOutProperties.push_back(
+ Property( C2U( "RefreshAddInAllowed" ),
+ PROP_DOCUMENT_UPDATE_ADDIN,
+ ::getBooleanCppuType(),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::TRANSIENT ));
+
+ // table:null-date // i99104
+ rOutProperties.push_back(
+ Property( C2U( "NullDate" ),
+ PROP_DOCUMENT_NULL_DATE,
+ ::getCppuType( static_cast< const ::com::sun::star::util::DateTime * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DisableComplexChartTypes" ),
+ PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
+ ::getBooleanCppuType(),
+ //#i112666# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ) );
+ rOutProperties.push_back(
+ Property( C2U( "DisableDataTableDialog" ),
+ PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG,
+ ::getBooleanCppuType(),
+ //#i112666# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ) );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_LABELS_IN_FIRST_ROW
+class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty
+{
+public:
+ WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataSourceLabelsInFirstRowProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataSourceLabelsInFirstRow"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataSourceLabelsInFirstRowProperty::~WrappedDataSourceLabelsInFirstRowProperty()
+{
+}
+
+void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( ! (rOuterValue >>= bLabelsInFirstRow) )
+ throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ bool bNewValue = bLabelsInFirstRow;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns && bNewValue != bFirstCellAsLabel )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
+ }
+ else if( !bUseColumns && bNewValue != bHasCategories )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
+ }
+ }
+}
+
+Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( bUseColumns )
+ bLabelsInFirstRow = bFirstCellAsLabel;
+ else
+ bLabelsInFirstRow = bHasCategories;
+
+ m_aOuterValue <<= bLabelsInFirstRow;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_True;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN
+class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty
+{
+public:
+ WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataSourceLabelsInFirstColumnProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataSourceLabelsInFirstColumn"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataSourceLabelsInFirstColumnProperty::~WrappedDataSourceLabelsInFirstColumnProperty()
+{
+}
+
+void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( ! (rOuterValue >>= bLabelsInFirstRow) )
+ throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ bool bNewValue = bLabelsInFirstRow;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns && bNewValue != bHasCategories )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
+ }
+ else if( !bUseColumns && bNewValue != bFirstCellAsLabel )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
+ }
+ }
+}
+
+Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ sal_Bool bLabelsInFirstColumn = sal_True;
+ if( bUseColumns )
+ bLabelsInFirstColumn = bHasCategories;
+ else
+ bLabelsInFirstColumn = bFirstCellAsLabel;
+
+ m_aOuterValue <<= bLabelsInFirstColumn;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_True;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_LEGEND
+class WrappedHasLegendProperty : public WrappedProperty
+{
+public:
+ WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasLegendProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasLegendProperty::WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasLegend"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasLegendProperty::~WrappedHasLegendProperty()
+{
+}
+
+void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasLegend requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
+ if(xLegend.is())
+ {
+ Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
+ sal_Bool bOldValue = sal_True;
+ Any aAOld = xLegendProp->getPropertyValue( C2U("Show") );
+ aAOld >>= bOldValue;
+ if( bOldValue != bNewValue )
+ xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( bNewValue ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ Reference< beans::XPropertySet > xLegendProp(
+ LegendHelper::getLegend( m_spChart2ModelContact->getChartModel() ), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ aRet = xLegendProp->getPropertyValue( C2U("Show"));
+ else
+ aRet <<= sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_MAIN_TITLE
+class WrappedHasMainTitleProperty : public WrappedProperty
+{
+public:
+ WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasMainTitleProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasMainTitleProperty::WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasMainTitle"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasMainTitleProperty::~WrappedHasMainTitleProperty()
+{
+}
+
+void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasMainTitle requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ TitleHelper::createTitle( TitleHelper::MAIN_TITLE, C2U("main-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ else
+ TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_SUB_TITLE
+class WrappedHasSubTitleProperty : public WrappedProperty
+{
+public:
+ WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasSubTitleProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasSubTitleProperty::WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasSubTitle"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasSubTitleProperty::~WrappedHasSubTitleProperty()
+{
+}
+
+void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasSubTitle requires value of type boolean"), 0, 0 );
+
+
+ try
+ {
+ if( bNewValue )
+ TitleHelper::createTitle( TitleHelper::SUB_TITLE, C2U("sub-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ else
+ TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+ChartDocumentWrapper::ChartDocumentWrapper(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_spChart2ModelContact( new Chart2ModelContact( xContext ) ),
+ m_bUpdateAddIn( sal_True ),
+ m_bIsDisposed( false )
+{
+}
+
+ChartDocumentWrapper::~ChartDocumentWrapper()
+{
+ stopAllComponentListening();
+}
+
+// ____ XInterface (for new interfaces) ____
+uno::Any SAL_CALL ChartDocumentWrapper::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ if( m_xDelegator.is())
+ // calls queryAggregation if the delegator doesn't know aType
+ return m_xDelegator->queryInterface( aType );
+ else
+ return queryAggregation( aType );
+}
+
+// ____ chart::XChartDocument (old API wrapper) ____
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xTitle.is() )
+ {
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact );
+ }
+ return m_xTitle;
+}
+
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSubTitle.is() )
+ {
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSubTitle;
+}
+
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getLegend()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xLegend.is())
+ {
+ m_xLegend = new LegendWrapper( m_spChart2ModelContact );
+ Reference< lang::XComponent > xComp( m_xLegend, uno::UNO_QUERY );
+ }
+
+ return m_xLegend;
+}
+
+Reference< beans::XPropertySet > SAL_CALL ChartDocumentWrapper::getArea()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xArea.is())
+ {
+ m_xArea.set( new AreaWrapper( m_spChart2ModelContact ) );
+ Reference< lang::XComponent > xComp( m_xArea, uno::UNO_QUERY );
+ }
+
+ return m_xArea;
+}
+
+Reference< XDiagram > SAL_CALL ChartDocumentWrapper::getDiagram()
+ throw (uno::RuntimeException)
+{
+ if( !m_xDiagram.is() )
+ {
+ try
+ {
+ m_xDiagram = new DiagramWrapper( m_spChart2ModelContact );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return m_xDiagram;
+}
+
+void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY );
+ if( xAddIn.is() )
+ {
+ setAddIn( xAddIn );
+ }
+ else if( xDiagram.is() && xDiagram != m_xDiagram )
+ {
+ // set new wrapped diagram at new chart. This requires the old
+ // diagram given as parameter to implement the new interface. If
+ // this is not possible throw an exception
+ Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW );
+ Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram());
+
+ try
+ {
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() )
+ {
+ // set the new diagram
+ xChartDoc->setFirstDiagram( xNewDia );
+ m_xDiagram = xDiagram;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Reference< XChartData > SAL_CALL ChartDocumentWrapper::getData()
+ throw (uno::RuntimeException)
+{
+ if( !m_xChartData.is() )
+ {
+ m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact ) );
+ }
+ //@todo: check hasInternalDataProvider also in else?
+
+ return m_xChartData;
+}
+
+void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& xNewData )
+ throw (uno::RuntimeException)
+{
+ if( !xNewData.is() )
+ return;
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact, xNewData ) );
+ // \-- locked controllers
+}
+
+// ____ XModel ____
+sal_Bool SAL_CALL ChartDocumentWrapper::attachResource(
+ const ::rtl::OUString& URL,
+ const Sequence< beans::PropertyValue >& Arguments )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->attachResource( URL, Arguments );
+ return sal_False;
+}
+
+::rtl::OUString SAL_CALL ChartDocumentWrapper::getURL()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getURL();
+ return ::rtl::OUString();
+}
+
+Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getArgs();
+ return Sequence< beans::PropertyValue >();
+}
+
+void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::XController >& Controller )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->connectController( Controller );
+}
+
+void SAL_CALL ChartDocumentWrapper::disconnectController(
+ const Reference< frame::XController >& Controller )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->disconnectController( Controller );
+}
+
+void SAL_CALL ChartDocumentWrapper::lockControllers()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->lockControllers();
+}
+
+void SAL_CALL ChartDocumentWrapper::unlockControllers()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->unlockControllers();
+}
+
+sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->hasControllersLocked();
+ return sal_False;
+}
+
+Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentController()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getCurrentController();
+ return 0;
+}
+
+void SAL_CALL ChartDocumentWrapper::setCurrentController(
+ const Reference< frame::XController >& Controller )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->setCurrentController( Controller );
+}
+
+Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getCurrentSelection();
+ return 0;
+}
+
+
+// ____ XComponent ____
+void SAL_CALL ChartDocumentWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ if( m_bIsDisposed )
+ throw lang::DisposedException(
+ C2U("ChartDocumentWrapper is disposed" ),
+ static_cast< ::cppu::OWeakObject* >( this ));
+
+ m_bIsDisposed = true;
+
+ try
+ {
+ Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY );
+ DisposeHelper::DisposeAndClear( m_xTitle );
+ DisposeHelper::DisposeAndClear( m_xSubTitle );
+ DisposeHelper::DisposeAndClear( m_xLegend );
+ DisposeHelper::DisposeAndClear( m_xChartData );
+ DisposeHelper::DisposeAndClear( m_xDiagram );
+ DisposeHelper::DisposeAndClear( m_xArea );
+ m_xChartView.set( 0 );
+ m_xShapeFactory.set( 0 );
+ m_xDelegator.set( 0 );
+
+ clearWrappedPropertySet();
+ m_spChart2ModelContact->clear();
+ impl_resetAddIn();
+
+ stopAllComponentListening();
+
+ try
+ {
+ if( xFormerDelegator.is())
+ xFormerDelegator->dispose();
+ }
+ catch( lang::DisposedException )
+ {
+ // this is ok, don't panic
+ }
+ }
+ catch( uno::Exception &ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ChartDocumentWrapper::impl_resetAddIn()
+{
+ Reference< util::XRefreshable > xAddIn( m_xAddIn );
+ m_xAddIn.set( 0 );
+
+ if( xAddIn.is() )
+ {
+ try
+ {
+ //make sure that the add-in does not hold a refernce to us anymore:
+ Reference< lang::XComponent > xComp( xAddIn, uno::UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ else
+ {
+ uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Any aParam;
+ uno::Reference< com::sun::star::chart::XChartDocument > xDoc( 0 );
+ aParam <<= xDoc;
+ uno::Sequence< uno::Any > aSeq( &aParam, 1 );
+ xInit->initialize( aSeq );
+ }
+ }
+ }
+ catch( const uno::RuntimeException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ catch( const uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void ChartDocumentWrapper::setBaseDiagram( const rtl::OUString& rBaseDiagram )
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ m_aBaseDiagram = rBaseDiagram;
+
+ uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
+ if( xDiagram.is() )
+ this->setDiagram( xDiagram );
+}
+
+rtl::OUString ChartDocumentWrapper::getBaseDiagram() const
+{
+ return m_aBaseDiagram;
+}
+
+Reference< util::XRefreshable > ChartDocumentWrapper::getAddIn() const
+{
+ return m_xAddIn;
+}
+
+void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAddIn )
+{
+ if( m_xAddIn == xAddIn )
+ return;
+
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ impl_resetAddIn();
+ m_xAddIn = xAddIn;
+ // initialize AddIn with this as chart document
+ uno::Reference< lang::XInitialization > xInit( m_xAddIn, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Any aParam;
+ uno::Reference< XChartDocument > xDoc( (XChartDocument*)this, uno::UNO_QUERY );
+ aParam <<= xDoc;
+ uno::Sequence< uno::Any > aSeq( &aParam, 1 );
+ xInit->initialize( aSeq );
+ }
+}
+
+void ChartDocumentWrapper::setUpdateAddIn( sal_Bool bUpdateAddIn )
+{
+ m_bUpdateAddIn = bUpdateAddIn;
+}
+sal_Bool ChartDocumentWrapper::getUpdateAddIn() const
+{
+ return m_bUpdateAddIn;
+}
+
+Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
+{
+ // get additional non-chart shapes for XML export
+ uno::Reference< drawing::XShapes > xFoundShapes;
+ uno::Reference< drawing::XDrawPage > xDrawPage( this->impl_getDrawPage() );
+
+ uno::Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY );
+ if( !xDrawPageShapes.is() )
+ return xFoundShapes;
+
+ uno::Reference<drawing::XShapes> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
+
+ // iterate 'flat' over all top-level objects
+ // and determine all that are no chart objects
+ ::std::vector< uno::Reference< drawing::XShape > > aShapeVector;
+ sal_Int32 nSubCount = xDrawPageShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nS = 0; nS < nSubCount; nS++ )
+ {
+ if( xDrawPageShapes->getByIndex( nS ) >>= xShape )
+ {
+ if( xShape.is() && xChartRoot!=xShape )
+ aShapeVector.push_back( xShape );
+ }
+ }
+
+ if( !aShapeVector.empty() )
+ {
+ // create a shape collection
+ xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY );
+
+ DBG_ASSERT( xFoundShapes.is(), "Couldn't create a shape collection!" );
+ if( xFoundShapes.is())
+ {
+ ::std::vector< uno::Reference< drawing::XShape > >::iterator aIter;
+ for( aIter = aShapeVector.begin(); aIter != aShapeVector.end(); ++aIter )
+ xFoundShapes->add( *aIter );
+ }
+ }
+
+ return xFoundShapes;
+}
+
+void SAL_CALL ChartDocumentWrapper::addEventListener( const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->addEventListener( xListener );
+}
+
+void SAL_CALL ChartDocumentWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->removeEventListener( aListener );
+}
+
+// ____ XDrawPageSupplier ____
+uno::Reference< drawing::XDrawPage > SAL_CALL ChartDocumentWrapper::getDrawPage()
+ throw (uno::RuntimeException)
+{
+ return this->impl_getDrawPage();
+}
+
+uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() const
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->getDrawPage();
+}
+
+// ____ XMultiServiceFactory ____
+uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
+ const ::rtl::OUString& aServiceSpecifier )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xResult;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return xResult;
+
+ bool bServiceFound = false;
+ tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
+
+ tServiceNameMap::const_iterator aIt( rMap.find( aServiceSpecifier ));
+ if( aIt != rMap.end())
+ {
+ bool bCreateDiagram = false;
+ uno::Reference< lang::XMultiServiceFactory > xManagerFact(
+ xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate;
+
+ switch( (*aIt).second )
+ {
+ case SERVICE_NAME_AREA_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Area" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_BAR_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ // this is for bar and column (the latter is the default if
+ // no "Vertical=false" property was set)
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Column" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_DONUT_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Donut" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_LINE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Line" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Net" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_FILLED_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ case SERVICE_NAME_PIE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Pie" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_STOCK_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.StockLowHighClose" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_XY_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.ScatterLineSymbol" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
+ case SERVICE_NAME_BUBBLE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
+ case SERVICE_NAME_DASH_TABLE:
+ case SERVICE_NAME_GARDIENT_TABLE:
+ case SERVICE_NAME_HATCH_TABLE:
+ 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 );
+ DBG_ASSERT( 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 );
+ }
+ break;
+
+ case SERVICE_NAME_NAMESPACE_MAP:
+// xResult = svx::NamespaceMap_createInstance( aWhichIds, &m_pModel->GetPool() );
+ break;
+ case SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER:
+// xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE ));
+ break;
+ case SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER:
+// xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ ));
+ break;
+ }
+
+ if( bCreateDiagram && xTemplate.is() )
+ {
+ try
+ {
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ if( xDia.is())
+ {
+ // /-- locked controllers
+ Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY );
+ ControllerLockGuard aCtrlLockGuard( xModel );
+ Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ 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#
+ xTemplate->changeDiagram( xDiagram );
+ if( Application::GetSettings().GetLayoutRTL() )
+ AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
+ ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ // \-- locked controllers
+ }
+ else
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ xDia.set( xTemplate->createDiagramByDataSource(
+ uno::Reference< chart2::data::XDataSource >(),
+ uno::Sequence< beans::PropertyValue >()));
+ xChartDoc->setFirstDiagram( xDia );
+ // \-- locked controllers
+ }
+
+ xResult = static_cast< ::cppu::OWeakObject* >( new DiagramWrapper( m_spChart2ModelContact ));
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ) )
+ {
+ Reference< lang::XUnoTunnel > xChartRenderer( new ChartRenderer( m_spChart2ModelContact->getChartModel() ) );
+ xResult.set( xChartRenderer );
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( C2U("com.sun.star.comp.chart2.DataSeriesWrapper") ) )
+ {
+ Reference< beans::XPropertySet > xDataSeries( new DataSeriesPointWrapper( m_spChart2ModelContact ) );
+ xResult.set( xDataSeries );
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( CHART_VIEW_SERVICE_NAME ) )
+ {
+ if( !m_xChartView.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ if( xFact.is() )
+ {
+ Reference< lang::XInitialization > xViewInit( xFact->createInstance(
+ CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if(xViewInit.is())
+ {
+ try
+ {
+ m_xChartView = xViewInit;
+
+ Sequence< Any > aArguments(2);
+ Reference<frame::XModel> xModel(this);
+ aArguments[0]=uno::makeAny(xModel);
+ sal_Bool bRefreshAddIn = sal_True;
+ aArguments[1]=uno::makeAny(bRefreshAddIn);
+ xViewInit->initialize(aArguments);
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ xResult.set( m_xChartView );
+ bServiceFound = true;
+ }
+ else if ( aServiceSpecifier.equals( CHART_UNDOMANAGER_SERVICE_NAME ) )
+ {
+ Reference< chart2::XUndoManager > xUndoManager( new UndoManager() );
+ xResult.set( xUndoManager );
+ bServiceFound = true;
+ }
+ else
+ {
+ // try to create a shape
+ try
+ {
+ if( !m_xShapeFactory.is() && m_xChartView.is() )
+ {
+ Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
+ if(xUnoTunnel.is())
+ {
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ if( pProvider )
+ m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
+ }
+ }
+ if( m_xShapeFactory.is() )
+ {
+ xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
+ bServiceFound = true;
+ }
+ }
+ catch( const uno::Exception )
+ {
+ // couldn't create shape
+ }
+ }
+
+ // finally, try to create an addin
+ if( !bServiceFound )
+ {
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ if( xFact.is() )
+ {
+ uno::Reference< util::XRefreshable > xAddIn(
+ xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
+ if( xAddIn.is() )
+ {
+ xResult = xAddIn;
+ bServiceFound = true;
+ }
+ }
+ }
+ catch( const uno::Exception& ex )
+ {
+ (void)ex;
+ // couldn't create service
+ }
+ }
+
+ return xResult;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceWithArguments(
+ const ::rtl::OUString& ServiceSpecifier,
+ const uno::Sequence< uno::Any >& Arguments )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" );
+ (void)(Arguments);
+
+ return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames()
+ throw (uno::RuntimeException)
+{
+ tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
+ uno::Sequence< ::rtl::OUString > aResult( rMap.size());
+
+ ::std::transform( rMap.begin(), rMap.end(),
+ aResult.getArray(),
+ ::std::select1st< tServiceNameMap::value_type >() );
+
+ return aResult;
+
+// // shapes
+// // uno::Sequence< OUString > aDrawServices( SvxUnoDrawMSFactory::getAvailableServiceNames() );
+// // const OUString * pArr = aDrawServices.getConstArray();
+// // aServices.insert( aServices.end(), pArr, pArr + aDrawServices.getLength() );
+// }
+
+
+ // add-ins
+ // uno::Sequence< OUString > aAddIns( GetAddInCollection().GetAddInNames() );
+// pArr = aAddIns.getConstArray();
+// aServices.insert( aServices.end(), pArr, pArr + aAddIns.getLength() );
+
+// return ContainerToSequence( aServices );
+}
+
+// ____ XAggregation ____
+void SAL_CALL ChartDocumentWrapper::setDelegator(
+ const uno::Reference< uno::XInterface >& rDelegator )
+ throw (uno::RuntimeException)
+{
+ if( m_bIsDisposed )
+ {
+ if( rDelegator.is() )
+ throw lang::DisposedException(
+ C2U("ChartDocumentWrapper is disposed" ),
+ static_cast< ::cppu::OWeakObject* >( this ));
+ else
+ return;
+ }
+
+ if( rDelegator.is())
+ {
+ m_xDelegator = rDelegator;
+ m_spChart2ModelContact->setModel( uno::Reference< frame::XModel >(m_xDelegator, uno::UNO_QUERY) );
+ }
+ else
+ {
+ // this is a sort of dispose() from the new model,so release ressources here
+ try
+ {
+ this->dispose();
+ }
+ catch( uno::Exception &ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType )
+ throw (uno::RuntimeException)
+{
+ return ChartDocumentWrapper_Base::queryInterface( rType );
+}
+
+// ____ ::utl::OEventListenerAdapter ____
+void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
+{
+ if( rSource.Source == m_xTitle )
+ m_xTitle.set( 0 );
+ else if( rSource.Source == m_xSubTitle )
+ m_xSubTitle.set( 0 );
+ else if( rSource.Source == m_xLegend )
+ m_xLegend.set( 0 );
+ else if( rSource.Source == m_xChartData )
+ m_xChartData.set( 0 );
+ else if( rSource.Source == m_xDiagram )
+ m_xDiagram.set( 0 );
+ else if( rSource.Source == m_xArea )
+ m_xArea.set( 0 );
+ else if( rSource.Source == m_xAddIn )
+ m_xAddIn.set( 0 );
+ else if( rSource.Source == m_xChartView )
+ m_xChartView.set( 0 );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
+{
+ return 0;
+}
+const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+ aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstRowProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstColumnProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasLegendProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasMainTitleProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasSubTitleProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAddInProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedBaseDiagramProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U("NullDate"),Any() ) ); // i99104
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableComplexChartTypes" ), uno::makeAny( sal_False ) ) );
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableDataTableDialog" ), uno::makeAny( sal_False ) ) );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > ChartDocumentWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDocument" );
+ aServices[ 1 ] = CHART_CHARTAPIWRAPPER_SERVICE_NAME;
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartDocumentWrapper, CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
new file mode 100644
index 000000000000..d69212512ebe
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -0,0 +1,887 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "macros.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ChartTypeHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedProperty.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSeriesAreaOrLineProperty.hxx"
+#include "WrappedScaleTextProperties.hxx"
+#include "WrappedNumberFormatProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+#include <algorithm>
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartAxisAssign.hpp>
+#include <com/sun/star/chart/ChartErrorCategory.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::chart::wrapper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.DataSeries" ));
+
+enum
+{
+ //data point properties
+ PROP_SERIES_DATAPOINT_SOLIDTYPE,
+ PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
+ PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
+ PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
+ PROP_SERIES_NUMBERFORMAT,
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
+ PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
+ //other series properties
+ PROP_SERIES_ATTACHED_AXIS,
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION
+};
+
+void lcl_AddPropertiesToVector_PointProperties(
+ ::std::vector< Property > & rOutProperties )
+{
+ //service chart::Chart3DBarProperties
+ rOutProperties.push_back(
+ Property( C2U( "SolidType" ),
+ PROP_SERIES_DATAPOINT_SOLIDTYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SegmentOffset" ),
+ PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "D3DPercentDiagonal" ),
+ PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
+ ::getCppuType( reinterpret_cast< sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelSeparator" ),
+ PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_SERIES_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "PercentageNumberFormat" ),
+ PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPlacement" ),
+ PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddPropertiesToVector_SeriesOnly(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Axis" ),
+ PROP_SERIES_ATTACHED_AXIS,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
+{
+ static uno::Sequence< Property > aSeriesPropSeq;
+ static uno::Sequence< Property > aPointPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ uno::Sequence< Property >& rPropSeq =
+ (_eType == DataSeriesPointWrapper::DATA_SERIES) ? aSeriesPropSeq : aPointPropSeq;
+ if( 0 == rPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ lcl_AddPropertiesToVector_PointProperties( aProperties );
+ if( _eType == DataSeriesPointWrapper::DATA_SERIES )
+ {
+ lcl_AddPropertiesToVector_SeriesOnly( aProperties );
+ WrappedStatisticProperties::addProperties( aProperties );
+ }
+ WrappedSymbolProperties::addProperties( aProperties ); //for series and points
+ WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points
+
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ rPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return rPropSeq;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+//PROP_SERIES_ATTACHED_AXIS
+class WrappedAttachedAxisProperty : public ::chart::WrappedProperty
+{
+public:
+ WrappedAttachedAxisProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAttachedAxisProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedAttachedAxisProperty::WrappedAttachedAxisProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Axis"),rtl::OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedAttachedAxisProperty::~WrappedAttachedAxisProperty()
+{
+}
+
+Any WrappedAttachedAxisProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ return aRet;
+}
+
+Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+ bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
+ if( bAttachedToMainAxis )
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ else
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::SECONDARY_Y;
+ return aRet;
+}
+
+void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+
+ sal_Int32 nChartAxisAssign = ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ if( ! (rOuterValue >>= nChartAxisAssign) )
+ throw lang::IllegalArgumentException( C2U("Property Axis requires value of type sal_Int32"), 0, 0 );
+
+ bool bNewAttachedToMainAxis = nChartAxisAssign == ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ bool bOldAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
+
+ if( bNewAttachedToMainAxis != bOldAttachedToMainAxis)
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext, false );
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedSegmentOffsetProperty : public ::chart::WrappedProperty
+{
+public:
+ WrappedSegmentOffsetProperty();
+ virtual ~WrappedSegmentOffsetProperty();
+
+protected:
+ virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
+ virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
+};
+
+WrappedSegmentOffsetProperty::WrappedSegmentOffsetProperty() :
+ WrappedProperty( C2U( "SegmentOffset" ), C2U( "Offset" ) )
+{}
+
+WrappedSegmentOffsetProperty::~WrappedSegmentOffsetProperty()
+{}
+
+Any WrappedSegmentOffsetProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ // convert new double offset to former integer segment-offset
+ double fOffset = 0;
+ Any aResult( rInnerValue );
+
+ if( rInnerValue >>= fOffset )
+ aResult <<= static_cast< sal_Int32 >( ::rtl::math::round( fOffset * 100.0 ));
+
+ return aResult;
+}
+
+Any WrappedSegmentOffsetProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ // convert former integer segment-offset to new double offset
+ sal_Int32 nOffset = 0;
+ Any aResult( rOuterValue );
+
+ if( rOuterValue >>= nOffset )
+ aResult <<= (static_cast< double >( nOffset ) / 100.0);
+
+ return aResult;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedLineColorProperty : public WrappedSeriesAreaOrLineProperty
+{
+public:
+ WrappedLineColorProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedLineColorProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ mutable Any m_aDefaultValue;
+ mutable Any m_aOuterValue;
+};
+
+WrappedLineColorProperty::WrappedLineColorProperty(
+ DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedSeriesAreaOrLineProperty(C2U( "LineColor" ), C2U( "BorderColor" ), C2U( "Color" ), pDataSeriesPointWrapper )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aDefaultValue(uno::makeAny(sal_Int32( 0x0099ccff ))) // blue 8
+ , m_aOuterValue(m_aDefaultValue)
+{
+}
+
+WrappedLineColorProperty::~WrappedLineColorProperty()
+{
+}
+
+void WrappedLineColorProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = rOuterValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
+}
+
+void WrappedLineColorProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = m_aDefaultValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
+}
+
+Any WrappedLineColorProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && !m_pDataSeriesPointWrapper->isSupportingAreaProperties() )
+ return m_aDefaultValue;
+ else
+ return WrappedSeriesAreaOrLineProperty::getPropertyDefault( xInnerPropertyState );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedLineStyleProperty : public WrappedSeriesAreaOrLineProperty
+{
+public:
+ WrappedLineStyleProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedLineStyleProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ mutable Any m_aDefaultValue;
+ mutable Any m_aOuterValue;
+};
+
+WrappedLineStyleProperty::WrappedLineStyleProperty(
+ DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedSeriesAreaOrLineProperty(C2U( "LineStyle" ), C2U( "BorderStyle" ), C2U( "LineStyle" ), pDataSeriesPointWrapper )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aDefaultValue(uno::makeAny(drawing::LineStyle_SOLID))
+ , m_aOuterValue(m_aDefaultValue)
+{
+}
+
+WrappedLineStyleProperty::~WrappedLineStyleProperty()
+{
+}
+
+void WrappedLineStyleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aNewValue(rOuterValue);
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ {
+ m_aOuterValue = rOuterValue;
+ aNewValue = uno::makeAny(drawing::LineStyle_NONE);
+ }
+ WrappedSeriesAreaOrLineProperty::setPropertyValue( aNewValue, xInnerPropertySet );
+}
+
+void WrappedLineStyleProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = m_aDefaultValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+DataSeriesPointWrapper::DataSeriesPointWrapper(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_eType( DATA_SERIES )
+ , m_nSeriesIndexInNewAPI( -1 )
+ , m_nPointIndex( -1 )
+ , m_bLinesAllowed(sal_True)
+ , m_xDataSeries(0)
+{
+ //need initialize call afterwards
+}
+
+void SAL_CALL DataSeriesPointWrapper::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw ( uno::Exception, uno::RuntimeException)
+{
+ DBG_ASSERT(aArguments.getLength() >= 1,"need at least 1 argument to initialize the DataSeriesPointWrapper: series reference + optional datapoint index");
+
+ m_nSeriesIndexInNewAPI = -1;//ignored in this case
+ m_nPointIndex = -1;
+ if( aArguments.getLength() >= 1 )
+ {
+ aArguments[0] >>= m_xDataSeries;
+ if( aArguments.getLength() >= 2 )
+ aArguments[1] >>= m_nPointIndex;
+ }
+
+ if( !m_xDataSeries.is() )
+ throw uno::Exception(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ //todo: check upper border of point index
+
+ if( m_nPointIndex >= 0 )
+ m_eType = DATA_POINT;
+ else
+ m_eType = DATA_SERIES;
+}
+
+DataSeriesPointWrapper::DataSeriesPointWrapper( eType _eType
+ , sal_Int32 nSeriesIndexInNewAPI
+ , sal_Int32 nPointIndex //ignored for series
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_eType( _eType )
+ , m_nSeriesIndexInNewAPI( nSeriesIndexInNewAPI )
+ , m_nPointIndex( (_eType == DATA_POINT) ? nPointIndex : -1 )
+ , m_xDataSeries(0)
+{
+}
+
+DataSeriesPointWrapper::~DataSeriesPointWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL DataSeriesPointWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ m_xDataSeries.clear();
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL DataSeriesPointWrapper::addEventListener(
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL DataSeriesPointWrapper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+void SAL_CALL DataSeriesPointWrapper::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+// ================================================================================
+
+bool DataSeriesPointWrapper::isSupportingAreaProperties()
+{
+ Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+
+ return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
+}
+
+bool DataSeriesPointWrapper::isLinesForbidden()
+{
+ return !m_bLinesAllowed;
+}
+
+Reference< chart2::XDataSeries > DataSeriesPointWrapper::getDataSeries()
+{
+ Reference< chart2::XDataSeries > xSeries( m_xDataSeries );
+ if( !xSeries.is() )
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) )
+ xSeries = aSeriesList[m_nSeriesIndexInNewAPI];
+ }
+
+ return xSeries;
+}
+
+Reference< beans::XPropertySet > DataSeriesPointWrapper::getDataPointProperties()
+{
+ Reference< beans::XPropertySet > xPointProp;
+
+ Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
+
+ // may throw an IllegalArgumentException
+ if( xSeries.is() )
+ xPointProp = xSeries->getDataPointByIndex( m_nPointIndex );
+
+ return xPointProp;
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void DataSeriesPointWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any DataSeriesPointWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+ return aRet;
+}
+awt::Size DataSeriesPointWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+
+//XPropertyState
+beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
+
+ if( m_eType == DATA_SERIES )
+ aState = WrappedPropertySet::getPropertyState( rPropertyName );
+ else
+ {
+ if( rPropertyName.equals(C2U("FillColor")) )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ sal_Bool bVaryColorsByPoint = sal_False;
+ if( xSeriesProp.is() && (xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint)
+ && bVaryColorsByPoint )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else if( rPropertyName.equals(C2U("Lines"))
+ || rPropertyName.equals(C2U("SymbolType"))
+ || rPropertyName.equals(C2U("SymbolSize")) )
+ return WrappedPropertySet::getPropertyState( rPropertyName );
+
+ uno::Any aDefault( getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( getPropertyValue( rPropertyName ) );
+ if( aDefault==aValue )
+ aState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ return aState;
+}
+
+void SAL_CALL DataSeriesPointWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( m_eType == DATA_SERIES )
+ WrappedPropertySet::setPropertyToDefault( rPropertyName );
+ else
+ {
+ //for data points the default is given by the series
+ setPropertyValue( rPropertyName, getPropertyDefault( rPropertyName ) );
+ }
+}
+Any SAL_CALL DataSeriesPointWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( nHandle > 0 )
+ {
+ //always take the series current value as default for points
+ Reference< beans::XPropertySet > xInnerPropertySet( getDataSeries(), uno::UNO_QUERY );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyValue(xInnerPropertySet);
+ else
+ aRet = xInnerPropertySet->getPropertyValue( rPropertyName );
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ (void)(ex);
+ aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
+ }
+ return aRet;
+}
+
+Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
+{
+ if( m_eType == DATA_SERIES )
+ return Reference< beans::XPropertySet >( getDataSeries(), uno::UNO_QUERY );
+ return getDataPointProperties();
+}
+
+const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence( m_eType );
+}
+
+const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+
+ if( m_eType == DATA_SERIES )
+ {
+ WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
+
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+ }
+
+ WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ WrappedDataCaptionProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ //add unnamed fill properties (different inner names here)
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillGradient" ), C2U( "GradientName" ) ) );
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillHatch" ), C2U( "HatchName" ) ) );
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillTransparenceGradient" ), C2U( "TransparencyGradientName" ) ) );
+
+ //add unnamed line properties (different inner names here)
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "LineDash" ), C2U( "LineDashName" ) ) );
+
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillColor" ), C2U( "Color" ) ) );
+ aWrappedProperties.push_back( new WrappedLineStyleProperty( this ) );
+ aWrappedProperties.push_back( new WrappedLineColorProperty( this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineDashName" ), C2U( "BorderDashName" ), C2U( "LineDashName" ), this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineTransparence" ), C2U( "BorderTransparency" ), C2U( "Transparency" ), this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineWidth" ), C2U( "BorderWidth" ), C2U( "LineWidth" ), this ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillStyle" ), C2U( "FillStyle" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparence" ), C2U( "Transparency" ) ) );
+
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparenceGradientName" ), C2U( "TransparencyGradientName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientName" ), C2U( "GradientName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientStepCount" ), C2U( "GradientStepCount" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillHatchName" ), C2U( "HatchName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapName" ), C2U( "FillBitmapName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBackground" ), C2U( "FillBackground" ) ) );
+
+ //bitmap properties
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapMode" ), C2U( "FillBitmapMode" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapSizeX" ), C2U( "FillBitmapSizeX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapSizeY" ), C2U( "FillBitmapSizeY" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapLogicalSize" ), C2U( "FillBitmapLogicalSize" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapOffsetX" ), C2U( "FillBitmapOffsetX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapOffsetY" ), C2U( "FillBitmapOffsetY" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapRectanglePoint" ), C2U( "FillBitmapRectanglePoint" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapPositionOffsetX" ), C2U( "FillBitmapPositionOffsetX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapPositionOffsetY" ), C2U( "FillBitmapPositionOffsetY" ) ) );
+
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "SolidType" ), C2U( "Geometry3D" ) ) );
+ aWrappedProperties.push_back( new WrappedSegmentOffsetProperty() );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "D3DPercentDiagonal" ), C2U( "PercentDiagonal" ) ) );
+
+ aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+
+ return aWrappedProperties;
+}
+
+void SAL_CALL DataSeriesPointWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(rPropertyName.equals(C2U("Lines")))
+ {
+ if( ! (rValue >>= m_bLinesAllowed) )
+ throw lang::IllegalArgumentException( C2U("Property Lines requires value of type sal_Bool"), 0, 0 );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ static const sal_Int32 nErrorCategoryHandle = getInfoHelper().getHandleByName( C2U("ErrorCategory") );
+ if( nErrorCategoryHandle == nHandle )
+ {
+ ::com::sun::star::chart::ChartErrorCategory aNewValue = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ rValue >>= aNewValue;
+ Any aLow, aHigh;
+ bool bSetHighAndLowValues = false;
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ aHigh = this->getPropertyValue(C2U("ConstantErrorHigh"));
+ aLow = this->getPropertyValue(C2U("ConstantErrorLow"));
+ bSetHighAndLowValues = true;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ aHigh = aLow = this->getPropertyValue(C2U("PercentageError"));
+ bSetHighAndLowValues = true;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ aHigh = aLow = this->getPropertyValue(C2U("ErrorMargin"));
+ bSetHighAndLowValues = true;
+ break;
+ default:
+ break;
+ }
+
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+
+ if(bSetHighAndLowValues)
+ {
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ this->setPropertyValue(C2U("ConstantErrorHigh"),aHigh);
+ this->setPropertyValue(C2U("ConstantErrorLow"),aLow);
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ this->setPropertyValue(C2U("PercentageError"),aHigh);
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ this->setPropertyValue(C2U("ErrorMargin"),aHigh);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+}
+
+Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const rtl::OUString& rPropertyName )
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_eType == DATA_POINT )
+ {
+ if( rPropertyName.equals(C2U("FillColor")) )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ sal_Bool bVaryColorsByPoint = sal_False;
+ if( xSeriesProp.is() && (xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint)
+ && bVaryColorsByPoint )
+ {
+ uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY );
+ if( xPointState.is() && xPointState->getPropertyState( C2U("Color")) == beans::PropertyState_DEFAULT_VALUE )
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
+ if( xColorScheme.is() )
+ return uno::makeAny( xColorScheme->getColorByIndex( m_nPointIndex ) );
+ }
+ }
+ }
+ }
+ }
+ return WrappedPropertySet::getPropertyValue( rPropertyName );
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > DataSeriesPointWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 7 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDataRowProperties" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart.ChartDataPointProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ 4 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 5 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 6 ] = C2U( "com.sun.star.style.CharacterProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DataSeriesPointWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
new file mode 100644
index 000000000000..b7246306959c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATASERIESPOINTWRAPPER_HXX
+#define CHART_DATASERIESPOINTWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#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 <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class DataSeriesPointWrapper : public ::cppu::ImplInheritanceHelper4<
+ WrappedPropertySet
+ , com::sun::star::lang::XServiceInfo
+ , com::sun::star::lang::XInitialization
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XEventListener
+ >
+ , public ReferenceSizePropertyProvider
+
+{
+public:
+ enum eType
+ {
+ DATA_SERIES,
+ DATA_POINT
+ };
+
+ //this constructor needs an initialize call afterwards
+ DataSeriesPointWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ DataSeriesPointWrapper( eType eType
+ , sal_Int32 nSeriesIndexInNewAPI
+ , sal_Int32 nPointIndex //ignored for series
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ virtual ~DataSeriesPointWrapper();
+
+ bool isSupportingAreaProperties();
+ bool isLinesForbidden();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ___lang::XInitialization___
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+protected:
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener ____
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //own methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getDataSeries();
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataPointProperties();
+
+private:
+
+ void SAL_CALL getStatisticsPropertyValue
+ ( ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle ) const;
+
+ void SAL_CALL setStatisticsPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ----------------------------------------
+
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ eType m_eType;
+ sal_Int32 m_nSeriesIndexInNewAPI;
+ sal_Int32 m_nPointIndex;
+
+ sal_Bool m_bLinesAllowed;
+
+ //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
+ //because a big change in the chartmodel may leed to an dataseriespointer thats not connected to the model anymore
+ //with the indizes instead we are can aleays get the new dataseries
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_DATASERIESPOINTWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
new file mode 100644
index 000000000000..c0be0ddcbf0d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -0,0 +1,2148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DiagramWrapper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "TitleWrapper.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "AxisWrapper.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "TitleHelper.hxx"
+#include "GridWrapper.hxx"
+#include "WallFloorWrapper.hxx"
+#include "MinMaxLineWrapper.hxx"
+#include "UpDownBarWrapper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "WrappedAxisAndGridExistenceProperties.hxx"
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSplineProperties.hxx"
+#include "WrappedStockProperties.hxx"
+#include "WrappedSceneProperty.hxx"
+#include "RelativePositionHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "DisposeHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "CommonConverters.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.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/chart/ChartSolidType.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "SceneProperties.hxx"
+
+#include <map>
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+// header for define DBG_ERROR
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::chart::wrapper;
+
+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 ::osl::MutexGuard;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Diagram" ));
+
+enum
+{
+ PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
+ PROP_DIAGRAM_PERCENT_STACKED,
+ PROP_DIAGRAM_STACKED,
+ PROP_DIAGRAM_THREE_D,
+ PROP_DIAGRAM_SOLIDTYPE,
+ PROP_DIAGRAM_DEEP,
+ PROP_DIAGRAM_VERTICAL,
+ PROP_DIAGRAM_NUMBER_OF_LINES,
+ PROP_DIAGRAM_STACKED_BARS_CONNECTED,
+ PROP_DIAGRAM_DATAROW_SOURCE,
+
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+
+ PROP_DIAGRAM_STARTING_ANGLE,
+
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ PROP_DIAGRAM_PERSPECTIVE,
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+
+ PROP_DIAGRAM_HAS_X_AXIS,
+ PROP_DIAGRAM_HAS_X_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_X_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_X_AXIS_GRID,
+ PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_Y_AXIS,
+ PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_Y_AXIS_GRID,
+ PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_Z_AXIS,
+ PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_Z_AXIS_GRID,
+ PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS,
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
+
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
+
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
+
+ PROP_DIAGRAM_AUTOMATIC_SIZE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AttributedDataPoints" ),
+ PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
+ ::getCppuType( reinterpret_cast< const uno::Sequence< uno::Sequence< sal_Int32 > > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // see com.sun.star.chart.StackableDiagram
+ rOutProperties.push_back(
+ Property( C2U( "Percent" ),
+ PROP_DIAGRAM_PERCENT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Stacked" ),
+ PROP_DIAGRAM_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Dim3D" ),
+ PROP_DIAGRAM_THREE_D,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // see com.sun.star.chart.Chart3DBarProperties
+ rOutProperties.push_back(
+ Property( C2U( "SolidType" ),
+ PROP_DIAGRAM_SOLIDTYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // see com.sun.star.chart.BarDiagram
+ rOutProperties.push_back(
+ Property( C2U( "Deep" ),
+ PROP_DIAGRAM_DEEP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Vertical" ),
+ PROP_DIAGRAM_VERTICAL,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "NumberOfLines" ),
+ PROP_DIAGRAM_NUMBER_OF_LINES,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "StackedBarsConnected" ),
+ PROP_DIAGRAM_STACKED_BARS_CONNECTED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DataRowSource" ),
+ PROP_DIAGRAM_DATAROW_SOURCE,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartDataRowSource * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GroupBarsPerAxis" ),
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "IncludeHiddenCells" ),
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //new for XY charts
+ rOutProperties.push_back(
+ Property( C2U( "SortByXValues" ),
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //for pie and donut charts
+ rOutProperties.push_back(
+ Property( C2U( "StartingAngle" ),
+ PROP_DIAGRAM_STARTING_ANGLE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //new for 3D charts
+ rOutProperties.push_back(
+ Property( C2U("RightAngledAxes"),
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("Perspective"),
+ PROP_DIAGRAM_PERSPECTIVE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationHorizontal"),
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationVertical"),
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ // XAxisXSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxis" ),
+ PROP_DIAGRAM_HAS_X_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisDescription" ),
+ PROP_DIAGRAM_HAS_X_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisTitle" ),
+ PROP_DIAGRAM_HAS_X_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisGrid" ),
+ PROP_DIAGRAM_HAS_X_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XAxisYSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxis" ),
+ PROP_DIAGRAM_HAS_Y_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisDescription" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisTitle" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisGrid" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XAxisZSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxis" ),
+ PROP_DIAGRAM_HAS_Z_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisDescription" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisTitle" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisGrid" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XTwoAxisXSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxis" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxisDescription" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XTwoAxisYSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxis" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxisDescription" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XSecondAxisTitleSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxisTitle" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxisTitle" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MissingValueTreatment" ),
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutomaticSize" ),
+ PROP_DIAGRAM_AUTOMATIC_SIZE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::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 );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram )
+{
+ bool bRet = false;
+ Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xChartType.is() )
+ {
+ rtl::OUString aChartType( xChartType->getChartType() );
+ if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ bRet = true;
+ }
+ return bRet;
+}
+
+sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
+ sal_Int32 nOldAPIIndex
+ , Reference< chart2::XDiagram > xDiagram )
+{
+ sal_Int32 nNewAPIIndex = nOldAPIIndex;
+
+ if( lcl_isXYChart( xDiagram ) )
+ {
+ if( nNewAPIIndex >= 1 )
+ nNewAPIIndex -= 1;
+ }
+
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) )
+ nNewAPIIndex = -1;
+
+ return nNewAPIIndex;
+}
+
+typedef ::std::map< OUString, OUString > tChartTypeMap;
+
+OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
+{
+ const OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.template."));
+
+ if( rTemplateServiceName.match( aPrefix ))
+ {
+ const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
+
+ // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
+ // "StackedThreeDArea" "PercentStackedThreeDArea"
+ if( aName.indexOf( C2U("Area") ) != -1 )
+ return C2U( "com.sun.star.chart.AreaDiagram" );
+
+ // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded"
+ if( aName.indexOf( C2U("Pie") ) != -1 )
+ return C2U( "com.sun.star.chart.PieDiagram" );
+
+ // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep"
+ // "ThreeDColumnFlat" "StackedThreeDColumnFlat"
+ // "PercentStackedThreeDColumnFlat" "Bar" "StackedBar"
+ // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat"
+ // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine"
+ // "StackedColumnWithLine"
+ if( aName.indexOf( C2U("Column") ) != -1 || aName.indexOf( C2U("Bar") ) != -1 )
+ return C2U( "com.sun.star.chart.BarDiagram" );
+
+ // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded"
+ if( aName.indexOf( C2U("Donut") ) != -1 )
+ return C2U( "com.sun.star.chart.DonutDiagram" );
+
+ // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter"
+ if( aName.indexOf( C2U("Scatter") ) != -1 )
+ return C2U( "com.sun.star.chart.XYDiagram" );
+
+ // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
+ if( aName.indexOf( C2U("FilledNet") ) != -1 )
+ return C2U( "com.sun.star.chart.FilledNetDiagram" );
+
+ // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
+ // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
+ // "PercentStackedNetLine"
+ if( aName.indexOf( C2U("Net") ) != -1 )
+ return C2U( "com.sun.star.chart.NetDiagram" );
+
+ // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose"
+ // "StockVolumeOpenLowHighClose"
+ if( aName.indexOf( C2U("Stock") ) != -1 )
+ return C2U( "com.sun.star.chart.StockDiagram" );
+
+ if( aName.indexOf( C2U("Bubble") ) != -1 )
+ return C2U( "com.sun.star.chart.BubbleDiagram" );
+
+ // Note: this must be checked after Bar, Net and Scatter
+
+ // "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
+ // "PercentStackedLine" "LineSymbol" "StackedLineSymbol"
+ // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine"
+ // "PercentStackedThreeDLine" "ThreeDLineDeep"
+ if( aName.indexOf( C2U("Line") ) != -1 || aName.indexOf( C2U("Symbol") ) != -1 )
+ return C2U( "com.sun.star.chart.LineDiagram" );
+
+ OSL_ENSURE( false, "unknown template" );
+ }
+
+ return OUString();
+}
+
+typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap;
+//static
+const tMakeStringStringMap& lcl_getChartTypeNameMap()
+{
+ static tMakeStringStringMap g_aChartTypeNameMap =
+ tMakeStringStringMap
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.LineChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.LineDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.AreaChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.AreaDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BarDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.PieChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.PieDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DonutChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.DonutDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
+
+ ;
+ return g_aChartTypeNameMap;
+}
+
+
+OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
+{
+ OUString aOld(rNewChartTypeName);
+
+ const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
+ tMakeStringStringMap::const_iterator aIt( rMap.find( rNewChartTypeName ));
+ if( aIt != rMap.end())
+ {
+ aOld = aIt->second;
+ }
+ return aOld;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+DiagramWrapper::DiagramWrapper(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+DiagramWrapper::~DiagramWrapper()
+{}
+
+// ____ XDiagram ____
+OUString SAL_CALL DiagramWrapper::getDiagramType()
+ throw (uno::RuntimeException)
+{
+ OUString aRet;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xChartDoc.is() && xDiagram.is() )
+ {
+ Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY );
+ if( xChartDocProp.is() )
+ {
+ uno::Reference< util::XRefreshable > xAddIn;
+ if( xChartDocProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn )
+ {
+ uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY );
+ if( xServiceName.is())
+ return xServiceName->getServiceName();
+ }
+ }
+
+ Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager );
+
+ aRet = lcl_getDiagramType( aTemplateAndService.second );
+ }
+
+ if( !aRet.getLength())
+ {
+ // none of the standard templates matched
+ // use first chart type
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xChartType.is() )
+ {
+ aRet = xChartType->getChartType();
+ if( aRet.getLength() )
+ aRet = lcl_getOldChartTypeName( aRet );
+ }
+ if( !aRet.getLength())
+ aRet = C2U( "com.sun.star.chart.BarDiagram" );
+ }
+
+ return aRet;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDataRowProperties( sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nRow < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< chart2::XDataSeries > xSeries;
+
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ if( nNewAPIIndex < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
+ DataSeriesPointWrapper::DATA_SERIES, nNewAPIIndex, 0, m_spChart2ModelContact ) );
+ return xRet;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nCol < 0 || nRow < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< chart2::XDataSeries > xSeries;
+
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ if( nNewAPIIndex < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ //todo: check borders of point index
+
+ Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
+ DataSeriesPointWrapper::DATA_POINT, nNewAPIIndex, nCol, m_spChart2ModelContact ) );
+
+ return xRet;
+}
+
+// ____ XShape (base of XDiagram) ____
+awt::Point SAL_CALL DiagramWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ awt::Point aPosition = ToPoint( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
+ return aPosition;
+}
+
+void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ if( aRelativePosition.Primary < 0 || aRelativePosition.Secondary < 0 || aRelativePosition.Primary > 1 || aRelativePosition.Secondary > 1 )
+ {
+ DBG_ERROR("DiagramWrapper::setPosition called with a position out of range -> automatic values are taken instead" );
+ uno::Any aEmpty;
+ xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty );
+ return;
+ }
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) );
+ }
+}
+
+awt::Size SAL_CALL DiagramWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize = ToSize( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() );
+ return aSize;
+}
+
+void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativeSize aRelativeSize;
+ aRelativeSize.Primary = double(aSize.Width)/double(aPageSize.Width);
+ aRelativeSize.Secondary = double(aSize.Height)/double(aPageSize.Height);
+
+ if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 )
+ {
+ DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" );
+ uno::Any aEmpty;
+ xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty );
+ return;
+ }
+
+ xProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) );
+ xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) );
+ }
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL DiagramWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.Diagram" );
+}
+
+// ____ XDiagramPositioning ____
+
+void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProps.is() )
+ {
+ xDiaProps->setPropertyValue( C2U( "RelativeSize" ), Any() );
+ xDiaProps->setPropertyValue( C2U( "RelativePosition" ), Any() );
+ }
+}
+::sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProps.is() )
+ {
+ Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) );
+ Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
+ return false;
+ }
+ return true;
+}
+void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
+ uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProps.is() )
+ xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(true) );
+}
+::sal_Bool SAL_CALL DiagramWrapper::isExcludingDiagramPositioning() throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProps.is() )
+ {
+ Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) );
+ Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( aRelativeSize.hasValue() && aRelativePosition.hasValue() )
+ {
+ sal_Bool bPosSizeExcludeAxes = false;
+ xDiaProps->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes;
+ return bPosSizeExcludeAxes;
+ }
+ }
+ return false;
+}
+awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( ) throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetDiagramRectangleExcludingAxes();
+}
+void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
+ uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProps.is() )
+ xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(false) );
+}
+awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( ) throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetDiagramRectangleIncludingAxes();
+}
+void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) );
+ DiagramWrapper::setDiagramPositionIncludingAxes( aRect );
+}
+::com::sun::star::awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle();
+}
+
+// ____ XAxisZSupplier ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xZAxisTitle.is() )
+ {
+ m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xZAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xZMainGrid.is())
+ {
+ m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact );
+ }
+ return m_xZMainGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( !m_xZHelpGrid.is() )
+ {
+ m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xZHelpGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xZAxis.is())
+ {
+ m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
+ }
+ return m_xZAxis;
+}
+
+
+// ____ XTwoAxisXSupplier ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xSecondXAxis.is())
+ {
+ m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
+ }
+ return m_xSecondXAxis;
+}
+
+
+// ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
+ throw (uno::RuntimeException)
+{
+
+ if( !m_xXAxisTitle.is() )
+ {
+ m_xXAxisTitle = new TitleWrapper( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xXAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXAxis.is())
+ {
+ m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
+ }
+
+ return m_xXAxis;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXMainGrid.is())
+ {
+ m_xXMainGrid = new GridWrapper( GridWrapper::X_MAIN_GRID, m_spChart2ModelContact );
+ }
+
+ return m_xXMainGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXHelpGrid.is())
+ {
+ m_xXHelpGrid = new GridWrapper( GridWrapper::X_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xXHelpGrid;
+}
+
+
+// ____ XTwoAxisYSupplier ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xSecondYAxis.is())
+ {
+ m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
+ }
+ return m_xSecondYAxis;
+}
+
+
+// ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xYAxisTitle.is() )
+ {
+ m_xYAxisTitle = new TitleWrapper( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xYAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYAxis.is())
+ {
+ m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
+ }
+ return m_xYAxis;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYHelpGrid.is())
+ {
+ m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xYHelpGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYMainGrid.is())
+ {
+ m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact );
+ }
+ return m_xYMainGrid;
+}
+
+// ____ XSecondAxisTitleSupplier ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSecondXAxisTitle.is() )
+ {
+ m_xSecondXAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_X_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSecondXAxisTitle;
+}
+
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSecondYAxisTitle.is() )
+ {
+ m_xSecondYAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSecondYAxisTitle;
+}
+
+// ____ XStatisticDisplay ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getUpBar()
+ throw (uno::RuntimeException)
+{
+ if( !m_xUpBarWrapper.is() )
+ {
+ m_xUpBarWrapper = new UpDownBarWrapper( true, m_spChart2ModelContact );
+ }
+ return m_xUpBarWrapper;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDownBar()
+ throw (uno::RuntimeException)
+{
+ if( !m_xDownBarWrapper.is() )
+ {
+ m_xDownBarWrapper = new UpDownBarWrapper( false, m_spChart2ModelContact );
+ }
+ return m_xDownBarWrapper;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getMinMaxLine()
+ throw (uno::RuntimeException)
+{
+ if( !m_xMinMaxLineWrapper.is() )
+ {
+ m_xMinMaxLineWrapper = new MinMaxLineWrapper( m_spChart2ModelContact );
+ }
+ return m_xMinMaxLineWrapper;
+}
+
+// ____ X3DDisplay ____
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getWall()
+ throw (uno::RuntimeException)
+{
+ if( !m_xWall.is() )
+ {
+ m_xWall = new WallFloorWrapper( true, m_spChart2ModelContact );
+ }
+ return m_xWall;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getFloor()
+ throw (uno::RuntimeException)
+{
+ if( !m_xFloor.is() )
+ {
+ m_xFloor = new WallFloorWrapper( false, m_spChart2ModelContact );
+ }
+ return m_xFloor;
+}
+
+// ____ X3DDefaultSetter ____
+void SAL_CALL DiagramWrapper::set3DSettingsToDefault()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->set3DSettingsToDefault();
+}
+
+void SAL_CALL DiagramWrapper::setDefaultRotation()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->setDefaultRotation();
+}
+
+void SAL_CALL DiagramWrapper::setDefaultIllumination()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->setDefaultIllumination();
+}
+
+// ____ XComponent ____
+void SAL_CALL DiagramWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ DisposeHelper::DisposeAndClear( m_xXAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xYAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xZAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xSecondXAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xSecondYAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xXAxis );
+ DisposeHelper::DisposeAndClear( m_xYAxis );
+ DisposeHelper::DisposeAndClear( m_xZAxis );
+ DisposeHelper::DisposeAndClear( m_xSecondXAxis );
+ DisposeHelper::DisposeAndClear( m_xSecondYAxis );
+ DisposeHelper::DisposeAndClear( m_xXMainGrid );
+ DisposeHelper::DisposeAndClear( m_xYMainGrid );
+ DisposeHelper::DisposeAndClear( m_xZMainGrid );
+ DisposeHelper::DisposeAndClear( m_xXHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xYHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xZHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xWall );
+ DisposeHelper::DisposeAndClear( m_xFloor );
+ DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper );
+ DisposeHelper::DisposeAndClear( m_xUpBarWrapper );
+ DisposeHelper::DisposeAndClear( m_xDownBarWrapper );
+
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL DiagramWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL DiagramWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+// void SAL_CALL DiagramWrapper::disposing( const lang::EventObject& Source )
+// throw (uno::RuntimeException)
+// {
+// }
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_DATAROW_SOURCE
+class WrappedDataRowSourceProperty : public WrappedProperty
+{
+public:
+ WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataRowSourceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataRowSourceProperty::WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataRowSource"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataRowSourceProperty::~WrappedDataRowSourceProperty()
+{
+}
+
+void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if( ! (rOuterValue >>= eChartDataRowSource) )
+ {
+ sal_Int32 nNew = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if( !(rOuterValue >>= nNew) )
+ throw lang::IllegalArgumentException( C2U("Property DataRowSource requires ::com::sun::star::chart::ChartDataRowSource value"), 0, 0 );
+ else
+ eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource(nNew);
+ }
+
+ m_aOuterValue = rOuterValue;
+
+ bool bNewUseColumns = eChartDataRowSource == ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns != bNewUseColumns )
+ {
+ aSequenceMapping.realloc(0);
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bHasCategories, bFirstCellAsLabel );
+ }
+ }
+}
+
+Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if(bUseColumns)
+ eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+
+ m_aOuterValue <<= eChartDataRowSource;
+ }
+
+ return m_aOuterValue;
+}
+
+Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+
+//PROP_DIAGRAM_STACKED
+//PROP_DIAGRAM_DEEP
+//PROP_DIAGRAM_PERCENT_STACKED
+class WrappedStackingProperty : public WrappedProperty
+{
+public:
+ WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedStackingProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ bool detectInnerValue( StackMode& eInnerStackMode ) const;
+
+private: //member
+::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ const StackMode m_eStackMode;
+ mutable Any m_aOuterValue;
+};
+
+WrappedStackingProperty::WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eStackMode( eStackMode )
+ , m_aOuterValue()
+{
+ switch( m_eStackMode )
+ {
+ case StackMode_Y_STACKED:
+ m_aOuterName = C2U( "Stacked" );
+ break;
+ case StackMode_Y_STACKED_PERCENT:
+ m_aOuterName = C2U( "Percent" );
+ break;
+ case StackMode_Z_STACKED:
+ m_aOuterName = C2U( "Deep" );
+ break;
+ default:
+ OSL_ENSURE( false, "unexpected stack mode" );
+ break;
+ }
+}
+
+WrappedStackingProperty::~WrappedStackingProperty()
+{
+}
+
+bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const
+{
+ bool bHasDetectableInnerValue = false;
+ bool bIsAmbiguous = false;
+ eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram()
+ , bHasDetectableInnerValue, bIsAmbiguous );
+ return bHasDetectableInnerValue;
+}
+
+void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Stacking Properties require boolean values"), 0, 0 );
+
+ StackMode eInnerStackMode;
+ bool bHasDetectableInnerValue = detectInnerValue( eInnerStackMode );
+
+ if( !bHasDetectableInnerValue )
+ {
+ m_aOuterValue = rOuterValue;
+ return;
+ }
+
+ if( bNewValue && eInnerStackMode == m_eStackMode )
+ return;
+ if( !bNewValue && eInnerStackMode != m_eStackMode )
+ return;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode_NONE;
+ DiagramHelper::setStackMode( xDiagram, eNewStackMode );
+ }
+}
+
+Any WrappedStackingProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ StackMode eInnerStackMode;
+ if( detectInnerValue( eInnerStackMode ) )
+ {
+ sal_Bool bValue = (eInnerStackMode == m_eStackMode);
+ Any aAny;
+ aAny <<= bValue;
+ return aAny;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_THREE_D
+class WrappedDim3DProperty : public WrappedProperty
+{
+public:
+ WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDim3DProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDim3DProperty::WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Dim3D"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( 0 );
+}
+
+WrappedDim3DProperty::~WrappedDim3DProperty()
+{
+}
+
+void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNew3D = false;
+ if( ! (rOuterValue >>= bNew3D) )
+ throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ sal_Bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ if( bOld3D != bNew3D )
+ DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 );
+}
+
+Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Bool b3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ m_aOuterValue <<= b3D;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_VERTICAL
+class WrappedVerticalProperty : public WrappedProperty
+{
+public:
+ WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedVerticalProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedVerticalProperty::WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Vertical"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( 0 );
+}
+
+WrappedVerticalProperty::~WrappedVerticalProperty()
+{
+}
+
+void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewVertical = false;
+ if( ! (rOuterValue >>= bNewVertical) )
+ throw lang::IllegalArgumentException( C2U("Property Vertical requires boolean value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ bool bFound = false;
+ bool bAmbiguous = false;
+ sal_Bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) )
+ DiagramHelper::setVertical( xDiagram, bNewVertical );
+}
+
+Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bFound = false;
+ bool bAmbiguous = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ if( bFound )
+ m_aOuterValue <<= bVertical;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_NUMBER_OF_LINES
+class WrappedNumberOfLinesProperty : public WrappedProperty
+{
+public:
+ WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedNumberOfLinesProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ bool detectInnerValue( uno::Any& rInnerValue ) const;
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("NumberOfLines"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue( this->getPropertyDefault(0) )
+{
+}
+
+WrappedNumberOfLinesProperty::~WrappedNumberOfLinesProperty()
+{
+}
+
+bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) const
+{
+ sal_Int32 nNumberOfLines = 0;
+ bool bHasDetectableInnerValue = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY );
+ xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines;
+ bHasDetectableInnerValue = true;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ if(bHasDetectableInnerValue)
+ rInnerValue = uno::makeAny(nNumberOfLines);
+ return bHasDetectableInnerValue;
+}
+
+void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewValue;
+ if( ! (rOuterValue >>= nNewValue) )
+ throw lang::IllegalArgumentException( C2U("property NumberOfLines requires sal_Int32 value"), 0, 0 );
+
+ 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 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
+ {
+ if( nNewValue != 0 )
+ {
+ xTemplate.set( aTemplateAndService.first );
+ try
+ {
+ sal_Int32 nOldValue = 0;
+ uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ xProp->getPropertyValue( m_aOuterName ) >>= nOldValue;
+ if( nOldValue == nNewValue )
+ return;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY );
+ }
+ }
+ else if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.Column" ) ) )
+ {
+ if( nNewValue == 0 )
+ return;
+ xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ), uno::UNO_QUERY );
+ }
+
+ if(xTemplate.is())
+ {
+ try
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ xProp->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNewValue) );
+ xTemplate->changeDiagram( xDiagram );
+ // \-- locked controllers
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+Any WrappedNumberOfLinesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( !detectInnerValue( aRet ) )
+ aRet = m_aOuterValue;
+ return aRet;
+}
+
+Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Int32( 0 );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS
+class WrappedAttributedDataPointsProperty : public WrappedProperty
+{
+public:
+ WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAttributedDataPointsProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("AttributedDataPoints"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( 0 );
+}
+
+WrappedAttributedDataPointsProperty::~WrappedAttributedDataPointsProperty()
+{
+}
+
+void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Sequence< uno::Sequence< sal_Int32 > > aNewValue;
+ if( ! (rOuterValue >>= aNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AttributedDataPoints requires value of type uno::Sequence< uno::Sequence< sal_Int32 > >"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+
+ if( xDiagram.is() && xDiaProp.is())
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
+
+ ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVector.begin();
+ sal_Int32 i = 0;
+ for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
+ {
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ uno::Any aVal;
+ if( i < aNewValue.getLength() )
+ aVal <<= aNewValue[i];
+ else
+ {
+ //set empty sequence
+ uno::Sequence< sal_Int32 > aSeq;
+ aVal <<= aSeq;
+ }
+ xProp->setPropertyValue( C2U( "AttributedDataPoints" ), aVal );
+ }
+ }
+ }
+}
+
+Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+
+ if( xDiagram.is() && xDiaProp.is())
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
+
+ ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVector.begin();
+ sal_Int32 i = 0;
+ for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
+ {
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ uno::Any aVal(
+ xProp->getPropertyValue( C2U( "AttributedDataPoints" )));
+ uno::Sequence< sal_Int32 > aSeq;
+ if( aVal >>= aSeq )
+ aResult[ i ] = aSeq;
+ }
+ }
+ m_aOuterValue <<= aResult;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ uno::Sequence< uno::Sequence< sal_Int32 > > aSeq;
+ aRet <<= aSeq;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_SOLIDTYPE
+class WrappedSolidTypeProperty : public WrappedProperty
+{
+public:
+ WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedSolidTypeProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedSolidTypeProperty::WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty( C2U( "SolidType" ), OUString() )
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( 0 );
+}
+
+WrappedSolidTypeProperty::~WrappedSolidTypeProperty()
+{
+}
+
+void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewSolidType = ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID;
+ if( ! (rOuterValue >>= nNewSolidType) )
+ throw lang::IllegalArgumentException( C2U("Property SolidType requires integer value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ bool bFound = false;
+ bool bAmbiguous = false;
+ sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) )
+ DiagramHelper::setGeometry3D( xDiagram, nNewSolidType );
+}
+
+Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bFound = false;
+ bool bAmbiguous = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ if( bFound )
+ m_aOuterValue <<= nGeometry;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID );
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedAutomaticSizeProperty : public WrappedProperty
+{
+public:
+ WrappedAutomaticSizeProperty();
+ virtual ~WrappedAutomaticSizeProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty()
+ : WrappedProperty( C2U( "AutomaticSize" ), OUString() )
+{
+}
+
+WrappedAutomaticSizeProperty::~WrappedAutomaticSizeProperty()
+{
+}
+
+void WrappedAutomaticSizeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = true;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AutomaticSize requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ {
+ Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
+ if( aRelativeSize.hasValue() )
+ xInnerPropertySet->setPropertyValue( C2U( "RelativeSize" ), Any() );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedAutomaticSizeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
+ if( !aRelativeSize.hasValue() )
+ aRet <<= true;
+ }
+ return aRet;
+}
+
+Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
+class WrappedIncludeHiddenCellsProperty : public WrappedProperty
+{
+public:
+ WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedIncludeHiddenCellsProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells"))
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
+{
+}
+
+void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
+
+ ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+// ____ XDiagramProvider ____
+Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->getChart2Diagram();
+}
+
+void SAL_CALL DiagramWrapper::setDiagram(
+ const Reference< chart2::XDiagram >& /*xDiagram*/ )
+ throw (uno::RuntimeException)
+{
+ //@todo: remove this method from interface
+ DBG_ERROR("DiagramWrapper::setDiagram is not implemented, should be removed and not be called" );
+}
+
+// ================================================================================
+
+Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ WrappedAxisAndGridExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAxisTitleExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAxisLabelExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSceneProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedIgnoreProperties::addIgnoreFillProperties( aWrappedProperties );
+ WrappedIgnoreProperties::addIgnoreLineProperties( aWrappedProperties );
+ WrappedStatisticProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSymbolProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+
+ aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED_PERCENT, m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Z_STACKED, m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedDim3DProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedVerticalProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedNumberOfLinesProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAttributedDataPointsProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) );
+ aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
+ aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+uno::Sequence< OUString > DiagramWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< OUString > aServices( 8 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.Diagram" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.chart.StackableDiagram" );
+ aServices[ 3 ] = C2U( "com.sun.star.chart.ChartAxisXSupplier" );
+ aServices[ 4 ] = C2U( "com.sun.star.chart.ChartAxisYSupplier" );
+ aServices[ 5 ] = C2U( "com.sun.star.chart.ChartAxisZSupplier" );
+ aServices[ 6 ] = C2U( "com.sun.star.chart.ChartTwoAxisXSupplier" );
+ aServices[ 7 ] = C2U( "com.sun.star.chart.ChartTwoAxisYSupplier" );
+// aServices[ x ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ x ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ x ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DiagramWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
new file mode 100644
index 000000000000..111e24bd6a8b
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DIAGRAMWRAPPER_HXX
+#define CHART_DIAGRAMWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include "DiagramHelper.hxx"
+#include <cppuhelper/implbase12.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart/XDiagramPositioning.hpp>
+#include <com/sun/star/chart2/XDiagramProvider.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/chart2/XChartTypeManager.hpp>
+#include <com/sun/star/chart/XDiagram.hpp>
+#include <com/sun/star/chart/XAxisZSupplier.hpp>
+#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
+#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
+#include <com/sun/star/chart/XStatisticDisplay.hpp>
+#include <com/sun/star/chart/X3DDisplay.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
+
+#include <com/sun/star/chart/X3DDefaultSetter.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class DiagramWrapper : public ::cppu::ImplInheritanceHelper12<
+ WrappedPropertySet
+ , ::com::sun::star::chart::XDiagram
+ , ::com::sun::star::chart::XAxisZSupplier
+ , ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier
+ , ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier
+ , ::com::sun::star::chart::XStatisticDisplay
+ , ::com::sun::star::chart::X3DDisplay
+ , ::com::sun::star::chart::X3DDefaultSetter
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XComponent
+// , ::com::sun::star::lang::XEventListener
+ , ::com::sun::star::chart::XDiagramPositioning
+ , ::com::sun::star::chart2::XDiagramProvider
+ , ::com::sun::star::chart::XSecondAxisTitleSupplier
+ >
+{
+public:
+ DiagramWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~DiagramWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDiagram ____
+ virtual ::rtl::OUString SAL_CALL getDiagramType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShape (base of XDiagram) ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisZSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTwoAxisXSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryXAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTwoAxisYSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryYAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XSecondAxisTitleSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getSecondXAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getSecondYAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XStatisticDisplay ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ X3DDisplay ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ X3DDefaultSetter ____
+ virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException);
+
+// // ____ XEventListener ____
+// virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDiagramPositioning ____
+
+ virtual void SAL_CALL setAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagramPositionExcludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isExcludingDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionExcludingAxes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagramPositionIncludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagramPositionIncludingAxesAndAxisTitles( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDiagramProvider ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > SAL_CALL getDiagram()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ void updateFromModel();
+
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xXAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xYAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xZAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xSecondXAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xSecondYAxisTitle;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xSecondXAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xSecondYAxis;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXHelpGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYHelpGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZHelpGrid;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xWall;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xFloor;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xMinMaxLineWrapper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xUpBarWrapper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xDownBarWrapper;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_DIAGRAMWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
new file mode 100644
index 000000000000..ff36c4cebcc7
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "GridWrapper.hxx"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedDefaultProperty.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+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;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Grid" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+GridWrapper::GridWrapper(
+ tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eType( eType )
+{
+}
+
+GridWrapper::~GridWrapper()
+{}
+
+// static
+void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid )
+{
+ rnDimensionIndex = 1;
+ rbSubGrid = false;
+
+ switch( eType )
+ {
+ case X_MAIN_GRID:
+ rnDimensionIndex = 0; rbSubGrid = false; break;
+ case Y_MAIN_GRID:
+ rnDimensionIndex = 1; rbSubGrid = false; break;
+ case Z_MAIN_GRID:
+ rnDimensionIndex = 2; rbSubGrid = false; break;
+ case X_SUB_GRID:
+ rnDimensionIndex = 0; rbSubGrid = true; break;
+ case Y_SUB_GRID:
+ rnDimensionIndex = 1; rbSubGrid = true; break;
+ case Z_SUB_GRID:
+ rnDimensionIndex = 2; rbSubGrid = true; break;
+ }
+}
+
+// ____ XComponent ____
+void SAL_CALL GridWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL GridWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL GridWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+
+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*/ ) );
+
+ 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 ) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xRet;
+}
+
+const Sequence< beans::Property >& GridWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > GridWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedDefaultProperty( C2U("LineColor"), C2U("LineColor"), uno::makeAny( sal_Int32( 0x000000) ) ) ); // black
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > GridWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartGrid" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( GridWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
new file mode 100644
index 000000000000..c731b6c22666
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_GRIDWRAPPER_HXX
+#define CHART_GRIDWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class GridWrapper : public ::cppu::ImplInheritanceHelper2<
+ WrappedPropertySet
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ enum tGridType
+ {
+ X_MAIN_GRID,
+ Y_MAIN_GRID,
+ Z_MAIN_GRID,
+ X_SUB_GRID,
+ Y_SUB_GRID,
+ Z_SUB_GRID
+ };
+
+ GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~GridWrapper();
+
+ static void getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid );
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ tGridType m_eType;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_GRIDWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
new file mode 100644
index 000000000000..02ffcb942c99
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LegendWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "LegendHelper.hxx"
+#include "ContainerHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+
+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;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace chart
+{
+class WrappedLegendAlignmentProperty : public WrappedProperty
+{
+public:
+ WrappedLegendAlignmentProperty();
+ virtual ~WrappedLegendAlignmentProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+protected:
+ virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
+ virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
+};
+
+WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty()
+ : ::chart::WrappedProperty( C2U( "Alignment" ), C2U( "AnchorPosition" ) )
+{
+}
+WrappedLegendAlignmentProperty::~WrappedLegendAlignmentProperty()
+{
+}
+
+Any WrappedLegendAlignmentProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertySet.is() )
+ {
+ sal_Bool bShowLegend = sal_True;
+ xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bShowLegend;
+ if(!bShowLegend)
+ {
+ aRet = uno::makeAny( ::com::sun::star::chart::ChartLegendPosition_NONE );
+ }
+ else
+ {
+ aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
+ aRet = this->convertInnerToOuterValue( aRet );
+ }
+ }
+ return aRet;
+}
+
+void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(xInnerPropertySet.is())
+ {
+ sal_Bool bNewShowLegend = sal_True;
+ sal_Bool bOldShowLegend = sal_True;
+ {
+ ::com::sun::star::chart::ChartLegendPosition eOuterPos(::com::sun::star::chart::ChartLegendPosition_NONE);
+ if( (rOuterValue >>= eOuterPos) && eOuterPos == ::com::sun::star::chart::ChartLegendPosition_NONE )
+ bNewShowLegend = sal_False;
+ xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bOldShowLegend;
+ }
+ if(bNewShowLegend!=bOldShowLegend)
+ {
+ xInnerPropertySet->setPropertyValue( C2U( "Show" ), uno::makeAny(bNewShowLegend) );
+ }
+ if(!bNewShowLegend)
+ return;
+
+ //set corresponding LegendPosition
+ Any aInnerValue = this->convertOuterToInnerValue( rOuterValue );
+ xInnerPropertySet->setPropertyValue( m_aInnerName, aInnerValue );
+
+ //correct LegendExpansion
+ chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END);
+ if( aInnerValue >>= eNewInnerPos )
+ {
+ chart2::LegendExpansion eNewExpansion =
+ ( eNewInnerPos == chart2::LegendPosition_LINE_END ||
+ eNewInnerPos == chart2::LegendPosition_LINE_START )
+ ? chart2::LegendExpansion_HIGH
+ : chart2::LegendExpansion_WIDE;
+
+ chart2::LegendExpansion eOldExpansion( chart2::LegendExpansion_HIGH );
+ bool bExpansionWasSet(
+ xInnerPropertySet->getPropertyValue( C2U( "Expansion" ) ) >>= eOldExpansion );
+
+ if( !bExpansionWasSet || (eOldExpansion != eNewExpansion))
+ xInnerPropertySet->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eNewExpansion ));
+ }
+
+ //correct RelativePosition
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if(aRelativePosition.hasValue())
+ {
+ xInnerPropertySet->setPropertyValue( C2U( "RelativePosition" ), Any() );
+ }
+ }
+}
+
+Any WrappedLegendAlignmentProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ ::com::sun::star::chart::ChartLegendPosition ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
+
+ chart2::LegendPosition eNewPos;
+ if( rInnerValue >>= eNewPos )
+ {
+ switch( eNewPos )
+ {
+ case chart2::LegendPosition_LINE_START:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_LEFT;
+ break;
+ case chart2::LegendPosition_LINE_END:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_RIGHT;
+ break;
+ case chart2::LegendPosition_PAGE_START:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_TOP;
+ break;
+ case chart2::LegendPosition_PAGE_END:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_BOTTOM;
+ break;
+
+ default:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
+ break;
+ }
+ }
+ return uno::makeAny( ePos );
+}
+Any WrappedLegendAlignmentProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END;
+
+ ::com::sun::star::chart::ChartLegendPosition ePos;
+ if( rOuterValue >>= ePos )
+ {
+ switch( ePos )
+ {
+ case ::com::sun::star::chart::ChartLegendPosition_LEFT:
+ eNewPos = chart2::LegendPosition_LINE_START;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_RIGHT:
+ eNewPos = chart2::LegendPosition_LINE_END;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_TOP:
+ eNewPos = chart2::LegendPosition_PAGE_START;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_BOTTOM:
+ eNewPos = chart2::LegendPosition_PAGE_END;
+ break;
+ default: // NONE
+ break;
+ }
+ }
+
+ return uno::makeAny( eNewPos );
+}
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Legend" ));
+
+enum
+{
+ PROP_LEGEND_ALIGNMENT
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Alignment" ),
+ PROP_LEGEND_ALIGNMENT,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+LegendWrapper::LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+LegendWrapper::~LegendWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL LegendWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetLegendPosition();
+}
+
+void SAL_CALL LegendWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+}
+
+awt::Size SAL_CALL LegendWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetLegendSize();
+}
+
+void SAL_CALL LegendWrapper::setSize( const awt::Size& aSize )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+ awt::Rectangle aPageRectangle( 0,0,aPageSize.Width,aPageSize.Height);
+
+ awt::Point aPos( this->getPosition() );
+ awt::Rectangle aNewPositionAndSize(aPos.X,aPos.Y,aSize.Width,aSize.Height);
+
+ PositionAndSizeHelper::moveObject( OBJECTTYPE_LEGEND
+ , xProp, aNewPositionAndSize, aPageRectangle );
+ }
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+::rtl::OUString SAL_CALL LegendWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartLegend" );
+}
+
+// ____ XComponent ____
+void SAL_CALL LegendWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL LegendWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL LegendWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void LegendWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any LegendWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+
+ return aRet;
+}
+awt::Size LegendWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ xRet.set( xDiagram->getLegend(), uno::UNO_QUERY );
+ OSL_ENSURE(xRet.is(),"LegendWrapper::getInnerPropertySet() is NULL");
+ return xRet;
+}
+
+const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() );
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ //same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillColor"), C2U("FillColor") ));
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< ::rtl::OUString > LegendWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLegend" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.Shape" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 4 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 5 ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ 6 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LegendWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
new file mode 100644
index 000000000000..94434a387d4e
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LEGENDWRAPPER_HXX
+#define CHART_LEGENDWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XLegend.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class LegendWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~LegendWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_LEGENDWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
new file mode 100644
index 000000000000..fdfc7c094aaf
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -0,0 +1,435 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "MinMaxLineWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+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;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_pPropertyArrayHelper()
+ , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE ))
+{
+}
+
+MinMaxLineWrapper::~MinMaxLineWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL MinMaxLineWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_xInfo.clear();
+ // \--
+}
+
+void SAL_CALL MinMaxLineWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL MinMaxLineWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper()
+{
+ if(!m_pPropertyArrayHelper.get())
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if(!m_pPropertyArrayHelper.get())
+ {
+ sal_Bool bSorted = sal_True;
+ m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) );
+ }
+ // \--
+ }
+ return *m_pPropertyArrayHelper.get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ if( !m_xInfo.is() )
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if( !m_xInfo.is() )
+ m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+ // \--
+ }
+ return m_xInfo;
+}
+void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
+ if( xSeriesContainer.is() )
+ {
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ if(aSeriesSeq.getLength())
+ {
+ xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ if( rPropertyName.equals( C2U("LineColor")) )
+ xPropSet->setPropertyValue( C2U("Color"), rValue );
+ else if( rPropertyName.equals( C2U("LineTransparence")) )
+ xPropSet->setPropertyValue( C2U("Transparency"), rValue );
+ else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet );
+ else
+ xPropSet->setPropertyValue( rPropertyName, rValue );
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
+ if( xSeriesContainer.is() )
+ {
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ if(aSeriesSeq.getLength())
+ {
+ xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
+ break;
+ }
+ }
+ }
+ }
+ if(xPropSet.is())
+ {
+ if( rPropertyName.equals( C2U("LineColor")) )
+ aRet = xPropSet->getPropertyValue( C2U("Color") );
+ else if( rPropertyName.equals( C2U("LineTransparence")) )
+ aRet = xPropSet->getPropertyValue( C2U("Transparency") );
+ else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ aRet = m_aWrappedLineJointProperty.getPropertyValue( xPropSet );
+ else
+ aRet = xPropSet->getPropertyValue( rPropertyName );
+
+ }
+ return aRet;
+}
+
+void SAL_CALL MinMaxLineWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XMultiPropertySet
+//getPropertySetInfo() already declared in XPropertySet
+void SAL_CALL MinMaxLineWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bUnknownProperty = false;
+ sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<nMinCount; nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ try
+ {
+ this->setPropertyValue( aPropertyName, rValueSeq[nN] );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bUnknownProperty = true;
+ }
+ }
+ //todo: store unknown properties elsewhere
+// if( bUnknownProperty )
+// throw beans::UnknownPropertyException();
+}
+uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyValue( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL MinMaxLineWrapper::addPropertiesChangeListener(
+ const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::firePropertiesChangeEvent(
+ const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XPropertyState
+beans::PropertyState SAL_CALL MinMaxLineWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ uno::Any aDefault( this->getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( this->getPropertyValue( rPropertyName ) );
+
+ if( aDefault == aValue )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return beans::PropertyState_DIRECT_VALUE;
+}
+uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Sequence< beans::PropertyState > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyState( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
+}
+uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+}
+
+//XMultiPropertyStates
+//getPropertyStates() already declared in XPropertyState
+void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence();
+ for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+void SAL_CALL MinMaxLineWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+
+// ================================================================================
+
+Sequence< OUString > MinMaxLineWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLine" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( MinMaxLineWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
new file mode 100644
index 000000000000..449a1f550860
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_MINMAXLINEWRAPPER_HXX
+#define CHART_MINMAXLINEWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include <cppuhelper/interfacecontainer.hxx>
+
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+// header for class OPropertyArrayHelper
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class MinMaxLineWrapper : public MutexContainer
+ , public ::cppu::WeakImplHelper6
+ < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::beans::XMultiPropertyStates
+ // , ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // , ::com::sun::star::uno::XInterface // implemented by WeakImplHelper
+ // , ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+public:
+ MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~MinMaxLineWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+ //getPropertySetInfo() already declared in XPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //getPropertyStates() already declared in XPropertyState
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ ::cppu::IPropertyArrayHelper& getInfoHelper();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >
+ m_xInfo;//outer PropertySetInfo
+
+ ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper;
+
+ WrappedIgnoreProperty m_aWrappedLineJointProperty;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_MINMAXLINEWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
new file mode 100644
index 000000000000..085128cddeeb
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+#define CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+
+#include <com/sun/star/awt/Size.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+class ReferenceSizePropertyProvider
+{
+public:
+ virtual void updateReferenceSize() = 0;
+ virtual ::com::sun::star::uno::Any getReferenceSize() = 0;
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference() = 0;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
new file mode 100644
index 000000000000..20785faa8b66
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -0,0 +1,566 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "TitleWrapper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include "ControllerLockGuard.hxx"
+
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+
+namespace chart
+{
+class WrappedTitleStringProperty : public WrappedProperty
+{
+public:
+ WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext );
+ virtual ~WrappedTitleStringProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+protected:
+ Reference< uno::XComponentContext > m_xContext;
+};
+
+WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext )
+ : ::chart::WrappedProperty( C2U( "String" ), OUString() )
+ , m_xContext( xContext )
+{
+}
+WrappedTitleStringProperty::~WrappedTitleStringProperty()
+{
+}
+
+void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
+ if(xTitle.is())
+ {
+ OUString aString;
+ rOuterValue >>= aString;
+ TitleHelper::setCompleteString( aString, xTitle, m_xContext );
+ }
+}
+Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
+ if(xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+
+ ::rtl::OUStringBuffer aBuf;
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ aBuf.append( aStrings[ i ]->getString());
+ }
+ aRet <<= aBuf.makeStringAndClear();
+ }
+ return aRet;
+}
+Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( rtl::OUString() );//default title is a empty String
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedStackedTextProperty : public WrappedProperty
+{
+public:
+ WrappedStackedTextProperty();
+ virtual ~WrappedStackedTextProperty();
+};
+
+WrappedStackedTextProperty::WrappedStackedTextProperty()
+ : ::chart::WrappedProperty( C2U( "StackedText" ), C2U( "StackCharacters" ) )
+{
+}
+WrappedStackedTextProperty::~WrappedStackedTextProperty()
+{
+}
+
+}// end namespace chart
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Title" ));
+
+enum
+{
+ PROP_TITLE_STRING,
+ PROP_TITLE_TEXT_ROTATION,
+ PROP_TITLE_TEXT_STACKED
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "String" ),
+ PROP_TITLE_STRING,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_TITLE_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "StackedText" ),
+ PROP_TITLE_TEXT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eTitleType(eTitleType)
+{
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped mapped correctly
+ TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+}
+
+TitleWrapper::~TitleWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL TitleWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetTitlePosition( this->getTitleObject() );
+}
+
+void SAL_CALL TitleWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropertySet( this->getInnerPropertySet() );
+ if(xPropertySet.is())
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ xPropertySet->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+}
+
+awt::Size SAL_CALL TitleWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetTitleSize( this->getTitleObject() );
+}
+
+void SAL_CALL TitleWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of title" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL TitleWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartTitle" );
+}
+
+// ____ XComponent ____
+void SAL_CALL TitleWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL TitleWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL TitleWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
+{
+ Reference< beans::XPropertySet > xProp;
+
+ Reference< chart2::XTitle > xTitle( this->getTitleObject() );
+ if( xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+ if( aStrings.getLength() > 0 )
+ xProp.set( aStrings[0], uno::UNO_QUERY );
+ }
+
+ return xProp;
+}
+
+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(), uno::UNO_QUERY );
+ Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
+ if(xProp.is())
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+ if( pWrappedProperty )
+ {
+ rValue = pWrappedProperty->getPropertyValue( xProp );
+ }
+ else if( xFastProp.is() )
+ {
+ rValue = xFastProp->getFastPropertyValue( nHandle );
+ }
+ }
+
+}
+
+void TitleWrapper::setFastCharacterPropertyValue(
+ sal_Int32 nHandle, const Any& rValue ) throw (uno::Exception)
+{
+ OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
+ nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
+
+ Reference< chart2::XTitle > xTitle( this->getTitleObject() );
+ if( xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY );
+
+ if( pWrappedProperty )
+ pWrappedProperty->setPropertyValue( rValue, xPropSet );
+ else if( xFastPropertySet.is() )
+ xFastPropertySet->setFastPropertyValue( nHandle, rValue );
+ }
+ }
+}
+
+// ================================================================================
+// WrappedPropertySet
+
+void SAL_CALL TitleWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ setFastCharacterPropertyValue( nHandle, rValue );
+ }
+ else
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+}
+
+Any SAL_CALL TitleWrapper::getPropertyValue( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ getFastCharacterPropertyValue( nHandle, aRet );
+ else
+ aRet = WrappedPropertySet::getPropertyValue( rPropertyName );
+ return aRet;
+}
+
+beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aState = pWrappedProperty->getPropertyState( xPropState );
+ else
+ aState = xPropState->getPropertyState( rPropertyName );
+ }
+ }
+ else
+ aState = WrappedPropertySet::getPropertyState( rPropertyName );
+
+ return aState;
+}
+void SAL_CALL TitleWrapper::setPropertyToDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Any aDefault = getPropertyDefault( rPropertyName );
+ setFastCharacterPropertyValue( nHandle, aDefault );
+ }
+ else
+ WrappedPropertySet::setPropertyToDefault( rPropertyName );
+}
+Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyDefault(xPropState);
+ else
+ aRet = xPropState->getPropertyDefault( rPropertyName );
+ }
+ }
+ else
+ aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
+
+ return aRet;
+}
+
+void SAL_CALL TitleWrapper::addPropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropSet.is() )
+ xPropSet->addPropertyChangeListener( rPropertyName, xListener );
+ }
+ else
+ WrappedPropertySet::addPropertyChangeListener( rPropertyName, xListener );
+}
+void SAL_CALL TitleWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropSet.is() )
+ xPropSet->removePropertyChangeListener( rPropertyName, xListener );
+ }
+ else
+ WrappedPropertySet::removePropertyChangeListener( rPropertyName, xListener );
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void TitleWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any TitleWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+
+ return aRet;
+}
+awt::Size TitleWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+Reference< chart2::XTitle > TitleWrapper::getTitleObject()
+{
+ return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+}
+
+// WrappedPropertySet
+
+Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( this->getTitleObject(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
+ aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
+ aWrappedProperties.push_back( new WrappedStackedTextProperty() );
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > TitleWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartTitle" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.Shape" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 4 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 5 ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ 6 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( TitleWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
new file mode 100644
index 000000000000..63902e452ee3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TITLEWRAPPER_HXX
+#define CHART_TITLEWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ServiceMacros.hxx"
+#include "TitleHelper.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class TitleWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~TitleWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+protected:
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // character properties have to be handled differently (via the XFormattedString elements)
+ void getFastCharacterPropertyValue( sal_Int32 nHandle, ::com::sun::star::uno::Any& rValue );
+ void setFastCharacterPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ____ WrappedPropertySet ____
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::chart::TitleHelper::eTitleType m_eTitleType;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_TITLEWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
new file mode 100644
index 000000000000..338131c4f973
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
@@ -0,0 +1,402 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UpDownBarWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+// #include "NamedProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+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;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+UpDownBarWrapper::UpDownBarWrapper(
+ bool bUp, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") )
+ , m_xInfo(0)
+ , m_pPropertyArrayHelper()
+{
+}
+
+UpDownBarWrapper::~UpDownBarWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL UpDownBarWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_xInfo.clear();
+ // \--
+}
+
+void SAL_CALL UpDownBarWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL UpDownBarWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+::cppu::IPropertyArrayHelper& UpDownBarWrapper::getInfoHelper()
+{
+ if(!m_pPropertyArrayHelper.get())
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if(!m_pPropertyArrayHelper.get())
+ {
+ sal_Bool bSorted = sal_True;
+ m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) );
+ }
+ // \--
+ }
+ return *m_pPropertyArrayHelper.get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ if( !m_xInfo.is() )
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if( !m_xInfo.is() )
+ m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+ // \--
+ }
+ return m_xInfo;
+}
+void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY );
+ if(xTypeProps.is())
+ {
+ xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
+ }
+ }
+ }
+ if(xPropSet.is())
+ xPropSet->setPropertyValue( rPropertyName, rValue );
+}
+uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY );
+ if(xTypeProps.is())
+ {
+ xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
+ }
+ }
+ }
+ if(xPropSet.is())
+ aRet = xPropSet->getPropertyValue( rPropertyName );
+ return aRet;
+}
+
+void SAL_CALL UpDownBarWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XMultiPropertySet
+//getPropertySetInfo() already declared in XPropertySet
+void SAL_CALL UpDownBarWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bUnknownProperty = false;
+ sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<nMinCount; nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ try
+ {
+ this->setPropertyValue( aPropertyName, rValueSeq[nN] );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bUnknownProperty = true;
+ }
+ }
+ //todo: store unknown properties elsewhere
+// if( bUnknownProperty )
+// throw beans::UnknownPropertyException();
+}
+uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyValue( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL UpDownBarWrapper::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XPropertyState
+beans::PropertyState SAL_CALL UpDownBarWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ uno::Any aDefault( this->getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( this->getPropertyValue( rPropertyName ) );
+
+ if( aDefault == aValue )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return beans::PropertyState_DIRECT_VALUE;
+}
+uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Sequence< beans::PropertyState > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyState( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
+}
+uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+}
+
+//XMultiPropertyStates
+//getPropertyStates() already declared in XPropertyState
+void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence();
+ for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+void SAL_CALL UpDownBarWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+
+// ================================================================================
+
+Sequence< OUString > UpDownBarWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartArea" );
+ aServices[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" );
+ aServices[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.FillProperties" );
+ aServices[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( UpDownBarWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
new file mode 100644
index 000000000000..5b028a6acc66
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_UPDOWNBARWRAPPER_HXX
+#define CHART_UPDOWNBARWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/interfacecontainer.hxx>
+
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+// header for class OPropertyArrayHelper
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class UpDownBarWrapper : public MutexContainer
+ , public ::cppu::WeakImplHelper6
+ < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::beans::XMultiPropertyStates
+ // , ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // , ::com::sun::star::uno::XInterface // implemented by WeakImplHelper
+ // , ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+public:
+ UpDownBarWrapper( bool bUp, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~UpDownBarWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+ //getPropertySetInfo() already declared in XPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //getPropertyStates() already declared in XPropertyState
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ ::cppu::IPropertyArrayHelper& getInfoHelper();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ rtl::OUString m_aPropertySetName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >
+ m_xInfo;//outer PropertySetInfo
+ ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper;
+
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_UPDOWNBARWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
new file mode 100644
index 000000000000..a43bc610fc0c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WallFloorWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "FillProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedDirectStateProperty.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+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::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.WallOrFloor" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+WallFloorWrapper::WallFloorWrapper( bool bWall,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_bWall( bWall )
+
+{
+}
+
+WallFloorWrapper::~WallFloorWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL WallFloorWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL WallFloorWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL WallFloorWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
+{
+ Reference< beans::XPropertySet > xRet;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ if( m_bWall )
+ xRet.set( xDiagram->getWall() );
+ else
+ xRet.set( xDiagram->getFloor() );
+ }
+
+ return xRet;
+}
+
+const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > WallFloorWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ // use direct state always, so that in XML the value is always
+ // exported. Because in the old chart the defaults is as follows:
+ // Floor: SOLID (new and old model default), Wall: NONE, except for some chart types (line, scatter)
+ if( m_bWall )
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ));
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillColor"), C2U("FillColor") ));
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > WallFloorWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( WallFloorWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
new file mode 100644
index 000000000000..44cb241281e3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WALLFLOORWRAPPER_HXX
+#define CHART_WALLFLOORWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class WallFloorWrapper : public ::cppu::ImplInheritanceHelper2<
+ WrappedPropertySet
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ WallFloorWrapper( bool bWall, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WallFloorWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ bool m_bWall;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WALLFLOORWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx
new file mode 100644
index 000000000000..8315a22d8ab4
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAddInProperty.hxx"
+#include "macros.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+namespace wrapper
+{
+
+WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "AddIn" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedAddInProperty::~WrappedAddInProperty()
+{
+}
+
+void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< util::XRefreshable > xAddIn;
+ if( ! (rOuterValue >>= xAddIn) )
+ throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 );
+
+ m_rChartDocumentWrapper.setAddIn( xAddIn );
+}
+
+Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getAddIn() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
+{
+}
+
+void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ rtl::OUString aBaseDiagram;
+ if( ! (rOuterValue >>= aBaseDiagram) )
+ throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 );
+
+ m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
+}
+
+Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
+{
+}
+
+void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 );
+}
+
+Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
+{
+}
+
+void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bUpdateAddIn = sal_True;
+ if( ! (rOuterValue >>= bUpdateAddIn) )
+ throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 );
+
+ m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
+}
+
+Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() );
+}
+
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
new file mode 100644
index 000000000000..e807873c82dc
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_ADDIN_PROPERTY_HXX
+#define CHART_WRAPPED_ADDIN_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "ChartDocumentWrapper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+namespace wrapper
+{
+
+class WrappedAddInProperty : public WrappedProperty
+{
+public:
+ WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedAddInProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedBaseDiagramProperty : public WrappedProperty
+{
+public:
+ WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedBaseDiagramProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedAdditionalShapesProperty : public WrappedProperty
+{
+public:
+ WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedAdditionalShapesProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedRefreshAddInAllowedProperty : public WrappedProperty
+{
+public:
+ WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedRefreshAddInAllowedProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_ADDIN_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
new file mode 100644
index 000000000000..15ae48bc22dd
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAutomaticPositionProperty : public WrappedProperty
+{
+public:
+ WrappedAutomaticPositionProperty();
+ virtual ~WrappedAutomaticPositionProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+};
+
+WrappedAutomaticPositionProperty::WrappedAutomaticPositionProperty()
+ : ::chart::WrappedProperty( C2U( "AutomaticPosition" ), rtl::OUString() )
+{
+}
+WrappedAutomaticPositionProperty::~WrappedAutomaticPositionProperty()
+{
+}
+
+void WrappedAutomaticPositionProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = true;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AutomaticPosition requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ {
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( aRelativePosition.hasValue() )
+ xInnerPropertySet->setPropertyValue( C2U( "RelativePosition" ), Any() );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedAutomaticPositionProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( !aRelativePosition.hasValue() )
+ aRet <<= true;
+ }
+ return aRet;
+}
+
+Any WrappedAutomaticPositionProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+namespace
+{
+enum
+{
+ PROP_CHART_AUTOMATIC_POSITION = FAST_PROPERTY_ID_START_CHART_AUTOPOSITION_PROP
+};
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList )
+{
+ rList.push_back( new WrappedAutomaticPositionProperty() );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedAutomaticPositionProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AutomaticPosition" ),
+ PROP_CHART_AUTOMATIC_POSITION,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedAutomaticPositionProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList )
+{
+ lcl_addWrappedProperties( rList );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
new file mode 100644
index 000000000000..1211f76c8f1f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_WRAPPED_AUTOMATICPOSITION_PROPERTIES_HXX
+#define CHART_WRAPPED_AUTOMATICPOSITION_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAutomaticPositionProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property >& rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList );
+};
+
+} //namespace wrapper
+} //namespace chart
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
new file mode 100644
index 000000000000..0c4a98263a04
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
@@ -0,0 +1,448 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAxisAndGridExistenceProperties.hxx"
+#include "AxisHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "TitleHelper.hxx"
+#include "macros.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAxisAndGridExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisAndGridExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ bool m_bAxis;
+ bool m_bMain;
+ sal_Int32 m_nDimensionIndex;
+};
+
+//static
+void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 0, spChart2ModelContact ) );//x axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 0, spChart2ModelContact ) );//x secondary axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 0, spChart2ModelContact ) );//x grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 0, spChart2ModelContact ) );//x help grid
+
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 1, spChart2ModelContact ) );//y axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 1, spChart2ModelContact ) );//y secondary axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 1, spChart2ModelContact ) );//y grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 1, spChart2ModelContact ) );//y help grid
+
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 2, spChart2ModelContact ) );//z axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 2, spChart2ModelContact ) );//z grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 2, spChart2ModelContact ) );//z help grid
+}
+
+WrappedAxisAndGridExistenceProperty::WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_bAxis( bAxis )
+ , m_bMain( bMain )
+ , m_nDimensionIndex( nDimensionIndex )
+{
+ switch( m_nDimensionIndex )
+ {
+ case 0:
+ {
+ if( m_bAxis )
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasXAxis" );
+ else
+ m_aOuterName = C2U( "HasSecondaryXAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasXAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasXAxisHelpGrid" );
+ }
+ }
+ break;
+ case 2:
+ {
+ if( m_bAxis )
+ {
+ OSL_ENSURE(m_bMain == true,"there is no secondary z axis at the old api");
+ m_bMain = true;
+ m_aOuterName = C2U( "HasZAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasZAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasZAxisHelpGrid" );
+ }
+ }
+ break;
+ default:
+ {
+ if( m_bAxis )
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasYAxis" );
+ else
+ m_aOuterName = C2U( "HasSecondaryYAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasYAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasYAxisHelpGrid" );
+ }
+ }
+ break;
+ }
+}
+
+WrappedAxisAndGridExistenceProperty::~WrappedAxisAndGridExistenceProperty()
+{
+}
+
+void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ if( bOldValue == bNewValue )
+ return;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( bNewValue )
+ {
+ if( m_bAxis )
+ AxisHelper::showAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
+ else
+ AxisHelper::showGrid( m_nDimensionIndex, 0, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
+ }
+ else
+ {
+ if( m_bAxis )
+ AxisHelper::hideAxis( m_nDimensionIndex, m_bMain, xDiagram );
+ else
+ AxisHelper::hideGrid( m_nDimensionIndex, 0, m_bMain, xDiagram );
+ }
+}
+
+Any WrappedAxisAndGridExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if(m_bAxis)
+ {
+ sal_Bool bShown = AxisHelper::isAxisShown( m_nDimensionIndex, m_bMain, xDiagram );
+ aRet <<= bShown;
+ }
+ else
+ {
+ sal_Bool bShown = AxisHelper::isGridShown( m_nDimensionIndex, 0, m_bMain, xDiagram );
+ aRet <<= bShown;
+ }
+ return aRet;
+}
+
+Any WrappedAxisAndGridExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisTitleExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisTitleExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ TitleHelper::eTitleType m_eTitleType;
+};
+
+//static
+void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 0, spChart2ModelContact ) );//x axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 1, spChart2ModelContact ) );//y axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 2, spChart2ModelContact ) );//z axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 3, spChart2ModelContact ) );//secondary x axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 4, spChart2ModelContact ) );//secondary y axis title
+}
+
+WrappedAxisTitleExistenceProperty::WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eTitleType( TitleHelper::Y_AXIS_TITLE )
+{
+ switch( nTitleIndex )
+ {
+ case 0:
+ m_aOuterName = C2U( "HasXAxisTitle" );
+ m_eTitleType = TitleHelper::X_AXIS_TITLE;
+ break;
+ case 2:
+ m_aOuterName = C2U( "HasZAxisTitle" );
+ m_eTitleType = TitleHelper::Z_AXIS_TITLE;
+ break;
+ case 3:
+ m_aOuterName = C2U( "HasSecondaryXAxisTitle" );
+ m_eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
+ break;
+ case 4:
+ m_aOuterName = C2U( "HasSecondaryYAxisTitle" );
+ m_eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
+ break;
+ default:
+ m_aOuterName = C2U( "HasYAxisTitle" );
+ m_eTitleType = TitleHelper::Y_AXIS_TITLE;
+ break;
+ }
+}
+
+WrappedAxisTitleExistenceProperty::~WrappedAxisTitleExistenceProperty()
+{
+}
+
+void WrappedAxisTitleExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ if( bOldValue == bNewValue )
+ return;
+
+ if( bNewValue )
+ {
+ rtl::OUString aTitleText;
+ TitleHelper::createTitle( m_eTitleType, aTitleText
+ , m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ }
+ else
+ {
+ TitleHelper::removeTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+ }
+}
+
+Any WrappedAxisTitleExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bHasTitle = sal_False;
+
+ Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) );
+ if( xTitle.is() && (TitleHelper::getCompleteString( xTitle ).getLength() != 0) )
+ bHasTitle = sal_True;
+
+ Any aRet;
+ aRet <<= bHasTitle;
+ return aRet;
+
+}
+
+Any WrappedAxisTitleExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisLabelExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisLabelExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ bool m_bMain;
+ sal_Int32 m_nDimensionIndex;
+};
+
+//static
+void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 0, spChart2ModelContact ) );//x axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 1, spChart2ModelContact ) );//y axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 2, spChart2ModelContact ) );//z axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( false, 0, spChart2ModelContact ) );//secondary x axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( false, 1, spChart2ModelContact ) );//secondary y axis
+}
+
+WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_bMain( bMain )
+ , m_nDimensionIndex( nDimensionIndex )
+{
+ switch( m_nDimensionIndex )
+ {
+ case 0:
+ m_aOuterName = m_bMain ? C2U( "HasXAxisDescription" ) : C2U( "HasSecondaryXAxisDescription" );
+ break;
+ case 2:
+ OSL_ENSURE(m_bMain,"there is no description available for a secondary z axis");
+ m_aOuterName = C2U( "HasZAxisDescription" );
+ break;
+ default:
+ m_aOuterName = m_bMain ? C2U( "HasYAxisDescription" ) : C2U( "HasSecondaryYAxisDescription" );
+ break;
+ }
+}
+
+WrappedAxisLabelExistenceProperty::~WrappedAxisLabelExistenceProperty()
+{
+}
+
+void WrappedAxisLabelExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ 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 );
+ if( !xProp.is() && bNewValue )
+ {
+ //create axis if needed
+ xProp.set( AxisHelper::createAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext ), uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "DisplayLabels" ), rOuterValue );
+}
+
+Any WrappedAxisLabelExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U( "DisplayLabels" ));
+ else
+ aRet <<= sal_False;
+ return aRet;
+}
+
+Any WrappedAxisLabelExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_True );
+ return aRet;
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
new file mode 100644
index 000000000000..a02e19d2a67c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_AXISANDGRIDEXISTENCE_PROPERTIES_HXX
+#define CHART_WRAPPED_AXISANDGRIDEXISTENCE_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAxisAndGridExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisTitleExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisLabelExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCALE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
new file mode 100644
index 000000000000..5fca42c2b3ad
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedCharacterHeightProperty.hxx"
+#include "macros.hxx"
+#include "RelativeSizeHelper.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+//.............................................................................
+//.............................................................................
+
+//.............................................................................
+//.............................................................................
+
+namespace chart
+{
+namespace wrapper
+{
+WrappedCharacterHeightProperty_Base::WrappedCharacterHeightProperty_Base(
+ const OUString& rOuterEqualsInnerName
+ , ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedProperty( rOuterEqualsInnerName, rOuterEqualsInnerName )
+ , m_pRefSizePropProvider( pRefSizePropProvider )
+{
+}
+WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base()
+{
+}
+
+//static
+void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ReferenceSizePropertyProvider* pRefSizePropProvider )
+{
+ rList.push_back( new WrappedCharacterHeightProperty( pRefSizePropProvider ) );
+ rList.push_back( new WrappedAsianCharacterHeightProperty( pRefSizePropProvider ) );
+ rList.push_back( new WrappedComplexCharacterHeightProperty( pRefSizePropProvider ) );
+}
+
+void WrappedCharacterHeightProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(xInnerPropertySet.is())
+ {
+ if( m_pRefSizePropProvider )
+ m_pRefSizePropProvider->updateReferenceSize();
+ xInnerPropertySet->setPropertyValue( m_aInnerName, rOuterValue );
+ }
+}
+
+Any WrappedCharacterHeightProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertySet.is() )
+ {
+ aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
+ float fHeight = 0;
+ if( aRet >>= fHeight )
+ {
+ if( m_pRefSizePropProvider )
+ {
+ awt::Size aReferenceSize;
+ if( m_pRefSizePropProvider->getReferenceSize() >>= aReferenceSize )
+ {
+ awt::Size aCurrentSize = m_pRefSizePropProvider->getCurrentSizeForReference();
+ aRet <<= static_cast< float >(
+ RelativeSizeHelper::calculate( fHeight, aReferenceSize, aCurrentSize ));
+ }
+ }
+ }
+ }
+ return aRet;
+}
+
+Any WrappedCharacterHeightProperty_Base::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertyState.is() )
+ {
+ aRet = xInnerPropertyState->getPropertyDefault( m_aInnerName );
+ }
+ return aRet;
+}
+
+beans::PropertyState WrappedCharacterHeightProperty_Base::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ return beans::PropertyState_DIRECT_VALUE;
+}
+
+Any WrappedCharacterHeightProperty_Base::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ OSL_ASSERT("should not be used: WrappedCharacterHeightProperty_Base::convertInnerToOuterValue - check if you miss data");
+ return rInnerValue;
+}
+Any WrappedCharacterHeightProperty_Base::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ OSL_ASSERT("should not be used: WrappedCharacterHeightProperty_Base::convertOuterToInnerValue - check if you miss data");
+ return rOuterValue;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedCharacterHeightProperty::WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeight" ), pRefSizePropProvider )
+{
+}
+WrappedCharacterHeightProperty::~WrappedCharacterHeightProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+WrappedAsianCharacterHeightProperty::WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeightAsian" ), pRefSizePropProvider )
+{
+}
+WrappedAsianCharacterHeightProperty::~WrappedAsianCharacterHeightProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+WrappedComplexCharacterHeightProperty::WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeightComplex" ), pRefSizePropProvider )
+{
+}
+WrappedComplexCharacterHeightProperty::~WrappedComplexCharacterHeightProperty()
+{
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
new file mode 100644
index 000000000000..34329d6d3a52
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+#define CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class ReferenceSizePropertyProvider;
+
+class WrappedCharacterHeightProperty_Base : public WrappedProperty
+{
+public:
+ WrappedCharacterHeightProperty_Base( const ::rtl::OUString& rOuterEqualsInnerName, ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedCharacterHeightProperty_Base();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+protected:
+ ReferenceSizePropertyProvider* m_pRefSizePropProvider;
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedCharacterHeightProperty();
+
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList, ReferenceSizePropertyProvider* pRefSizePropProvider );
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedAsianCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedAsianCharacterHeightProperty();
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedComplexCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedComplexCharacterHeightProperty();
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
new file mode 100644
index 000000000000..bc91136590cb
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart/ChartDataCaption.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedDataCaptionProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const;
+
+ explicit WrappedDataCaptionProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedDataCaptionProperty();
+};
+
+namespace
+{
+enum
+{
+ //data caption properties
+ PROP_CHART_DATAPOINT_DATA_CAPTION = FAST_PROPERTY_ID_START_CHART_DATACAPTION_PROP
+};
+
+sal_Int32 lcl_LabelToCaption( const chart2::DataPointLabel& rLabel )
+{
+ sal_Int32 nCaption=0;
+
+ if( rLabel.ShowNumber )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::VALUE;
+ if( rLabel.ShowNumberInPercent )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::PERCENT;
+ if( rLabel.ShowCategoryName )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::TEXT;
+ if( rLabel.ShowLegendSymbol )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::SYMBOL;
+
+ return nCaption;
+}
+
+chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption )
+{
+ chart2::DataPointLabel aLabel(false,false,false,false);
+
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::VALUE )
+ aLabel.ShowNumber = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::PERCENT )
+ aLabel.ShowNumberInPercent = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::TEXT )
+ aLabel.ShowCategoryName = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::SYMBOL )
+ aLabel.ShowLegendSymbol = true;
+
+ return aLabel;
+}
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ //if !spChart2ModelContact.get() is then the created properties do belong to a single series or single datapoint
+ //otherwise they do belong to the whole diagram
+
+ rList.push_back( new WrappedDataCaptionProperty( spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedDataCaptionProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "DataCaption" ),
+ PROP_CHART_DATAPOINT_DATA_CAPTION,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedDataCaptionProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedDataCaptionProperty::WrappedDataCaptionProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("DataCaption")
+ , uno::makeAny( sal_Int32(0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedDataCaptionProperty::~WrappedDataCaptionProperty()
+{
+}
+
+sal_Int32 WrappedDataCaptionProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 aRet = 0;
+ m_aDefaultValue >>= aRet;
+ chart2::DataPointLabel aLabel;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Label")) >>= aLabel ) )
+ aRet = lcl_LabelToCaption( aLabel );
+ return aRet;
+}
+
+void WrappedDataCaptionProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nCaption ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::DataPointLabel aLabel = lcl_CaptionToLabel( nCaption );
+ xSeriesPropertySet->setPropertyValue( C2U("Label"), uno::makeAny( aLabel ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
new file mode 100644
index 000000000000..f805d7e87fa0
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+#define CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedDataCaptionProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
new file mode 100644
index 000000000000..a5dc9b23feed
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedGapwidthProperty.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+const sal_Int32 DEFAULT_GAPWIDTH = 100;
+const sal_Int32 DEFAULT_OVERLAP = 0;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedBarPositionProperty_Base::WrappedBarPositionProperty_Base(
+ const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerSequencePropertyName
+ , sal_Int32 nDefaultValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedDefaultProperty( rOuterName, rtl::OUString(), uno::makeAny( nDefaultValue ) )
+ , m_nDimensionIndex(0)
+ , m_nAxisIndex(0)
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_nDefaultValue( nDefaultValue )
+ , m_InnerSequencePropertyName( rInnerSequencePropertyName )
+{
+}
+
+void WrappedBarPositionProperty_Base::setDimensionAndAxisIndex( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ m_nDimensionIndex = nDimensionIndex;
+ m_nAxisIndex = nAxisIndex;
+}
+
+WrappedBarPositionProperty_Base::~WrappedBarPositionProperty_Base()
+{
+}
+
+void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewValue = 0;
+ if( ! (rOuterValue >>= nNewValue) )
+ throw lang::IllegalArgumentException( C2U("GapWidth and Overlap property require value of type sal_Int32"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ if( m_nDimensionIndex==1 )
+ {
+ Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aChartTypeList.getLength(); nN++ )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ 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::makeAny( aBarPositionSequence ) );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ //the above properties are not supported by all charttypes (only by column and bar)
+ //in that cases this exception is ok
+ e.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+}
+
+Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ bool bInnerValueDetected = false;
+ sal_Int32 nInnerValue = m_nDefaultValue;
+
+ if( m_nDimensionIndex==1 )
+ {
+ Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aChartTypeList.getLength() && !bInnerValueDetected; nN++ )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ Sequence< sal_Int32 > aBarPositionSequence;
+ xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
+ if( m_nAxisIndex < aBarPositionSequence.getLength() )
+ {
+ nInnerValue = aBarPositionSequence[m_nAxisIndex];
+ bInnerValueDetected = true;
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ //the above properties are not supported by all charttypes (only by column and bar)
+ //in that cases this exception is ok
+ e.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+ if( bInnerValueDetected )
+ {
+ m_aOuterValue <<= nInnerValue;
+ }
+ }
+ return m_aOuterValue;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedGapwidthProperty::WrappedGapwidthProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedBarPositionProperty_Base( C2U("GapWidth"), C2U("GapwidthSequence"), DEFAULT_GAPWIDTH, spChart2ModelContact )
+{
+}
+WrappedGapwidthProperty::~WrappedGapwidthProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedBarOverlapProperty::WrappedBarOverlapProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedBarPositionProperty_Base( C2U("Overlap"), C2U("OverlapSequence"), DEFAULT_OVERLAP, spChart2ModelContact )
+{
+}
+WrappedBarOverlapProperty::~WrappedBarOverlapProperty()
+{
+}
+
+} // namespace wrapper
+} // namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
new file mode 100644
index 000000000000..1ec7180d5455
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+#define CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+
+#include "WrappedDefaultProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedBarPositionProperty_Base : public WrappedDefaultProperty
+{
+public:
+ WrappedBarPositionProperty_Base(
+ const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerSequencePropertyName
+ , sal_Int32 nDefaultValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedBarPositionProperty_Base();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ void setDimensionAndAxisIndex( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+protected:
+ sal_Int32 m_nDimensionIndex;
+ sal_Int32 m_nAxisIndex;
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+
+ sal_Int32 m_nDefaultValue;
+ ::rtl::OUString m_InnerSequencePropertyName;
+
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+};
+
+class WrappedGapwidthProperty : public WrappedBarPositionProperty_Base
+{
+public:
+ WrappedGapwidthProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedGapwidthProperty();
+};
+
+class WrappedBarOverlapProperty : public WrappedBarPositionProperty_Base
+{
+public:
+ WrappedBarOverlapProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedBarOverlapProperty();
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
new file mode 100644
index 000000000000..7a8d1554df7d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedNumberFormatProperty.hxx"
+#include "macros.hxx"
+
+// header for define DBG_ERROR
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+//.............................................................................
+
+WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedDirectStateProperty( C2U("NumberFormat"), C2U("NumberFormat") )
+ , m_spChart2ModelContact(spChart2ModelContact)
+{
+ m_aOuterValue = getPropertyDefault( 0 );
+}
+
+WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
+{
+ if( m_pWrappedLinkNumberFormatProperty )
+ {
+ if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty == this )
+ m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty = 0;
+ }
+}
+
+void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nFormat = 0;
+ if( ! (rOuterValue >>= nFormat) )
+ throw lang::IllegalArgumentException( C2U("Property 'NumberFormat' requires value of type sal_Int32"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ if(xInnerPropertySet.is())
+ {
+ bool bUseSourceFormat = !xInnerPropertySet->getPropertyValue( C2U("NumberFormat" )).hasValue();
+ if( bUseSourceFormat )
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
+ bUseSourceFormat = false;
+ }
+ if( !bUseSourceFormat )
+ xInnerPropertySet->setPropertyValue( m_aInnerName, this->convertOuterToInnerValue( rOuterValue ) );
+ }
+}
+
+Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
+ return Any();
+ }
+ Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
+ if( !aRet.hasValue() )
+ {
+ sal_Int32 nKey = 0;
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
+ if( xSeries.is() )
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
+ else
+ {
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ }
+ aRet <<= nKey;
+ }
+ return aRet;
+}
+
+Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( sal_Int32( 0 ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty )
+ : WrappedProperty( C2U("LinkNumberFormatToSource"), C2U("") )
+ , m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty )
+{
+ if( m_pWrappedNumberFormatProperty )
+ {
+ m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = this;
+ }
+}
+
+WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
+{
+ if( m_pWrappedNumberFormatProperty )
+ {
+ if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty == this )
+ m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 0;
+ }
+}
+
+void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue");
+ return;
+ }
+
+ bool bLinkFormat = false;
+ if( rOuterValue >>= bLinkFormat )
+ {
+ Any aValue;
+ if( bLinkFormat )
+ {
+ if( m_pWrappedNumberFormatProperty )
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
+ return;
+ }
+ }
+ else
+ {
+ if( m_pWrappedNumberFormatProperty )
+ {
+ aValue = m_pWrappedNumberFormatProperty->getPropertyValue( xInnerPropertySet );
+ }
+ else
+ aValue <<= sal_Int32( 0 );
+ }
+
+ xInnerPropertySet->setPropertyValue( C2U("NumberFormat"), aValue );
+ }
+}
+
+Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
+ return getPropertyDefault(0);
+ }
+ bool bLink = ! xInnerPropertySet->getPropertyValue( C2U("NumberFormat" )).hasValue();
+ return uno::makeAny( bLink );
+}
+
+Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bLink = true;
+ return uno::makeAny( bLink );
+}
+
+//.............................................................................
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
new file mode 100644
index 000000000000..51e9b253150b
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+#define CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+
+#include "WrappedDirectStateProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+//.............................................................................
+
+class WrappedLinkNumberFormatProperty;
+
+class WrappedNumberFormatProperty : public WrappedDirectStateProperty
+{
+public:
+ WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedNumberFormatProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ friend class WrappedLinkNumberFormatProperty;
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty;
+};
+
+class WrappedLinkNumberFormatProperty : public WrappedProperty
+{
+public:
+ WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty );
+ virtual ~WrappedLinkNumberFormatProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ friend class WrappedNumberFormatProperty;
+private:
+ WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty;
+};
+
+//.............................................................................
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
new file mode 100644
index 000000000000..b0fc030d0fbf
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedScaleProperty.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "AxisHelper.hxx"
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/AxisOrientation.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eScaleProperty( eScaleProperty )
+{
+ switch( m_eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ m_aOuterName = C2U("Max");
+ break;
+ case SCALE_PROP_MIN:
+ m_aOuterName = C2U("Min");
+ break;
+ case SCALE_PROP_ORIGIN:
+ m_aOuterName = C2U("Origin");
+ break;
+ case SCALE_PROP_STEPMAIN:
+ m_aOuterName = C2U("StepMain");
+ break;
+ case SCALE_PROP_STEPHELP:
+ m_aOuterName = C2U("StepHelp");
+ break;
+ case SCALE_PROP_STEPHELP_COUNT:
+ m_aOuterName = C2U("StepHelpCount");
+ break;
+ case SCALE_PROP_AUTO_MAX:
+ m_aOuterName = C2U("AutoMax");
+ break;
+ case SCALE_PROP_AUTO_MIN:
+ m_aOuterName = C2U("AutoMin");
+ break;
+ case SCALE_PROP_AUTO_ORIGIN:
+ m_aOuterName = C2U("AutoOrigin");
+ break;
+ case SCALE_PROP_AUTO_STEPMAIN:
+ m_aOuterName = C2U("AutoStepMain");
+ break;
+ case SCALE_PROP_AUTO_STEPHELP:
+ m_aOuterName = C2U("AutoStepHelp");
+ break;
+ case SCALE_PROP_LOGARITHMIC:
+ m_aOuterName = C2U("Logarithmic");
+ break;
+ case SCALE_PROP_REVERSEDIRECTION:
+ m_aOuterName = C2U("ReverseDirection");
+ break;
+ default:
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+}
+
+WrappedScaleProperty::~WrappedScaleProperty()
+{
+}
+
+//static
+void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_MAX, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_MIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_ORIGIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPMAIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP_COUNT, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MAX, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_ORIGIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPMAIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) );
+}
+
+void WrappedScaleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ setPropertyValue( m_eScaleProperty, rOuterValue, xInnerPropertySet );
+}
+
+Any WrappedScaleProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return getPropertyValue( m_eScaleProperty, xInnerPropertySet );
+}
+
+void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ OSL_ENSURE(xAxis.is(),"need an XAxis");
+ if(!xAxis.is())
+ return;
+
+ bool bSetScaleData = false;
+
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+
+ sal_Bool bBool = false;
+ switch( eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ {
+ aScaleData.Maximum = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_MIN:
+ {
+ aScaleData.Minimum = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPMAIN:
+ {
+ aScaleData.IncrementData.Distance = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+
+ double fStepMain = 0, fStepHelp = 0;
+ if( (rOuterValue >>= fStepHelp) )
+ {
+ if( AxisHelper::isLogarithmic(aScaleData.Scaling) )
+ {
+ sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp);
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ }
+ else if( (fStepHelp != 0.0) &&
+ (aScaleData.IncrementData.Distance >>= fStepMain) )
+ {
+ // approximate interval count
+ sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ }
+ }
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPHELP_COUNT:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+ sal_Int32 nIntervalCount=0;
+ if( rOuterValue>>=nIntervalCount )
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ else
+ rSubIncrements[ 0 ].IntervalCount = Any();
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_MAX:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Maximum = Any();
+ else
+ aScaleData.Maximum = getPropertyValue( SCALE_PROP_MAX, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_MIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Minimum = Any();
+ else
+ aScaleData.Minimum = getPropertyValue( SCALE_PROP_MIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPMAIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.IncrementData.Distance = Any();
+ else
+ aScaleData.IncrementData.Distance = getPropertyValue( SCALE_PROP_STEPMAIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+
+ if( (rOuterValue >>= bBool) && bBool )
+ rSubIncrements[ 0 ].IntervalCount = Any();
+ else
+ rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_ORIGIN:
+ {
+ aScaleData.Origin = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_ORIGIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Origin = Any();
+ else
+ aScaleData.Origin = getPropertyValue( SCALE_PROP_ORIGIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_LOGARITHMIC:
+ {
+ if( rOuterValue >>= bBool )
+ {
+ bool bWasLogarithm = AxisHelper::isLogarithmic( aScaleData.Scaling );
+
+ // safe comparison between sal_Bool and bool
+ if( (!bBool) != (!bWasLogarithm) )
+ {
+ if( bBool )
+ aScaleData.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
+ else
+ aScaleData.Scaling = 0;
+ bSetScaleData = true;
+ }
+ }
+ break;
+ }
+ case SCALE_PROP_REVERSEDIRECTION:
+ {
+ if( rOuterValue >>= bBool )
+ {
+ bool bWasReverse = ( AxisOrientation_REVERSE == aScaleData.Orientation );
+ if( (!bBool) != (!bWasReverse) ) // safe comparison between sal_Bool and bool
+ {
+ aScaleData.Orientation = bBool ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
+ bSetScaleData = true;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+ }
+
+ if( bSetScaleData )
+ xAxis->setScaleData( aScaleData );
+}
+
+Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( m_aOuterValue );
+
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ OSL_ENSURE(xAxis.is(),"need an XAxis");
+ if(!xAxis.is())
+ return aRet;
+
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+
+ chart2::ExplicitScaleData aExplicitScale;
+ chart2::ExplicitIncrementData aExplicitIncrement;
+
+ switch( eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ {
+ aRet = aScaleData.Maximum;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Maximum;
+ }
+ break;
+ }
+ case SCALE_PROP_MIN:
+ {
+ aRet = aScaleData.Minimum;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Minimum;
+ }
+ break;
+ }
+
+ case SCALE_PROP_STEPMAIN:
+ {
+ aRet = aScaleData.IncrementData.Distance;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitIncrement.Distance;
+ }
+ break;
+ }
+ case SCALE_PROP_STEPHELP:
+ {
+ // todo: evaluate PostEquidistant
+ bool bNeedToCalculateExplicitValues = true;
+
+ bool bLogarithmic( AxisHelper::isLogarithmic(aScaleData.Scaling) );
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( bLogarithmic )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ sal_Int32 nIntervalCount = 0;
+ rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount;
+ aRet = uno::makeAny( double(nIntervalCount) );
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+ else if( aScaleData.IncrementData.Distance.hasValue() )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ double fStepMain = 0;
+ sal_Int32 nIntervalCount = 0;
+ if( (aScaleData.IncrementData.Distance >>= fStepMain) &&
+ (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) &&
+ nIntervalCount > 0 )
+ {
+ aRet <<= ( fStepMain / static_cast< double >( nIntervalCount ) );
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+ else
+ {
+ aRet = aScaleData.IncrementData.Distance;
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+
+ if( bNeedToCalculateExplicitValues )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ if( aExplicitIncrement.SubIncrements.getLength() > 0 &&
+ aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 )
+ {
+ if( bLogarithmic )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ sal_Int32 nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
+ aRet = uno::makeAny( double(nIntervalCount) );
+ }
+ }
+ else
+ aRet <<= ( aExplicitIncrement.Distance /
+ static_cast< double >(
+ aExplicitIncrement.SubIncrements[ 0 ].IntervalCount ));
+ }
+ else
+ {
+ if( bLogarithmic )
+ aRet <<= 5.0;
+ else
+ aRet <<= aExplicitIncrement.Distance;
+ }
+ }
+ break;
+ }
+ case SCALE_PROP_STEPHELP_COUNT:
+ {
+ sal_Int32 nIntervalCount = 0;
+ bool bNeedToCalculateExplicitValues = true;
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() > 0 )
+ {
+ if( (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) && (nIntervalCount > 0) )
+ bNeedToCalculateExplicitValues = false;
+ }
+ if( bNeedToCalculateExplicitValues )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
+ if( aExplicitIncrement.SubIncrements.getLength() > 0 )
+ nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
+ }
+ aRet = uno::makeAny( nIntervalCount );
+ break;
+ }
+ case SCALE_PROP_AUTO_MAX:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.Maximum.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_MIN:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.Minimum.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPMAIN:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.IncrementData.Distance.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() > 0 )
+ aRet <<= (sal_Bool)( !rSubIncrements[ 0 ].IntervalCount.hasValue() );
+ else
+ aRet <<= sal_True;
+ break;
+ }
+ case SCALE_PROP_ORIGIN:
+ {
+ aRet = aScaleData.Origin;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Origin;
+ }
+ break;
+ }
+ case SCALE_PROP_AUTO_ORIGIN:
+ {
+ aRet <<= !hasDoubleValue(aScaleData.Origin);
+ break;
+ }
+ case SCALE_PROP_LOGARITHMIC:
+ {
+ aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) );
+ break;
+ }
+ case SCALE_PROP_REVERSEDIRECTION:
+ {
+ aRet <<= static_cast< sal_Bool >( AxisOrientation_REVERSE == aScaleData.Orientation );
+ break;
+ }
+ default:
+ {
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+ }
+
+ return aRet;
+}
+
+} // namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
new file mode 100644
index 000000000000..4d29bc009777
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SCALE_PROPERTY_HXX
+#define CHART_WRAPPED_SCALE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleProperty : public WrappedProperty
+{
+public:
+ enum tScaleProperty
+ {
+ SCALE_PROP_MAX
+ , SCALE_PROP_MIN
+ , SCALE_PROP_ORIGIN
+ , SCALE_PROP_STEPMAIN
+ , SCALE_PROP_STEPHELP //deprecated property
+ , SCALE_PROP_STEPHELP_COUNT
+ , SCALE_PROP_AUTO_MAX
+ , SCALE_PROP_AUTO_MIN
+ , SCALE_PROP_AUTO_ORIGIN
+ , SCALE_PROP_AUTO_STEPMAIN
+ , SCALE_PROP_AUTO_STEPHELP
+ , SCALE_PROP_LOGARITHMIC
+ , SCALE_PROP_REVERSEDIRECTION
+ };
+
+public:
+ WrappedScaleProperty( tScaleProperty eScaleProperty, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedScaleProperty();
+
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ void setPropertyValue( tScaleProperty eScaleProperty, const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any getPropertyValue( tScaleProperty eScaleProperty, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ tScaleProperty m_eScaleProperty;
+
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+};
+
+} // namespace wrapper
+} // namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCALE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
new file mode 100644
index 000000000000..5e11a3012cf3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+
+#include "WrappedScaleTextProperties.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleTextProperty : public WrappedProperty
+{
+public:
+ WrappedScaleTextProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedScaleTextProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedScaleTextProperty::WrappedScaleTextProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : ::chart::WrappedProperty( C2U( "ScaleText" ), rtl::OUString() )
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedScaleTextProperty::~WrappedScaleTextProperty()
+{
+}
+
+void WrappedScaleTextProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize") );
+
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ {
+ if( rOuterValue.hasValue() )
+ throw lang::IllegalArgumentException( C2U("Property ScaleText requires value of type boolean"), 0, 0 );
+ }
+
+ try
+ {
+ if( bNewValue )
+ {
+ awt::Size aRefSize( m_spChart2ModelContact->GetPageSize() );
+ xInnerPropertySet->setPropertyValue( aRefSizeName, uno::makeAny( aRefSize ) );
+ }
+ else
+ xInnerPropertySet->setPropertyValue( aRefSizeName, Any() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedScaleTextProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize") );
+
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ if( xInnerPropertySet->getPropertyValue( aRefSizeName ).hasValue() )
+ aRet <<= true;
+ else
+ aRet <<= false;
+ }
+
+ return aRet;
+}
+
+Any WrappedScaleTextProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+namespace
+{
+enum
+{
+ PROP_CHART_SCALE_TEXT = FAST_PROPERTY_ID_START_SCALE_TEXT_PROP
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedScaleTextProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ScaleText" ),
+ PROP_CHART_SCALE_TEXT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedScaleTextProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedScaleTextProperty( spChart2ModelContact ) );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
new file mode 100644
index 000000000000..0094e30f7def
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_WRAPPED_SCALETEXT_PROPERTIES_HXX
+#define CHART_WRAPPED_SCALETEXT_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleTextProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property >& rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
new file mode 100644
index 000000000000..68d408ea7147
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSceneProperty.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "BaseGFXHelper.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//static
+void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("D3DTransformMatrix"),C2U("D3DTransformMatrix"))
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
+{
+}
+
+void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ {
+ drawing::HomogenMatrix aHM;
+ if( rOuterValue >>= aHM )
+ {
+ ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
+ BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
+
+ ::basegfx::B3DHomMatrix aMatrix;
+ aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
+ ::basegfx::B3DHomMatrix aObjectMatrix;
+ ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
+
+ aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
+
+ WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
+ return;
+ }
+ }
+
+ WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
+}
+
+Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ {
+ uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
+ drawing::HomogenMatrix aHM;
+ if( aAMatrix >>= aHM )
+ {
+ ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
+ BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
+
+ ::basegfx::B3DHomMatrix aMatrix;
+ aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
+ ::basegfx::B3DHomMatrix aObjectMatrix;
+ ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
+
+ aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
+
+ return uno::makeAny(aHM);
+ }
+ }
+
+ return WrappedProperty::getPropertyValue( xInnerPropertySet );
+}
+
+Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return WrappedProperty::getPropertyDefault( xInnerPropertyState );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
new file mode 100644
index 000000000000..23a186de6406
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SCENE_PROPERTY_HXX
+#define CHART_WRAPPED_SCENE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSceneProperty
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedD3DTransformMatrixProperty : public WrappedProperty
+{
+public:
+ WrappedD3DTransformMatrixProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedD3DTransformMatrixProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCENE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
new file mode 100644
index 000000000000..6124e2baf506
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSeriesAreaOrLineProperty.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "macros.hxx"
+
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+WrappedSeriesAreaOrLineProperty::WrappedSeriesAreaOrLineProperty(
+ const rtl::OUString& rOuterName
+ , const rtl::OUString& rInnerAreaTypeName
+ , const rtl::OUString& rInnerLineTypeName
+ , DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedProperty( rOuterName, C2U( "" ) )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aInnerAreaTypeName( rInnerAreaTypeName )
+ , m_aInnerLineTypeName( rInnerLineTypeName )
+{
+}
+WrappedSeriesAreaOrLineProperty::~WrappedSeriesAreaOrLineProperty()
+{
+}
+
+//virtual
+::rtl::OUString WrappedSeriesAreaOrLineProperty::getInnerName() const
+{
+ if( m_pDataSeriesPointWrapper && !m_pDataSeriesPointWrapper->isSupportingAreaProperties() )
+ return m_aInnerLineTypeName;
+ return m_aInnerAreaTypeName;
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
new file mode 100644
index 000000000000..6045802f4a5d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+#define CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class DataSeriesPointWrapper;
+class WrappedSeriesAreaOrLineProperty : public WrappedProperty
+{
+public:
+ WrappedSeriesAreaOrLineProperty( const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerAreaTypeName, const ::rtl::OUString& rInnerLineTypeName
+ , DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedSeriesAreaOrLineProperty();
+
+ virtual ::rtl::OUString getInnerName() const;
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ ::rtl::OUString m_aInnerAreaTypeName;
+ ::rtl::OUString m_aInnerLineTypeName;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
new file mode 100644
index 000000000000..02ab979163bb
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+#define CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/XDataSeries.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+enum tSeriesOrDiagramPropertyType
+{
+ DATA_SERIES,
+ DIAGRAM
+};
+
+//PROPERTYTYPE is the type of the outer property
+
+template< typename PROPERTYTYPE >
+class WrappedSeriesOrDiagramProperty : public WrappedProperty
+{
+public:
+ virtual PROPERTYTYPE getValueFromSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet ) const =0;
+ virtual void setValueToSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet, PROPERTYTYPE aNewValue ) const =0;
+
+ explicit WrappedSeriesOrDiagramProperty( const ::rtl::OUString& rName, const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedProperty(rName,::rtl::OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue(rDefaulValue)
+ , m_aDefaultValue(rDefaulValue)
+ , m_ePropertyType( ePropertyType )
+ {
+ }
+ virtual ~WrappedSeriesOrDiagramProperty() {};
+
+ bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
+ {
+ bool bHasDetectableInnerValue = false;
+ rHasAmbiguousValue = false;
+ if( m_ePropertyType == DIAGRAM &&
+ m_spChart2ModelContact.get() )
+ {
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >::const_iterator aIter =
+ aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ PROPERTYTYPE aCurValue = getValueFromSeries( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >::query( *aIter ) );
+ if( !bHasDetectableInnerValue )
+ rValue = aCurValue;
+ else
+ {
+ if( rValue != aCurValue )
+ {
+ rHasAmbiguousValue = true;
+ break;
+ }
+ else
+ rValue = aCurValue;
+ }
+ bHasDetectableInnerValue = true;
+ }
+ }
+ return bHasDetectableInnerValue;
+ }
+ void setInnerValue( PROPERTYTYPE aNewValue ) const
+ {
+ if( m_ePropertyType == DIAGRAM &&
+ m_spChart2ModelContact.get() )
+ {
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >::const_iterator aIter =
+ aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSeriesPropertySet( *aIter, ::com::sun::star::uno::UNO_QUERY );
+ if( xSeriesPropertySet.is() )
+ {
+ setValueToSeries( xSeriesPropertySet, aNewValue );
+ }
+ }
+ }
+ }
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ PROPERTYTYPE aNewValue = PROPERTYTYPE();
+ if( ! (rOuterValue >>= aNewValue) )
+ throw ::com::sun::star::lang::IllegalArgumentException( C2U("statistic property requires different type"), 0, 0 );
+
+ if( m_ePropertyType == DIAGRAM )
+ {
+ m_aOuterValue = rOuterValue;
+
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aOldValue = PROPERTYTYPE();
+ if( detectInnerValue( aOldValue, bHasAmbiguousValue ) )
+ {
+ if( bHasAmbiguousValue || aNewValue != aOldValue )
+ setInnerValue( aNewValue );
+ }
+ }
+ else
+ {
+ setValueToSeries( xInnerPropertySet, aNewValue );
+ }
+ }
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ if( m_ePropertyType == DIAGRAM )
+ {
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aValue;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ if(bHasAmbiguousValue)
+ m_aOuterValue <<= m_aDefaultValue;
+ else
+ m_aOuterValue <<= aValue;
+ }
+ return m_aOuterValue;
+ }
+ else
+ {
+ ::com::sun::star::uno::Any aRet( m_aDefaultValue );
+ aRet <<= getValueFromSeries( xInnerPropertySet );
+ return aRet;
+ }
+ }
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ return m_aDefaultValue;
+ }
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+ tSeriesOrDiagramPropertyType m_ePropertyType;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
new file mode 100644
index 000000000000..16ddb1137d4a
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSplineProperties.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//PROPERTYTYPE is the type of the outer property
+
+template< typename PROPERTYTYPE >
+class WrappedSplineProperty : public WrappedProperty
+{
+public:
+ explicit WrappedSplineProperty( const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(rOuterName,OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue(rDefaulValue)
+ , m_aDefaultValue(rDefaulValue)
+ , m_aOwnInnerName(rInnerName)
+ {
+ }
+ virtual ~WrappedSplineProperty() {};
+
+ bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
+ {
+ bool bHasDetectableInnerValue = false;
+ rHasAmbiguousValue = false;
+ Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > aChartTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ {
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], ::com::sun::star::uno::UNO_QUERY );
+
+ Any aSingleValue = this->convertInnerToOuterValue( xChartTypePropertySet->getPropertyValue(m_aOwnInnerName) );
+ PROPERTYTYPE aCurValue = PROPERTYTYPE();
+ aSingleValue >>= aCurValue;
+ if( !bHasDetectableInnerValue )
+ rValue = aCurValue;
+ else
+ {
+ if( rValue != aCurValue )
+ {
+ rHasAmbiguousValue = true;
+ break;
+ }
+ else
+ rValue = aCurValue;
+ }
+ bHasDetectableInnerValue = true;
+ }
+ catch( uno::Exception & ex )
+ {
+ //spline properties are not supported by all charttypes
+ //in that cases this exception is ok
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ return bHasDetectableInnerValue;
+ }
+ void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ PROPERTYTYPE aNewValue;
+ if( ! (rOuterValue >>= aNewValue) )
+ throw ::com::sun::star::lang::IllegalArgumentException( C2U("spline property requires different type"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aOldValue;
+ if( detectInnerValue( aOldValue, bHasAmbiguousValue ) )
+ {
+ if( bHasAmbiguousValue || aNewValue != aOldValue )
+ {
+ Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > aChartTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ {
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], ::com::sun::star::uno::UNO_QUERY );
+ if( xChartTypePropertySet.is() )
+ {
+ xChartTypePropertySet->setPropertyValue(m_aOwnInnerName,this->convertOuterToInnerValue(uno::makeAny(aNewValue)));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ //spline properties are not supported by all charttypes
+ //in that cases this exception is ok
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+ }
+ }
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aValue;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ m_aOuterValue <<= aValue;
+ }
+ return m_aOuterValue;
+ }
+
+ ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ return m_aDefaultValue;
+ }
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+ // this inner name is not set as inner name at the base class
+ const OUString m_aOwnInnerName;
+};
+
+class WrappedSplineTypeProperty : public WrappedSplineProperty< sal_Int32 >
+{
+public:
+ explicit WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedSplineTypeProperty();
+
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+};
+
+namespace
+{
+enum
+{
+ //spline properties
+ PROP_CHART_SPLINE_TYPE = FAST_PROPERTY_ID_START_CHART_SPLINE_PROP
+ , PROP_CHART_SPLINE_ORDER
+ , PROP_CHART_SPLINE_RESOLUTION
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedSplineProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "SplineType" ),
+ PROP_CHART_SPLINE_TYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_CHART_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineResolution" ),
+ PROP_CHART_SPLINE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) );
+ rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(2)), spChart2ModelContact ) );
+ rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineResolution"), C2U("CurveResolution"), uno::makeAny(sal_Int32(20)), spChart2ModelContact ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+
+WrappedSplineTypeProperty::WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedSplineProperty<sal_Int32>( C2U("SplineType"), C2U("CurveStyle"), uno::makeAny(sal_Int32(0)), spChart2ModelContact )
+{
+}
+WrappedSplineTypeProperty::~WrappedSplineTypeProperty()
+{
+}
+Any WrappedSplineTypeProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ chart2::CurveStyle aInnerValue = chart2::CurveStyle_LINES;
+ rInnerValue >>= aInnerValue;
+
+ sal_Int32 nOuterValue;
+ if( chart2::CurveStyle_CUBIC_SPLINES == aInnerValue )
+ nOuterValue = 1;
+ else if( chart2::CurveStyle_B_SPLINES == aInnerValue )
+ nOuterValue = 2;
+ else
+ nOuterValue = 0;
+
+ return uno::makeAny(nOuterValue);
+}
+Any WrappedSplineTypeProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ sal_Int32 nOuterValue=0;
+ rOuterValue >>= nOuterValue;
+
+ chart2::CurveStyle aInnerValue;
+
+ if(1==nOuterValue)
+ aInnerValue = chart2::CurveStyle_CUBIC_SPLINES;
+ else if(2==nOuterValue)
+ aInnerValue = chart2::CurveStyle_B_SPLINES;
+ else
+ aInnerValue = chart2::CurveStyle_LINES;
+
+ return uno::makeAny(aInnerValue);
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
new file mode 100644
index 000000000000..877d9cbe9a51
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+#define CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSplineProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
new file mode 100644
index 000000000000..1c7b495bd566
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
@@ -0,0 +1,1154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ErrorBar.hxx"
+#include "StatisticsHelper.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartErrorCategory.hpp>
+#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/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+namespace
+{
+
+Any lcl_getRegressionDefault()
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType( RegressionCurveHelper::tRegressionType eRegressionType )
+{
+ ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ switch(eRegressionType)
+ {
+ case RegressionCurveHelper::REGRESSION_TYPE_LINEAR:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_LOG:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_EXP:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_POWER:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
+ break;
+ default:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ break;
+ }
+ return eRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+RegressionCurveHelper::tRegressionType lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
+{
+ RegressionCurveHelper::tRegressionType eRet;
+ switch(eRegressionCurveType)
+ {
+ case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_LOG;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_EXP;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
+ case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_POWER;
+ break;
+ default:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_NONE;
+ break;
+ }
+ return eRet;
+}
+
+sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
+{
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ if(xErrorBarProperties.is())
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
+ return nStyle;
+}
+
+uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ uno::Reference< chart2::data::XDataProvider > xResult;
+ if( spChart2ModelContact.get())
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc(
+ spChart2ModelContact->getChart2Document());
+ if( xChartDoc.is())
+ xResult.set( xChartDoc->getDataProvider());
+ }
+ return xResult;
+}
+
+void lcl_ConvertRangeFromXML(
+ ::rtl::OUString & rInOutRange,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ if( rInOutRange.getLength())
+ {
+ uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
+ lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
+ if( xConverter.is())
+ {
+ ::rtl::OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
+ rInOutRange = aResult;
+ }
+ }
+}
+
+void lcl_ConvertRangeToXML(
+ ::rtl::OUString & rInOutRange,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ if( rInOutRange.getLength())
+ {
+ uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
+ lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
+ if( xConverter.is())
+ {
+ ::rtl::OUString aResult = xConverter->convertRangeToXML( rInOutRange );
+ rInOutRange = aResult;
+ }
+ }
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+template< typename PROPERTYTYPE >
+class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
+{
+public:
+ explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
+ {}
+ virtual ~WrappedStatisticProperty() {};
+
+
+protected:
+ uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+ {
+ if(!xSeriesPropertySet.is())
+ return 0;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties;
+ if( !xErrorBarProperties.is() )
+ {
+ // todo: use a valid context
+ xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
+ //default in new and old api are different
+ xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(sal_Bool(sal_False)) );
+ xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(sal_Bool(sal_False)) );
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
+ xSeriesPropertySet->setPropertyValue( C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProperties ) );
+ }
+ return xErrorBarProperties;
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_CONST_ERROR_LOW
+class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedConstantErrorLowProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ConstantErrorLow")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
+{
+}
+
+double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "NegativeError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_CONST_ERROR_HIGH
+class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedConstantErrorHighProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ConstantErrorHigh")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
+{
+}
+
+double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_MEAN_VALUE
+class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
+{
+public:
+ virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const;
+
+ explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedMeanValueProperty();
+};
+
+WrappedMeanValueProperty::WrappedMeanValueProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< sal_Bool >( C2U("MeanValue"), uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedMeanValueProperty::~WrappedMeanValueProperty()
+{
+}
+
+sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Bool bRet = sal_False;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
+ return bRet;
+}
+void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ if(aNewValue)
+ RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
+ else
+ RegressionCurveHelper::removeMeanValueLine( xRegCnt );
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_CATEGORY
+// deprecated, replaced by ErrorBarStyle
+class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
+{
+public:
+ virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const;
+
+ explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorCategoryProperty();
+};
+
+WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( C2U("ErrorCategory")
+ , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
+{
+}
+
+::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
+ switch(nStyle)
+ {
+ case ::com::sun::star::chart::ErrorBarStyle::NONE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
+ break;
+ default:
+ break;
+ }
+ }
+ return aRet;
+}
+void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const
+{
+ if( !xSeriesPropertySet.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_NONE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
+ break;
+ default:
+ break;
+ }
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(nNewStyle) );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_PERCENT_ERROR
+class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedPercentageErrorProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("PercentageError")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
+{
+}
+
+double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_MARGIN
+class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorMarginProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorMarginProperty::WrappedErrorMarginProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ErrorMargin")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
+{
+}
+
+double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_INDICATOR
+class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
+{
+public:
+ virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const;
+
+ explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorIndicatorProperty();
+};
+
+WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( C2U("ErrorIndicator")
+ , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
+{
+}
+
+::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ sal_Bool bPositive = sal_False;
+ sal_Bool bNegative = sal_False;
+ xErrorBarProperties->getPropertyValue( C2U( "ShowPositiveError" )) >>= bPositive;
+ xErrorBarProperties->getPropertyValue( C2U( "ShowNegativeError" )) >>= bNegative;
+
+ if( bPositive && bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
+ else if( bPositive && !bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
+ else if( !bPositive && bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
+ }
+ return aRet;
+}
+void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ sal_Bool bPositive = sal_False;
+ sal_Bool bNegative = sal_False;
+ switch( aNewValue )
+ {
+ case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
+ bPositive = sal_True;
+ bNegative = sal_True;
+ break;
+ case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
+ bPositive = sal_True;
+ break;
+ case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
+ bNegative = sal_True;
+ break;
+ default:
+ break;
+ }
+
+ xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(bPositive) );
+ xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(bNegative) );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_BAR_STYLE
+// this is the new constant group that replaces the deprecated enum ChartErrorCategory
+class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const;
+
+ explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarStyleProperty();
+};
+
+WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< sal_Int32 >( C2U("ErrorBarStyle")
+ , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
+{
+}
+
+sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ m_aDefaultValue >>= nRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nRet;
+ }
+ return nRet;
+}
+void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const
+{
+ if( !xSeriesPropertySet.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny( nNewValue ));
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
+class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
+
+ explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarRangePositiveProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangePositive")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
+{
+}
+
+OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
+ if( xSeriesPropertySet.is() &&
+ ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
+ xErrorBarDataSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarDataSource, true /* positive */, true /* y-error */ ));
+ if( xSeq.is())
+ aRet = xSeq->getSourceRangeRepresentation();
+ else
+ m_aOuterValue >>= aRet;
+ }
+ lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
+ return aRet;
+}
+
+void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider(
+ lcl_getDataProviderFromContact( m_spChart2ModelContact ));
+ uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
+ if( xDataSource.is() && xDataProvider.is())
+ {
+ OUString aXMLRange( aNewValue );
+ lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
+ StatisticsHelper::setErrorDataSequence(
+ xDataSource, xDataProvider, aNewValue, true /* positive */, true /* y-error */, &aXMLRange );
+ m_aOuterValue <<= aNewValue;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
+class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
+
+ explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarRangeNegativeProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangeNegative")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
+{
+}
+
+OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
+ if( xSeriesPropertySet.is() &&
+ ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
+ xErrorBarDataSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarDataSource, false /* positive */, true /* y-error */ ));
+ if( xSeq.is())
+ aRet = xSeq->getSourceRangeRepresentation();
+ else
+ m_aOuterValue >>= aRet;
+ }
+ lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
+ return aRet;
+}
+
+void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider(
+ lcl_getDataProviderFromContact( m_spChart2ModelContact ));
+ uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
+ if( xDataSource.is() && xDataProvider.is())
+ {
+ OUString aXMLRange( aNewValue );
+ lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
+ StatisticsHelper::setErrorDataSequence(
+ xDataSource, xDataProvider, aNewValue, false /* positive */, true /* y-error */, &aXMLRange );
+ m_aOuterValue <<= aNewValue;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_REGRESSION_CURVES
+class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
+{
+public:
+ virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const;
+
+ explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedRegressionCurvesProperty();
+};
+
+WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( C2U("RegressionCurves")
+ , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
+{
+}
+
+::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartRegressionCurveType aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ aRet = lcl_getRegressionCurveType(
+ RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
+ }
+ return aRet;
+}
+void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ RegressionCurveHelper::tRegressionType eNewRegressionType = lcl_getRegressionType( aNewValue );
+ RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
+ if( eNewRegressionType != RegressionCurveHelper::REGRESSION_TYPE_NONE )
+ RegressionCurveHelper::addRegressionCurve( eNewRegressionType, xRegCnt, 0, 0 );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
+//PROP_CHART_STATISTIC_ERROR_PROPERTIES
+//PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
+class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
+{
+public:
+ virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ // properties are read-only, so this method should never be called
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, Reference< beans::XPropertySet > xNewValue ) const;
+
+ enum PropertySetType
+ {
+ PROPERTY_SET_TYPE_REGRESSION,
+ PROPERTY_SET_TYPE_ERROR_BAR,
+ PROPERTY_SET_TYPE_MEAN_VALUE
+ };
+
+ explicit WrappedStatisticPropertySetProperty(
+ PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedStatisticPropertySetProperty();
+
+private:
+ PropertySetType m_eType;
+};
+
+WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
+ PropertySetType ePropertySetType
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
+ (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
+ ? C2U("DataRegressionProperties")
+ : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
+ ? C2U("DataErrorProperties")
+ : C2U("DataMeanValueProperties")
+ , uno::Any(), spChart2ModelContact, ePropertyType )
+ , m_eType( ePropertySetType )
+{
+}
+WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
+{
+}
+
+Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ Reference< beans::XPropertySet > xResult;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+
+ switch( m_eType )
+ {
+ case PROPERTY_SET_TYPE_REGRESSION:
+ if( xRegCnt.is() )
+ xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ break;
+ case PROPERTY_SET_TYPE_ERROR_BAR:
+ if( xSeriesPropertySet.is())
+ xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult;
+ break;
+ case PROPERTY_SET_TYPE_MEAN_VALUE:
+ if( xRegCnt.is() )
+ xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ break;
+ }
+
+ return xResult;
+}
+
+void WrappedStatisticPropertySetProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
+ , Reference< beans::XPropertySet > /* xNewValue */ ) const
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+enum
+{
+ //statistic properties
+ PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
+ PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
+ PROP_CHART_STATISTIC_MEAN_VALUE,
+ PROP_CHART_STATISTIC_ERROR_CATEGORY,
+ PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
+ PROP_CHART_STATISTIC_PERCENT_ERROR,
+ PROP_CHART_STATISTIC_ERROR_MARGIN,
+ PROP_CHART_STATISTIC_ERROR_INDICATOR,
+ PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
+ PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
+ PROP_CHART_STATISTIC_REGRESSION_CURVES,
+ PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
+ PROP_CHART_STATISTIC_ERROR_PROPERTIES,
+ PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
+};
+
+/** @parameter bDataSeriesProperty if true, this property is for a single data
+ series, if false, it is for the whole diagram, i.e. for all
+ series
+ */
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//static
+void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ConstantErrorLow" ),
+ PROP_CHART_STATISTIC_CONST_ERROR_LOW,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ConstantErrorHigh" ),
+ PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "MeanValue" ),
+ PROP_CHART_STATISTIC_MEAN_VALUE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorCategory" ),
+ PROP_CHART_STATISTIC_ERROR_CATEGORY,
+ ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorCategory * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarStyle" ),
+ PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "PercentageError" ),
+ PROP_CHART_STATISTIC_PERCENT_ERROR,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorMargin" ),
+ PROP_CHART_STATISTIC_ERROR_MARGIN,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorIndicator" ),
+ PROP_CHART_STATISTIC_ERROR_INDICATOR,
+ ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorIndicatorType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarRangePositive" ),
+ PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
+ ::getCppuType( reinterpret_cast< OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarRangeNegative" ),
+ PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
+ ::getCppuType( reinterpret_cast< OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "RegressionCurves" ),
+ PROP_CHART_STATISTIC_REGRESSION_CURVES,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartRegressionCurveType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DataRegressionProperties" ),
+ PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "DataErrorProperties" ),
+ PROP_CHART_STATISTIC_ERROR_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "DataMeanValueProperties" ),
+ PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
new file mode 100644
index 000000000000..973f0fef8ec8
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+#define CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedStatisticProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
new file mode 100644
index 000000000000..3ecb23ce84d2
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
@@ -0,0 +1,330 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedStockProperties.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedStockProperty : public WrappedProperty
+{
+public:
+ explicit WrappedStockProperty( const ::rtl::OUString& rOuterName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedStockProperty();
+
+ void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const = 0;
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+};
+
+WrappedStockProperty::WrappedStockProperty( const ::rtl::OUString& rOuterName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(rOuterName,rtl::OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue()
+ , m_aDefaultValue(rDefaulValue)
+{
+}
+WrappedStockProperty::~WrappedStockProperty()
+{
+}
+
+void WrappedStockProperty::setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("stock properties require type sal_Bool"), 0, 0 );
+
+ 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 )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFactory );
+
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate =
+ getNewTemplate( bNewValue, aTemplateAndService.second, xFactory );
+
+ if(xTemplate.is())
+ {
+ try
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ xTemplate->changeDiagram( xDiagram );
+ // \-- locked controllers
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any WrappedStockProperty::getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ return m_aDefaultValue;
+}
+
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+
+class WrappedVolumeProperty : public WrappedStockProperty
+{
+public:
+ explicit WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedVolumeProperty();
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
+};
+
+WrappedVolumeProperty::WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedStockProperty( C2U("Volume"), uno::makeAny(sal_False) , spChart2ModelContact )
+{
+}
+WrappedVolumeProperty::~WrappedVolumeProperty()
+{
+}
+
+::com::sun::star::uno::Any WrappedVolumeProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) )
+ || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ m_aOuterValue <<= sal_Bool(sal_True);
+ else if( aTemplateAndService.second.getLength() || !m_aOuterValue.hasValue() )
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ else if(!m_aOuterValue.hasValue())
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ return m_aOuterValue;
+}
+
+uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+{
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+
+ if(!xFactory.is())
+ return xTemplate;
+
+ if( bNewValue ) //add volume
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ else //remove volume
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ return xTemplate;
+}
+
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+
+
+class WrappedUpDownProperty : public WrappedStockProperty
+{
+public:
+ explicit WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedUpDownProperty();
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
+};
+WrappedUpDownProperty::WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedStockProperty( C2U("UpDown"), uno::makeAny(sal_False) , spChart2ModelContact )
+{
+}
+WrappedUpDownProperty::~WrappedUpDownProperty()
+{
+}
+::com::sun::star::uno::Any WrappedUpDownProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) )
+ || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ m_aOuterValue <<= sal_Bool(sal_True);
+ else if( aTemplateAndService.second.getLength() || !m_aOuterValue.hasValue() )
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ else if(!m_aOuterValue.hasValue())
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ return m_aOuterValue;
+}
+uno::Reference< chart2::XChartTypeTemplate > WrappedUpDownProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+{
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+ if( bNewValue ) //add open series
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ else //remove open series
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ return xTemplate;
+}
+
+namespace
+{
+enum
+{
+ //spline properties
+ PROP_CHART_STOCK_VOLUME = FAST_PROPERTY_ID_START_CHART_STOCK_PROP
+ , PROP_CHART_STOCK_UPDOWN
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedStockProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Volume" ),
+ PROP_CHART_STOCK_VOLUME,
+ ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "UpDown" ),
+ PROP_CHART_STOCK_UPDOWN,
+ ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStockProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedVolumeProperty( spChart2ModelContact ) );
+ rList.push_back( new WrappedUpDownProperty( spChart2ModelContact ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
new file mode 100644
index 000000000000..3693b521b7dc
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_STOCK_PROPERTIES_HXX
+#define CHART_WRAPPED_STOCK_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedStockProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_STOCK_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
new file mode 100644
index 000000000000..4ca8f7161f6e
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -0,0 +1,593 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "ChartTypeHelper.hxx"
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartSymbolType.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+// for UNO_NAME_GRAPHOBJ_URLPREFIX
+#include <editeng/unoprnms.hxx>
+
+// for Graphic
+#include <vcl/graph.hxx>
+// for GraphicObject
+#include <svtools/grfmgr.hxx>
+#include <vcl/outdev.hxx>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const;
+
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolTypeProperty();
+};
+
+class WrappedSymbolBitmapURLProperty : public WrappedSeriesOrDiagramProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewGraphicURL ) const;
+
+ explicit WrappedSymbolBitmapURLProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolBitmapURLProperty();
+};
+
+// this operator is not defined by default
+bool operator!=( const awt::Size & rSize1, const awt::Size & rSize2 )
+{
+ return (rSize1.Width != rSize2.Width) || (rSize1.Height != rSize2.Height);
+}
+
+class WrappedSymbolSizeProperty : public WrappedSeriesOrDiagramProperty< awt::Size >
+{
+public:
+ virtual awt::Size getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, awt::Size aNewSize ) const;
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolSizeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolSizeProperty();
+};
+
+class WrappedSymbolAndLinesProperty : public WrappedSeriesOrDiagramProperty< sal_Bool >
+{
+public:
+ virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool bDrawLines ) const;
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolAndLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolAndLinesProperty();
+};
+
+namespace
+{
+enum
+{
+ //symbol properties
+ PROP_CHART_SYMBOL_TYPE = FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP,
+ PROP_CHART_SYMBOL_BITMAP_URL,
+ PROP_CHART_SYMBOL_SIZE,
+ PROP_CHART_SYMBOL_AND_LINES
+};
+
+sal_Int32 lcl_getSymbolType( const ::com::sun::star::chart2::Symbol& rSymbol )
+{
+ sal_Int32 nSymbol = ::com::sun::star::chart::ChartSymbolType::NONE;
+ switch( rSymbol.Style )
+ {
+ case chart2::SymbolStyle_NONE:
+ break;
+ case chart2::SymbolStyle_AUTO:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ case chart2::SymbolStyle_STANDARD:
+ nSymbol = rSymbol.StandardSymbol%8;
+ break;
+ case chart2::SymbolStyle_POLYGON://new feature
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ case chart2::SymbolStyle_GRAPHIC:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::BITMAPURL;
+ break;
+ default:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ }
+ return nSymbol;
+}
+void lcl_setSymbolTypeToSymbol( sal_Int32 nSymbolType, chart2::Symbol& rSymbol )
+{
+ switch( nSymbolType )
+ {
+ case ::com::sun::star::chart::ChartSymbolType::NONE:
+ rSymbol.Style = chart2::SymbolStyle_NONE;
+ break;
+ case ::com::sun::star::chart::ChartSymbolType::AUTO:
+ rSymbol.Style = chart2::SymbolStyle_AUTO;
+ break;
+ case ::com::sun::star::chart::ChartSymbolType::BITMAPURL:
+ rSymbol.Style = chart2::SymbolStyle_GRAPHIC;
+ break;
+ default:
+ rSymbol.Style = chart2::SymbolStyle_STANDARD;
+ rSymbol.StandardSymbol = nSymbolType;
+ break;
+ }
+}
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ rList.push_back( new WrappedSymbolTypeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolBitmapURLProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolSizeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolAndLinesProperty( spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "SymbolType" ),
+ PROP_CHART_SYMBOL_TYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SymbolBitmapURL" ),
+ PROP_CHART_SYMBOL_BITMAP_URL,
+ ::getCppuType( reinterpret_cast< ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SymbolSize" ),
+ PROP_CHART_SYMBOL_SIZE,
+ ::getCppuType( reinterpret_cast< awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Lines" ),
+ PROP_CHART_SYMBOL_AND_LINES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSymbolProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolTypeProperty::WrappedSymbolTypeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("SymbolType")
+ , uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE )
+ , spChart2ModelContact
+ , ePropertyType )
+{
+}
+WrappedSymbolTypeProperty::~WrappedSymbolTypeProperty()
+{
+}
+
+sal_Int32 WrappedSymbolTypeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 aRet = 0;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) )
+ aRet = lcl_getSymbolType( aSymbol );
+ return aRet;
+}
+
+void WrappedSymbolTypeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nSymbolType ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol;
+
+ lcl_setSymbolTypeToSymbol( nSymbolType, aSymbol );
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+}
+
+Any WrappedSymbolTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //the old chart (< OOo 2.3) needs symbol-type="automatic" at the plot-area if any of the series should be able to have symbols
+ if( m_ePropertyType == DIAGRAM )
+ {
+ bool bHasAmbiguousValue = false;
+ sal_Int32 aValue = 0;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ if(bHasAmbiguousValue)
+ {
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
+ }
+ else
+ {
+ if( ::com::sun::star::chart::ChartSymbolType::NONE == aValue )
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE );
+ else
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
+ }
+ }
+ return m_aOuterValue;
+ }
+ else
+ {
+ ::com::sun::star::uno::Any aRet( m_aDefaultValue );
+ aRet <<= getValueFromSeries( xInnerPropertySet );
+ return aRet;
+ }
+}
+
+beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //the special situation for this property here is that the diagram default can be
+ //different from the normal default and different from all sinlges series values
+ //so we need to return PropertyState_DIRECT_VALUE for more cases
+
+ if( m_ePropertyType == DATA_SERIES && //single series or point
+ m_spChart2ModelContact.get())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY );
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolBitmapURLProperty::WrappedSymbolBitmapURLProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< OUString >( C2U("SymbolBitmapURL")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolBitmapURLProperty::~WrappedSymbolBitmapURLProperty()
+{
+}
+
+OUString WrappedSymbolBitmapURLProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ && aSymbol.Graphic.is())
+ {
+ GraphicObject aGrObj( Graphic( aSymbol.Graphic ));
+ aRet = OUString( RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
+ aRet += OUString::createFromAscii( aGrObj.GetUniqueID().GetBuffer());
+ }
+ return aRet;
+}
+
+void WrappedSymbolBitmapURLProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ OUString aNewGraphicURL ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ {
+ bool bMatchesPrefix =
+ aNewGraphicURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
+ if( bMatchesPrefix )
+ {
+ GraphicObject aGrObj = GraphicObject(
+ ByteString( U2C( aNewGraphicURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ))));
+ aSymbol.Graphic.set( aGrObj.GetGraphic().GetXGraphic());
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+ else
+ {
+ try
+ {
+ // @todo: get factory from some context?
+ Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ Reference< graphic::XGraphicProvider > xGraphProv(
+ xFact->createInstance( C2U("com.sun.star.graphic.GraphicProvider")), uno::UNO_QUERY_THROW );
+ Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0] = beans::PropertyValue(
+ C2U("URL"), -1, uno::makeAny( aNewGraphicURL ),
+ beans::PropertyState_DIRECT_VALUE );
+ aSymbol.Graphic.set( xGraphProv->queryGraphic( aArgs ));
+ OSL_ENSURE( aSymbol.Graphic.is(), "Invalid URL for Symbol Bitmap" );
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+
+void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol )
+{
+ if( rSymbol.Style != chart2::SymbolStyle_GRAPHIC )
+ return;
+ if( rSymbol.Size.Width != -1 )
+ return;
+ if( rSymbol.Size.Height != -1 )
+ return;
+
+ //find a good automatic size
+ try
+ {
+ const awt::Size aDefaultSize(250,250);
+ awt::Size aSize = aDefaultSize;
+ uno::Reference< beans::XPropertySet > xProp( rSymbol.Graphic, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ bool bFoundSize = false;
+ try
+ {
+ if( (xProp->getPropertyValue( C2U( "Size100thMM" ) ) >>= aSize) )
+ {
+ if( aSize.Width == 0 && aSize.Height == 0 )
+ aSize = aDefaultSize;
+ else
+ bFoundSize = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ if(!bFoundSize)
+ {
+ awt::Size aAWTPixelSize(10,10);
+ if( (xProp->getPropertyValue( C2U( "SizePixel" ) ) >>= aAWTPixelSize) )
+ {
+ Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height);
+ Size aNewSize = ( OutputDevice::LogicToLogic( aPixelSize, MAP_PIXEL, MAP_100TH_MM ));
+ aSize = awt::Size( aNewSize.Width(), aNewSize.Height() );
+
+ if( aSize.Width == 0 && aSize.Height == 0 )
+ aSize = aDefaultSize;
+ }
+ }
+ }
+ rSymbol.Size = aSize;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+}//end anonymous namespace
+
+WrappedSymbolSizeProperty::WrappedSymbolSizeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< awt::Size >( C2U("SymbolSize")
+ , uno::makeAny( awt::Size(250,250) ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolSizeProperty::~WrappedSymbolSizeProperty()
+{
+}
+
+awt::Size WrappedSymbolSizeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ awt::Size aRet;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
+ aRet = aSymbol.Size;
+ return aRet;
+}
+
+void WrappedSymbolSizeProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ awt::Size aNewSize ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ {
+ aSymbol.Size = aNewSize;
+ lcl_correctSymbolSizeForBitmaps(aSymbol);
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+}
+
+beans::PropertyState WrappedSymbolSizeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //only export symbol size if necessary
+ if( m_ePropertyType == DIAGRAM )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ try
+ {
+ chart2::Symbol aSymbol;
+ Reference< beans::XPropertySet > xSeriesPropertySet( xInnerPropertyState, uno::UNO_QUERY );
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
+ {
+ if( chart2::SymbolStyle_NONE != aSymbol.Style )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return beans::PropertyState_DEFAULT_VALUE;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolAndLinesProperty::WrappedSymbolAndLinesProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Bool >( C2U("Lines")
+ , uno::makeAny( sal_True ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolAndLinesProperty::~WrappedSymbolAndLinesProperty()
+{
+}
+
+sal_Bool WrappedSymbolAndLinesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& /*xSeriesPropertySet*/ ) const
+{
+ //do not export this property anymore, instead use a linestyle none for no lines
+ return sal_True;
+}
+
+void WrappedSymbolAndLinesProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ sal_Bool bDrawLines ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ drawing::LineStyle eLineStyle( bDrawLines ? drawing::LineStyle_SOLID : drawing::LineStyle_NONE );
+ xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( eLineStyle ) );
+}
+
+beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //do not export this property anymore, instead use a linestyle none for no lines
+ return beans::PropertyState_DEFAULT_VALUE;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
new file mode 100644
index 000000000000..5a175623e441
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+#define CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSymbolProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx
new file mode 100644
index 000000000000..a5d5afe6debc
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedTextRotationProperty.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+WrappedTextRotationProperty::WrappedTextRotationProperty( bool bDirectState )
+ : ::chart::WrappedProperty( C2U( "TextRotation" ), C2U( "TextRotation" ) )
+ , m_bDirectState( bDirectState )
+{
+}
+WrappedTextRotationProperty::~WrappedTextRotationProperty()
+{
+}
+
+beans::PropertyState WrappedTextRotationProperty::getPropertyState( const uno::Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( m_bDirectState )
+ return beans::PropertyState_DIRECT_VALUE;
+ return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
+Any WrappedTextRotationProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ Any aRet;
+ double fVal = 0;
+ if( rInnerValue >>= fVal )
+ {
+ sal_Int32 n100thDegrees = static_cast< sal_Int32 >( fVal * 100.0 );
+ aRet <<= n100thDegrees;
+ }
+ return aRet;
+}
+Any WrappedTextRotationProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ Any aRet;
+ sal_Int32 nVal = 0;
+ if( rOuterValue >>= nVal )
+ {
+ double fDoubleDegrees = ( static_cast< double >( nVal ) / 100.0 );
+ aRet <<= fDoubleDegrees;
+ }
+ return aRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
new file mode 100644
index 000000000000..ba0bf8919919
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+#define CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class WrappedTextRotationProperty : public WrappedProperty
+{
+public:
+ WrappedTextRotationProperty( bool bDirectState=false );
+ virtual ~WrappedTextRotationProperty();
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+ bool m_bDirectState;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/makefile.mk b/chart2/source/controller/chartapiwrapper/makefile.mk
new file mode 100644
index 000000000000..0af72c700a41
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJNAME= chart2
+TARGET= chchartapiwrapper
+
+PRJINC= $(PRJ)$/source
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/Chart2ModelContact.obj \
+ $(SLO)$/AreaWrapper.obj \
+ $(SLO)$/AxisWrapper.obj \
+ $(SLO)$/ChartDataWrapper.obj \
+ $(SLO)$/ChartDocumentWrapper.obj \
+ $(SLO)$/DataSeriesPointWrapper.obj \
+ $(SLO)$/DiagramWrapper.obj \
+ $(SLO)$/GridWrapper.obj \
+ $(SLO)$/LegendWrapper.obj \
+ $(SLO)$/TitleWrapper.obj \
+ $(SLO)$/MinMaxLineWrapper.obj \
+ $(SLO)$/UpDownBarWrapper.obj \
+ $(SLO)$/WallFloorWrapper.obj \
+ $(SLO)$/WrappedAutomaticPositionProperties.obj \
+ $(SLO)$/WrappedCharacterHeightProperty.obj \
+ $(SLO)$/WrappedDataCaptionProperties.obj \
+ $(SLO)$/WrappedTextRotationProperty.obj \
+ $(SLO)$/WrappedGapwidthProperty.obj \
+ $(SLO)$/WrappedScaleProperty.obj \
+ $(SLO)$/WrappedSplineProperties.obj \
+ $(SLO)$/WrappedStockProperties.obj \
+ $(SLO)$/WrappedSymbolProperties.obj \
+ $(SLO)$/WrappedAxisAndGridExistenceProperties.obj \
+ $(SLO)$/WrappedNumberFormatProperty.obj \
+ $(SLO)$/WrappedStatisticProperties.obj \
+ $(SLO)$/WrappedSceneProperty.obj \
+ $(SLO)$/WrappedSeriesAreaOrLineProperty.obj \
+ $(SLO)$/WrappedAddInProperty.obj \
+ $(SLO)$/WrappedScaleTextProperties.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component
new file mode 100644
index 000000000000..fc99913b5a74
--- /dev/null
+++ b/chart2/source/controller/chartcontroller.component
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.chart.ElementSelectorToolbarController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ChartController">
+ <service name="com.sun.star.chart2.ChartController"/>
+ <service name="com.sun.star.frame.Controller"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ChartDocumentWrapper">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart.ChartDocument"/>
+ <service name="com.sun.star.chart2.ChartDocumentWrapper"/>
+ <service name="com.sun.star.xml.UserDefinedAttributeSupplier"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ChartFrameLoader">
+ <service name="com.sun.star.frame.SynchronousFrameLoader"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ChartTypeDialog">
+ <service name="com.sun.star.chart2.ChartTypeDialog"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ShapeToolbarController">
+ <service name="com.sun.star.chart2.ShapeToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.WizardDialog">
+ <service name="com.sun.star.chart2.WizardDialog"/>
+ </implementation>
+</component>
diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
new file mode 100644
index 000000000000..6349a121ff28
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps.hrc
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BITMAPS_HRC
+#define CHART_BITMAPS_HRC
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+#ifndef STD_MASKCOLOR
+#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+#endif
+
+//-----------------------------------------------------------------------------
+// chart types
+// Images:
+
+#define IMG_TYPE_COLUMN (RID_APP_START + 1)
+#define IMG_TYPE_BAR (RID_APP_START + 2)
+#define IMG_TYPE_PIE (RID_APP_START + 3)
+#define IMG_TYPE_AREA (RID_APP_START + 4)
+#define IMG_TYPE_LINE (RID_APP_START + 5)
+#define IMG_TYPE_XY (RID_APP_START + 6)
+#define IMG_TYPE_BUBBLE (RID_APP_START + 7)
+#define IMG_TYPE_NET (RID_APP_START + 8)
+#define IMG_TYPE_STOCK (RID_APP_START + 9)
+#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
+
+//----------------------
+// Column Chart Subtypes
+#define BMP_COLUMNS_2D_1 (RID_APP_START + 1)
+#define BMP_COLUMNS_2D_2 (RID_APP_START + 2)
+#define BMP_COLUMNS_2D_3 (RID_APP_START + 3)
+
+#define BMP_COLUMNS_3D (RID_APP_START + 4)
+#define BMP_COLUMNS_3D_1 (RID_APP_START + 5)
+#define BMP_COLUMNS_3D_2 (RID_APP_START + 6)
+#define BMP_COLUMNS_3D_3 (RID_APP_START + 7)
+
+#define BMP_SAEULE_3D_1 (RID_APP_START + 8)
+#define BMP_SAEULE_3D_2 (RID_APP_START + 9)
+#define BMP_SAEULE_3D_3 (RID_APP_START + 10)
+#define BMP_SAEULE_3D_4 (RID_APP_START + 11)
+
+#define BMP_KEGEL_3D_1 (RID_APP_START + 12)
+#define BMP_KEGEL_3D_2 (RID_APP_START + 13)
+#define BMP_KEGEL_3D_3 (RID_APP_START + 14)
+#define BMP_KEGEL_3D_4 (RID_APP_START + 15)
+
+#define BMP_PYRAMID_3D_1 (RID_APP_START + 16)
+#define BMP_PYRAMID_3D_2 (RID_APP_START + 17)
+#define BMP_PYRAMID_3D_3 (RID_APP_START + 18)
+#define BMP_PYRAMID_3D_4 (RID_APP_START + 19)
+
+//----------------------
+// Bar Chart Subtypes
+
+#define BMP_BARS_2D_1 (RID_APP_START + 20)
+#define BMP_BARS_2D_2 (RID_APP_START + 21)
+#define BMP_BARS_2D_3 (RID_APP_START + 22)
+
+#define BMP_BARS_3D (RID_APP_START + 23)
+#define BMP_BARS_3D_1 (RID_APP_START + 24)
+#define BMP_BARS_3D_2 (RID_APP_START + 25)
+#define BMP_BARS_3D_3 (RID_APP_START + 26)
+
+#define BMP_ROEHRE_3D_1 (RID_APP_START + 27)
+#define BMP_ROEHRE_3D_2 (RID_APP_START + 28)
+#define BMP_ROEHRE_3D_3 (RID_APP_START + 29)
+#define BMP_ROEHRE_3D_4 (RID_APP_START + 30)
+
+#define BMP_KEGELQ_3D_1 (RID_APP_START + 31)
+#define BMP_KEGELQ_3D_2 (RID_APP_START + 32)
+#define BMP_KEGELQ_3D_3 (RID_APP_START + 33)
+#define BMP_KEGELQ_3D_4 (RID_APP_START + 34)
+
+#define BMP_PYRAMIDQ_3D_1 (RID_APP_START + 35)
+#define BMP_PYRAMIDQ_3D_2 (RID_APP_START + 36)
+#define BMP_PYRAMIDQ_3D_3 (RID_APP_START + 37)
+#define BMP_PYRAMIDQ_3D_4 (RID_APP_START + 38)
+
+//----------------------
+// Pie and Donut Chart Subtypes
+
+#define BMP_CIRCLES_2D (RID_APP_START + 39)
+#define BMP_CIRCLES_2D_EXPLODED (RID_APP_START + 40)
+#define BMP_CIRCLES_3D (RID_APP_START + 41)
+#define BMP_CIRCLES_3D_EXPLODED (RID_APP_START + 42)
+#define BMP_DONUT_2D (RID_APP_START + 43)
+#define BMP_DONUT_2D_EXPLODED (RID_APP_START + 44)
+#define BMP_DONUT_3D (RID_APP_START + 45)
+#define BMP_DONUT_3D_EXPLODED (RID_APP_START + 46)
+
+//----------------------
+// Points and Lines Chart Subtypes
+
+#define BMP_POINTS_XVALUES (RID_APP_START + 47)
+#define BMP_POINTS_XCATEGORY (RID_APP_START + 48)
+#define BMP_POINTS_STACKED (RID_APP_START + 49)
+
+
+#define BMP_LINE_P_XVALUES (RID_APP_START + 50)
+#define BMP_LINE_O_XVALUES (RID_APP_START + 51)
+#define BMP_LINE3D_XVALUES (RID_APP_START + 52)
+
+#define BMP_LINE_P_XCATEGORY (RID_APP_START + 53)
+#define BMP_LINE_O_XCATEGORY (RID_APP_START + 54)
+#define BMP_LINE3D_XCATEGORY (RID_APP_START + 55)
+
+#define BMP_LINE_P_STACKED (RID_APP_START + 56)
+#define BMP_LINE_O_STACKED (RID_APP_START + 57)
+#define BMP_LINE3D_STACKED (RID_APP_START + 58)
+
+#define BMP_LINE_P_XVALUES_SMOOTH (RID_APP_START + 59)
+#define BMP_LINE_O_XVALUES_SMOOTH (RID_APP_START + 60)
+#define BMP_LINE3D_XVALUES_SMOOTH (RID_APP_START + 61)
+
+#define BMP_LINE_P_XCATEGORY_SMOOTH (RID_APP_START + 62)
+#define BMP_LINE_O_XCATEGORY_SMOOTH (RID_APP_START + 63)
+#define BMP_LINE3D_XCATEGORY_SMOOTH (RID_APP_START + 64)
+
+#define BMP_LINE_P_STACKED_SMOOTH (RID_APP_START + 65)
+#define BMP_LINE_O_STACKED_SMOOTH (RID_APP_START + 66)
+#define BMP_LINE3D_STACKED_SMOOTH (RID_APP_START + 67)
+
+//----------------------
+// Area Chart Subtypes
+
+#define BMP_AREAS_2D (RID_APP_START + 68)
+#define BMP_AREAS_2D_1 (RID_APP_START + 69)
+#define BMP_AREAS_2D_3 (RID_APP_START + 70)
+#define BMP_AREAS_3D (RID_APP_START + 71)
+#define BMP_AREAS_3D_1 (RID_APP_START + 72)
+#define BMP_AREAS_3D_2 (RID_APP_START + 73)
+
+//----------------------
+// Net Chart Subtypes
+
+#define BMP_NET (RID_APP_START + 74)
+#define BMP_NET_STACK (RID_APP_START + 75)
+#define BMP_NET_SYMB (RID_APP_START + 76)
+#define BMP_NET_SYMB_STACK (RID_APP_START + 77)
+#define BMP_NET_LINESYMB (RID_APP_START + 78)
+#define BMP_NET_LINESYMB_STACK (RID_APP_START + 79)
+#define BMP_NET_FILL (RID_APP_START + 80)
+#define BMP_NET_FILL_STACK (RID_APP_START + 81)
+
+//----------------------
+// Stock Chart Subtypes
+
+#define BMP_STOCK_1 (RID_APP_START + 82)
+#define BMP_STOCK_2 (RID_APP_START + 83)
+#define BMP_STOCK_3 (RID_APP_START + 84)
+#define BMP_STOCK_4 (RID_APP_START + 85)
+
+//----------------------
+// Column + Line Chart Subtypes
+
+#define BMP_COLUMN_LINE (RID_APP_START + 86)
+#define BMP_COLUMN_LINE_STACKED (RID_APP_START + 87)
+
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1 (RID_APP_START + 88)
+
+//-----------------------------------------------------------------------------
+//further Images:
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 1
+#define BMP_INDICATE_BOTH_VERTI (RID_APP_START + 89)
+#define BMP_INDICATE_UP (RID_APP_START + 90)
+#define BMP_INDICATE_DOWN (RID_APP_START + 91)
+#define BMP_INDICATE_BOTH_HORI (RID_APP_START + 97)
+#define BMP_INDICATE_RIGHT (RID_APP_START + 98)
+#define BMP_INDICATE_LEFT (RID_APP_START + 99)
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 2
+#define BMP_REGRESSION_NONE (RID_APP_START + 92)
+#define BMP_REGRESSION_LINEAR (RID_APP_START + 93)
+#define BMP_REGRESSION_LOG (RID_APP_START + 94)
+#define BMP_REGRESSION_EXP (RID_APP_START + 95)
+#define BMP_REGRESSION_POWER (RID_APP_START + 96)
+
+// hide-button for range-choosing
+#define IMG_SELECTRANGE (RID_APP_START + 100)
+
+// CHART_BITMAPS_HRC
+#endif
diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src
new file mode 100644
index 000000000000..3945090217e0
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps.src
@@ -0,0 +1,543 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Bitmaps.hrc"
+
+Image IMG_TYPE_COLUMN
+{
+ ImageBitmap = Bitmap { File = "typecolumn_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_BAR
+{
+ ImageBitmap = Bitmap { File = "typebar_16.png " ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_PIE
+{
+ ImageBitmap = Bitmap { File = "typepie_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_LINE
+{
+ ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_XY
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_AREA
+{
+ ImageBitmap = Bitmap { File = "typearea_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_NET
+{
+ ImageBitmap = Bitmap { File = "typenet_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_STOCK
+{
+ ImageBitmap = Bitmap { File = "typestock_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_COLUMN_LINE
+{
+ ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Image IMG_TYPE_BUBBLE
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1
+{
+ File = "bubble_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D
+{
+ File = "areas_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D_1
+{
+ File = "areaspiled_52x60.png" ;
+};
+Bitmap BMP_AREAS_2D_3
+{
+ File = "areasfull_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D
+{
+ File = "areaspiled3d_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D_1
+{
+ File = "areas3d_52x60.png" ;
+};
+Bitmap BMP_AREAS_3D_2
+{
+ File = "areasfull3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_BARS_2D_1
+{
+ File = "bar_52x60.png" ;
+};
+Bitmap BMP_BARS_2D_2
+{
+ File = "barstack_52x60.png" ;
+};
+Bitmap BMP_BARS_2D_3
+{
+ File = "barpercent_52x60.png" ;
+};
+Bitmap BMP_BARS_3D
+{
+ File = "bar3ddeep_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_1
+{
+ File = "bar3d_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_2
+{
+ File = "barstack3d_52x60.png" ;
+};
+Bitmap BMP_BARS_3D_3
+{
+ File = "barpercent3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_CIRCLES_2D
+{
+ File = "pie_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_2D_EXPLODED
+{
+ File = "pieexploded_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_3D
+{
+ File = "pie3d_52x60.png" ;
+};
+Bitmap BMP_CIRCLES_3D_EXPLODED
+{
+ File = "pie3dexploded_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_DONUT_2D
+{
+ File = "donut_52x60.png" ;
+};
+Bitmap BMP_DONUT_2D_EXPLODED
+{
+ File = "donutexploded_52x60.png" ;
+};
+Bitmap BMP_DONUT_3D
+{
+ File = "donut3d_52x60.png" ;
+};
+Bitmap BMP_DONUT_3D_EXPLODED
+{
+ File = "donut3dexploded_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_2D_1
+{
+ File = "columns_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_2D_2
+{
+ File = "columnstack_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_2D_3
+{
+ File = "columnpercent_52x60.png" ;
+};
+Bitmap BMP_COLUMN_LINE
+{
+ File = "columnline_52x60.png" ;
+};
+Bitmap BMP_COLUMN_LINE_STACKED
+{
+ File = "columnstackline_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_3D
+{
+ File = "columns3ddeep_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_1
+{
+ File = "columns3d_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_2
+{
+ File = "columnstack3d_52x60.png" ;
+};
+Bitmap BMP_COLUMNS_3D_3
+{
+ File = "columnpercent3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_KEGELQ_3D_1
+{
+ File = "conehori_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_2
+{
+ File = "conehoristack_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_3
+{
+ File = "conehoripercent_52x60.png" ;
+};
+Bitmap BMP_KEGELQ_3D_4
+{
+ File = "conehorideep_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_1
+{
+ File = "cone_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_2
+{
+ File = "conestack_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_3
+{
+ File = "conepercent_52x60.png" ;
+};
+Bitmap BMP_KEGEL_3D_4
+{
+ File = "conedeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_POINTS_XVALUES
+{
+ File = "valueaxisdirectpoints_52x60.png" ;
+};
+Bitmap BMP_POINTS_XCATEGORY
+{
+ File = "nostackdirectpoints_52x60.png" ;
+};
+Bitmap BMP_POINTS_STACKED
+{
+ File = "stackdirectpoints_52x60.png" ;
+};
+//---------------------
+
+Bitmap BMP_LINE_P_XVALUES
+{
+ File = "valueaxisdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES
+{
+ File = "valueaxisdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES
+{
+ File = "valueaxisdirect3d_52x60.png" ;
+};
+
+
+Bitmap BMP_LINE_P_XCATEGORY
+{
+ File = "nostackdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY
+{
+ File = "nostackdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY
+{
+ File = "nostackdirect3d_52x60.png" ;
+};
+
+
+Bitmap BMP_LINE_P_STACKED
+{
+ File = "stackdirectboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_STACKED
+{
+ File = "stackdirectlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_STACKED
+{
+ File = "stackdirect3d_52x60.png" ;
+};
+
+//---------------------
+Bitmap BMP_LINE_P_XVALUES_SMOOTH
+{
+ File = "valueaxissmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_SMOOTH
+{
+ File = "valueaxissmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_SMOOTH
+{
+ File = "valueaxissmooth3d_52x60.png" ;
+};
+Bitmap BMP_LINE_P_XCATEGORY_SMOOTH
+{
+ File = "nostacksmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_SMOOTH
+{
+ File = "nostacksmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_SMOOTH
+{
+ File = "nostacksmooth3d_52x60.png" ;
+};
+Bitmap BMP_LINE_P_STACKED_SMOOTH
+{
+ File = "stacksmoothboth_52x60.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_SMOOTH
+{
+ File = "stacksmoothlines_52x60.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_SMOOTH
+{
+ File = "stacksmooth3d_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_NET
+{
+ File = "net_52x60.png" ;
+};
+Bitmap BMP_NET_STACK
+{
+ File = "netstack_52x60.png" ;
+};
+Bitmap BMP_NET_SYMB
+{
+ File = "netpoint_52x60.png" ;
+};
+Bitmap BMP_NET_SYMB_STACK
+{
+ File = "netpointstack_52x60.png" ;
+};
+Bitmap BMP_NET_LINESYMB
+{
+ File = "netlinepoint_52x60.png" ;
+};
+Bitmap BMP_NET_LINESYMB_STACK
+{
+ File = "netlinepointstack_52x60.png" ;
+};
+Bitmap BMP_NET_FILL
+{
+ File = "netfill_52x60.png" ;
+};
+Bitmap BMP_NET_FILL_STACK
+{
+ File = "netstackfill_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_PYRAMIDQ_3D_1
+{
+ File = "pyramindhori_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_2
+{
+ File = "pyramindhoristack_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_3
+{
+ File = "pyramindhoripercent_52x60.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_4
+{
+ File = "pyramindhorideep_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_1
+{
+ File = "pyramind_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_2
+{
+ File = "pyramindstack_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_3
+{
+ File = "pyramindpercent_52x60.png" ;
+};
+Bitmap BMP_PYRAMID_3D_4
+{
+ File = "pyraminddeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_ROEHRE_3D_1
+{
+ File = "cylinderhori_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_2
+{
+ File = "cylinderhoristack_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_3
+{
+ File = "cylinderhoriprocent_52x60.png" ;
+};
+Bitmap BMP_ROEHRE_3D_4
+{
+ File = "cylinderhorideep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_SAEULE_3D_1
+{
+ File = "cylinder_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_2
+{
+ File = "cylinderstack_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_3
+{
+ File = "cylinderpercent_52x60.png" ;
+};
+Bitmap BMP_SAEULE_3D_4
+{
+ File = "cylinderdeep_52x60.png" ;
+};
+//---------------------
+Bitmap BMP_STOCK_1
+{
+ File = "stock_52x60.png" ;
+};
+Bitmap BMP_STOCK_2
+{
+ File = "stockblock_52x60.png" ;
+};
+Bitmap BMP_STOCK_3
+{
+ File = "stockcolumns_52x60.png" ;
+};
+Bitmap BMP_STOCK_4
+{
+ File = "stockcolumnsattach_52x60.png" ;
+};
+//---------------------
+//---------------------
+//---------------------
+//error indicator
+Image BMP_INDICATE_BOTH_VERTI
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothverti_30.png" ;
+ };
+};
+Image BMP_INDICATE_DOWN
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errordown_30.png" ;
+ };
+};
+Image BMP_INDICATE_UP
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorup_30.png" ;
+ };
+};
+Image BMP_INDICATE_BOTH_HORI
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothhori_30.png" ;
+ };
+};
+Image BMP_INDICATE_RIGHT
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorright_30.png" ;
+ };
+};
+Image BMP_INDICATE_LEFT
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorleft_30.png" ;
+ };
+};
+
+//---------------------
+//regression curves
+Image BMP_REGRESSION_NONE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regno.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LINEAR
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglin.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LOG
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglog.bmp" ;
+ };
+};
+Image BMP_REGRESSION_EXP
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regexp.bmp" ;
+ };
+};
+Image BMP_REGRESSION_POWER
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regpow.bmp" ;
+ };
+};
+//---------------------
+Image IMG_SELECTRANGE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "selectrange.png";
+ };
+ MaskColor = STD_MASKCOLOR;
+};
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
new file mode 100644
index 000000000000..16bffd0cf86d
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+// RID_SCH_START is 30512 (see svl/solar.hrc)
+
+// next free: 100
+
+#ifndef SC_HC_MASKCOLOR
+#define SC_HC_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
+#endif
+
+//-----------------------------------------------------------------------------
+// chart types
+// Images:
+
+#define IMG_TYPE_COLUMN_HC (RID_SCH_START + 1)
+#define IMG_TYPE_BAR_HC (RID_SCH_START + 2)
+#define IMG_TYPE_PIE_HC (RID_SCH_START + 3)
+#define IMG_TYPE_AREA_HC (RID_SCH_START + 4)
+#define IMG_TYPE_LINE_HC (RID_SCH_START + 5)
+#define IMG_TYPE_XY_HC (RID_SCH_START + 6)
+#define IMG_TYPE_BUBBLE_HC (RID_SCH_START + 7)
+#define IMG_TYPE_NET_HC (RID_SCH_START + 8)
+#define IMG_TYPE_STOCK_HC (RID_SCH_START + 9)
+#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
+
+//----------------------
+// Column Chart Subtypes
+#define BMP_COLUMNS_2D_1_HC (RID_SCH_START + 1)
+#define BMP_COLUMNS_2D_2_HC (RID_SCH_START + 2)
+#define BMP_COLUMNS_2D_3_HC (RID_SCH_START + 3)
+
+#define BMP_COLUMNS_3D_HC (RID_SCH_START + 4)
+#define BMP_COLUMNS_3D_1_HC (RID_SCH_START + 5)
+#define BMP_COLUMNS_3D_2_HC (RID_SCH_START + 6)
+#define BMP_COLUMNS_3D_3_HC (RID_SCH_START + 7)
+
+#define BMP_SAEULE_3D_1_HC (RID_SCH_START + 8)
+#define BMP_SAEULE_3D_2_HC (RID_SCH_START + 9)
+#define BMP_SAEULE_3D_3_HC (RID_SCH_START + 10)
+#define BMP_SAEULE_3D_4_HC (RID_SCH_START + 11)
+
+#define BMP_KEGEL_3D_1_HC (RID_SCH_START + 12)
+#define BMP_KEGEL_3D_2_HC (RID_SCH_START + 13)
+#define BMP_KEGEL_3D_3_HC (RID_SCH_START + 14)
+#define BMP_KEGEL_3D_4_HC (RID_SCH_START + 15)
+
+#define BMP_PYRAMID_3D_1_HC (RID_SCH_START + 16)
+#define BMP_PYRAMID_3D_2_HC (RID_SCH_START + 17)
+#define BMP_PYRAMID_3D_3_HC (RID_SCH_START + 18)
+#define BMP_PYRAMID_3D_4_HC (RID_SCH_START + 19)
+
+//----------------------
+// Bar Chart Subtypes
+
+#define BMP_BARS_2D_1_HC (RID_SCH_START + 20)
+#define BMP_BARS_2D_2_HC (RID_SCH_START + 21)
+#define BMP_BARS_2D_3_HC (RID_SCH_START + 22)
+
+#define BMP_BARS_3D_HC (RID_SCH_START + 23)
+#define BMP_BARS_3D_1_HC (RID_SCH_START + 24)
+#define BMP_BARS_3D_2_HC (RID_SCH_START + 25)
+#define BMP_BARS_3D_3_HC (RID_SCH_START + 26)
+
+#define BMP_ROEHRE_3D_1_HC (RID_SCH_START + 27)
+#define BMP_ROEHRE_3D_2_HC (RID_SCH_START + 28)
+#define BMP_ROEHRE_3D_3_HC (RID_SCH_START + 29)
+#define BMP_ROEHRE_3D_4_HC (RID_SCH_START + 30)
+
+#define BMP_KEGELQ_3D_1_HC (RID_SCH_START + 31)
+#define BMP_KEGELQ_3D_2_HC (RID_SCH_START + 32)
+#define BMP_KEGELQ_3D_3_HC (RID_SCH_START + 33)
+#define BMP_KEGELQ_3D_4_HC (RID_SCH_START + 34)
+
+#define BMP_PYRAMIDQ_3D_1_HC (RID_SCH_START + 35)
+#define BMP_PYRAMIDQ_3D_2_HC (RID_SCH_START + 36)
+#define BMP_PYRAMIDQ_3D_3_HC (RID_SCH_START + 37)
+#define BMP_PYRAMIDQ_3D_4_HC (RID_SCH_START + 38)
+
+//----------------------
+// Pie and Donut Chart Subtypes
+
+#define BMP_CIRCLES_2D_HC (RID_SCH_START + 39)
+#define BMP_CIRCLES_2D_EXPLODED_HC (RID_SCH_START + 40)
+#define BMP_CIRCLES_3D_HC (RID_SCH_START + 41)
+#define BMP_CIRCLES_3D_EXPLODED_HC (RID_SCH_START + 42)
+#define BMP_DONUT_2D_HC (RID_SCH_START + 43)
+#define BMP_DONUT_2D_EXPLODED_HC (RID_SCH_START + 44)
+#define BMP_DONUT_3D_HC (RID_SCH_START + 45)
+#define BMP_DONUT_3D_EXPLODED_HC (RID_SCH_START + 46)
+
+//----------------------
+// Points and Lines Chart Subtypes
+
+#define BMP_POINTS_XVALUES_HC (RID_SCH_START + 47)
+#define BMP_POINTS_XCATEGORY_HC (RID_SCH_START + 48)
+#define BMP_POINTS_STACKED_HC (RID_SCH_START + 49)
+
+#define BMP_LINE_P_XVALUES_HC (RID_SCH_START + 50)
+#define BMP_LINE_O_XVALUES_HC (RID_SCH_START + 51)
+#define BMP_LINE3D_XVALUES_HC (RID_SCH_START + 52)
+
+#define BMP_LINE_P_XCATEGORY_HC (RID_SCH_START + 53)
+#define BMP_LINE_O_XCATEGORY_HC (RID_SCH_START + 54)
+#define BMP_LINE3D_XCATEGORY_HC (RID_SCH_START + 55)
+
+#define BMP_LINE_P_STACKED_HC (RID_SCH_START + 56)
+#define BMP_LINE_O_STACKED_HC (RID_SCH_START + 57)
+#define BMP_LINE3D_STACKED_HC (RID_SCH_START + 58)
+
+#define BMP_LINE_P_XVALUES_SMOOTH_HC (RID_SCH_START + 59)
+#define BMP_LINE_O_XVALUES_SMOOTH_HC (RID_SCH_START + 60)
+#define BMP_LINE3D_XVALUES_SMOOTH_HC (RID_SCH_START + 61)
+
+#define BMP_LINE_P_XCATEGORY_SMOOTH_HC (RID_SCH_START + 62)
+#define BMP_LINE_O_XCATEGORY_SMOOTH_HC (RID_SCH_START + 63)
+#define BMP_LINE3D_XCATEGORY_SMOOTH_HC (RID_SCH_START + 64)
+
+#define BMP_LINE_P_STACKED_SMOOTH_HC (RID_SCH_START + 65)
+#define BMP_LINE_O_STACKED_SMOOTH_HC (RID_SCH_START + 66)
+#define BMP_LINE3D_STACKED_SMOOTH_HC (RID_SCH_START + 67)
+
+//----------------------
+// Area Chart Subtypes
+
+#define BMP_AREAS_2D_HC (RID_SCH_START + 68)
+#define BMP_AREAS_2D_1_HC (RID_SCH_START + 69)
+#define BMP_AREAS_2D_3_HC (RID_SCH_START + 70)
+#define BMP_AREAS_3D_HC (RID_SCH_START + 71)
+#define BMP_AREAS_3D_1_HC (RID_SCH_START + 72)
+#define BMP_AREAS_3D_2_HC (RID_SCH_START + 73)
+
+//----------------------
+// Net Chart Subtypes
+
+#define BMP_NET_HC (RID_SCH_START + 74)
+#define BMP_NET_STACK_HC (RID_SCH_START + 75)
+#define BMP_NET_SYMB_HC (RID_SCH_START + 76)
+#define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77)
+#define BMP_NET_LINESYMB_HC (RID_SCH_START + 78)
+#define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79)
+#define BMP_NET_FILL_HC (RID_SCH_START + 80)
+#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81)
+
+//----------------------
+// Stock Chart Subtypes
+
+#define BMP_STOCK_1_HC (RID_SCH_START + 82)
+#define BMP_STOCK_2_HC (RID_SCH_START + 83)
+#define BMP_STOCK_3_HC (RID_SCH_START + 84)
+#define BMP_STOCK_4_HC (RID_SCH_START + 85)
+
+//----------------------
+// Column + Line Chart Subtypes
+
+#define BMP_COLUMN_LINE_HC (RID_SCH_START + 86)
+#define BMP_COLUMN_LINE_STACKED_HC (RID_SCH_START + 87)
+
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1_HC (RID_SCH_START + 88)
+
+//-----------------------------------------------------------------------------
+//further Images:
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 1
+#define BMP_INDICATE_BOTH_VERTI_HC (RID_SCH_START + 89)
+#define BMP_INDICATE_UP_HC (RID_SCH_START + 90)
+#define BMP_INDICATE_DOWN_HC (RID_SCH_START + 91)
+#define BMP_INDICATE_BOTH_HORI_HC (RID_SCH_START + 97)
+#define BMP_INDICATE_RIGHT_HC (RID_SCH_START + 98)
+#define BMP_INDICATE_LEFT_HC (RID_SCH_START + 99)
+
+//SchStatisticTabPage and SchDataStatisticsDlg part 2
+#define BMP_REGRESSION_NONE_HC (RID_SCH_START + 92)
+#define BMP_REGRESSION_LINEAR_HC (RID_SCH_START + 93)
+#define BMP_REGRESSION_LOG_HC (RID_SCH_START + 94)
+#define BMP_REGRESSION_EXP_HC (RID_SCH_START + 95)
+#define BMP_REGRESSION_POWER_HC (RID_SCH_START + 96)
+
+// hide-button for range-choosing
+#define IMG_SELECTRANGE_HC (RID_SCH_START + 100)
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src
new file mode 100644
index 000000000000..738c133483e1
--- /dev/null
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.src
@@ -0,0 +1,543 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Bitmaps_HC.hrc"
+
+Image IMG_TYPE_COLUMN_HC
+{
+ ImageBitmap = Bitmap { File = "typecolumn_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_BAR_HC
+{
+ ImageBitmap = Bitmap { File = "typebar_16.png " ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_PIE_HC
+{
+ ImageBitmap = Bitmap { File = "typepie_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_LINE_HC
+{
+ ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_XY_HC
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_AREA_HC
+{
+ ImageBitmap = Bitmap { File = "typearea_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_NET_HC
+{
+ ImageBitmap = Bitmap { File = "typenet_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_STOCK_HC
+{
+ ImageBitmap = Bitmap { File = "typestock_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_COLUMN_LINE_HC
+{
+ ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Image IMG_TYPE_BUBBLE_HC
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1_HC
+{
+ File = "bubble_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_HC
+{
+ File = "areas_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_1_HC
+{
+ File = "areaspiled_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_2D_3_HC
+{
+ File = "areasfull_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_HC
+{
+ File = "areaspiled3d_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_1_HC
+{
+ File = "areas3d_52x60_h.png" ;
+};
+Bitmap BMP_AREAS_3D_2_HC
+{
+ File = "areasfull3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_BARS_2D_1_HC
+{
+ File = "bar_52x60_h.png" ;
+};
+Bitmap BMP_BARS_2D_2_HC
+{
+ File = "barstack_52x60_h.png" ;
+};
+Bitmap BMP_BARS_2D_3_HC
+{
+ File = "barpercent_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_HC
+{
+ File = "bar3ddeep_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_1_HC
+{
+ File = "bar3d_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_2_HC
+{
+ File = "barstack3d_52x60_h.png" ;
+};
+Bitmap BMP_BARS_3D_3_HC
+{
+ File = "barpercent3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_CIRCLES_2D_HC
+{
+ File = "pie_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_2D_EXPLODED_HC
+{
+ File = "pieexploded_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_3D_HC
+{
+ File = "pie3d_52x60_h.png" ;
+};
+Bitmap BMP_CIRCLES_3D_EXPLODED_HC
+{
+ File = "pie3dexploded_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_DONUT_2D_HC
+{
+ File = "donut_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_2D_EXPLODED_HC
+{
+ File = "donutexploded_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_3D_HC
+{
+ File = "donut3d_52x60_h.png" ;
+};
+Bitmap BMP_DONUT_3D_EXPLODED_HC
+{
+ File = "donut3dexploded_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_2D_1_HC
+{
+ File = "columns_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_2D_2_HC
+{
+ File = "columnstack_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_2D_3_HC
+{
+ File = "columnpercent_52x60_h.png" ;
+};
+Bitmap BMP_COLUMN_LINE_HC
+{
+ File = "columnline_52x60_h.png" ;
+};
+Bitmap BMP_COLUMN_LINE_STACKED_HC
+{
+ File = "columnstackline_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_COLUMNS_3D_HC
+{
+ File = "columns3ddeep_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_1_HC
+{
+ File = "columns3d_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_2_HC
+{
+ File = "columnstack3d_52x60_h.png" ;
+};
+Bitmap BMP_COLUMNS_3D_3_HC
+{
+ File = "columnpercent3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_KEGELQ_3D_1_HC
+{
+ File = "conehori_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_2_HC
+{
+ File = "conehoristack_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_3_HC
+{
+ File = "conehoripercent_52x60_h.png" ;
+};
+Bitmap BMP_KEGELQ_3D_4_HC
+{
+ File = "conehorideep_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_1_HC
+{
+ File = "cone_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_2_HC
+{
+ File = "conestack_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_3_HC
+{
+ File = "conepercent_52x60_h.png" ;
+};
+Bitmap BMP_KEGEL_3D_4_HC
+{
+ File = "conedeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_POINTS_XVALUES_HC
+{
+ File = "valueaxisdirectpoints_52x60_h.png" ;
+};
+Bitmap BMP_POINTS_XCATEGORY_HC
+{
+ File = "nostackdirectpoints_52x60_h.png" ;
+};
+Bitmap BMP_POINTS_STACKED_HC
+{
+ File = "stackdirectpoints_52x60_h.png" ;
+};
+//---------------------
+
+Bitmap BMP_LINE_P_XVALUES_HC
+{
+ File = "valueaxisdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_HC
+{
+ File = "valueaxisdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_HC
+{
+ File = "valueaxisdirect3d_52x60_h.png" ;
+};
+
+
+Bitmap BMP_LINE_P_XCATEGORY_HC
+{
+ File = "nostackdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_HC
+{
+ File = "nostackdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_HC
+{
+ File = "nostackdirect3d_52x60_h.png" ;
+};
+
+
+Bitmap BMP_LINE_P_STACKED_HC
+{
+ File = "stackdirectboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_HC
+{
+ File = "stackdirectlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_HC
+{
+ File = "stackdirect3d_52x60_h.png" ;
+};
+
+//---------------------
+Bitmap BMP_LINE_P_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XVALUES_SMOOTH_HC
+{
+ File = "valueaxissmooth3d_52x60_h.png" ;
+};
+Bitmap BMP_LINE_P_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_XCATEGORY_SMOOTH_HC
+{
+ File = "nostacksmooth3d_52x60_h.png" ;
+};
+Bitmap BMP_LINE_P_STACKED_SMOOTH_HC
+{
+ File = "stacksmoothboth_52x60_h.png" ;
+};
+Bitmap BMP_LINE_O_STACKED_SMOOTH_HC
+{
+ File = "stacksmoothlines_52x60_h.png" ;
+};
+Bitmap BMP_LINE3D_STACKED_SMOOTH_HC
+{
+ File = "stacksmooth3d_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_NET_HC
+{
+ File = "net_52x60_h.png" ;
+};
+Bitmap BMP_NET_STACK_HC
+{
+ File = "netstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_SYMB_HC
+{
+ File = "netpoint_52x60_h.png" ;
+};
+Bitmap BMP_NET_SYMB_STACK_HC
+{
+ File = "netpointstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_LINESYMB_HC
+{
+ File = "netlinepoint_52x60_h.png" ;
+};
+Bitmap BMP_NET_LINESYMB_STACK_HC
+{
+ File = "netlinepointstack_52x60_h.png" ;
+};
+Bitmap BMP_NET_FILL_HC
+{
+ File = "netfill_52x60_h.png" ;
+};
+Bitmap BMP_NET_FILL_STACK_HC
+{
+ File = "netstackfill_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_PYRAMIDQ_3D_1_HC
+{
+ File = "pyramindhori_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_2_HC
+{
+ File = "pyramindhoristack_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_3_HC
+{
+ File = "pyramindhoripercent_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMIDQ_3D_4_HC
+{
+ File = "pyramindhorideep_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_1_HC
+{
+ File = "pyramind_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_2_HC
+{
+ File = "pyramindstack_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_3_HC
+{
+ File = "pyramindpercent_52x60_h.png" ;
+};
+Bitmap BMP_PYRAMID_3D_4_HC
+{
+ File = "pyraminddeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_ROEHRE_3D_1_HC
+{
+ File = "cylinderhori_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_2_HC
+{
+ File = "cylinderhoristack_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_3_HC
+{
+ File = "cylinderhoriprocent_52x60_h.png" ;
+};
+Bitmap BMP_ROEHRE_3D_4_HC
+{
+ File = "cylinderhorideep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_SAEULE_3D_1_HC
+{
+ File = "cylinder_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_2_HC
+{
+ File = "cylinderstack_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_3_HC
+{
+ File = "cylinderpercent_52x60_h.png" ;
+};
+Bitmap BMP_SAEULE_3D_4_HC
+{
+ File = "cylinderdeep_52x60_h.png" ;
+};
+//---------------------
+Bitmap BMP_STOCK_1_HC
+{
+ File = "stock_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_2_HC
+{
+ File = "stockblock_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_3_HC
+{
+ File = "stockcolumns_52x60_h.png" ;
+};
+Bitmap BMP_STOCK_4_HC
+{
+ File = "stockcolumnsattach_52x60_h.png" ;
+};
+//---------------------
+//---------------------
+//---------------------
+//error indicator
+Image BMP_INDICATE_BOTH_VERTI_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothverti_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_DOWN_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errordown_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_UP_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorup_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_BOTH_HORI_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorbothhori_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_RIGHT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorright_30_h.png" ;
+ };
+};
+Image BMP_INDICATE_LEFT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "errorleft_30_h.png" ;
+ };
+};
+
+//---------------------
+//regression curves
+Image BMP_REGRESSION_NONE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regno_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LINEAR_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglin_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_LOG_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "reglog_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_EXP_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regexp_h.bmp" ;
+ };
+};
+Image BMP_REGRESSION_POWER_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "regpow_h.bmp" ;
+ };
+};
+//---------------------
+Image IMG_SELECTRANGE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "selectrange.png";
+ };
+ MaskColor = SC_HC_MASKCOLOR;
+};
diff --git a/chart2/source/controller/dialogs/ChangingResource.cxx b/chart2/source/controller/dialogs/ChangingResource.cxx
new file mode 100644
index 000000000000..22886c9b6108
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChangingResource.cxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChangingResource.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ResourceChangeListener::~ResourceChangeListener()
+{
+}
+
+ChangingResource::ChangingResource()
+ : m_pChangeListener(0)
+{
+}
+ChangingResource::~ChangingResource()
+{
+}
+void ChangingResource::setChangeListener( ResourceChangeListener* pListener )
+{
+ m_pChangeListener = pListener;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChangingResource.hxx b/chart2/source/controller/dialogs/ChangingResource.hxx
new file mode 100644
index 000000000000..ed6be33b912e
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChangingResource.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CHANGINGRESOURCE_HXX
+#define _CHART2_CHANGINGRESOURCE_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class ChangingResource;
+class ResourceChangeListener
+{
+public:
+ virtual void stateChanged( ChangingResource* pResource ) = 0;
+ virtual ~ResourceChangeListener();
+};
+
+class ChangingResource
+{
+public:
+ ChangingResource();
+ virtual ~ChangingResource();
+
+ virtual void setChangeListener( ResourceChangeListener* pListener );
+
+protected:
+ ResourceChangeListener* m_pChangeListener;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
new file mode 100644
index 000000000000..5e8bd7336b86
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -0,0 +1,1285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartTypeDialogController.hxx"
+#include "ResId.hxx"
+#include "HelpIds.hrc"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "AxisHelper.hxx"
+
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/PieChartOffsetMode.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+// header for class Image
+#include <vcl/image.hxx>
+// header for class Bitmap
+#include <vcl/bitmap.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_BITMAP(name) Bitmap( SchResId( bIsHighContrast ? name ## _HC : name ))
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+/*
+ ( C2U( "com.sun.star.chart2.template.Surface" ), CHSTYLE_3D_SURFACE)
+ ( C2U( "com.sun.star.chart2.template.Addin" ), CHSTYLE_ADDIN)
+*/
+
+ChartTypeParameter::ChartTypeParameter()
+ : nSubTypeIndex( 1 )
+ , bXAxisWithValues( false )
+ , b3DLook( false )
+ , bSymbols( true )
+ , bLines( true )
+ , eStackMode( GlobalStackMode_NONE )
+ , eCurveStyle( CurveStyle_LINES )
+ , nCurveResolution(20)
+ , nSplineOrder(3)
+ , nGeometry3D(DataPointGeometry3D::CUBOID)
+ , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , bSortByXValues(sal_False)
+{
+}
+
+ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex, bool HasXAxisWithValues
+ , bool Is3DLook, GlobalStackMode nStackMode
+ , bool HasSymbols, bool HasLines
+ , CurveStyle nCurveStyle )
+ : nSubTypeIndex( SubTypeIndex )
+ , bXAxisWithValues( HasXAxisWithValues )
+ , b3DLook( Is3DLook )
+ , bSymbols( HasSymbols )
+ , bLines( HasLines )
+ , eStackMode( nStackMode )
+ , eCurveStyle( nCurveStyle )
+ , nCurveResolution(20)
+ , nSplineOrder(3)
+ , nGeometry3D(DataPointGeometry3D::CUBOID)
+ , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , bSortByXValues(sal_False)
+{
+}
+ChartTypeParameter::~ChartTypeParameter()
+{
+}
+
+bool ChartTypeParameter::mapsToSameService( const ChartTypeParameter& rParameter ) const
+{
+ return this->mapsToSimilarService( rParameter, 0 );
+}
+bool ChartTypeParameter::mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const
+{
+ sal_Int32 nMax=7;
+ if(nTheHigherTheLess>nMax)
+ return true;
+ if( this->bXAxisWithValues!=rParameter.bXAxisWithValues )
+ return nTheHigherTheLess>nMax-1;
+ if( this->b3DLook!=rParameter.b3DLook )
+ return nTheHigherTheLess>nMax-2;
+ if( this->eStackMode!=rParameter.eStackMode )
+ return nTheHigherTheLess>nMax-3;
+ if( this->nSubTypeIndex!=rParameter.nSubTypeIndex )
+ return nTheHigherTheLess>nMax-4;
+ if( this->bSymbols!=rParameter.bSymbols )
+ return nTheHigherTheLess>nMax-5;
+ if( this->bLines!=rParameter.bLines )
+ return nTheHigherTheLess>nMax-6;
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ChartTypeDialogController::ChartTypeDialogController()
+ : bSupportsXAxisWithValues(false)
+ , bSupports3D(true)
+{
+}
+
+ChartTypeDialogController::~ChartTypeDialogController()
+{
+}
+Image ChartTypeDialogController::getImage( bool /*bIsHighContrast*/ )
+{
+ return Image();
+}
+bool ChartTypeDialogController::isSubType( const rtl::OUString& rServiceName )
+{
+ const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
+ if( aIt != rTemplateMap.end())
+ return true;
+ return false;
+}
+ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
+ const rtl::OUString& rServiceName
+ , const uno::Reference< beans::XPropertySet >& xTemplateProps )
+{
+ ChartTypeParameter aRet;
+ const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
+ if( aIt != rTemplateMap.end())
+ aRet = (*aIt).second;
+ if( xTemplateProps.is() )
+ {
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U( "CurveStyle" )) >>= aRet.eCurveStyle;
+ xTemplateProps->getPropertyValue( C2U( "CurveResolution" )) >>= aRet.nCurveResolution;
+ xTemplateProps->getPropertyValue( C2U( "SplineOrder" )) >>= aRet.nSplineOrder;
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support CurveStyle, CurveResolution or SplineOrder
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U( "Geometry3D" )) >>= aRet.nGeometry3D;
+ }
+ catch( uno::Exception& ex )
+ {
+ //not all templates need to support CGeometry3D
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ return aRet;
+}
+void ChartTypeDialogController::adjustSubTypeAndEnableControls( ChartTypeParameter& /*rParameter*/ )
+{
+}
+void ChartTypeDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ case 3:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
+ break;
+ case 4:
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+void ChartTypeDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ bool bFoundSomeMatch=false;
+
+ rParameter.bXAxisWithValues = bSupportsXAxisWithValues;
+ if( rParameter.b3DLook && !bSupports3D )
+ rParameter.b3DLook = false;
+ if(!rParameter.b3DLook && rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
+ const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
+ for( sal_Int32 nMatchPrecision=0; nMatchPrecision<7 && !bFoundSomeMatch; nMatchPrecision++ )
+ {
+ for( aIter = rMap.begin(); aIter != aEnd; aIter++ )
+ {
+ if( rParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
+ {
+ //remind some values
+ ThreeDLookScheme aScheme = rParameter.eThreeDLookScheme;
+ sal_Int32 nCurveResolution = rParameter.nCurveResolution;
+ sal_Int32 nSplineOrder = rParameter.nSplineOrder;
+ CurveStyle eCurveStyle = rParameter.eCurveStyle;
+ sal_Int32 nGeometry3D = rParameter.nGeometry3D;
+ sal_Bool bSortByXValues = rParameter.bSortByXValues;
+
+ rParameter = (*aIter).second;
+
+ //some values should not be changed with charttype
+ rParameter.eThreeDLookScheme = aScheme;
+ rParameter.nCurveResolution = nCurveResolution;
+ rParameter.nSplineOrder =nSplineOrder;
+ rParameter.eCurveStyle = eCurveStyle;
+ rParameter.nGeometry3D = nGeometry3D;
+ rParameter.bSortByXValues = bSortByXValues;
+
+ bFoundSomeMatch = true;
+ break;
+ }
+ }
+ }
+ if(!bFoundSomeMatch)
+ {
+ if(rMap.begin()!=rMap.end())
+ rParameter = (*rMap.begin()).second;
+ else
+ rParameter = ChartTypeParameter();
+ }
+}
+rtl::OUString ChartTypeDialogController::getServiceNameForParameter( const ChartTypeParameter& rParameter ) const
+{
+ ChartTypeParameter aParameter(rParameter);
+ if( aParameter.bXAxisWithValues )
+ aParameter.eStackMode = GlobalStackMode_NONE;
+ if(!aParameter.b3DLook && aParameter.eStackMode==GlobalStackMode_STACK_Z)
+ aParameter.eStackMode = GlobalStackMode_NONE;
+ const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
+ tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
+ const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ if( aParameter.mapsToSameService( (*aIter).second ) )
+ return (*aIter).first;
+ }
+
+ OSL_ENSURE( false, "ChartType not implemented yet - use fallback to similar type" );
+ for( sal_Int32 nMatchPrecision=1; nMatchPrecision<8; nMatchPrecision++ )
+ {
+ for( aIter = rMap.begin(); aIter != aEnd; aIter++ )
+ {
+ if( aParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
+ return (*aIter).first;
+ }
+ }
+ return ::rtl::OUString();
+}
+uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTemplate(
+ const ChartTypeParameter& rParameter
+ , const uno::Reference< lang::XMultiServiceFactory >& xTemplateManager ) const
+{
+ uno::Reference< XChartTypeTemplate > xTemplate(0);
+
+ rtl::OUString aServiceName( this->getServiceNameForParameter( rParameter ) );
+ if(aServiceName.getLength())
+ {
+ xTemplate.set( xTemplateManager->createInstance( aServiceName ), uno::UNO_QUERY );
+ if(xTemplate.is())
+ {
+ uno::Reference< beans::XPropertySet > xTemplateProps( xTemplate, uno::UNO_QUERY );
+ if(xTemplateProps.is())
+ {
+ try
+ {
+ xTemplateProps->setPropertyValue( C2U( "CurveStyle" ), uno::makeAny(rParameter.eCurveStyle) );
+ xTemplateProps->setPropertyValue( C2U( "CurveResolution" ), uno::makeAny(rParameter.nCurveResolution) );
+ xTemplateProps->setPropertyValue( C2U( "SplineOrder" ), uno::makeAny(rParameter.nSplineOrder) );
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support CurveStyle, CurveResolution or SplineOrder
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ try
+ {
+ xTemplateProps->setPropertyValue( C2U( "Geometry3D" ), uno::makeAny(rParameter.nGeometry3D) );
+ }
+ catch( uno::Exception & ex )
+ {
+ //not all templates need to support Geometry3D
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ try
+ {
+ this->setTemplateProperties( xTemplateProps );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ return xTemplate;
+}
+
+bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter
+ , const uno::Reference< XChartDocument >& xChartModel )
+{
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< XChartTypeTemplate > xTemplate( this->getCurrentTemplate( rParameter, xTemplateManager ) );
+ if(xTemplate.is())
+ {
+ uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY);
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( xModel );
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ DiagramHelper::tTemplateWithServiceName aTemplateWithService(
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
+ if( aTemplateWithService.first.is())
+ aTemplateWithService.first->resetStyles( xDiagram );
+ xTemplate->changeDiagram( xDiagram );
+ if( Application::GetSettings().GetLayoutRTL() )
+ AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
+ if( rParameter.b3DLook )
+ ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
+
+ //SortByXValues
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is() )
+ xDiaProp->setPropertyValue( C2U( "SortByXValues" ), uno::makeAny( rParameter.bSortByXValues ) );
+ }
+ // \-- locked controllers
+ }
+ return false;
+}
+void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool /*bIsHighContrast*/, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+}
+bool ChartTypeDialogController::shouldShow_XAxisTypeControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_3DLookControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_StackingControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_DeepStackingControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_SplineControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_GeometryControl() const
+{
+ return false;
+}
+bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
+{
+ return false;
+}
+
+void ChartTypeDialogController::showExtraControls( Window* /*pParent*/, const Point& /*rPosition*/, const Size& /*rSize*/ )
+{
+}
+void ChartTypeDialogController::hideExtraControls() const
+{
+}
+void ChartTypeDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
+ , const uno::Reference< XChartDocument >& /*xChartModel*/
+ , const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const
+{
+}
+void ChartTypeDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const throw (uno::RuntimeException)
+{
+}
+//--------------------------------------------------------------------------
+
+ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
+ : ChartTypeDialogController()
+{
+}
+ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
+{
+}
+bool ColumnOrBarChartDialogController_Base::shouldShow_3DLookControl() const
+{
+ return true;
+}
+bool ColumnOrBarChartDialogController_Base::shouldShow_GeometryControl() const
+{
+ return true;
+}
+void ColumnOrBarChartDialogController_Base::adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter )
+{
+ if(rParameter.nSubTypeIndex>3 && !rParameter.b3DLook)
+ {
+ rParameter.nSubTypeIndex=1;
+ }
+}
+//--------------------------------------------------------------------------
+ColumnChartDialogController::ColumnChartDialogController()
+{
+}
+ColumnChartDialogController::~ColumnChartDialogController()
+{
+}
+String ColumnChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_COLUMN ));
+}
+Image ColumnChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_COLUMN );
+}
+const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Column" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedColumn" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
+ ;
+ return m_aTemplateMap;
+}
+void ColumnChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ switch(rParameter.nGeometry3D)
+ {
+ case DataPointGeometry3D::CYLINDER:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_SAEULE_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_SAEULE_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_SAEULE_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_SAEULE_3D_4 ) );
+ break;
+ case DataPointGeometry3D::CONE:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_KEGEL_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_KEGEL_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_KEGEL_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_KEGEL_3D_4 ) );
+ break;
+ case DataPointGeometry3D::PYRAMID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMID_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMID_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMID_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMID_3D_4 ) );
+ break;
+ default: //DataPointGeometry3D::CUBOID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_COLUMNS_3D ) );
+ break;
+ }
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_2D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_2D_3 ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DEEP )) );
+}
+
+//--------------------------------------------------------------------------
+
+BarChartDialogController::BarChartDialogController()
+{
+}
+BarChartDialogController::~BarChartDialogController()
+{
+}
+String BarChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BAR ));
+}
+Image BarChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BAR );
+}
+const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bar" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedBar" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
+ ;
+ return m_aTemplateMap;
+}
+void BarChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ switch(rParameter.nGeometry3D)
+ {
+ case DataPointGeometry3D::CYLINDER:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_ROEHRE_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_ROEHRE_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_ROEHRE_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_ROEHRE_3D_4 ) );
+ break;
+ case DataPointGeometry3D::CONE:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_KEGELQ_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_KEGELQ_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_KEGELQ_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_KEGELQ_3D_4 ) );
+ break;
+ case DataPointGeometry3D::PYRAMID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMIDQ_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMIDQ_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMIDQ_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMIDQ_3D_4 ) );
+ break;
+ default: //DataPointGeometry3D::CUBOID:
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BARS_3D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_BARS_3D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_BARS_3D_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_BARS_3D ) );
+ break;
+ }
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BARS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_BARS_2D_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_BARS_2D_3 ) );
+ }
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DEEP )) );
+}
+
+//--------------------------------------------------------------------------
+
+PieChartDialogController::PieChartDialogController()
+{
+}
+PieChartDialogController::~PieChartDialogController()
+{
+}
+String PieChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_PIE ));
+}
+Image PieChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_PIE );
+}
+const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Pie" ), ChartTypeParameter(1,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), ChartTypeParameter(2,false,false) )
+ ( C2U( "com.sun.star.chart2.template.Donut" ), ChartTypeParameter(3,false,false) )
+ ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), ChartTypeParameter(4,false,false) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), ChartTypeParameter(1,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), ChartTypeParameter(2,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), ChartTypeParameter(3,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), ChartTypeParameter(4,false,true) )
+ ;
+ return m_aTemplateMap;
+}
+void PieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_3D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_3D_EXPLODED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_3D ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_3D_EXPLODED ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_2D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_2D_EXPLODED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_2D ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_2D_EXPLODED ) );
+ }
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_PIE_EXPLODED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_DONUT )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_DONUT_EXPLODED )) );
+}
+bool PieChartDialogController::shouldShow_3DLookControl() const
+{
+ return true;
+}
+void PieChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//--------------------------------------------------------------------------
+LineChartDialogController::LineChartDialogController()
+{
+}
+LineChartDialogController::~LineChartDialogController()
+{
+}
+String LineChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_LINE ));
+}
+Image LineChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_LINE );
+}
+const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //-------------------------------------------------------
+ ( C2U( "com.sun.star.chart2.template.Symbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
+ ( C2U( "com.sun.star.chart2.template.LineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
+ ( C2U( "com.sun.star.chart2.template.Line" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+ //-------------------------------------------------------
+ //( C2U( "com.sun.star.chart2.template.ThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z,false,true) )
+ //-------------------------------------------------------
+ ;
+ return m_aTemplateMap;
+}
+void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( CurveStyle_LINES==rParameter.eCurveStyle )
+ {
+ //direct lines
+ if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED ) );
+ }
+ }
+ else //CurveStyle_LINES
+ {
+ if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY_SMOOTH ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED_SMOOTH ) );
+ }
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_LINES_3D )) );
+}
+bool LineChartDialogController::shouldShow_StackingControl() const
+{
+ return true;
+}
+bool LineChartDialogController::shouldShow_DeepStackingControl() const
+{
+ return false;
+}
+bool LineChartDialogController::shouldShow_SplineControl() const
+{
+ return true;
+}
+void LineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ rParameter.b3DLook = true;
+ if( rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+
+ if(!rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_STACK_Z )
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+void LineChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+
+ ChartTypeDialogController::adjustParameterToMainType( rParameter );
+}
+//--------------------------------------------------------------------------
+XYChartDialogController::XYChartDialogController()
+{
+ bSupportsXAxisWithValues = true;
+}
+XYChartDialogController::~XYChartDialogController()
+{
+}
+String XYChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_XY ));
+}
+Image XYChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_XY );
+}
+const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //-------------------------------------------------------
+ ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), ChartTypeParameter(1,true,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), ChartTypeParameter(2,true,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.ScatterLine" ), ChartTypeParameter(3,true,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), ChartTypeParameter(4,true,true,GlobalStackMode_NONE,false,true) )
+ ;
+ return m_aTemplateMap;
+}
+void XYChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( CurveStyle_LINES==rParameter.eCurveStyle )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES ) );
+ }
+ else //CurveStyle_LINES
+ {
+ //smooth lines
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES_SMOOTH ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES_SMOOTH ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES_SMOOTH ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_LINES_3D )) );
+}
+bool XYChartDialogController::shouldShow_SplineControl() const
+{
+ return true;
+}
+bool XYChartDialogController::shouldShow_SortByXValuesResourceGroup() const
+{
+ return true;
+}
+void XYChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ rParameter.b3DLook = false;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ rParameter.b3DLook = true;
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+AreaChartDialogController::AreaChartDialogController()
+{
+}
+AreaChartDialogController::~AreaChartDialogController()
+{
+}
+String AreaChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_AREA ));
+}
+Image AreaChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_AREA );
+}
+bool AreaChartDialogController::shouldShow_3DLookControl() const
+{
+ return true;
+}
+const tTemplateServiceChartTypeParameterMap& AreaChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Area" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
+ ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), ChartTypeParameter(1,false,true,GlobalStackMode_STACK_Z) )
+ ( C2U( "com.sun.star.chart2.template.StackedArea" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
+ ;
+ return m_aTemplateMap;
+}
+void AreaChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( rParameter.b3DLook )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_3D ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_3D_1 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_3D_2 ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_2D_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_2D ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_2D_3 ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( rParameter.b3DLook ? STR_DEEP : STR_NORMAL )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STACKED )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_PERCENT )) );
+}
+void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.eCurveStyle = CurveStyle_LINES;
+
+ if( rParameter.nSubTypeIndex>3 )
+ rParameter.nSubTypeIndex = 1;
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ case 3:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
+ break;
+ default:
+ if( rParameter.b3DLook )
+ rParameter.eStackMode=GlobalStackMode_STACK_Z;
+ else
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+void AreaChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
+{
+ if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+
+ ChartTypeDialogController::adjustParameterToMainType( rParameter );
+}
+//--------------------------------------------------------------------------
+NetChartDialogController::NetChartDialogController()
+{
+ bSupports3D = false;
+}
+NetChartDialogController::~NetChartDialogController()
+{
+}
+String NetChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_NET ));
+}
+Image NetChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_NET );
+}
+bool NetChartDialogController::shouldShow_StackingControl() const
+{
+ return true;
+}
+const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ //@todo need templates with symbols only
+ ( C2U( "com.sun.star.chart2.template.NetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ),ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
+
+ ( C2U( "com.sun.star.chart2.template.Net" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
+
+ ( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
+ ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) )
+ ;
+ return m_aTemplateMap;
+}
+void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter )
+{
+ rSubTypeList.Clear();
+
+ if( GlobalStackMode_NONE == rParameter.eStackMode )
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) );
+ }
+ else
+ {
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) );
+ }
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) );
+}
+void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.bSymbols = true;
+ rParameter.bLines = true;
+ break;
+ case 3:
+ rParameter.bSymbols = false;
+ rParameter.bLines = true;
+ break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = false;
+ break;
+ default:
+ rParameter.bSymbols = true;
+ rParameter.bLines = false;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+StockChartDialogController::StockChartDialogController()
+{
+ bSupports3D = false;
+}
+StockChartDialogController::~StockChartDialogController()
+{
+}
+String StockChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_STOCK ));
+}
+Image StockChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_STOCK );
+}
+const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), ChartTypeParameter(1) )
+ ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), ChartTypeParameter(2) )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), ChartTypeParameter(3) )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ),ChartTypeParameter(4) )
+ ;
+ return m_aTemplateMap;
+}
+void StockChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_STOCK_1 ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_STOCK_2 ) );
+ rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_STOCK_3 ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_STOCK_4 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_STOCK_1 )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_STOCK_2 )) );
+ rSubTypeList.SetItemText( 3, String( SchResId( STR_STOCK_3 )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_STOCK_4 )) );
+}
+void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//--------------------------------------------------------------------------
+CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
+ : m_pFT_NumberOfLines(0)
+ , m_pMF_NumberOfLines(0)
+{
+ bSupports3D = false;
+}
+CombiColumnLineChartDialogController::~CombiColumnLineChartDialogController()
+{
+ if(m_pFT_NumberOfLines)
+ delete m_pFT_NumberOfLines;
+ if(m_pMF_NumberOfLines)
+ delete m_pMF_NumberOfLines;
+}
+String CombiColumnLineChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_COMBI_COLUMN_LINE ));
+}
+Image CombiColumnLineChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_COLUMN_LINE );
+}
+const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), ChartTypeParameter(1) )
+ ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
+ ;
+ return m_aTemplateMap;
+}
+void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_COLUMN_LINE ) );
+ rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_COLUMN_LINE_STACKED ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_LINE_COLUMN )) );
+ rSubTypeList.SetItemText( 2, String( SchResId( STR_LINE_STACKEDCOLUMN )) );
+}
+void CombiColumnLineChartDialogController::showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize )
+{
+ if(!m_pFT_NumberOfLines)
+ {
+ m_pFT_NumberOfLines = new FixedText(pParent,pParent->GetStyle());
+ m_pFT_NumberOfLines->SetText( String( SchResId( STR_NUMBER_OF_LINES )) );
+ }
+ if(!m_pMF_NumberOfLines)
+ {
+ m_pMF_NumberOfLines = new MetricField(pParent,pParent->GetStyle() | WB_SPIN | WB_REPEAT | WB_BORDER );
+ m_pMF_NumberOfLines->SetDefaultUnit( FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetUnit( FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetSpinSize(1);
+ m_pMF_NumberOfLines->SetFirst( 1, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetLast( 100, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetMin( 1, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetMax( 100, FUNIT_CUSTOM );
+ m_pMF_NumberOfLines->SetHelpId( HID_SCH_NUM_OF_LINES );
+
+ m_pMF_NumberOfLines->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController, ChangeLineCountHdl ) );
+ }
+
+ Size aDistanceSize( pParent->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,2), MapMode(MAP_APPFONT) ) );
+ Size aMFSize( pParent->LogicToPixel( Size(20,RSC_CD_TEXTBOX_HEIGHT), MapMode(MAP_APPFONT) ) );
+ m_pMF_NumberOfLines->SetSizePixel( aMFSize );
+
+ Size aFTSize(m_pFT_NumberOfLines->CalcMinimumSize(rSize.Width()-aMFSize.Width()-aDistanceSize.Width()));
+ m_pFT_NumberOfLines->SetSizePixel(aFTSize);
+
+ m_pFT_NumberOfLines->SetPosPixel( Point( rPosition.X(), rPosition.Y()+aDistanceSize.Height()) );
+ m_pMF_NumberOfLines->SetPosPixel( Point( rPosition.X()+aFTSize.Width()+aDistanceSize.Width(), rPosition.Y()) );
+
+ m_pFT_NumberOfLines->Show();
+ m_pMF_NumberOfLines->Show();
+}
+void CombiColumnLineChartDialogController::hideExtraControls() const
+{
+ if(m_pFT_NumberOfLines)
+ m_pFT_NumberOfLines->Hide();
+ if(m_pMF_NumberOfLines)
+ m_pMF_NumberOfLines->Hide();
+}
+void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
+{
+ if(!m_pMF_NumberOfLines)
+ return;
+
+ uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY );
+
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ if(!xDiagram.is())
+ return;
+
+ sal_Int32 nNumLines = 0;
+
+ if(xTemplateProps.is())
+ try
+ {
+ xTemplateProps->getPropertyValue( C2U("NumberOfLines") ) >>= nNumLines;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ if( nNumLines < 0 )
+ nNumLines = 0;
+ m_pMF_NumberOfLines->SetValue( nNumLines );
+
+ sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xModel ).size() - 1;
+ if( nMaxLines < 0 )
+ nMaxLines = 0;
+ m_pMF_NumberOfLines->SetLast( nMaxLines );
+ m_pMF_NumberOfLines->SetMax( nMaxLines );
+}
+void CombiColumnLineChartDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& xTemplateProps ) const throw (uno::RuntimeException)
+{
+ if( xTemplateProps.is() )
+ {
+ sal_Int32 nNumLines = static_cast< sal_Int32 >( m_pMF_NumberOfLines->GetValue());
+ xTemplateProps->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNumLines) );
+ }
+}
+
+IMPL_LINK( CombiColumnLineChartDialogController, ChangeLineCountHdl, void *, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
+ rParameter.eStackMode = GlobalStackMode_NONE;
+
+ switch( rParameter.nSubTypeIndex )
+ {
+ case 2:
+ rParameter.eStackMode=GlobalStackMode_STACK_Y;
+ break;
+ default:
+ rParameter.eStackMode=GlobalStackMode_NONE;
+ break;
+ }
+}
+//--------------------------------------------------------------------------
+BubbleChartDialogController::BubbleChartDialogController()
+{
+}
+BubbleChartDialogController::~BubbleChartDialogController()
+{
+}
+String BubbleChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BUBBLE ));
+}
+Image BubbleChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BUBBLE );
+}
+const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), ChartTypeParameter(1,true) ) ;
+ return m_aTemplateMap;
+}
+void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BUBBLE_1 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_BUBBLE_1 )) );
+}
+void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
new file mode 100644
index 000000000000..56ffb93e4a60
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
+#define _CHART2_CHARTTYPE_DIALOG_CONTROLLER_HXX
+
+#include "ChangingResource.hxx"
+#include "ThreeDHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+
+#include <com/sun/star/chart2/CurveStyle.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <svtools/valueset.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+enum GlobalStackMode
+{
+ GlobalStackMode_NONE,
+ GlobalStackMode_STACK_Y,
+ GlobalStackMode_STACK_Y_PERCENT,
+ GlobalStackMode_STACK_Z
+};
+
+class ChartTypeParameter
+{
+public:
+ ChartTypeParameter( sal_Int32 nSubTypeIndex, bool bXAxisWithValues=false
+ , bool b3DLook=false, GlobalStackMode eStackMode=GlobalStackMode_NONE
+ , bool _bSymbols = true, bool _bLines = true
+ , ::com::sun::star::chart2::CurveStyle eCurveStyle = ::com::sun::star::chart2::CurveStyle_LINES );
+ ChartTypeParameter();
+ virtual ~ChartTypeParameter();
+
+ bool mapsToSameService( const ChartTypeParameter& rParameter ) const;
+ bool mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const;
+
+ sal_Int32 nSubTypeIndex;//starting with 1
+
+ bool bXAxisWithValues;
+ bool b3DLook;
+ bool bSymbols;
+ bool bLines;
+
+ GlobalStackMode eStackMode;
+ ::com::sun::star::chart2::CurveStyle eCurveStyle;
+
+ sal_Int32 nCurveResolution;
+ sal_Int32 nSplineOrder;
+
+ sal_Int32 nGeometry3D;
+
+ ThreeDLookScheme eThreeDLookScheme;
+ sal_Bool bSortByXValues;
+};
+
+typedef ::comphelper::MakeMap< ::rtl::OUString, ChartTypeParameter > tTemplateServiceChartTypeParameterMap;
+
+class ChartTypeDialogController : public ChangingResource
+{
+public:
+ ChartTypeDialogController();
+ virtual ~ChartTypeDialogController();
+
+ virtual String getName()=0;
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_XAxisTypeControl() const;
+ virtual bool shouldShow_3DLookControl() const;
+ virtual bool shouldShow_StackingControl() const;
+ virtual bool shouldShow_DeepStackingControl() const;
+ virtual bool shouldShow_SplineControl() const;
+ virtual bool shouldShow_GeometryControl() const;
+ virtual bool shouldShow_SortByXValuesResourceGroup() const;
+
+ virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
+ virtual void hideExtraControls() const;
+ virtual void fillExtraControls( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
+ virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
+
+ virtual bool isSubType( const rtl::OUString& rServiceName );
+ virtual ChartTypeParameter getChartTypeParameterForService( const rtl::OUString& rServiceName, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTemplateProps );
+ virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );//if you have different counts of subtypes you may need to adjust the index
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+ virtual rtl::OUString getServiceNameForParameter( const ChartTypeParameter& rParameter ) const;
+ virtual bool commitToModel( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xTemplateManager ) const;
+
+protected:
+ bool bSupportsXAxisWithValues;
+ bool bSupports3D;
+};
+
+class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController
+{
+public:
+ ColumnOrBarChartDialogController_Base();
+ virtual ~ColumnOrBarChartDialogController_Base();
+
+ virtual bool shouldShow_3DLookControl() const;
+ virtual bool shouldShow_GeometryControl() const;
+
+ virtual void adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter );
+};
+
+class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base
+{
+public:
+ ColumnChartDialogController();
+ virtual ~ColumnChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+};
+
+class BarChartDialogController : public ColumnOrBarChartDialogController_Base
+{
+public:
+ BarChartDialogController();
+ virtual ~BarChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+};
+
+class PieChartDialogController : public ChartTypeDialogController
+{
+public:
+ PieChartDialogController();
+ virtual ~PieChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_3DLookControl() const;
+};
+
+class LineChartDialogController : public ChartTypeDialogController
+{
+public:
+ LineChartDialogController();
+ virtual ~LineChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_StackingControl() const;
+ virtual bool shouldShow_DeepStackingControl() const;
+ virtual bool shouldShow_SplineControl() const;
+};
+
+class XYChartDialogController : public ChartTypeDialogController
+{
+public:
+ XYChartDialogController();
+ virtual ~XYChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_SplineControl() const;
+ virtual bool shouldShow_SortByXValuesResourceGroup() const;
+};
+
+class AreaChartDialogController : public ChartTypeDialogController
+{
+public:
+ AreaChartDialogController();
+ virtual ~AreaChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+ virtual void adjustParameterToMainType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_3DLookControl() const;
+};
+
+class NetChartDialogController : public ChartTypeDialogController
+{
+public:
+ NetChartDialogController();
+ virtual ~NetChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual bool shouldShow_StackingControl() const;
+};
+
+class StockChartDialogController : public ChartTypeDialogController
+{
+public:
+ StockChartDialogController();
+ virtual ~StockChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
+class CombiColumnLineChartDialogController : public ChartTypeDialogController
+{
+public:
+ CombiColumnLineChartDialogController();
+ virtual ~CombiColumnLineChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+
+ virtual void showExtraControls( Window* pParent, const Point& rPosition, const Size& rSize );
+ virtual void hideExtraControls() const;
+ virtual void fillExtraControls( const ChartTypeParameter& rParameter
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps=::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() ) const;
+
+ virtual void setTemplateProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xTemplateProps ) const throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ DECL_LINK( ChangeLineCountHdl, void* );
+
+private:
+ FixedText* m_pFT_NumberOfLines;
+ MetricField* m_pMF_NumberOfLines;
+};
+
+class BubbleChartDialogController : public ChartTypeDialogController
+{
+public:
+ BubbleChartDialogController();
+ virtual ~BubbleChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
new file mode 100644
index 000000000000..b2790a1678bb
--- /dev/null
+++ b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_DIALOGS_TEMPLATEPROVIDER_HXX
+#define _CHART2_DIALOGS_TEMPLATEPROVIDER_HXX
+
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class ChartTypeTemplateProvider
+{
+public:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const =0;
+ virtual ~ChartTypeTemplateProvider() {}
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/CommonResources.hrc b/chart2/source/controller/dialogs/CommonResources.hrc
new file mode 100644
index 000000000000..8a3ae8f9f63c
--- /dev/null
+++ b/chart2/source/controller/dialogs/CommonResources.hrc
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_HXX
+#define _CHART2_RESOURCE_HXX
+
+#define BUTTONS_OK_CANCEL_HELP( xPos, yPos, xOffset, yOffset ) \
+OKButton BTN_OK \
+{ \
+ Pos = MAP_APPFONT ( xPos , yPos ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton BTN_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset , yPos+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+HelpButton BTN_HELP \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset+xOffset , yPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_OK_CANCEL_HELP_STACKED( xPos ) \
+BUTTONS_OK_CANCEL_HELP( xPos, 6, 0, 17 )
+
+#define BUTTONS_HELP_OK_CANCEL( xPos, yPos, xOffset, yOffset ) \
+HelpButton BTN_HELP \
+{ \
+ Pos = MAP_APPFONT ( xPos , yPos ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+OKButton BTN_OK \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset , yPos+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton BTN_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xPos+xOffset+xOffset , yPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_HELP_OK_CANCEL_NEXT( xPos, yPos ) \
+BUTTONS_HELP_OK_CANCEL( xPos, yPos, 53, 0 )
+
+
+#endif
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
new file mode 100644
index 000000000000..513d49b6aad8
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -0,0 +1,1364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+
+#include "DataBrowser.hxx"
+#include "DataBrowserModel.hxx"
+#include "Strings.hrc"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ResId.hxx"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "HelpIds.hrc"
+
+#include <vcl/fixed.hxx>
+#include <vcl/image.hxx>
+#include <vcl/msgbox.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include <algorithm>
+#include <functional>
+
+#define SELECT_IMAGE(name,hc) Image( SchResId( hc ? name ## _HC : name ))
+
+/* BROWSER_COLUMNSELECTION : single cells may be selected rather than only
+ entire rows
+ BROWSER_(H|V)LINES : show horizontal or vertical grid-lines
+
+ BROWSER_AUTO_(H|V)SCROLL : scroll automated horizontally or vertically when
+ cursor is moved beyond the edge of the dialog
+ BROWSER_HIGHLIGHT_NONE : Do not mark the current row with selection color
+ (usually blue)
+
+ */
+#define BROWSER_STANDARD_FLAGS \
+ BROWSER_COLUMNSELECTION | \
+ BROWSER_HLINES | BROWSER_VLINES | \
+ BROWSER_AUTO_HSCROLL | BROWSER_AUTO_VSCROLL | \
+ BROWSER_HIGHLIGHT_NONE
+
+// BROWSER_HIDECURSOR would prevent flickering in edit fields, but navigating
+// with shift up/down, and entering non-editable cells would be problematic,
+// e.g. the first cell, or when being in read-only mode
+
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+using namespace ::svt;
+
+namespace
+{
+sal_Int32 lcl_getRowInData( long nRow )
+{
+ return static_cast< sal_Int32 >( nRow );
+}
+
+sal_Int32 lcl_getColumnInData( USHORT nCol )
+{
+ return static_cast< sal_Int32 >( nCol ) - 1;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+// ----------------------------------------
+namespace impl
+{
+
+class SeriesHeaderEdit : public Edit
+{
+public:
+ SeriesHeaderEdit( Window * pParent );
+ virtual ~SeriesHeaderEdit();
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void setStartColumn( sal_Int32 nStartColumn );
+ sal_Int32 getStartColumn() const;
+ void SetShowWarningBox( bool bShowWarning = true );
+
+private:
+ sal_Int32 m_nStartColumn;
+ bool m_bShowWarningBox;
+};
+
+SeriesHeaderEdit::SeriesHeaderEdit( Window * pParent ) :
+ Edit( pParent ),
+ m_nStartColumn( 0 ),
+ m_bShowWarningBox( false )
+{}
+SeriesHeaderEdit::~SeriesHeaderEdit()
+{}
+
+void SeriesHeaderEdit::setStartColumn( sal_Int32 nStartColumn )
+{
+ m_nStartColumn = nStartColumn;
+}
+
+sal_Int32 SeriesHeaderEdit::getStartColumn() const
+{
+ return m_nStartColumn;
+}
+
+void SeriesHeaderEdit::SetShowWarningBox( bool bShowWarning )
+{
+ m_bShowWarningBox = bShowWarning;
+}
+
+void SeriesHeaderEdit::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Edit::MouseButtonDown( rMEvt );
+
+ if( m_bShowWarningBox )
+ WarningBox( this, WinBits( WB_OK ),
+ String( SchResId( STR_INVALID_NUMBER ))).Execute();
+}
+
+class SeriesHeader
+{
+public:
+ explicit SeriesHeader( Window * pParent );
+
+ void SetColor( const Color & rCol );
+ void SetPos( const Point & rPos );
+ void SetWidth( sal_Int32 nWidth );
+ void SetChartType( const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bIsHighContrast );
+ void SetSeriesName( const String & rName );
+ void SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol );
+
+ void SetPixelPosX( sal_Int32 nPos );
+ void SetPixelWidth( sal_Int32 nWidth );
+
+ sal_Int32 GetStartColumn() const;
+ sal_Int32 GetEndColumn() const;
+
+ static sal_Int32 GetRelativeAppFontXPosForNameField();
+
+ void Show();
+
+ /** call this before destroying the class. This notifies the listeners to
+ changes of the edit field for the series name.
+ */
+ void applyChanges();
+
+ void SetGetFocusHdl( const Link& rLink );
+
+ void SetEditChangedHdl( const Link & rLink );
+
+ bool HasFocus() const;
+
+private:
+ ::boost::shared_ptr< FixedImage > m_spSymbol;
+ ::boost::shared_ptr< SeriesHeaderEdit > m_spSeriesName;
+ ::boost::shared_ptr< FixedText > m_spColorBar;
+ OutputDevice * m_pDevice;
+ Link m_aChangeLink;
+
+ void notifyChanges();
+ DECL_LINK( SeriesNameChanged, void * );
+ DECL_LINK( SeriesNameEdited, void * );
+
+ /// @param bHC </TRUE> for hight-contrast image
+ static Image GetChartTypeImage(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bHC );
+
+ sal_Int32 m_nStartCol, m_nEndCol;
+ sal_Int32 m_nWidth;
+ Point m_aPos;
+ bool m_bSeriesNameChangePending;
+};
+
+SeriesHeader::SeriesHeader( Window * pParent ) :
+ m_spSymbol( new FixedImage( pParent, WB_NOBORDER )),
+ m_spSeriesName( new SeriesHeaderEdit( pParent )),
+ m_spColorBar( new FixedText( pParent, WB_NOBORDER )),
+ m_pDevice( pParent ),
+ m_nStartCol( 0 ),
+ m_nEndCol( 0 ),
+ m_nWidth( 42 ),
+ m_aPos( 0, 22 ),
+ m_bSeriesNameChangePending( false )
+{
+ m_spSeriesName->EnableUpdateData( 4 * EDIT_UPDATEDATA_TIMEOUT ); // define is in vcl/edit.hxx
+ m_spSeriesName->SetUpdateDataHdl( LINK( this, SeriesHeader, SeriesNameChanged ));
+ m_spSeriesName->SetModifyHdl( LINK( this, SeriesHeader, SeriesNameEdited ));
+ m_spSeriesName->SetHelpId( HID_SCH_DATA_SERIES_LABEL );
+ Show();
+}
+
+void SeriesHeader::notifyChanges()
+{
+ if( m_aChangeLink.IsSet())
+ m_aChangeLink.Call( m_spSeriesName.get());
+
+ m_bSeriesNameChangePending = false;
+}
+
+void SeriesHeader::applyChanges()
+{
+ if( m_bSeriesNameChangePending )
+ {
+ notifyChanges();
+ }
+}
+
+void SeriesHeader::SetColor( const Color & rCol )
+{
+ m_spColorBar->SetControlBackground( rCol );
+}
+
+const sal_Int32 nSymbolHeight = 10;
+const sal_Int32 nSymbolDistance = 2;
+
+sal_Int32 SeriesHeader::GetRelativeAppFontXPosForNameField()
+{
+ return nSymbolHeight + nSymbolDistance;
+}
+
+void SeriesHeader::SetPos( const Point & rPos )
+{
+ m_aPos = rPos;
+
+ // chart type symbol
+ Point aPos( rPos );
+ aPos.setY( aPos.getY() + nSymbolDistance );
+ Size aSize( nSymbolHeight, nSymbolHeight );
+ m_spSymbol->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spSymbol->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+ aPos.setY( aPos.getY() - nSymbolDistance );
+
+ // series name edit field
+ aPos.setX( aPos.getX() + nSymbolHeight + nSymbolDistance );
+ aSize.setWidth( m_nWidth - nSymbolHeight - nSymbolDistance );
+ sal_Int32 nHeight = 12;
+ aSize.setHeight( nHeight );
+ m_spSeriesName->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spSeriesName->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+
+ // color bar
+ aPos.setX( rPos.getX() + 1 );
+ aPos.setY( aPos.getY() + nHeight + 2 );
+ nHeight = 3;
+ aSize.setWidth( m_nWidth - 1 );
+ aSize.setHeight( nHeight );
+ m_spColorBar->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT ));
+ m_spColorBar->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT ));
+}
+
+void SeriesHeader::SetWidth( sal_Int32 nWidth )
+{
+ m_nWidth = nWidth;
+ SetPos( m_aPos );
+}
+
+
+void SeriesHeader::SetPixelPosX( sal_Int32 nPos )
+{
+ Point aPos( m_pDevice->LogicToPixel( m_aPos, MAP_APPFONT ));
+ aPos.setX( nPos );
+ SetPos( m_pDevice->PixelToLogic( aPos, MAP_APPFONT ));
+}
+
+void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
+{
+ SetWidth( m_pDevice->PixelToLogic( Size( nWidth, 0 ), MAP_APPFONT ).getWidth());
+}
+
+void SeriesHeader::SetChartType(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bIsHighContrast )
+{
+ m_spSymbol->SetImage( GetChartTypeImage( xChartType, bSwapXAndYAxis, bIsHighContrast ));
+}
+
+void SeriesHeader::SetSeriesName( const String & rName )
+{
+ m_spSeriesName->SetText( rName );
+}
+
+void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )
+{
+ m_nStartCol = nStartCol;
+ m_nEndCol = (nEndCol > nStartCol) ? nEndCol : nStartCol;
+ m_spSeriesName->setStartColumn( nStartCol );
+}
+
+sal_Int32 SeriesHeader::GetStartColumn() const
+{
+ return m_nStartCol;
+}
+
+sal_Int32 SeriesHeader::GetEndColumn() const
+{
+ return m_nEndCol;
+}
+
+void SeriesHeader::Show()
+{
+ m_spSymbol->Show();
+ m_spSeriesName->Show();
+ m_spColorBar->Show();
+}
+
+void SeriesHeader::SetEditChangedHdl( const Link & rLink )
+{
+ m_aChangeLink = rLink;
+}
+
+IMPL_LINK( SeriesHeader, SeriesNameChanged, void * , EMPTYARG )
+{
+ notifyChanges();
+ return 0;
+}
+
+IMPL_LINK( SeriesHeader, SeriesNameEdited, void * , EMPTYARG )
+{
+ m_bSeriesNameChangePending = true;
+ return 0;
+}
+
+void SeriesHeader::SetGetFocusHdl( const Link& rLink )
+{
+ m_spSeriesName->SetGetFocusHdl( rLink );
+}
+
+bool SeriesHeader::HasFocus() const
+{
+ return m_spSeriesName->HasFocus();
+}
+
+// static
+Image SeriesHeader::GetChartTypeImage(
+ const Reference< chart2::XChartType > & xChartType,
+ bool bSwapXAndYAxis,
+ bool bHC )
+{
+ Image aResult;
+ if( !xChartType.is())
+ return aResult;
+ OUString aChartTypeName( xChartType->getChartType());
+
+ if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_AREA ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_AREA, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
+ {
+ if( bSwapXAndYAxis )
+ aResult = SELECT_IMAGE( IMG_TYPE_BAR, bHC );
+ else
+ aResult = SELECT_IMAGE( IMG_TYPE_COLUMN, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_LINE, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_XY, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_PIE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )
+ || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ))
+ {
+ // @todo: correct image for candle-stick type
+ aResult = SELECT_IMAGE( IMG_TYPE_STOCK, bHC );
+ }
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_BUBBLE, bHC );
+ }
+
+ return aResult;
+}
+
+struct applyChangesFunctor : public ::std::unary_function< ::boost::shared_ptr< SeriesHeader >, void >
+{
+ void operator() ( ::boost::shared_ptr< SeriesHeader > spHeader )
+ {
+ spHeader->applyChanges();
+ }
+};
+
+} // namespace impl
+// ----------------------------------------
+
+namespace
+{
+
+/** returns false, if no header as the focus.
+
+ If a header has the focus, true is returned and the index of the header
+ with focus is set at pIndex if pOutIndex is not 0.
+*/
+bool lcl_SeriesHeaderHasFocus(
+ const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader,
+ sal_Int32 * pOutIndex = 0 )
+{
+ sal_Int32 nIndex = 0;
+ for( ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > >::const_iterator aIt( rSeriesHeader.begin());
+ aIt != rSeriesHeader.end(); ++aIt, ++nIndex )
+ {
+ if( (*aIt)->HasFocus())
+ {
+ if( pOutIndex )
+ *pOutIndex = nIndex;
+ return true;
+ }
+ }
+ return false;
+}
+
+sal_Int32 lcl_getColumnInDataOrHeader(
+ USHORT nCol, const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader )
+{
+ sal_Int32 nColIdx = 0;
+ bool bHeaderHasFocus( lcl_SeriesHeaderHasFocus( rSeriesHeader, &nColIdx ));
+
+ if( bHeaderHasFocus )
+ nColIdx = lcl_getColumnInData( static_cast< USHORT >( rSeriesHeader[nColIdx]->GetStartColumn()));
+ else
+ nColIdx = lcl_getColumnInData( nCol );
+
+ return nColIdx;
+}
+
+} // anonymous namespace
+
+
+DataBrowser::DataBrowser( Window* pParent, const ResId& rId, bool bLiveUpdate ) :
+ ::svt::EditBrowseBox( pParent, rId, EBBF_SMART_TAB_TRAVEL | EBBF_HANDLE_COLUMN_TEXT, BROWSER_STANDARD_FLAGS ),
+ m_nSeekRow( 0 ),
+ m_bIsReadOnly( false ),
+ m_bIsDirty( false ),
+ m_bLiveUpdate( bLiveUpdate ),
+ m_bDataValid( true ),
+ m_aNumberEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
+ m_aTextEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
+ m_rNumberEditController( new ::svt::FormattedFieldCellController( & m_aNumberEditField )),
+ m_rTextEditController( new ::svt::EditCellController( & m_aTextEditField ))
+{
+ double fNan;
+ ::rtl::math::setNan( & fNan );
+ m_aNumberEditField.SetDefaultValue( fNan );
+ m_aNumberEditField.TreatAsNumber( TRUE );
+ RenewTable();
+ SetClean();
+}
+
+DataBrowser::~DataBrowser()
+{
+}
+
+bool DataBrowser::MayInsertRow() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ));
+}
+
+bool DataBrowser::MayInsertColumn() const
+{
+ return ! IsReadOnly();
+}
+
+bool DataBrowser::MayDeleteRow() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ && ( GetCurRow() >= 0 )
+ && ( GetRowCount() > 1 );
+}
+
+bool DataBrowser::MayDeleteColumn() const
+{
+ // if a series header has the focus
+ if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ return true;
+
+ return ! IsReadOnly()
+ && ( GetCurColumnId() > 1 )
+ && ( ColCount() > 2 );
+}
+
+bool DataBrowser::MaySwapRows() const
+{
+ return ! IsReadOnly()
+ && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
+ && ( GetCurRow() >= 0 )
+ && ( GetCurRow() < GetRowCount() - 1 );
+}
+
+bool DataBrowser::MaySwapColumns() const
+{
+ // if a series header (except the last one) has the focus
+ {
+ sal_Int32 nColIndex(0);
+ if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex ))
+ return (static_cast< sal_uInt32 >( nColIndex ) < (m_aSeriesHeaders.size() - 1));
+ }
+
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+ return ! IsReadOnly()
+ && ( nColIdx > 0 )
+ && ( nColIdx < ColCount()-2 )
+ && m_apDataBrowserModel.get()
+ && !m_apDataBrowserModel->isCategoriesColumn( nColIdx );
+}
+
+void DataBrowser::clearHeaders()
+{
+ ::std::for_each( m_aSeriesHeaders.begin(), m_aSeriesHeaders.end(), impl::applyChangesFunctor());
+ m_aSeriesHeaders.clear();
+}
+
+void DataBrowser::RenewTable()
+{
+ if( ! m_apDataBrowserModel.get())
+ return;
+
+ long nOldRow = GetCurRow();
+ USHORT nOldColId = GetCurColumnId();
+
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ if( IsModified() )
+ SaveModified();
+
+ DeactivateCell();
+
+ RemoveColumns();
+ RowRemoved( 1, GetRowCount() );
+
+ // for row numbers
+ InsertHandleColumn( static_cast< sal_uInt16 >(
+ GetDataWindow().LogicToPixel( Size( 42, 0 )).getWidth() ));
+
+ OUString aDefaultSeriesName( ::chart::SchResId::getResString( STR_COLUMN_LABEL ));
+ replaceParamterInString( aDefaultSeriesName, C2U("%COLUMNNUMBER"), OUString::valueOf( sal_Int32(24) ) );
+ sal_Int32 nColumnWidth = GetDataWindow().GetTextWidth( aDefaultSeriesName )
+ + GetDataWindow().LogicToPixel( Point( 4 + impl::SeriesHeader::GetRelativeAppFontXPosForNameField(), 0 ), MAP_APPFONT ).X();
+ sal_Int32 nColumnCount = m_apDataBrowserModel->getColumnCount();
+ // nRowCount is a member of a base class
+ sal_Int32 nRowCountLocal = m_apDataBrowserModel->getMaxRowCount();
+ for( sal_Int32 nColIdx=1; nColIdx<=nColumnCount; ++nColIdx )
+ {
+ InsertDataColumn( static_cast< sal_uInt16 >( nColIdx ), GetColString( nColIdx ), nColumnWidth );
+ }
+
+ RowInserted( 1, nRowCountLocal );
+ GoToRow( ::std::min( nOldRow, GetRowCount() - 1 ));
+ GoToColumnId( ::std::min( nOldColId, static_cast< USHORT >( ColCount() - 1 )));
+
+ Window * pWin = this->GetParent();
+ if( !pWin )
+ pWin = this;
+
+ // fill series headers
+ clearHeaders();
+ const DataBrowserModel::tDataHeaderVector& aHeaders( m_apDataBrowserModel->getDataHeaders());
+ Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
+ Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
+ bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false;
+
+ for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin());
+ aIt != aHeaders.end(); ++aIt )
+ {
+ ::boost::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( pWin ));
+ Reference< beans::XPropertySet > xSeriesProp( aIt->m_xDataSeries, uno::UNO_QUERY );
+ sal_Int32 nColor = 0;
+ // @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
+ if( xSeriesProp.is() &&
+ ( xSeriesProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Color"))) >>= nColor ))
+ spHeader->SetColor( Color( nColor ));
+ spHeader->SetChartType( aIt->m_xChartType, aIt->m_bSwapXAndYAxis, bIsHighContrast );
+ spHeader->SetSeriesName(
+ String( DataSeriesHelper::getDataSeriesLabel(
+ aIt->m_xDataSeries,
+ (aIt->m_xChartType.is() ?
+ aIt->m_xChartType->getRoleOfSequenceForSeriesLabel() :
+ OUString( RTL_CONSTASCII_USTRINGPARAM("values-y"))))));
+ // index is 1-based, as 0 is for the column that contains the row-numbers
+ spHeader->SetRange( aIt->m_nStartColumn + 1, aIt->m_nEndColumn + 1 );
+ spHeader->SetGetFocusHdl( aFocusLink );
+ spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
+ m_aSeriesHeaders.push_back( spHeader );
+ }
+
+ ImplAdjustHeaderControls();
+ SetDirty();
+ SetUpdateMode( bLastUpdateMode );
+ ActivateCell();
+ Invalidate();
+}
+
+String DataBrowser::GetColString( sal_Int32 nColumnId ) const
+{
+ OSL_ASSERT( m_apDataBrowserModel.get());
+ if( nColumnId > 0 )
+ return String( m_apDataBrowserModel->getRoleOfColumn( static_cast< sal_Int32 >( nColumnId ) - 1 ));
+ return String();
+}
+
+String DataBrowser::GetRowString( sal_Int32 nRow ) const
+{
+ return String::CreateFromInt32( nRow + 1 );
+}
+
+String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const
+{
+ String aResult;
+
+ if( nColumnId == 0 )
+ {
+ aResult = GetRowString( static_cast< sal_Int32 >( nRow ));
+ }
+ else if( nRow >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ sal_Int32 nColIndex = static_cast< sal_Int32 >( nColumnId ) - 1;
+
+ if( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::NUMBER )
+ {
+ double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow ));
+ sal_Int32 nLabelColor;
+ bool bColorChanged = false;
+
+ if( ! ::rtl::math::isNan( fData ) &&
+ m_spNumberFormatterWrapper.get() )
+ aResult = String( m_spNumberFormatterWrapper->getFormattedString(
+ GetNumberFormatKey( nRow, nColumnId ),
+ fData, nLabelColor, bColorChanged ));
+ }
+ else
+ {
+ OSL_ASSERT( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXT );
+ aResult = m_apDataBrowserModel->getCellText( nColIndex, nRow );
+ }
+ }
+
+ return aResult;
+}
+
+double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if(( nColumnId >= 1 ) && ( nRow >= 0 ) &&
+ m_apDataBrowserModel.get())
+ {
+ fResult = m_apDataBrowserModel->getCellNumber(
+ static_cast< sal_Int32 >( nColumnId ) - 1, nRow );
+ }
+
+ return fResult;
+}
+
+void DataBrowser::Resize()
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ ::svt::EditBrowseBox::Resize();
+ ImplAdjustHeaderControls();
+ SetUpdateMode( bLastUpdateMode );
+}
+
+bool DataBrowser::SetReadOnly( bool bNewState )
+{
+ bool bResult = m_bIsReadOnly;
+
+ if( m_bIsReadOnly != bNewState )
+ {
+ m_bIsReadOnly = bNewState;
+ Invalidate();
+ DeactivateCell();
+ }
+
+ return bResult;
+}
+
+bool DataBrowser::IsReadOnly() const
+{
+ return m_bIsReadOnly;
+}
+
+
+void DataBrowser::SetClean()
+{
+ m_bIsDirty = false;
+}
+
+void DataBrowser::SetDirty()
+{
+ if( !m_bLiveUpdate )
+ m_bIsDirty = true;
+}
+
+void DataBrowser::CursorMoved()
+{
+ EditBrowseBox::CursorMoved();
+
+ if( GetUpdateMode() && m_aCursorMovedHdlLink.IsSet())
+ m_aCursorMovedHdlLink.Call( this );
+}
+
+void DataBrowser::SetCellModifiedHdl( const Link& rLink )
+{
+ m_aCellModifiedLink = rLink;
+}
+
+void DataBrowser::MouseButtonDown( const BrowserMouseEvent& rEvt )
+{
+ if( !m_bDataValid )
+ ShowWarningBox();
+ else
+ EditBrowseBox::MouseButtonDown( rEvt );
+}
+
+void DataBrowser::ShowWarningBox()
+{
+ WarningBox( this, WinBits( WB_OK ),
+ String( SchResId( STR_INVALID_NUMBER ))).Execute();
+}
+
+bool DataBrowser::ShowQueryBox()
+{
+ QueryBox* pQueryBox = new QueryBox( this, WB_YES_NO, String( SchResId( STR_DATA_EDITOR_INCORRECT_INPUT )));
+
+ return ( pQueryBox->Execute() == RET_YES );
+}
+
+bool DataBrowser::IsDataValid()
+{
+ bool bValid = true;
+ const sal_Int32 nRow = lcl_getRowInData( GetCurRow());
+ const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
+
+ if( m_apDataBrowserModel->getCellType( nCol, nRow ) == DataBrowserModel::NUMBER )
+ {
+ sal_uInt32 nDummy = 0;
+ double fDummy = 0.0;
+ String aText( m_aNumberEditField.GetText());
+
+ if( aText.Len() > 0 &&
+ m_spNumberFormatterWrapper.get() &&
+ m_spNumberFormatterWrapper->getSvNumberFormatter() &&
+ ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat(
+ aText, nDummy, fDummy ))
+ {
+ bValid = false;
+ }
+ }
+
+ return bValid;
+}
+
+bool DataBrowser::IsEnableItem()
+{
+ return m_bDataValid;
+}
+
+void DataBrowser::CellModified()
+{
+ m_bDataValid = IsDataValid();
+ SetDirty();
+ if( m_aCellModifiedLink.IsSet())
+ m_aCursorMovedHdlLink.Call( this );
+}
+
+void DataBrowser::SetDataFromModel(
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext )
+{
+ if( m_bLiveUpdate )
+ {
+ m_xChartDoc.set( xChartDoc );
+ }
+ else
+ {
+ Reference< util::XCloneable > xCloneable( xChartDoc, uno::UNO_QUERY );
+ if( xCloneable.is())
+ m_xChartDoc.set( xCloneable->createClone(), uno::UNO_QUERY );
+ }
+
+ m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc, xContext ));
+ m_spNumberFormatterWrapper.reset(
+ new NumberFormatterWrapper(
+ Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )));
+
+ RenewTable();
+
+ const sal_Int32 nColCnt = m_apDataBrowserModel->getColumnCount();
+ const sal_Int32 nRowCnt = m_apDataBrowserModel->getMaxRowCount();
+ if( nRowCnt && nColCnt )
+ {
+ GoToRow( 0 );
+ GoToColumnId( 1 );
+ }
+ SetClean();
+}
+
+void DataBrowser::InsertColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->insertDataSeries( nColIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::InsertTextColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->insertComplexCategoryLevel( nColIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::RemoveColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_bDataValid = true;
+ m_apDataBrowserModel->removeDataSeriesOrComplexCategoryLevel( nColIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::InsertRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->insertDataPointForAllSeries( nRowIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::RemoveRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_bDataValid = true;
+ m_apDataBrowserModel->removeDataPointForAllSeries( nRowIdx );
+ RenewTable();
+ }
+}
+
+void DataBrowser::SwapColumn()
+{
+ sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
+
+ if( nColIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->swapDataSeries( nColIdx );
+
+ // keep cursor in swapped column
+ if( GetCurColumnId() < ColCount() - 1 )
+ {
+ Dispatch( BROWSER_CURSORRIGHT );
+ }
+ RenewTable();
+ }
+}
+
+void DataBrowser::SwapRow()
+{
+ sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow());
+
+ if( nRowIdx >= 0 &&
+ m_apDataBrowserModel.get())
+ {
+ // save changes made to edit-field
+ if( IsModified() )
+ SaveModified();
+
+ m_apDataBrowserModel->swapDataPointForAllSeries( nRowIdx );
+
+ // keep cursor in swapped row
+ if( GetCurRow() < GetRowCount() - 1 )
+ {
+ Dispatch( BROWSER_CURSORDOWN );
+ }
+ RenewTable();
+ }
+}
+
+void DataBrowser::SetCursorMovedHdl( const Link& rLink )
+{
+ m_aCursorMovedHdlLink = rLink;
+}
+
+// implementations for ::svt::EditBrowseBox (pure virtual methods)
+void DataBrowser::PaintCell(
+ OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const
+{
+ Point aPos( rRect.TopLeft());
+ aPos.X() += 1;
+
+ String aText = GetCellText( m_nSeekRow, nColumnId );
+ Size TxtSize( GetDataWindow().GetTextWidth( aText ), GetDataWindow().GetTextHeight());
+
+ // clipping
+ if( aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() ||
+ aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom())
+ rDev.SetClipRegion( rRect );
+
+ // allow for a disabled control ...
+ sal_Bool bEnabled = IsEnabled();
+ Color aOriginalColor = rDev.GetTextColor();
+ if( ! bEnabled )
+ rDev.SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
+
+ // TEST
+// if( nColumnId == 1 )
+// // categories
+// rDev.SetFillColor( Color( 0xff, 0xff, 0xff ));
+// else if( nColumnId == 2 )
+// // x-values
+// rDev.SetFillColor( Color( 0xf0, 0xf0, 0xff ));
+// else
+// // y-values
+// rDev.SetFillColor( Color( 0xff, 0xff, 0xf0 ));
+
+// rDev.DrawRect( rRect );
+
+ // draw the text
+ rDev.DrawText( aPos, aText );
+
+ // reset the color (if necessary)
+ if( ! bEnabled )
+ rDev.SetTextColor( aOriginalColor );
+
+ if( rDev.IsClipRegion())
+ rDev.SetClipRegion();
+}
+
+sal_Bool DataBrowser::SeekRow( long nRow )
+{
+ if( ! EditBrowseBox::SeekRow( nRow ))
+ return sal_False;
+
+ if( nRow < 0 )
+ m_nSeekRow = - 1;
+ else
+ m_nSeekRow = nRow;
+
+ return sal_True;
+}
+
+sal_Bool DataBrowser::IsTabAllowed( sal_Bool bForward ) const
+{
+ long nRow = GetCurRow();
+ long nCol = GetCurColumnId();
+
+ // column 0 is header-column
+ long nBadCol = bForward
+ ? GetColumnCount() - 1
+ : 1;
+ long nBadRow = bForward
+ ? GetRowCount() - 1
+ : 0;
+
+ if( !m_bDataValid )
+ {
+ const_cast< DataBrowser* >( this )->ShowWarningBox();
+ return sal_False;
+ }
+
+ return ( nRow != nBadRow ||
+ nCol != nBadCol );
+}
+
+::svt::CellController* DataBrowser::GetController( long nRow, sal_uInt16 nCol )
+{
+ if( m_bIsReadOnly )
+ return 0;
+
+ if( CellContainsNumbers( nRow, nCol ))
+ {
+ m_aNumberEditField.UseInputStringForFormatting();
+ m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
+ return m_rNumberEditController;
+ }
+
+ return m_rTextEditController;
+}
+
+void DataBrowser::InitController(
+ ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol )
+{
+ if( rController == m_rTextEditController )
+ {
+ String aText( GetCellText( nRow, nCol ) );
+ m_aTextEditField.SetText( aText );
+ m_aTextEditField.SetSelection( Selection( 0, aText.Len() ));
+ }
+ else if( rController == m_rNumberEditController )
+ {
+ // treat invalid and empty text as Nan
+ m_aNumberEditField.EnableNotANumber( true );
+ if( ::rtl::math::isNan( GetCellNumber( nRow, nCol )))
+ m_aNumberEditField.SetTextValue( String());
+ else
+ m_aNumberEditField.SetValue( GetCellNumber( nRow, nCol ) );
+ String aText( m_aNumberEditField.GetText());
+ m_aNumberEditField.SetSelection( Selection( 0, aText.Len()));
+ }
+ else
+ {
+ DBG_ERROR( "Invalid Controller" );
+ }
+}
+
+bool DataBrowser::CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const
+{
+ if( ! m_apDataBrowserModel.get())
+ return false;
+ return (m_apDataBrowserModel->getCellType( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow )) ==
+ DataBrowserModel::NUMBER);
+}
+
+sal_uInt32 DataBrowser::GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const
+{
+ if( ! m_apDataBrowserModel.get())
+ return 0;
+ return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow ));
+}
+
+sal_Bool DataBrowser::SaveModified()
+{
+ if( ! IsModified() )
+ return sal_True;
+
+ sal_Bool bChangeValid = sal_True;
+
+ const sal_Int32 nRow = lcl_getRowInData( GetCurRow());
+ const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
+
+ DBG_ASSERT( nRow >= 0 || nCol >= 0, "This cell should not be modified!" );
+
+ switch( m_apDataBrowserModel->getCellType( nCol, nRow ))
+ {
+ case DataBrowserModel::NUMBER:
+ {
+ sal_uInt32 nDummy = 0;
+ double fDummy = 0.0;
+ String aText( m_aNumberEditField.GetText());
+ // an empty string is valid, if no numberformatter exists, all
+ // values are treated as valid
+ if( aText.Len() > 0 &&
+ m_spNumberFormatterWrapper.get() &&
+ m_spNumberFormatterWrapper->getSvNumberFormatter() &&
+ ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat(
+ aText, nDummy, fDummy ))
+ {
+ bChangeValid = sal_False;
+ }
+ else
+ {
+ double fData = m_aNumberEditField.GetValue();
+ bChangeValid = m_apDataBrowserModel->setCellNumber( nCol, nRow, fData );
+ }
+ }
+ break;
+ case DataBrowserModel::TEXT:
+ {
+ OUString aText( m_aTextEditField.GetText());
+ bChangeValid = m_apDataBrowserModel->setCellText( nCol, nRow, aText );
+ }
+ break;
+ }
+
+ // the first valid change changes this to true
+ if( bChangeValid )
+ {
+ RowModified( GetCurRow(), GetCurColumnId());
+ ::svt::CellController* pCtrl = GetController( GetCurRow(), GetCurColumnId());
+ if( pCtrl )
+ pCtrl->ClearModified();
+ SetDirty();
+ }
+
+ return bChangeValid;
+}
+
+bool DataBrowser::EndEditing()
+{
+ if( IsModified())
+ SaveModified();
+
+ // apply changes made to series headers
+ ::std::for_each( m_aSeriesHeaders.begin(), m_aSeriesHeaders.end(), impl::applyChangesFunctor());
+
+ if( m_bDataValid )
+ return true;
+ else
+ return ShowQueryBox();
+}
+
+sal_Int16 DataBrowser::GetFirstVisibleColumNumber() const
+{
+ return GetFirstVisibleColNumber();
+}
+
+void DataBrowser::ColumnResized( USHORT nColId )
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ EditBrowseBox::ColumnResized( nColId );
+ ImplAdjustHeaderControls();
+ SetUpdateMode( bLastUpdateMode );
+}
+
+// virtual void MouseMove( const MouseEvent& rEvt );
+
+void DataBrowser::EndScroll()
+{
+ BOOL bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ EditBrowseBox::EndScroll();
+ RenewSeriesHeaders();
+
+ SetUpdateMode( bLastUpdateMode );
+}
+
+void DataBrowser::RenewSeriesHeaders()
+{
+ Window * pWin = this->GetParent();
+ if( !pWin )
+ pWin = this;
+
+ clearHeaders();
+ DataBrowserModel::tDataHeaderVector aHeaders( m_apDataBrowserModel->getDataHeaders());
+ Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
+ Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
+ bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false;
+
+ for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin());
+ aIt != aHeaders.end(); ++aIt )
+ {
+ ::boost::shared_ptr< impl::SeriesHeader > spHeader( new impl::SeriesHeader( pWin ));
+ Reference< beans::XPropertySet > xSeriesProp( aIt->m_xDataSeries, uno::UNO_QUERY );
+ sal_Int32 nColor = 0;
+ if( xSeriesProp.is() &&
+ ( xSeriesProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Color"))) >>= nColor ))
+ spHeader->SetColor( Color( nColor ));
+ spHeader->SetChartType( aIt->m_xChartType, aIt->m_bSwapXAndYAxis, bIsHighContrast );
+ spHeader->SetSeriesName(
+ String( DataSeriesHelper::getDataSeriesLabel(
+ aIt->m_xDataSeries,
+ (aIt->m_xChartType.is() ?
+ aIt->m_xChartType->getRoleOfSequenceForSeriesLabel() :
+ OUString( RTL_CONSTASCII_USTRINGPARAM("values-y"))))));
+ spHeader->SetRange( aIt->m_nStartColumn + 1, aIt->m_nEndColumn + 1 );
+ spHeader->SetGetFocusHdl( aFocusLink );
+ spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
+ m_aSeriesHeaders.push_back( spHeader );
+ }
+
+ ImplAdjustHeaderControls();
+}
+
+void DataBrowser::ImplAdjustHeaderControls()
+{
+ sal_uInt16 nColCount = this->GetColumnCount();
+ sal_uInt32 nCurrentPos = this->GetPosPixel().getX();
+ sal_uInt32 nMaxPos = nCurrentPos + this->GetOutputSizePixel().getWidth();
+ sal_uInt32 nStartPos = nCurrentPos;
+
+ // width of header column
+ nCurrentPos += this->GetColumnWidth( 0 );
+ tSeriesHeaderContainer::iterator aIt( m_aSeriesHeaders.begin());
+ sal_uInt16 i = this->GetFirstVisibleColumNumber();
+ while( (aIt != m_aSeriesHeaders.end()) && ((*aIt)->GetStartColumn() < i) )
+ ++aIt;
+ for( ; i < nColCount && aIt != m_aSeriesHeaders.end(); ++i )
+ {
+ if( (*aIt)->GetStartColumn() == i )
+ nStartPos = nCurrentPos;
+
+ nCurrentPos += (this->GetColumnWidth( i ));
+
+ if( (*aIt)->GetEndColumn() == i )
+ {
+ if( nStartPos < nMaxPos )
+ {
+ (*aIt)->SetPixelPosX( nStartPos + 2 );
+ (*aIt)->SetPixelWidth( nCurrentPos - nStartPos - 3 );
+ }
+ else
+ // do not hide, to get focus events. Move outside the dialog for "hiding"
+ (*aIt)->SetPixelPosX( nMaxPos + 42 );
+ ++aIt;
+ }
+ }
+}
+
+IMPL_LINK( DataBrowser, SeriesHeaderGotFocus, impl::SeriesHeaderEdit*, pEdit )
+{
+ if( pEdit )
+ {
+ pEdit->SetShowWarningBox( !m_bDataValid );
+
+ if( !m_bDataValid )
+ GoToCell( 0, 0 );
+ else
+ {
+ //DeactivateCell();
+ MakeFieldVisible( GetCurRow(), static_cast< sal_uInt16 >( pEdit->getStartColumn()), true /* bComplete */ );
+ ActivateCell();
+ m_aCursorMovedHdlLink.Call( this );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit*, pEdit )
+{
+ if( pEdit )
+ {
+ Reference< chart2::XDataSeries > xSeries(
+ m_apDataBrowserModel->getDataSeriesByColumn( pEdit->getStartColumn() - 1 ));
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Reference< chart2::XChartType > xChartType(
+ m_apDataBrowserModel->getHeaderForSeries( xSeries ).m_xChartType );
+ if( xChartType.is())
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, xChartType->getRoleOfSequenceForSeriesLabel()));
+ if( xLabeledSeq.is())
+ {
+ Reference< container::XIndexReplace > xIndexReplace( xLabeledSeq->getLabel(), uno::UNO_QUERY );
+ if( xIndexReplace.is())
+ xIndexReplace->replaceByIndex(
+ 0, uno::makeAny( OUString( pEdit->GetText())));
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+sal_Int32 DataBrowser::GetTotalWidth() const
+{
+ ULONG nWidth = 0;
+ for ( USHORT nCol = 0; nCol < ColCount(); ++nCol )
+ nWidth += GetColumnWidth( nCol );
+ return static_cast< sal_Int32 >( nWidth );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
new file mode 100644
index 000000000000..3583db2770c0
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_DATA_BROWSER_HXX
+#define CHART_DATA_BROWSER_HXX
+
+#include <svtools/editbrowsebox.hxx>
+#include <vcl/outdev.hxx>
+#include <svtools/fmtfield.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vector>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartDocument;
+ }
+}}}
+
+namespace chart
+{
+
+class DataBrowserModel;
+class NumberFormatterWrapper;
+
+namespace impl
+{
+class SeriesHeader;
+class SeriesHeaderEdit;
+}
+
+class DataBrowser : public ::svt::EditBrowseBox
+{
+protected:
+ // EditBrowseBox overridables
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const;
+ virtual sal_Bool SeekRow( long nRow );
+ virtual sal_Bool IsTabAllowed( sal_Bool bForward ) const;
+ virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol );
+ virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol );
+ virtual sal_Bool SaveModified();
+ virtual void CursorMoved();
+ // called whenever the control of the current cell has been modified
+ virtual void CellModified();
+ virtual void ColumnResized( USHORT nColId );
+ virtual void EndScroll();
+ virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
+
+ void SetDirty();
+
+public:
+ DataBrowser( Window* pParent, const ResId & rId, bool bLiveUpdate );
+ virtual ~DataBrowser();
+
+ /** GetCellText returns the text at the given position
+ @param nRow
+ the number of the row
+ @param nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long nRow, USHORT nColId) const;
+
+ /** 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, USHORT nColumnId ) const;
+
+ // Window
+ virtual void Resize();
+
+ /// @return old state
+ bool SetReadOnly( bool bNewState );
+ bool IsReadOnly() const;
+
+ /// reset the dirty status, if changes have been saved
+ void SetClean();
+
+ void SetDataFromModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+// void setNumberFormatter();
+
+ // predicates to determine what actions are possible at the current cursor
+ // position. This depends on the implementation of the according mutators
+ // below. (They are used for enabling toolbar icons)
+ bool MayInsertRow() const;
+ bool MayInsertColumn() const;
+ bool MayDeleteRow() const;
+ bool MayDeleteColumn() const;
+
+ bool MaySwapRows() const;
+ bool MaySwapColumns() const;
+
+ // mutators mutating data
+ void InsertRow();
+ void InsertColumn();
+ void InsertTextColumn();
+ void RemoveRow();
+ void RemoveColumn();
+
+ using BrowseBox::RemoveColumn;
+ using BrowseBox::MouseButtonDown;
+
+ void SwapRow();
+ void SwapColumn();
+
+ void SetCursorMovedHdl( const Link& rLink );
+
+ void SetCellModifiedHdl( const Link& rLink );
+
+ /// confirms all pending changes to be ready to be closed
+ bool EndEditing();
+
+ // calls the protected inline-function BrowseBox::GetFirstVisibleColNumber()
+ sal_Int16 GetFirstVisibleColumNumber() const;
+
+ sal_Int32 GetTotalWidth() const;
+
+ bool CellContainsNumbers( sal_Int32 nRow, sal_uInt16 nCol ) const;
+
+ sal_uInt32 GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) const;
+
+ bool IsEnableItem();
+ bool IsDataValid();
+ void ShowWarningBox();
+ bool ShowQueryBox();
+
+ void RenewSeriesHeaders();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
+ ::std::auto_ptr< DataBrowserModel > m_apDataBrowserModel;
+
+ typedef ::std::vector< ::boost::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer;
+ tSeriesHeaderContainer m_aSeriesHeaders;
+
+ ::boost::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper;
+
+ /// the row that is currently painted
+ long m_nSeekRow;
+ bool m_bIsReadOnly;
+ bool m_bIsDirty;
+ bool m_bLiveUpdate;
+ bool m_bDataValid;
+
+ FormattedField m_aNumberEditField;
+ Edit m_aTextEditField;
+
+ /// note: m_aNumberEditField must precede this member!
+ ::svt::CellControllerRef m_rNumberEditController;
+ /// note: m_aTextEditField must precede this member!
+ ::svt::CellControllerRef m_rTextEditController;
+
+ Link m_aCursorMovedHdlLink;
+ Link m_aCellModifiedLink;
+
+ void clearHeaders();
+ void RenewTable();
+ void ImplAdjustHeaderControls();
+
+ String GetColString( sal_Int32 nColumnId ) const;
+ String GetRowString( sal_Int32 nRow ) const;
+
+ DECL_LINK( SeriesHeaderGotFocus, impl::SeriesHeaderEdit* );
+ DECL_LINK( SeriesHeaderChanged, impl::SeriesHeaderEdit* );
+
+ /// not implemented: inhibit copy construction
+ DataBrowser( const DataBrowser & );
+};
+
+} // namespace chart
+
+#endif // CHART_DATA_BROWSER_HXX
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
new file mode 100644
index 000000000000..c0b865536686
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -0,0 +1,1000 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DataBrowserModel.hxx"
+#include "DialogModel.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "macros.hxx"
+#include "StatisticsHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ExplicitCategoriesProvider.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/XDataSink.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 <rtl/math.hxx>
+
+#include <algorithm>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <cstdio>
+#endif
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+OUString lcl_getRole(
+ const Reference< chart2::data::XDataSequence > & xSeq )
+{
+ OUString aResult;
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("Role")) >>= aResult;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return aResult;
+}
+
+
+OUString lcl_getRole(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ OUString aResult;
+ if( xLSeq.is())
+ aResult = lcl_getRole( xLSeq->getValues());
+ return aResult;
+}
+
+OUString lcl_getUIRoleName(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ OUString aResult( lcl_getRole( xLSeq ));
+ if( aResult.getLength())
+ aResult = ::chart::DialogModel::ConvertRoleFromInternalToUI( aResult );
+ return aResult;
+}
+
+void lcl_copyDataSequenceProperties(
+ const Reference< chart2::data::XDataSequence > & xOldSequence,
+ const Reference< chart2::data::XDataSequence > & xNewSequence )
+{
+ Reference< beans::XPropertySet > xOldSeqProp( xOldSequence, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xNewSeqProp( xNewSequence, uno::UNO_QUERY );
+ comphelper::copyProperties( xOldSeqProp, xNewSeqProp );
+}
+
+bool lcl_SequenceOfSeriesIsShared(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::data::XDataSequence > & xValues )
+{
+ bool bResult = false;
+ if( !xValues.is())
+ return bResult;
+ try
+ {
+ OUString aValuesRole( lcl_getRole( xValues ));
+ OUString aValuesRep( xValues->getSourceRangeRepresentation());
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
+ for( sal_Int32 i=0; i<aLSeq.getLength(); ++i )
+ if( aLSeq[i].is() &&
+ lcl_getRole( aLSeq[i] ).equals( aValuesRole ))
+ {
+ // getValues().is(), because lcl_getRole checked that already
+ bResult = (aValuesRep == aLSeq[i]->getValues()->getSourceRangeRepresentation());
+ // assumption: a role appears only once in a series
+ break;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return bResult;
+}
+
+typedef ::std::vector< Reference< chart2::data::XLabeledDataSequence > > lcl_tSharedSeqVec;
+
+lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< chart2::XDataSeries > > & 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 )
+ return aResult;
+
+ Reference< chart2::data::XDataSource > xSource( rSeries[0], uno::UNO_QUERY );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences());
+ for( sal_Int32 nIdx=0; nIdx<aLSeq.getLength(); ++nIdx )
+ {
+ Reference< chart2::data::XDataSequence > xValues( aLSeq[nIdx]->getValues());
+ bool bShared = true;
+ for( sal_Int32 nSeriesIdx=1; nSeriesIdx<rSeries.getLength(); ++nSeriesIdx )
+ {
+ bShared = lcl_SequenceOfSeriesIsShared( rSeries[nSeriesIdx], xValues );
+ if( !bShared )
+ break;
+ }
+ if( bShared )
+ aResult.push_back( aLSeq[nIdx] );
+ }
+
+ return aResult;
+}
+
+sal_Int32 lcl_getValuesRepresentationIndex(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ sal_Int32 nResult = -1;
+ if( xLSeq.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq( xLSeq->getValues());
+ if( xSeq.is())
+ {
+ OUString aRep( xSeq->getSourceRangeRepresentation());
+ nResult = aRep.toInt32();
+ }
+ }
+ return nResult;
+}
+
+struct lcl_RepresentationsOfLSeqMatch : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+ lcl_RepresentationsOfLSeqMatch( const Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
+ m_aValuesRep( xLSeq.is() ?
+ (xLSeq->getValues().is() ? xLSeq->getValues()->getSourceRangeRepresentation() : OUString())
+ : OUString() )
+ {}
+ bool operator() ( const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+ {
+ return (xLSeq.is() &&
+ xLSeq->getValues().is() &&
+ (xLSeq->getValues()->getSourceRangeRepresentation() == m_aValuesRep ));
+ }
+private:
+ OUString m_aValuesRep;
+};
+
+struct lcl_RolesOfLSeqMatch : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+ lcl_RolesOfLSeqMatch( const Reference< chart2::data::XLabeledDataSequence > & xLSeq ) :
+ m_aRole( lcl_getRole( xLSeq ))
+ {}
+ bool operator() ( const Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+ {
+ return lcl_getRole( xLSeq ).equals( m_aRole );
+ }
+private:
+ OUString m_aRole;
+};
+
+bool lcl_ShowCategories( const Reference< chart2::XDiagram > & /* xDiagram */ )
+{
+ // show categories for all charts
+ return true;
+// return DiagramHelper::isCategoryDiagram( xDiagram );
+}
+
+bool lcl_ShowCategoriesAsDataLabel( const Reference< chart2::XDiagram > & xDiagram )
+{
+ return ! ::chart::DiagramHelper::isCategoryDiagram( xDiagram );
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+
+struct DataBrowserModel::tDataColumn
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+ sal_Int32 m_nIndexInDataSeries;
+ ::rtl::OUString m_aUIRoleName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > m_xLabeledDataSequence;
+ eCellType m_eCellType;
+ sal_Int32 m_nNumberFormatKey;
+
+ // default CTOR
+ tDataColumn() : m_nIndexInDataSeries( -1 ), m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {}
+ // "full" CTOR
+ tDataColumn(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nIndexInDataSeries,
+ ::rtl::OUString aUIRoleName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > xLabeledDataSequence,
+ eCellType aCellType,
+ sal_Int32 nNumberFormatKey ) :
+ m_xDataSeries( xDataSeries ),
+ m_nIndexInDataSeries( nIndexInDataSeries ),
+ m_aUIRoleName( aUIRoleName ),
+ m_xLabeledDataSequence( xLabeledDataSequence ),
+ m_eCellType( aCellType ),
+ m_nNumberFormatKey( nNumberFormatKey )
+ {}
+};
+
+struct DataBrowserModel::implColumnLess : public ::std::binary_function<
+ DataBrowserModel::tDataColumn, DataBrowserModel::tDataColumn, bool >
+{
+ bool operator() ( const first_argument_type & rLeft, const second_argument_type & rRight )
+ {
+ if( rLeft.m_xLabeledDataSequence.is() && rRight.m_xLabeledDataSequence.is())
+ {
+ return DialogModel::GetRoleIndexForSorting( lcl_getRole( rLeft.m_xLabeledDataSequence )) <
+ DialogModel::GetRoleIndexForSorting( lcl_getRole( rRight.m_xLabeledDataSequence ));
+ }
+ return true;
+ }
+};
+
+DataBrowserModel::DataBrowserModel(
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xChartDocument( xChartDoc ),
+ m_xContext( xContext ),
+ m_apDialogModel( new DialogModel( xChartDoc, xContext ))
+{
+ updateFromModel();
+}
+
+DataBrowserModel::~DataBrowserModel()
+{}
+
+namespace
+{
+struct lcl_DataSeriesOfHeaderMatches : public ::std::unary_function< ::chart::DataBrowserModel::tDataHeader, bool >
+{
+ lcl_DataSeriesOfHeaderMatches(
+ const Reference< chart2::XDataSeries > & xSeriesToCompareWith ) :
+ m_xSeries( xSeriesToCompareWith )
+ {}
+ bool operator() ( const ::chart::DataBrowserModel::tDataHeader & rHeader )
+ {
+ return (m_xSeries == rHeader.m_xDataSeries);
+ }
+private:
+ Reference< chart2::XDataSeries > m_xSeries;
+};
+}
+
+void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProvider.is())
+ {
+ if( isCategoriesColumn(nAfterColumnIndex) )
+ nAfterColumnIndex = getCategoryColumnCount()-1;
+
+ sal_Int32 nStartCol = 0;
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDocument ));
+ Reference< chart2::XChartType > xChartType;
+ Reference< chart2::XDataSeries > xSeries;
+ if( static_cast< tDataColumnVector::size_type >( nAfterColumnIndex ) <= m_aColumns.size())
+ xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+
+ sal_Int32 nSeriesNumberFormat = 0;
+ if( xSeries.is())
+ {
+ xChartType.set( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ));
+ tDataHeaderVector::const_iterator aIt(
+ ::std::find_if( m_aHeaders.begin(), m_aHeaders.end(),
+ lcl_DataSeriesOfHeaderMatches( xSeries )));
+ if( aIt != m_aHeaders.end())
+ nStartCol = aIt->m_nEndColumn;
+
+ Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY );
+ if( xSeriesProps.is() )
+ xSeriesProps->getPropertyValue( C2U( "NumberFormat" )) >>= nSeriesNumberFormat;
+ }
+ else
+ {
+ xChartType.set( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ));
+ nStartCol = nAfterColumnIndex;
+ }
+
+ if( xChartType.is())
+ {
+ sal_Int32 nOffset = 0;
+ if( xDiagram.is() && lcl_ShowCategories( xDiagram ))
+ nOffset=getCategoryColumnCount();
+ // get shared sequences of current series
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY );
+ lcl_tSharedSeqVec aSharedSequences;
+ if( xSeriesCnt.is())
+ aSharedSequences = lcl_getSharedSequences( xSeriesCnt->getDataSeries());
+ Reference< chart2::XDataSeries > xNewSeries(
+ m_apDialogModel->insertSeriesAfter( xSeries, xChartType, true /* bCreateDataCachedSequences */ ));
+ if( xNewSeries.is())
+ {
+ {
+ Reference< chart2::data::XDataSource > xSource( xNewSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSequences(
+ xSource->getDataSequences());
+ sal_Int32 nSeqIdx = 0;
+ sal_Int32 nSeqSize = aLSequences.getLength();
+ nStartCol -= (nOffset - 1);
+ for( sal_Int32 nIndex = nStartCol;
+ (nSeqIdx < nSeqSize);
+ ++nSeqIdx )
+ {
+ lcl_tSharedSeqVec::const_iterator aSharedIt(
+ ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RolesOfLSeqMatch( aLSequences[nSeqIdx] )));
+ if( aSharedIt != aSharedSequences.end())
+ {
+ aLSequences[nSeqIdx]->setValues( (*aSharedIt)->getValues());
+ aLSequences[nSeqIdx]->setLabel( (*aSharedIt)->getLabel());
+ }
+ else
+ {
+ xDataProvider->insertSequence( nIndex - 1 );
+
+ // values
+ Reference< chart2::data::XDataSequence > xNewSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ OUString::valueOf( nIndex )));
+ lcl_copyDataSequenceProperties(
+ aLSequences[nSeqIdx]->getValues(), xNewSeq );
+ aLSequences[nSeqIdx]->setValues( xNewSeq );
+
+ // labels
+ Reference< chart2::data::XDataSequence > xNewLabelSeq(
+ xDataProvider->createDataSequenceByRangeRepresentation(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "label " )) +
+ OUString::valueOf( 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 immidiately
+ Reference< beans::XPropertySet > xNewSeriesProps( xNewSeries, uno::UNO_QUERY );
+ if( xNewSeriesProps.is() )
+ xNewSeriesProps->setPropertyValue( C2U( "NumberFormat" ), uno::makeAny( nSeriesNumberFormat ) );
+ }
+
+ updateFromModel();
+ }
+ }
+ }
+}
+
+void DataBrowserModel::insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex )
+{
+ //create a new text column for complex categories
+
+ OSL_ASSERT( m_apDialogModel.get());
+ Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProvider.is() )
+ {
+ if( !isCategoriesColumn(nAfterColumnIndex) )
+ nAfterColumnIndex = getCategoryColumnCount()-1;
+
+ if(nAfterColumnIndex<0)
+ {
+ OSL_ENSURE( false, "wrong index for category level insertion" );
+ return;
+ }
+
+ m_apDialogModel->startControllerLockTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ xDataProvider->insertComplexCategoryLevel( nAfterColumnIndex+1 );
+ updateFromModel();
+ }
+}
+
+void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ if( static_cast< tDataColumnVector::size_type >( nAtColumnIndex ) < m_aColumns.size())
+ {
+ Reference< chart2::XDataSeries > xSeries( m_aColumns[nAtColumnIndex].m_xDataSeries );
+ if( xSeries.is())
+ {
+ m_apDialogModel->deleteSeries(
+ xSeries, getHeaderForSeries( xSeries ).m_xChartType );
+
+ //delete sequences from internal data provider that are not used anymore
+ //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 > xSourceOfDeletedSeries( xSeries, uno::UNO_QUERY );
+ if( xDataProvider.is() && xSourceOfDeletedSeries.is())
+ {
+ ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequencesOfDeletedSeries( xSourceOfDeletedSeries->getDataSequences() );
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY );
+ if( xSeriesCnt.is())
+ {
+ Reference< chart2::data::XDataSource > xRemainingDataSource( DataSeriesHelper::getDataSource( xSeriesCnt->getDataSeries() ) );
+ if( xRemainingDataSource.is() )
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aRemainingSeq( ContainerHelper::SequenceToVector( xRemainingDataSource->getDataSequences() ) );
+ for( sal_Int32 i=0; i<aSequencesOfDeletedSeries.getLength(); ++i )
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aHitIt(
+ ::std::find_if( aRemainingSeq.begin(), aRemainingSeq.end(),
+ lcl_RepresentationsOfLSeqMatch( aSequencesOfDeletedSeries[i] )));
+ // if not used by the remaining series this sequence can be deleted
+ if( aHitIt == aRemainingSeq.end() )
+ aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeletedSeries[i] ) );
+ }
+ }
+ }
+
+ // delete unnecessary sequences of the internal data
+ // iterate using greatest index first, so that deletion does not
+ // shift other sequences that will be deleted later
+ ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
+ for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
+ aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ {
+ if( *aIt != -1 )
+ xDataProvider->deleteSequence( *aIt );
+ }
+ }
+ updateFromModel();
+ }
+ else
+ {
+ //delete a category column if there is more than one level (in case of a single column we do not get here)
+ OSL_ENSURE(nAtColumnIndex>0, "wrong index for categories deletion" );
+
+ Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProvider.is() )
+ {
+ m_apDialogModel->startControllerLockTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ xDataProvider->deleteComplexCategoryLevel( nAtColumnIndex );
+ updateFromModel();
+ }
+ }
+ }
+}
+
+void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ if( static_cast< tDataColumnVector::size_type >( nFirstColumnIndex ) < m_aColumns.size() - 1 )
+ {
+ Reference< chart2::XDataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries );
+ if( xSeries.is())
+ {
+ m_apDialogModel->moveSeries( xSeries, DialogModel::MOVE_DOWN );
+ updateFromModel();
+ }
+ }
+}
+
+void DataBrowserModel::swapDataPointForAllSeries( sal_Int32 nFirstIndex )
+{
+ OSL_ASSERT( m_apDialogModel.get());
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->swapDataPointWithNextOneForAllSequences( nFirstIndex );
+ // unlockControllers
+}
+
+void DataBrowserModel::insertDataPointForAllSeries( sal_Int32 nAfterIndex )
+{
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->insertDataPointForAllSequences( nAfterIndex );
+ // unlockControllers
+}
+
+void DataBrowserModel::removeDataPointForAllSeries( sal_Int32 nAtIndex )
+{
+ Reference< chart2::XInternalDataProvider > xDataProvider(
+ m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
+ // lockControllers
+ ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ if( xDataProvider.is())
+ xDataProvider->deleteDataPointForAllSequences( nAtIndex );
+ // unlockControllers
+}
+
+DataBrowserModel::tDataHeader DataBrowserModel::getHeaderForSeries(
+ const Reference< chart2::XDataSeries > & xSeries ) const
+{
+ for( tDataHeaderVector::const_iterator aIt( m_aHeaders.begin());
+ aIt != m_aHeaders.end(); ++aIt )
+ {
+ if( aIt->m_xDataSeries == xSeries )
+ return (*aIt);
+ }
+ return tDataHeader();
+}
+
+Reference< chart2::XDataSeries >
+ DataBrowserModel::getDataSeriesByColumn( sal_Int32 nColumn ) const
+{
+ tDataColumnVector::size_type nIndex( nColumn );
+ if( nIndex < m_aColumns.size())
+ return m_aColumns[nIndex].m_xDataSeries;
+ return 0;
+}
+
+DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ )
+{
+ eCellType eResult = TEXT;
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size())
+ eResult = m_aColumns[nIndex].m_eCellType;
+ return eResult;
+}
+
+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())
+ {
+ Reference< chart2::data::XNumericalDataSequence > xData(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+ if( xData.is())
+ {
+ Sequence< double > aValues( xData->getNumericalData());
+ if( nAtRow < aValues.getLength())
+ fResult = aValues[nAtRow];
+ }
+ }
+ return fResult;
+}
+
+OUString DataBrowserModel::getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow )
+{
+ OUString aResult;
+
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XTextualDataSequence > xData(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+ if( xData.is())
+ {
+ Sequence< OUString > aValues( xData->getTextualData());
+ if( nAtRow < aValues.getLength())
+ aResult = aValues[nAtRow];
+ }
+ }
+ return aResult;
+}
+
+sal_uInt32 DataBrowserModel::getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ )
+{
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size())
+ return m_aColumns[ nIndex ].m_nNumberFormatKey;
+ return 0;
+}
+
+bool DataBrowserModel::setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const uno::Any & rValue )
+{
+ bool bResult = false;
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ bResult = true;
+ try
+ {
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ // label
+ if( nAtRow == -1 )
+ {
+ Reference< container::XIndexReplace > xIndexReplace(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getLabel(), uno::UNO_QUERY_THROW );
+ xIndexReplace->replaceByIndex( 0, rValue );
+ }
+ else
+ {
+ Reference< container::XIndexReplace > xIndexReplace(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues(), uno::UNO_QUERY_THROW );
+ xIndexReplace->replaceByIndex( nAtRow, rValue );
+ }
+
+ 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);
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex);
+ bResult = false;
+ }
+ }
+ return bResult;
+}
+
+bool DataBrowserModel::setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue )
+{
+ return (getCellType( nAtColumn, nAtRow ) == NUMBER) &&
+ setCellAny( nAtColumn, nAtRow, uno::makeAny( fValue ));
+}
+
+bool DataBrowserModel::setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText )
+{
+ return (getCellType( nAtColumn, nAtRow ) == TEXT) &&
+ setCellAny( nAtColumn, nAtRow, uno::makeAny( rText ));
+}
+
+sal_Int32 DataBrowserModel::getColumnCount() const
+{
+ return static_cast< sal_Int32 >( m_aColumns.size());
+}
+
+sal_Int32 DataBrowserModel::getMaxRowCount() const
+{
+ sal_Int32 nResult = 0;
+ tDataColumnVector::const_iterator aIt( m_aColumns.begin());
+ for( ; aIt != m_aColumns.end(); ++aIt )
+ {
+ if( aIt->m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XDataSequence > xSeq(
+ aIt->m_xLabeledDataSequence->getValues());
+ if( !xSeq.is())
+ continue;
+ sal_Int32 nLength( xSeq->getData().getLength());
+ if( nLength > nResult )
+ nResult = nLength;
+ }
+ }
+
+ return nResult;
+}
+
+OUString DataBrowserModel::getRoleOfColumn( sal_Int32 nColumnIndex ) const
+{
+ if( nColumnIndex != -1 &&
+ static_cast< sal_uInt32 >( nColumnIndex ) < m_aColumns.size())
+ return m_aColumns[ nColumnIndex ].m_aUIRoleName;
+ return OUString();
+}
+
+bool DataBrowserModel::isCategoriesColumn( sal_Int32 nColumnIndex ) const
+{
+ bool bIsCategories = false;
+ if( nColumnIndex>=0 && nColumnIndex<static_cast< sal_Int32 >(m_aColumns.size()) )
+ bIsCategories = !m_aColumns[ nColumnIndex ].m_xDataSeries.is();
+ return bIsCategories;
+}
+
+sal_Int32 DataBrowserModel::getCategoryColumnCount()
+{
+ sal_Int32 nLastTextColumnIndex = -1;
+ tDataColumnVector::const_iterator aIt = m_aColumns.begin();
+ for( ; aIt != m_aColumns.end(); ++aIt )
+ {
+ if( !aIt->m_xDataSeries.is() )
+ nLastTextColumnIndex++;
+ else
+ break;
+ }
+ return nLastTextColumnIndex+1;
+}
+
+const DataBrowserModel::tDataHeaderVector& DataBrowserModel::getDataHeaders() const
+{
+ return m_aHeaders;
+}
+
+void DataBrowserModel::updateFromModel()
+{
+ if( !m_xChartDocument.is())
+ return;
+ m_aColumns.clear();
+ m_aHeaders.clear();
+
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDocument ));
+ 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 );
+
+ sal_Int32 nHeaderStart = 0;
+ sal_Int32 nHeaderEnd = 0;
+ if( lcl_ShowCategories( xDiagram ))
+ {
+ Reference< frame::XModel > xChartModel( m_xChartDocument, uno::UNO_QUERY );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
+
+ const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
+ sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+ for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xCategories( rSplitCategoriesList[nL] );
+ if( !xCategories.is() )
+ continue;
+
+ tDataColumn aCategories;
+ aCategories.m_xLabeledDataSequence.set( xCategories );
+ if( lcl_ShowCategoriesAsDataLabel( xDiagram ))
+ aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
+ else
+ aCategories.m_aUIRoleName = lcl_getUIRoleName( xCategories );
+ aCategories.m_eCellType = TEXT;
+ m_aColumns.push_back( aCategories );
+ ++nHeaderStart;
+ }
+ }
+
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
+ if( !xCooSysCnt.is())
+ return;
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( 0, aCooSysSeq[nCooSysIdx], 0, 0 );
+
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
+ if( xSeriesCnt.is())
+ {
+ rtl::OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] );
+
+ Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
+ lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
+ for( lcl_tSharedSeqVec::const_iterator aIt( aSharedSequences.begin());
+ aIt != aSharedSequences.end(); ++aIt )
+ {
+ tDataColumn aSharedSequence;
+ aSharedSequence.m_xLabeledDataSequence = *aIt;
+ aSharedSequence.m_aUIRoleName = lcl_getUIRoleName( *aIt );
+ 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( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
+ {
+ tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
+ Reference< chart2::XDataSeries > xSeries( aSeries[nSeriesIdx] );
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
+ if( aLSeqs.getLength() == 0 )
+ continue;
+ nHeaderEnd = nHeaderStart;
+
+ // @todo: dimension index 1 for y-values used here. This is just a guess
+ sal_Int32 nYAxisNumberFormatKey =
+ DataSeriesHelper::getNumberFormatKeyFromAxis(
+ aSeries[nSeriesIdx], aCooSysSeq[nCooSysIdx], 1 );
+
+ sal_Int32 nSeqIdx=0;
+ for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
+ {
+ sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
+ OUString aRole = lcl_getRole( aLSeqs[nSeqIdx] );
+
+ if( aRole.equals( aRoleForDataLabelNumberFormat ) )
+ {
+ nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ), xSeries, -1, xDiagram );
+ }
+ else if( aRole.equals( C2U( "values-x" ) ) )
+ nSequenceNumberFormatKey = nXAxisNumberFormat;
+
+ if( ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
+ lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) == aSharedSequences.end())
+ {
+ // no shared sequence
+ m_aColumns.push_back(
+ tDataColumn(
+ aSeries[nSeriesIdx],
+ nSeqIdx,
+ lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
+ aLSeqs[nSeqIdx],
+ NUMBER,
+ nSequenceNumberFormatKey ));
+ ++nHeaderEnd;
+ }
+ // else skip
+ }
+ bool bSwapXAndYAxis = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY );
+ xProp->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXAndYAxis;
+ }
+ catch( const beans::UnknownPropertyException & ex )
+ {
+ (void)ex;
+ }
+
+ // add ranges for error bars if present for a series
+ if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx], /* bYError = */ true ))
+ addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd );
+
+ m_aHeaders.push_back(
+ tDataHeader(
+ aSeries[nSeriesIdx],
+ aChartTypes[nCTIdx],
+ bSwapXAndYAxis,
+ nHeaderStart,
+ nHeaderEnd - 1 ));
+
+ nHeaderStart = nHeaderEnd;
+
+ ::std::sort( m_aColumns.begin() + nStartColIndex, m_aColumns.end(), implColumnLess() );
+ }
+ }
+ }
+ }
+ }
+}
+
+void DataBrowserModel::addErrorBarRanges(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nNumberFormatKey,
+ sal_Int32 & rInOutSequenceIndex,
+ sal_Int32 & rInOutHeaderEnd )
+{
+ try
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aSequences;
+
+ // x error bars
+ // ------------
+ Reference< chart2::data::XDataSource > xErrorSource(
+ StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ false ), uno::UNO_QUERY );
+
+ // positive x error bars
+ Reference< chart2::data::XLabeledDataSequence > xErrorLSequence(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ true,
+ /* bYError = */ false ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // negative x error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ false,
+ /* bYError = */ false ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // y error bars
+ // ------------
+ xErrorSource.set(
+ StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ true ), uno::UNO_QUERY );
+
+ // positive y error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ true,
+ /* bYError = */ true ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+ // negative y error bars
+ xErrorLSequence.set(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xErrorSource,
+ /* bPositiveValue = */ false,
+ /* bYError = */ true ));
+ if( xErrorLSequence.is())
+ aSequences.push_back( xErrorLSequence );
+
+
+ for( ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aIt( aSequences.begin());
+ aIt != aSequences.end(); ++aIt )
+ {
+ m_aColumns.push_back(
+ tDataColumn(
+ xDataSeries,
+ rInOutSequenceIndex,
+ lcl_getUIRoleName( *aIt ),
+ *aIt,
+ NUMBER,
+ nNumberFormatKey ));
+ ++rInOutSequenceIndex;
+ ++rInOutHeaderEnd;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx
new file mode 100644
index 000000000000..a4378972f70f
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATABROWSERMODEL_HXX
+#define CHART2_DATABROWSERMODEL_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+#include <vector>
+
+namespace com { namespace sun { namespace star { namespace chart2 {
+ class XDataSeries;
+ class XChartType;
+ namespace data {
+ class XLabeledDataSequence;
+ }
+}}}}
+
+namespace chart
+{
+
+class DialogModel;
+
+class DataBrowserModel
+{
+public:
+ explicit DataBrowserModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataBrowserModel();
+
+ /** Inserts a new data series after the data series to which the data column
+ with index nAfterColumnIndex belongs.
+ */
+ void insertDataSeries( sal_Int32 nAfterColumnIndex );
+
+ /** Inserts a new text column for complex categories.
+ */
+ void insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex );
+
+ /** Removes a data series to which the data column with index nAtColumnIndex
+ belongs.
+ */
+ void removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex );
+
+ /** Swaps the series to which the data column with index nFirstIndex belongs
+ with the next series (which starts at an index >= nFirstIndex + 1)
+ */
+ void swapDataSeries( sal_Int32 nFirstIndex );
+ void swapDataPointForAllSeries( sal_Int32 nFirstIndex );
+
+ void insertDataPointForAllSeries( sal_Int32 nAfterIndex );
+ void removeDataPointForAllSeries( sal_Int32 nAtIndex );
+
+ enum eCellType
+ {
+ NUMBER,
+ TEXT
+ };
+
+ eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan
+ double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ ::rtl::OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+
+ /// returns </TRUE> if the number could successfully be set at the given position
+ bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue );
+ /// returns </TRUE> if the text could successfully be set at the given position
+ bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText );
+ bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::com::sun::star::uno::Any & aValue );
+
+ sal_Int32 getColumnCount() const;
+ sal_Int32 getMaxRowCount() const;
+
+ // returns the UI string of the corresponding role
+ ::rtl::OUString getRoleOfColumn( sal_Int32 nColumnIndex ) const;
+ bool isCategoriesColumn( sal_Int32 nColumnIndex ) const;
+
+ struct tDataHeader
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > m_xChartType;
+ bool m_bSwapXAndYAxis;
+ sal_Int32 m_nStartColumn;
+ sal_Int32 m_nEndColumn;
+
+ // default CTOR
+ tDataHeader() :
+ m_bSwapXAndYAxis( false ),
+ m_nStartColumn( -1 ),
+ m_nEndColumn( -1 )
+ {}
+ // "full" CTOR
+ tDataHeader(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > xDataSeries,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > xChartType,
+ bool bSwapXAndYAxis,
+ sal_Int32 nStartColumn,
+ sal_Int32 nEndColumn ) :
+ m_xDataSeries( xDataSeries ),
+ m_xChartType( xChartType ),
+ m_bSwapXAndYAxis( bSwapXAndYAxis ),
+ m_nStartColumn( nStartColumn ),
+ m_nEndColumn( nEndColumn )
+ {}
+ };
+
+ typedef ::std::vector< tDataHeader > tDataHeaderVector;
+
+ const tDataHeaderVector& getDataHeaders() const;
+
+ tDataHeader getHeaderForSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > &xSeries ) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >
+ getDataSeriesByColumn( sal_Int32 nColumn ) const;
+
+private:
+ void updateFromModel();
+
+ void addErrorBarRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ sal_Int32 nNumberFormatKey,
+ sal_Int32 & rInOutSequenceIndex,
+ sal_Int32 & rInOutHeaderEnd );
+
+ sal_Int32 getCategoryColumnCount();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::std::auto_ptr< DialogModel > m_apDialogModel;
+
+ struct tDataColumn;
+ struct implColumnLess;
+
+ typedef ::std::vector< tDataColumn > tDataColumnVector;
+
+ tDataColumnVector m_aColumns;
+ tDataHeaderVector m_aHeaders;
+};
+
+} // namespace chart
+
+// CHART2_DATABROWSERMODEL_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
new file mode 100644
index 000000000000..f32a882aa1e9
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -0,0 +1,849 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DialogModel.hxx"
+#include "RangeSelectionHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "macros.hxx"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XTitled.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/XDataSink.hpp>
+
+#include <tools/string.hxx>
+
+#include <utility>
+#include <algorithm>
+#include <iterator>
+#include <functional>
+#include <numeric>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ----------------------------------------
+
+namespace
+{
+const OUString lcl_aLabelRole( RTL_CONSTASCII_USTRINGPARAM( "label" ));
+
+struct lcl_ChartTypeToSeriesCnt : ::std::unary_function<
+ Reference< XChartType >, Reference< XDataSeriesContainer > >
+{
+ Reference< XDataSeriesContainer > operator() (
+ const Reference< XChartType > & xChartType )
+ {
+ return Reference< XDataSeriesContainer >::query( xChartType );
+ }
+};
+
+OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
+{
+ OUString aResult( rRoleString );
+
+ typedef ::std::map< OUString, OUString > tTranslationMap;
+ static tTranslationMap aTranslationMap;
+
+ if( aTranslationMap.size() == 0 )
+ {
+ aTranslationMap[ C2U( "categories" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_CATEGORIES )));
+ aTranslationMap[ C2U( "error-bars-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR )));
+ aTranslationMap[ C2U( "error-bars-x-positive" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR_POSITIVE )));
+ aTranslationMap[ C2U( "error-bars-x-negative" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X_ERROR_NEGATIVE )));
+ aTranslationMap[ C2U( "error-bars-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR )));
+ aTranslationMap[ C2U( "error-bars-y-positive" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR_POSITIVE )));
+ aTranslationMap[ C2U( "error-bars-y-negative" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y_ERROR_NEGATIVE )));
+ aTranslationMap[ C2U( "label" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_LABEL )));
+ aTranslationMap[ C2U( "values-first" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_FIRST )));
+ aTranslationMap[ C2U( "values-last" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_LAST )));
+ aTranslationMap[ C2U( "values-max" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MAX )));
+ aTranslationMap[ C2U( "values-min" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MIN )));
+ aTranslationMap[ C2U( "values-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X )));
+ aTranslationMap[ C2U( "values-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y )));
+ aTranslationMap[ C2U( "values-size" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_SIZE )));
+ }
+
+ if( bFromInternalToUI )
+ {
+ tTranslationMap::const_iterator aIt( aTranslationMap.find( rRoleString ));
+ if( aIt != aTranslationMap.end())
+ {
+ aResult = (*aIt).second;
+ }
+ }
+ else
+ {
+ tTranslationMap::const_iterator aIt(
+ ::std::find_if( aTranslationMap.begin(), aTranslationMap.end(),
+ ::std::compose1( ::std::bind2nd(
+ ::std::equal_to< tTranslationMap::mapped_type >(),
+ rRoleString ),
+ ::std::select2nd< tTranslationMap::value_type >())));
+
+ if( aIt != aTranslationMap.end())
+ aResult = (*aIt).first;
+ }
+
+ return aResult;
+}
+
+typedef ::std::map< ::rtl::OUString, sal_Int32 > lcl_tRoleIndexMap;
+
+void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap )
+{
+ rOutMap.clear();
+ sal_Int32 nIndex = 0;
+
+ rOutMap[ C2U( "label" ) ] = ++nIndex;
+ rOutMap[ C2U( "categories" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-x" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-y" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x-positive" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-x-negative" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y-positive" ) ] = ++nIndex;
+ rOutMap[ C2U( "error-bars-y-negative" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-first" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-min" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-max" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-last" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-size" ) ] = ++nIndex;
+}
+
+struct lcl_DataSeriesContainerAppend : public
+ ::std::iterator< ::std::output_iterator_tag, Reference< XDataSeriesContainer > >
+{
+ 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())
+ {
+ Sequence< Reference< XDataSeries > > aSeq( xVal->getDataSeries());
+ OUString aRole( RTL_CONSTASCII_USTRINGPARAM("values-y"));
+ Reference< XChartType > xCT( xVal, uno::UNO_QUERY );
+ if( xCT.is())
+ aRole = xCT->getRoleOfSequenceForSeriesLabel();
+ for( sal_Int32 nI = 0; nI < aSeq.getLength(); ++ nI )
+ {
+ m_rDestCnt.push_back(
+ chart::DialogModel::tSeriesWithChartTypeByName(
+ ::chart::DataSeriesHelper::getDataSeriesLabel( aSeq[nI], aRole ),
+ ::std::make_pair( aSeq[nI], xCT )));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return *this;
+ }
+
+ lcl_DataSeriesContainerAppend & operator* () { return *this; }
+ lcl_DataSeriesContainerAppend & operator++ () { return *this; }
+ lcl_DataSeriesContainerAppend & operator++ (int) { return *this; }
+
+private:
+ tContainerType & m_rDestCnt;
+};
+
+struct lcl_RolesWithRangeAppend : public
+ ::std::iterator< ::std::output_iterator_tag, Reference< data::XLabeledDataSequence > >
+{
+ typedef ::chart::DialogModel::tRolesWithRanges tContainerType;
+
+ explicit lcl_RolesWithRangeAppend( tContainerType & rCnt,
+ const ::rtl::OUString & aLabelRole )
+ : m_rDestCnt( rCnt ),
+ m_aRoleForLabelSeq( aLabelRole )
+ {}
+
+ lcl_RolesWithRangeAppend & operator= ( const value_type & xVal )
+ {
+ try
+ {
+ if( xVal.is())
+ {
+ // data sequence
+ Reference< data::XDataSequence > xSeq( xVal->getValues());
+ if( xSeq.is())
+ {
+ OUString aRole;
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
+ if( xProp->getPropertyValue( C2U("Role")) >>= aRole )
+ {
+ m_rDestCnt.insert(
+ tContainerType::value_type(
+ aRole, xSeq->getSourceRangeRepresentation()));
+ // label
+ if( aRole.equals( m_aRoleForLabelSeq ))
+ {
+ Reference< data::XDataSequence > xLabelSeq( xVal->getLabel());
+ if( xLabelSeq.is())
+ {
+ m_rDestCnt.insert(
+ tContainerType::value_type(
+ lcl_aLabelRole, xLabelSeq->getSourceRangeRepresentation()));
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return *this;
+ }
+
+ lcl_RolesWithRangeAppend & operator* () { return *this; }
+ lcl_RolesWithRangeAppend & operator++ () { return *this; }
+ lcl_RolesWithRangeAppend & operator++ (int) { return *this; }
+
+private:
+ tContainerType & m_rDestCnt;
+ OUString m_aRoleForLabelSeq;
+};
+
+void lcl_SetSequenceRole(
+ const Reference< data::XDataSequence > & xSeq,
+ const OUString & rRole )
+{
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is())
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( rRole ));
+}
+
+Reference< XDataSeries > lcl_CreateNewSeries(
+ const Reference< uno::XComponentContext > & xContext,
+ const Reference< XChartType > & xChartType,
+ sal_Int32 nNewSeriesIndex,
+ sal_Int32 nTotalNumberOfSeriesInCTGroup,
+ const Reference< XDiagram > & xDiagram,
+ const Reference< XChartTypeTemplate > & xTemplate,
+ bool bCreateDataCachedSequences )
+{
+ // create plain series
+ Reference< XDataSeries > xResult(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.DataSeries" ),
+ xContext ), uno::UNO_QUERY );
+ 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(
+ C2U("Color"), uno::makeAny( xColorScheme->getColorByIndex( nNewSeriesIndex )));
+ }
+ sal_Int32 nGroupIndex=0;
+ if( xChartType.is())
+ {
+ Sequence< Reference< XChartType > > aCTs(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ));
+ for( ; nGroupIndex<aCTs.getLength(); ++nGroupIndex)
+ if( aCTs[nGroupIndex] == xChartType )
+ break;
+ if( nGroupIndex == aCTs.getLength())
+ nGroupIndex = 0;
+ }
+ xTemplate->applyStyle( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup );
+ }
+
+ if( bCreateDataCachedSequences )
+ {
+ // set chart type specific roles
+ Reference< data::XDataSink > xSink( xResult, uno::UNO_QUERY );
+ if( xChartType.is() && xSink.is())
+ {
+ ::std::vector< Reference< data::XLabeledDataSequence > > aNewSequences;
+ const OUString aRoleOfSeqForSeriesLabel = xChartType->getRoleOfSequenceForSeriesLabel();
+ const OUString aLabel( String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES )));
+ const Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
+ const Sequence< OUString > aOptRoles( xChartType->getSupportedOptionalRoles());
+ sal_Int32 nI = 0;
+
+ for(nI=0; nI<aRoles.getLength(); ++nI)
+ {
+ if( aRoles[nI].equals( lcl_aLabelRole ))
+ continue;
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence() );
+ lcl_SetSequenceRole( xSeq, aRoles[nI] );
+ // assert that aRoleOfSeqForSeriesLabel is part of the mandatory roles
+ if( aRoles[nI].equals( aRoleOfSeqForSeriesLabel ))
+ {
+ Reference< data::XDataSequence > xLabel( ::chart::DataSourceHelper::createCachedDataSequence( aLabel ));
+ lcl_SetSequenceRole( xLabel, lcl_aLabelRole );
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq, xLabel ));
+ }
+ else
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
+ }
+
+ for(nI=0; nI<aOptRoles.getLength(); ++nI)
+ {
+ if( aOptRoles[nI].equals( lcl_aLabelRole ))
+ continue;
+ Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence());
+ lcl_SetSequenceRole( xSeq, aOptRoles[nI] );
+ aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq ));
+ }
+
+ xSink->setData( ContainerToSequence( aNewSequences ));
+ }
+ }
+
+ return xResult;
+}
+
+struct lcl_addSeriesNumber : public ::std::binary_function<
+ sal_Int32, Reference< XDataSeriesContainer >, sal_Int32 >
+{
+ sal_Int32 operator() ( sal_Int32 nCurrentNumber, const Reference< XDataSeriesContainer > & xCnt ) const
+ {
+ if( xCnt.is())
+ return nCurrentNumber + (xCnt->getDataSeries().getLength());
+ return nCurrentNumber;
+ }
+};
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+
+namespace chart
+{
+
+DialogModel::DialogModel(
+ const Reference< XChartDocument > & xChartDocument,
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xChartDocument( xChartDocument ),
+ m_xContext( xContext ),
+ m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) )
+{
+ createBackup();
+}
+
+DialogModel::~DialogModel()
+{}
+
+void DialogModel::setTemplate(
+ const Reference< XChartTypeTemplate > & xTemplate )
+{
+ m_xTemplate = xTemplate;
+}
+
+::boost::shared_ptr< RangeSelectionHelper >
+ DialogModel::getRangeSelectionHelper() const
+{
+ if( ! m_spRangeSelectionHelper.get())
+ m_spRangeSelectionHelper.reset(
+ new RangeSelectionHelper( m_xChartDocument ));
+
+ return m_spRangeSelectionHelper;
+}
+
+Reference< frame::XModel > DialogModel::getChartModel() const
+{
+ Reference< frame::XModel > xResult( m_xChartDocument, uno::UNO_QUERY );
+ return xResult;
+}
+
+Reference< data::XDataProvider > DialogModel::getDataProvider() const
+{
+ Reference< data::XDataProvider > xResult;
+ if( m_xChartDocument.is())
+ xResult.set( m_xChartDocument->getDataProvider());
+ return xResult;
+}
+
+::std::vector< Reference< XDataSeriesContainer > >
+ DialogModel::getAllDataSeriesContainers() const
+{
+ ::std::vector< Reference< XDataSeriesContainer > > aResult;
+
+ try
+ {
+ Reference< XDiagram > xDiagram;
+ if( m_xChartDocument.is())
+ xDiagram.set( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ ::std::transform(
+ aChartTypeSeq.getConstArray(), aChartTypeSeq.getConstArray() + aChartTypeSeq.getLength(),
+ ::std::back_inserter( aResult ),
+ lcl_ChartTypeToSeriesCnt() );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return aResult;
+}
+
+::std::vector< DialogModel::tSeriesWithChartTypeByName >
+ DialogModel::getAllDataSeriesWithLabel() const
+{
+ ::std::vector< tSeriesWithChartTypeByName > aResult;
+ ::std::vector< Reference< XDataSeriesContainer > > aContainers(
+ getAllDataSeriesContainers());
+
+ ::std::copy( aContainers.begin(), aContainers.end(),
+ lcl_DataSeriesContainerAppend( aResult ));
+ return aResult;
+}
+
+DialogModel::tRolesWithRanges DialogModel::getRolesWithRanges(
+ const Reference< XDataSeries > & xSeries,
+ const ::rtl::OUString & aRoleOfSequenceForLabel,
+ const Reference< chart2::XChartType > & xChartType ) const
+{
+ DialogModel::tRolesWithRanges aResult;
+ try
+ {
+ Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW );
+ const Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
+ ::std::copy( aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength(),
+ lcl_RolesWithRangeAppend( aResult, aRoleOfSequenceForLabel ));
+ if( xChartType.is())
+ {
+ // add missing mandatory roles
+ Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles());
+ OUString aEmptyString;
+ sal_Int32 nI = 0;
+ for( nI=0; nI < aRoles.getLength(); ++nI )
+ {
+ if( aResult.find( aRoles[nI] ) == aResult.end() )
+ aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString ));
+ }
+
+ // add missing optional roles
+ aRoles = xChartType->getSupportedOptionalRoles();
+ for( nI=0; nI < aRoles.getLength(); ++nI )
+ {
+ if( aResult.find( aRoles[nI] ) == aResult.end() )
+ aResult.insert( DialogModel::tRolesWithRanges::value_type( aRoles[nI], aEmptyString ));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aResult;
+}
+
+void DialogModel::moveSeries(
+ const Reference< XDataSeries > & xSeries,
+ eMoveDirection eDirection )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ DiagramHelper::moveSeries( xDiagram, xSeries, eDirection==MOVE_UP );
+}
+
+Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter(
+ const Reference< XDataSeries > & xSeries,
+ const Reference< XChartType > & xChartType,
+ bool bCreateDataCachedSequences /* = false */ )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ Reference< XDataSeries > xNewSeries;
+
+ try
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
+ ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
+
+ sal_Int32 nSeriesInChartType = 0;
+ const sal_Int32 nTotalSeries = countSeries();
+ if( xChartType.is())
+ {
+ Reference< XDataSeriesContainer > xCnt( xChartType, uno::UNO_QUERY_THROW );
+ nSeriesInChartType = xCnt->getDataSeries().getLength();
+ }
+
+ // create new series
+ xNewSeries.set(
+ lcl_CreateNewSeries(
+ m_xContext,
+ xChartType,
+ nTotalSeries, // new series' index
+ nSeriesInChartType,
+ xDiagram,
+ m_xTemplate,
+ bCreateDataCachedSequences ));
+
+ // add new series to container
+ if( xNewSeries.is())
+ {
+ Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY_THROW );
+ ::std::vector< Reference< XDataSeries > > aSeries(
+ SequenceToVector( xSeriesCnt->getDataSeries()));
+ ::std::vector< Reference< XDataSeries > >::iterator aIt =
+ ::std::find( aSeries.begin(), aSeries.end(), xSeries );
+ if( aIt == aSeries.end())
+ // if we have no series we insert at the first position.
+ aIt = aSeries.begin();
+ else
+ // vector::insert inserts before, so we have to advance
+ ++aIt;
+ aSeries.insert( aIt, xNewSeries );
+ xSeriesCnt->setDataSeries( ContainerToSequence( aSeries ));
+ }
+
+ ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xNewSeries;
+}
+
+void DialogModel::deleteSeries(
+ const Reference< XDataSeries > & xSeries,
+ const Reference< XChartType > & xChartType )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ DataSeriesHelper::deleteSeries( xSeries, xChartType );
+}
+
+Reference< data::XLabeledDataSequence > DialogModel::getCategories() const
+{
+ Reference< data::XLabeledDataSequence > xResult;
+ try
+ {
+ if( m_xChartDocument.is())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ xResult.set( DiagramHelper::getCategoriesFromDiagram( xDiagram ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xResult;
+}
+
+void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequence > & xCategories )
+{
+ if( m_xChartDocument.is())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ // categories
+ bool bSupportsCategories = true;
+
+ Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xFirstChartType.is() )
+ {
+ sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis
+ bSupportsCategories = (nAxisType == AxisType::CATEGORY);
+ }
+ DiagramHelper::setCategoriesToDiagram( xCategories, xDiagram, true, bSupportsCategories );
+ }
+ }
+}
+
+OUString DialogModel::getCategoriesRange() const
+{
+ Reference< data::XLabeledDataSequence > xLSeq( getCategories());
+ OUString aRange;
+ if( xLSeq.is())
+ {
+ Reference< data::XDataSequence > xSeq( xLSeq->getValues());
+ if( xSeq.is())
+ aRange = xSeq->getSourceRangeRepresentation();
+ }
+ return aRange;
+}
+
+bool DialogModel::isCategoryDiagram() const
+{
+ bool bRet = false;
+ if( m_xChartDocument.is())
+ bRet = DiagramHelper::isCategoryDiagram( m_xChartDocument->getFirstDiagram() );
+ return bRet;
+}
+
+void DialogModel::detectArguments(
+ OUString & rOutRangeString,
+ bool & rOutUseColumns,
+ bool & rOutFirstCellAsLabel,
+ bool & rOutHasCategories ) const
+{
+ try
+ {
+ uno::Sequence< sal_Int32 > aSequenceMapping;//todo YYYX
+
+ // 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 ),
+ rOutRangeString, aSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+bool DialogModel::allArgumentsForRectRangeDetected() const
+{
+ return DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument );
+}
+
+void DialogModel::startControllerLockTimer()
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+}
+
+bool DialogModel::setData(
+ const Sequence< beans::PropertyValue > & rArguments )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+
+ Reference< data::XDataProvider > xDataProvider( getDataProvider());
+ if( ! xDataProvider.is() ||
+ ! m_xTemplate.is() )
+ {
+ OSL_ENSURE( false, "Model objects missing" );
+ return false;
+ }
+
+ try
+ {
+ Reference< chart2::data::XDataSource > xDataSource(
+ xDataProvider->createDataSource( rArguments ) );
+
+ Reference< chart2::XDataInterpreter > xInterpreter(
+ m_xTemplate->getDataInterpreter());
+ if( xInterpreter.is())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
+ ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
+
+ ::std::vector< Reference< XDataSeries > > aSeriesToReUse(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ applyInterpretedData(
+ xInterpreter->interpretDataSource(
+ xDataSource, rArguments,
+ ContainerToSequence( aSeriesToReUse )),
+ aSeriesToReUse,
+ true /* bSetStyles */);
+
+ ThreeDHelper::setScheme( xDiagram, e3DScheme );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ return false;
+ }
+
+ return true;
+}
+
+// static
+OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString )
+{
+ return lcl_ConvertRole( rRoleString, true );
+}
+
+// static
+OUString DialogModel::GetRoleDataLabel()
+{
+ return OUString( String( ::chart::SchResId( STR_OBJECT_DATALABELS )));
+}
+
+// static
+
+sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString )
+{
+ static lcl_tRoleIndexMap aRoleIndexMap;
+
+ if( aRoleIndexMap.empty())
+ lcl_createRoleIndexMap( aRoleIndexMap );
+
+ lcl_tRoleIndexMap::const_iterator aIt( aRoleIndexMap.find( rInternalRoleString ));
+ if( aIt != aRoleIndexMap.end())
+ return aIt->second;
+
+ return 0;
+}
+
+// private methods
+
+void DialogModel::createBackup()
+{
+ OSL_ENSURE( ! m_xBackupChartDocument.is(), "Cloning already cloned model" );
+ try
+ {
+ Reference< util::XCloneable > xCloneable( m_xChartDocument, uno::UNO_QUERY_THROW );
+ m_xBackupChartDocument.set( xCloneable->createClone(), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void DialogModel::applyInterpretedData(
+ const InterpretedData & rNewData,
+ const ::std::vector< Reference< XDataSeries > > & rSeriesToReUse,
+ bool bSetStyles )
+{
+ if( ! m_xChartDocument.is())
+ return;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ // styles
+ if( bSetStyles && m_xTemplate.is() )
+ {
+ sal_Int32 nGroup = 0;
+ sal_Int32 nSeriesCounter = 0;
+ sal_Int32 nNewSeriesIndex = static_cast< sal_Int32 >( rSeriesToReUse.size());
+ const sal_Int32 nOuterSize=rNewData.Series.getLength();
+
+ for(; nGroup < nOuterSize; ++nGroup)
+ {
+ Sequence< Reference< XDataSeries > > aSeries( rNewData.Series[ nGroup ] );
+ const sal_Int32 nSeriesInGroup = aSeries.getLength();
+ 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())
+ {
+ // @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(
+ C2U("Color"), uno::makeAny( xColorScheme->getColorByIndex( nSeriesCounter )));
+ }
+ m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup );
+ }
+ }
+ }
+ }
+
+ // data series
+ ::std::vector< Reference< XDataSeriesContainer > > aSeriesCnt( getAllDataSeriesContainers());
+ ::std::vector< Sequence< Reference< XDataSeries > > > aNewSeries(
+ SequenceToVector( rNewData.Series ));
+
+ OSL_ASSERT( aSeriesCnt.size() == aNewSeries.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();
+ ++aSrcIt, ++aDestIt )
+ {
+ try
+ {
+ OSL_ASSERT( (*aDestIt).is());
+ (*aDestIt)->setDataSeries( *aSrcIt );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ DialogModel::setCategories(rNewData.Categories);
+ }
+}
+
+sal_Int32 DialogModel::countSeries() const
+{
+ ::std::vector< Reference< XDataSeriesContainer > > aCnt( getAllDataSeriesContainers());
+ return ::std::accumulate( aCnt.begin(), aCnt.end(), 0, lcl_addSeriesNumber());
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
new file mode 100644
index 000000000000..dcca6c716b8d
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DIALOGMODEL_HXX
+#define CHART2_DIALOGMODEL_HXX
+
+#include "TimerTriggeredControllerLock.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+namespace com { namespace sun { namespace star { namespace chart2 {
+ class XDataSeriesContainer;
+ class XDataSeries;
+ class XChartType;
+ class XChartTypeTemplate;
+ struct InterpretedData;
+ namespace data {
+ class XDataProvider;
+ class XLabeledDataSequence;
+ }
+}}}}
+
+namespace chart
+{
+
+class RangeSelectionHelper;
+
+class DialogModel
+{
+public:
+ explicit DialogModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ ~DialogModel();
+
+ typedef ::std::pair<
+ ::rtl::OUString,
+ ::std::pair< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > >
+ tSeriesWithChartTypeByName;
+
+ typedef ::std::map< ::rtl::OUString, ::rtl::OUString >
+ tRolesWithRanges;
+
+ void setTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > & xTemplate );
+
+ ::boost::shared_ptr< RangeSelectionHelper >
+ getRangeSelectionHelper() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >
+ getChartModel() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider >
+ getDataProvider() const;
+
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeriesContainer > >
+ getAllDataSeriesContainers() const;
+
+ ::std::vector< tSeriesWithChartTypeByName >
+ getAllDataSeriesWithLabel() const;
+
+ tRolesWithRanges getRolesWithRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::rtl::OUString & aRoleOfSequenceForLabel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType ) const;
+
+ enum eMoveDirection
+ {
+ MOVE_DOWN,
+ MOVE_UP
+ };
+
+ void moveSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ eMoveDirection eDirection );
+
+ /// @return the newly inserted series
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > insertSeriesAfter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType,
+ bool bCreateDataCachedSequences = false );
+
+ void deleteSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getCategories() const;
+
+ void setCategories( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories );
+
+ ::rtl::OUString getCategoriesRange() const;
+
+ bool isCategoryDiagram() const;
+
+ void detectArguments(
+ ::rtl::OUString & rOutRangeString,
+ bool & rOutUseColumns, bool & rOutFirstCellAsLabel, bool & rOutHasCategories ) const;
+
+ bool allArgumentsForRectRangeDetected() const;
+
+ bool setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rArguments );
+
+ void startControllerLockTimer();
+
+ static ::rtl::OUString ConvertRoleFromInternalToUI( const ::rtl::OUString & rRoleString );
+ static ::rtl::OUString GetRoleDataLabel();
+
+ // pass a role string (not translated) and get an index that serves for
+ // relative ordering, to get e.g. x-values and y-values in the right order
+ static sal_Int32 GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >
+ m_xChartDocument;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >
+ m_xBackupChartDocument;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate >
+ m_xTemplate;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ mutable ::boost::shared_ptr< RangeSelectionHelper >
+ m_spRangeSelectionHelper;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+
+private:
+ void createBackup();
+
+ void applyInterpretedData(
+ const ::com::sun::star::chart2::InterpretedData & rNewData,
+ const ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & rSeriesToReUse,
+ bool bSetStyles );
+
+ sal_Int32 countSeries() const;
+};
+
+} // namespace chart
+
+// CHART2_DIALOGMODEL_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
new file mode 100644
index 000000000000..0836ab9ca93a
--- /dev/null
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -0,0 +1,852 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ObjectNameProvider.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "TitleHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+#include "CommonConverters.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+
+//.............................................................................
+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;
+using rtl::OUString;
+
+namespace
+{
+
+OUString lcl_getDataSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet;
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( xChartType.is() )
+ {
+ aRet = ::chart::DataSeriesHelper::getDataSeriesLabel(
+ xSeries, xChartType->getRoleOfSequenceForSeriesLabel() ) ;
+ }
+ }
+
+ return aRet;
+}
+
+OUString lcl_getFullSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet = String(SchResId(STR_TIP_DATASERIES));
+ OUString aWildcard( C2U("%SERIESNAME") );
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ return aRet;
+}
+
+void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rNext )
+{
+ if( rOut.getLength() && rNext.getLength() )
+ rOut+=rSeparator;
+ if( rNext.getLength() )
+ rOut+=rNext;
+}
+
+OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal_Int32 nPointIndex,
+ const Reference< XCoordinateSystem >& xCooSys,
+ const Reference< frame::XModel >& xChartModel )
+{
+
+ OUString aRet;
+
+ Reference<data::XDataSource> xDataSource(
+ uno::Reference<data::XDataSource>( xSeries, uno::UNO_QUERY ) );
+ if(!xDataSource.is())
+ return aRet;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+
+ rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
+ double fValue = 0;
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ sal_Int32 nLabelColor = 0;//dummy
+ bool bColorChanged;//dummy
+
+ for(sal_Int32 nN = aDataSequences.getLength();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
+ {
+ uno::Any aARole = xProp->getPropertyValue( C2U( "Role" ) );
+ rtl::OUString aRole;
+ aARole >>= aRole;
+
+ if( aRole.equals(C2U("values-x")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aX = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-y")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-first")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_First = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-min")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Min = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-max")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Max = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-last")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ aY_Last = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ else if( aRole.equals(C2U("values-size")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ if( aX.getLength() == 0 )
+ {
+ rtl::OUString aCategory = ::rtl::OUString( String(SchResId(STR_TIP_CATEGORY_VALUE)));
+
+ replaceParamterInString( aCategory
+ , C2U("%CATEGORYVALUE")
+ , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex )
+ );
+
+ aRet = aCategory;
+ }
+ else
+ {
+ aRet = aX;
+ }
+
+ OUString aSeparator(C2U(" "));
+
+ lcl_addText( aRet, aSeparator, aY );
+ lcl_addText( aRet, aSeparator, aY_First );
+ lcl_addText( aRet, aSeparator, aY_Min );
+ lcl_addText( aRet, aSeparator, aY_Max );
+ lcl_addText( aRet, aSeparator, aY_Last );
+ lcl_addText( aRet, aSeparator, a_Size );
+
+ return aRet;
+}
+
+} //end anonymous namespace
+
+rtl::OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural )
+{
+ rtl::OUString aRet;
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_PAGE:
+ aRet=String(SchResId(STR_OBJECT_PAGE));
+ break;
+ case OBJECTTYPE_TITLE:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_TITLES));
+ else
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+ }
+ break;
+ case OBJECTTYPE_LEGEND:
+ aRet=String(SchResId(STR_OBJECT_LEGEND));
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ aRet=String(SchResId(STR_OBJECT_LEGEND_SYMBOL));//@todo change string if we do differenciate symbol and legend entry in future
+ break;
+ case OBJECTTYPE_DIAGRAM:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM));
+ break;
+ case OBJECTTYPE_DIAGRAM_WALL:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM_WALL));
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ aRet=String(SchResId(STR_OBJECT_DIAGRAM_FLOOR));
+ break;
+ case OBJECTTYPE_AXIS:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_AXES));
+ else
+ aRet=String(SchResId(STR_OBJECT_AXIS));
+ }
+ break;
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ aRet=String(SchResId(STR_OBJECT_LABEL));//@todo maybe a more concrete name
+ break;
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID: //maybe todo: different names for subgrids
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_GRIDS));
+ else
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ }
+ break;
+ case OBJECTTYPE_DATA_SERIES:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_DATASERIES_PLURAL));
+ else
+ aRet=String(SchResId(STR_OBJECT_DATASERIES));
+ }
+ break;
+ case OBJECTTYPE_DATA_POINT:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_DATAPOINTS));
+ else
+ aRet=String(SchResId(STR_OBJECT_DATAPOINT));
+ }
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ aRet=String(SchResId(STR_OBJECT_DATALABELS));
+ break;
+ case OBJECTTYPE_DATA_LABEL:
+ aRet=String(SchResId(STR_OBJECT_LABEL));
+ break;
+ case OBJECTTYPE_DATA_ERRORS:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe distinguish plural singular
+ break;
+ case OBJECTTYPE_DATA_ERRORS_X:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ aRet=String(SchResId(STR_OBJECT_AVERAGE_LINE));
+ break;
+ case OBJECTTYPE_DATA_CURVE:
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_CURVES));
+ else
+ aRet=String(SchResId(STR_OBJECT_CURVE));
+ }
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ //aRet=String(SchResId());
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ aRet=String(SchResId(STR_OBJECT_STOCK_LOSS));
+ break;
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ aRet=String(SchResId(STR_OBJECT_STOCK_GAIN));
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ aRet=String(SchResId(STR_OBJECT_CURVE_EQUATION));
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ ;
+ }
+ return aRet;
+}
+//static
+rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ rtl::OUString aRet;
+
+
+
+ Reference< XAxis > xAxis(
+ ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
+
+ sal_Int32 nCooSysIndex = 0;
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ), nCooSysIndex, nDimensionIndex, nAxisIndex );
+
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_X));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_X_AXIS));
+ break;
+ case 1://y-axis
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_Y));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_Y_AXIS));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_AXIS_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_AXIS));
+ break;
+ }
+
+ return aRet;
+}
+
+//static
+OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType )
+{
+ OUString aRet;
+
+ switch(eType)
+ {
+ case TitleHelper::MAIN_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_MAIN));
+ break;
+ case TitleHelper::SUB_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SUB));
+ break;
+ case TitleHelper::X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS));
+ break;
+ case TitleHelper::Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS));
+ break;
+ case TitleHelper::Z_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS));
+ break;
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS));
+ break;
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS));
+ break;
+ default:
+ DBG_ERROR("unknown title type");
+ break;
+ }
+
+ if( !aRet.getLength() )
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+
+ return aRet;
+}
+
+//static
+OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet;
+
+ Reference< XTitle > xTitle(
+ ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xTitle.is() )
+ {
+ TitleHelper::eTitleType eType;
+ if( TitleHelper::getTitleType( eType, xTitle, xChartModel ) )
+ aRet = ObjectNameProvider::getTitleNameByType( eType );
+ }
+ if( !aRet.getLength() )
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+
+ return aRet;
+}
+
+//static
+rtl::OUString ObjectNameProvider::getGridName( const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ rtl::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 )
+ , nCooSysIndex , nDimensionIndex, nAxisIndex );
+
+ bool bMainGrid = (ObjectIdentifier::getObjectType( rObjectCID ) == OBJECTTYPE_GRID);
+
+ if( bMainGrid )
+ {
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_X));
+ break;
+ case 1://y-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_Y));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MAJOR_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ break;
+ }
+ }
+ else
+ {
+ switch(nDimensionIndex)
+ {
+ case 0://x-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_X));
+ break;
+ case 1://y-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_Y));
+ break;
+ case 2://z-axis
+ aRet=String(SchResId(STR_OBJECT_GRID_MINOR_Z));
+ break;
+ default://axis
+ aRet=String(SchResId(STR_OBJECT_GRID));
+ break;
+ }
+ }
+ return aRet;
+}
+
+rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, const Reference< chart2::XChartDocument >& xChartDocument, bool bVerbose )
+{
+ return getHelpText( rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY ), bVerbose );
+}
+
+rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel, bool bVerbose )
+{
+ rtl::OUString aRet;
+ ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
+ if( OBJECTTYPE_AXIS == eObjectType )
+ {
+ aRet=ObjectNameProvider::getAxisName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_GRID == eObjectType
+ || OBJECTTYPE_SUBGRID == eObjectType )
+ {
+ aRet=ObjectNameProvider::getGridName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_TITLE == eObjectType )
+ {
+ aRet=ObjectNameProvider::getTitleName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_DATA_SERIES == eObjectType )
+ {
+ aRet = lcl_getFullSeriesName( rObjectCID, xChartModel );
+ }
+ else if( OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ if( bVerbose )
+ {
+ OUString aNewLine(C2U("\n"));
+
+ aRet=String(SchResId(STR_TIP_DATAPOINT_INDEX));
+ aRet+=aNewLine;
+ aRet+=String(SchResId(STR_TIP_DATASERIES));
+ aRet+=aNewLine;
+ aRet+=String(SchResId(STR_TIP_DATAPOINT_VALUES));
+ }
+ else
+ aRet=String(SchResId(STR_TIP_DATAPOINT));
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+
+ //replace data point index
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%POINTNUMBER") );
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::valueOf(nPointIndex+1) );
+ }
+
+ //replace data series index
+ aWildcard = C2U("%SERIESNUMBER");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ sal_Int32 nSeriesIndex = -1;
+ for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
+ {
+ if( aSeriesVector[nSeriesIndex] == xSeries )
+ {
+ break;
+ }
+ }
+
+ OUString aReplacement( OUString::valueOf(nSeriesIndex+1) );
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), aReplacement );
+ }
+
+ //replace point values
+ aWildcard = C2U("%POINTVALUES");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataPointValueText(
+ xSeries,nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) );
+
+ //replace series name
+ aWildcard = C2U("%SERIESNAME");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ }
+ }
+ /*
+ else if( OBJECTTYPE_DIAGRAM == eObjectType )
+ {
+ //todo different names for different diagram types ???
+ //or different names for series of diferent charttypes
+ }
+ */
+ else if( OBJECTTYPE_DATA_CURVE == eObjectType )
+ {
+ if( bVerbose )
+ {
+ aRet = String( SchResId( STR_OBJECT_CURVE_WITH_PARAMETERS ));
+ Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ));
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ));
+ if( xCurve.is())
+ {
+ try
+ {
+ Reference< chart2::XRegressionCurveCalculator > xCalculator( xCurve->getCalculator(), uno::UNO_QUERY_THROW );
+ RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
+
+ // replace formula
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%FORMULA") );
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), xCalculator->getRepresentation());
+
+ // replace r^2
+ aWildcard = C2U("%RSQUARED");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ sal_Unicode aDecimalSep( '.' );
+ //@todo: enable this code when a localized decimal
+ //separator is also available for the formula
+// SvtSysLocale aSysLocale;
+// OUString aSep( aSysLocale.GetLocaleData().getNumDecimalSep());
+// if( aSep.getLength() == 1 )
+// aDecimalSep = aSep.toChar();
+ double fR( xCalculator->getCorrelationCoefficient());
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fR*fR, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ else
+ {
+ // non-verbose
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ }
+ else if( OBJECTTYPE_DATA_AVERAGE_LINE == eObjectType )
+ {
+ if( bVerbose )
+ {
+ aRet = String( 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())
+ {
+ Reference< chart2::XRegressionCurve > xCurve( RegressionCurveHelper::getMeanValueLine( xCurveCnt ));
+ if( xCurve.is())
+ {
+ try
+ {
+ Reference< chart2::XRegressionCurveCalculator > xCalculator( xCurve->getCalculator(), uno::UNO_QUERY_THROW );
+ RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
+
+ sal_Unicode aDecimalSep( '.' );
+ // replace average value
+// SvtSysLocale aSysLocale;
+// OUString aSep( aSysLocale.GetLocaleData().getNumDecimalSep());
+// if( aSep.getLength() == 1 )
+// aDecimalSep = aSep.toChar();
+
+ sal_Int32 nIndex = -1;
+ OUString aWildcard( C2U("%AVERAGE_VALUE") );
+ nIndex = aRet.indexOf( aWildcard );
+ // as the curve is constant, the value at any x-value is ok
+ if( nIndex != -1 )
+ {
+ const double fMeanValue( xCalculator->getCurveValue( 0.0 ));
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fMeanValue, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+
+ // replace standard deviation
+ aWildcard = C2U("%STD_DEVIATION");
+ nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ {
+ const double fStdDev( xCalculator->getCorrelationCoefficient());
+ aRet = aRet.replaceAt(
+ nIndex, aWildcard.getLength(),
+ ::rtl::math::doubleToUString(
+ fStdDev, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ else
+ {
+ // non-verbose
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ }
+ else
+ {
+ aRet = ObjectNameProvider::getName( eObjectType, false );
+ }
+ return aRet;
+}
+
+// static
+rtl::OUString ObjectNameProvider::getSelectedObjectText( const rtl::OUString & rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument )
+{
+ rtl::OUString aRet;
+ ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) );
+ Reference< frame::XModel > xChartModel( xChartDocument, uno::UNO_QUERY );
+
+ if( OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ aRet = String( SchResId( STR_STATUS_DATAPOINT_MARKED ));
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ), uno::UNO_QUERY );
+ if( xDiagram.is() && xSeries.is() )
+ {
+ sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
+
+ // replace data point index
+ replaceParamterInString( aRet, C2U("%POINTNUMBER"), OUString::valueOf( nPointIndex + 1 ));
+
+ // replace data series index
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ sal_Int32 nSeriesIndex = -1;
+ for( nSeriesIndex=aSeriesVector.size();nSeriesIndex--;)
+ {
+ if( aSeriesVector[nSeriesIndex] == xSeries )
+ break;
+ }
+ replaceParamterInString( aRet, C2U("%SERIESNUMBER"), OUString::valueOf( nSeriesIndex + 1 ) );
+ }
+
+ // replace point value
+ replaceParamterInString( aRet, C2U("%POINTVALUES"), lcl_getDataPointValueText(
+ xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) );
+ }
+ }
+ else
+ {
+ // use the verbose text including the formula for trend lines
+ const bool bVerbose( OBJECTTYPE_DATA_CURVE == eObjectType || OBJECTTYPE_DATA_AVERAGE_LINE == eObjectType );
+ const OUString aHelpText( getHelpText( rObjectCID, xChartModel, bVerbose ));
+ if( aHelpText.getLength())
+ {
+ aRet = String( SchResId( STR_STATUS_OBJECT_MARKED ));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), aHelpText );
+ }
+ }
+
+ return aRet;
+}
+
+
+// static
+rtl::OUString ObjectNameProvider::getNameForCID(
+ const rtl::OUString& rObjectCID,
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ ObjectType eType( ObjectIdentifier::getObjectType( rObjectCID ));
+ Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY );
+
+ switch( eType )
+ {
+ case OBJECTTYPE_AXIS:
+ return getAxisName( rObjectCID, xModel );
+ case OBJECTTYPE_TITLE:
+ return getTitleName( rObjectCID, xModel );
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ return getGridName( rObjectCID, xModel );
+ case OBJECTTYPE_DATA_SERIES:
+ return lcl_getFullSeriesName( rObjectCID, xModel );
+ //case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ rtl::OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel );
+ aRet += C2U(" ");
+ if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += getName( OBJECTTYPE_DATA_POINT );
+ sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
+ aRet += C2U(" ");
+ aRet += OUString::valueOf(nPointIndex+1);
+
+ if( eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += C2U(" ");
+ aRet += getName( OBJECTTYPE_DATA_LABEL );
+ }
+ }
+ else
+ aRet += getName( eType );
+ return aRet;
+ }
+ default:
+ break;
+ }
+
+ return getName( eType );
+}
+
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForSeries(
+ ObjectType eObjectType,
+ const rtl::OUString& rSeriesCID,
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ uno::Reference< frame::XModel> xChartModel( xChartDocument, uno::UNO_QUERY );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, false /*bPlural*/ ) );
+ replaceParamterInString( aRet, C2U("%SERIESNAME"), lcl_getDataSeriesName( rSeriesCID, xChartModel ) );
+ return aRet;
+ }
+ else
+ return ObjectNameProvider::getName_ObjectForAllSeries( eObjectType );
+}
+
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType )
+{
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_ALL_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, true /*bPlural*/ ) );
+ return aRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeEdit.cxx b/chart2/source/controller/dialogs/RangeEdit.cxx
new file mode 100644
index 000000000000..55888156b1b1
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeEdit.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeEdit.hxx"
+
+namespace chart
+{
+
+//============================================================================
+// class RangeEdit
+//----------------------------------------------------------------------------
+RangeEdit::RangeEdit( Window* pParent, const ResId& rResId):
+ Edit( pParent , rResId )
+{
+ EnableUpdateData( 1000 );
+}
+
+RangeEdit::~RangeEdit()
+{
+}
+
+void RangeEdit::SetKeyInputHdl( const Link& rKeyInputLink )
+{
+ m_aKeyInputLink = rKeyInputLink;
+}
+
+void RangeEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ if( !rKeyCode.GetModifier() && rKeyCode.GetCode() == KEY_F2 )
+ {
+ if ( m_aKeyInputLink.IsSet() )
+ {
+ m_aKeyInputLink.Call( NULL );
+ }
+ }
+ else
+ Edit::KeyInput( rKEvt );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeSelectionButton.cxx b/chart2/source/controller/dialogs/RangeSelectionButton.cxx
new file mode 100644
index 000000000000..9b94d7e1752b
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionButton.cxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionButton.hxx"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+RangeSelectionButton::RangeSelectionButton( Window *pParent, const ResId& rResId ) :
+ ImageButton( pParent, rResId )
+{
+ SetModeImage( Image( SchResId(IMG_SELECTRANGE) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SchResId(IMG_SELECTRANGE_HC) ), BMP_COLOR_HIGHCONTRAST );
+ this->SetQuickHelpText(SchResId(STR_TIP_SELECT_RANGE));
+}
+
+RangeSelectionButton::~RangeSelectionButton()
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
new file mode 100644
index 000000000000..ccb4979420d1
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionHelper.hxx"
+#include "RangeSelectionListener.hxx"
+#include "macros.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XCellRangesAccess.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ----------------------------------------
+
+namespace chart
+{
+
+RangeSelectionHelper::RangeSelectionHelper(
+ const Reference< chart2::XChartDocument > & xChartDocument ) :
+ m_xChartDocument( xChartDocument )
+{}
+
+RangeSelectionHelper::~RangeSelectionHelper()
+{}
+
+bool RangeSelectionHelper::hasRangeSelection()
+{
+ return getRangeSelection().is();
+}
+
+Reference< sheet::XRangeSelection > RangeSelectionHelper::getRangeSelection()
+{
+ if( !m_xRangeSelection.is() &&
+ m_xChartDocument.is() )
+ {
+ try
+ {
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( xDataProvider.is())
+ m_xRangeSelection.set( xDataProvider->getRangeSelection());
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+
+ m_xRangeSelection.clear();
+ }
+ }
+
+ return m_xRangeSelection;
+}
+
+void RangeSelectionHelper::raiseRangeSelectionDocument()
+{
+ Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection());
+ if( xRangeSel.is())
+ {
+ try
+ {
+ // bring document to front
+ Reference< frame::XController > xCtrl( xRangeSel, uno::UNO_QUERY );
+ if( xCtrl.is())
+ {
+ Reference< frame::XFrame > xFrame( xCtrl->getFrame());
+ if( xFrame.is())
+ {
+ Reference< awt::XTopWindow > xWin( xFrame->getContainerWindow(),
+ uno::UNO_QUERY_THROW );
+ xWin->toFront();
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+bool RangeSelectionHelper::chooseRange(
+ const OUString & aCurrentRange,
+ const OUString & aUIString,
+ RangeSelectionListenerParent & rListenerParent )
+{
+ ControllerLockGuard aGuard( Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) );
+
+ bool bResult = true;
+ raiseRangeSelectionDocument();
+
+ try
+ {
+ Reference< sheet::XRangeSelection > xRangeSel( getRangeSelection());
+ if( xRangeSel.is())
+ {
+ Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ C2U("InitialValue"), -1, uno::makeAny( aCurrentRange ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ C2U("Title"), -1,
+ uno::makeAny( aUIString ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ C2U("CloseOnMouseRelease"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ C2U("MultiSelectionMode"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ if( m_xRangeSelectionListener.is() )
+ stopRangeListening();
+ m_xRangeSelectionListener.set( Reference< sheet::XRangeSelectionListener >(
+ new RangeSelectionListener( rListenerParent, aCurrentRange, Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) )));
+
+ xRangeSel->addRangeSelectionListener( m_xRangeSelectionListener );
+ xRangeSel->startRangeSelection( aArgs );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ bResult = false;
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bResult;
+}
+
+void RangeSelectionHelper::stopRangeListening( bool bRemoveListener /* = true */ )
+{
+ if( bRemoveListener &&
+ m_xRangeSelectionListener.is() &&
+ m_xRangeSelection.is() )
+ {
+ m_xRangeSelection->removeRangeSelectionListener( m_xRangeSelectionListener );
+ }
+
+ m_xRangeSelectionListener = 0;
+}
+
+bool RangeSelectionHelper::verifyCellRange( const OUString & rRangeStr )
+{
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( ! xDataProvider.is())
+ return false;
+
+ return xDataProvider->createDataSequenceByRangeRepresentationPossible( rRangeStr );
+}
+
+bool RangeSelectionHelper::verifyArguments( const Sequence< beans::PropertyValue > & rArguments )
+{
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( ! xDataProvider.is())
+ return false;
+
+ return xDataProvider->createDataSourcePossible( rArguments );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/RangeSelectionListener.cxx b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
new file mode 100644
index 000000000000..a2bb0b7602d6
--- /dev/null
+++ b/chart2/source/controller/dialogs/RangeSelectionListener.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeSelectionListener.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+RangeSelectionListener::RangeSelectionListener(
+ RangeSelectionListenerParent & rParent,
+ const ::rtl::OUString & rInitialRange,
+ const Reference< frame::XModel >& xModelToLockController ) :
+ m_rParent( rParent ),
+ m_aRange( rInitialRange ),
+ m_aControllerLockGuard( xModelToLockController )
+{}
+
+RangeSelectionListener::~RangeSelectionListener()
+{}
+
+// ____ XRangeSelectionListener ____
+void SAL_CALL RangeSelectionListener::done( const sheet::RangeSelectionEvent& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_aRange = aEvent.RangeDescriptor;
+ m_rParent.listeningFinished( m_aRange );
+}
+
+void SAL_CALL RangeSelectionListener::aborted( const sheet::RangeSelectionEvent& /*aEvent*/ )
+ throw (uno::RuntimeException)
+{
+ m_rParent.listeningFinished( m_aRange );
+}
+
+// ____ XEventListener ____
+void SAL_CALL RangeSelectionListener::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+ m_rParent.disposingRangeSelection();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/ResourceIds.hrc b/chart2/source/controller/dialogs/ResourceIds.hrc
new file mode 100644
index 000000000000..2ab544c77ab1
--- /dev/null
+++ b/chart2/source/controller/dialogs/ResourceIds.hrc
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_RESOURCE_IDS_HRC
+#define _CHART2_RESOURCE_IDS_HRC
+
+//-----------------------------------------------------------------------------
+//for strings see Strings.hrc
+
+//-----------------------------------------------------------------------------
+//for Bimaps see Bimaps.hrc and Bimaps_HC.hrc
+
+//-----------------------------------------------------------------------------
+//Dialog Ids:
+#define DLG_DIAGRAM_TYPE 743
+#define DLG_CHART_WIZARD 902
+#define DLG_DATA_SOURCE 901
+#define DLG_AXIS_OR_GRID 839
+#define DLG_DATA_DESCR 836
+#define DLG_LEGEND 835
+#define DLG_TITLE 834
+#define DLG_3D_VIEW 752
+#define DLG_OBJECT_PROPERTIES 903
+#define DLG_SPLINE_PROPERTIES 904
+#define DLG_DATA_TRENDLINE 841
+#define DLG_DATA_YERRORBAR 842
+#define DLG_SHAPE_FONT 921
+#define DLG_SHAPE_PARAGRAPH 922
+
+//-----------------------------------------------------------------------------
+//TabPage Ids:
+#define TP_LEGEND_POS 900
+#define TP_DATA_DESCR 901
+#define TP_ALIGNMENT 902
+//#define TP_SYMBOL 906
+#define TP_LAYOUT 907
+#define TP_OPTIONS 908
+#define TP_POLAROPTIONS 909
+#define TP_AXIS_LABEL 920
+#define TP_SCALE 903
+#define TP_AXIS_POSITIONS 904
+#define TP_CHARTTYPE 910
+#define TP_RANGECHOOSER 911
+#define TP_WIZARD_TITLEANDOBJECTS 912
+#define TP_LOCATION 913
+#define TP_DATA_SOURCE 914
+
+#define TP_3D_SCENEGEOMETRY 915
+#define TP_3D_SCENEAPPEARANCE 916
+#define TP_3D_SCENEILLUMINATION 917
+
+#define TP_TRENDLINE 918
+#define TP_YERRORBAR 919
+
+//-----------------------------------------------------------------------------
+//listbox Ids:
+#define LB_BAR_GEOMETRY 1000
+#define LB_TEXT_SEPARATOR 1001
+
+//-----------------------------------------------------------------------------
+
+#endif
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
new file mode 100644
index 000000000000..4b4cec65426e
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -0,0 +1,608 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_DLG_CHART_WIZARD
+{
+ Text [ en-US ] = "Chart Wizard" ;
+};
+
+String STR_DLG_SMOOTH_LINE_PROPERTIES
+{
+ Text [ en-US ] = "Smooth Lines" ;
+};
+
+String STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE
+{
+ Text [ en-US ] = "Number Format for Percentage Value" ;
+};
+
+String STR_PAGE_CHARTTYPE
+{
+ Text [ en-US ] = "Chart Type" ;
+};
+
+String STR_PAGE_DATA_RANGE
+{
+ Text [ en-US ] = "Data Range";
+};
+
+String STR_PAGE_CHART_ELEMENTS
+{
+ Text [ en-US ] = "Chart Elements";
+};
+
+String STR_PAGE_CHART_LOCATION
+{
+ Text [ en-US ] = "Chart Location";
+};
+
+String STR_PAGE_LINE
+{
+ Text [ en-US ] = "Line" ;
+};
+
+String STR_PAGE_BORDER
+{
+ Text [ en-US ] = "Borders" ;
+};
+
+String STR_PAGE_AREA
+{
+ Text [ en-US ] = "Area" ;
+};
+
+String STR_PAGE_TRANSPARENCY
+{
+ Text [ en-US ] = "Transparency";
+};
+
+String STR_PAGE_FONT
+{
+ Text [ en-US ] = "Font" ;
+};
+
+String STR_PAGE_FONT_EFFECTS
+{
+ Text [ en-US ] = "Font Effects" ;
+};
+
+String STR_PAGE_NUMBERS
+{
+ Text [ en-US ] = "Numbers" ;
+};
+
+String STR_PAGE_POSITION
+{
+ Text [ en-US ] = "Position" ;
+};
+
+String STR_PAGE_LAYOUT
+{
+ Text [ en-US ] = "Layout";
+};
+
+String STR_PAGE_OPTIONS
+{
+ Text [ en-US ] = "Options";
+};
+
+String STR_PAGE_SCALE
+{
+ Text [ en-US ] = "Scale" ;
+};
+
+String STR_PAGE_POSITIONING
+{
+ Text [ en-US ] = "Positioning" ;
+};
+
+// String STR_PAGE_STATISTICS
+// {
+// Text [ en-US ] = "Statistics" ;
+// };
+
+String STR_PAGE_TRENDLINE_TYPE
+{
+ Text[ en-US ] = "Type";
+};
+
+String STR_PAGE_YERROR_BARS
+{
+ Text[ en-US ] = "Y Error Bars";
+};
+
+String STR_PAGE_ALIGNMENT
+{
+ Text [ en-US ] = "Alignment" ;
+};
+
+String STR_PAGE_PERSPECTIVE
+{
+ Text [ en-US ] = "Perspective" ;
+};
+String STR_PAGE_APPEARANCE
+{
+ Text [ en-US ] = "Appearance" ;
+};
+String STR_PAGE_ILLUMINATION
+{
+ Text [ en-US ] = "Illumination" ;
+};
+
+String STR_PAGE_ASIAN
+{
+ Text [ en-US ] = "Asian Typography" ;
+};
+
+String STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS
+{
+ Text [ en-US ] = "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION";
+};
+
+String STR_OBJECT_AXIS
+{
+ Text [ en-US ] = "Axis" ;
+};
+String STR_OBJECT_AXIS_X
+{
+ Text [ en-US ] = "X Axis" ;
+};
+String STR_OBJECT_AXIS_Y
+{
+ Text [ en-US ] = "Y Axis" ;
+};
+String STR_OBJECT_AXIS_Z
+{
+ Text [ en-US ] = "Z Axis" ;
+};
+String STR_OBJECT_SECONDARY_X_AXIS
+{
+ Text [ en-US ] = "Secondary X Axis" ;
+};
+String STR_OBJECT_SECONDARY_Y_AXIS
+{
+ Text [ en-US ] = "Secondary Y Axis" ;
+};
+
+String STR_OBJECT_AXES
+{
+ Text [ en-US ] = "Axes" ;
+};
+String STR_OBJECT_GRIDS
+{
+ Text [ en-US ] = "Grids" ;
+};
+String STR_OBJECT_GRID
+{
+ Text [ en-US ] = "Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_X
+{
+ Text [ en-US ] = "X Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_Y
+{
+ Text [ en-US ] = "Y Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MAJOR_Z
+{
+ Text [ en-US ] = "Z Axis Major Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_X
+{
+ Text [ en-US ] = "X Axis Minor Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_Y
+{
+ Text [ en-US ] = "Y Axis Minor Grid" ;
+};
+String STR_OBJECT_GRID_MINOR_Z
+{
+ Text [ en-US ] = "Z Axis Minor Grid" ;
+};
+
+String STR_OBJECT_LEGEND
+{
+ Text [ en-US ] = "Legend" ;
+};
+
+String STR_OBJECT_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_OBJECT_TITLES
+{
+ Text [ en-US ] = "Titles" ;
+};
+String STR_OBJECT_TITLE_MAIN
+{
+ Text [ en-US ] = "Main Title" ;
+};
+String STR_OBJECT_TITLE_SUB
+{
+ Text [ en-US ] = "Subtitle" ;
+};
+String STR_OBJECT_TITLE_X_AXIS
+{
+ Text [ en-US ] = "X Axis Title" ;
+};
+String STR_OBJECT_TITLE_Y_AXIS
+{
+ Text [ en-US ] = "Y Axis Title" ;
+};
+String STR_OBJECT_TITLE_Z_AXIS
+{
+ Text [ en-US ] = "Z Axis Title" ;
+};
+String STR_OBJECT_TITLE_SECONDARY_X_AXIS
+{
+ Text [ en-US ] = "Secondary X Axis Title" ;
+};
+String STR_OBJECT_TITLE_SECONDARY_Y_AXIS
+{
+ Text [ en-US ] = "Secondary Y Axis Title" ;
+};
+String STR_OBJECT_LABEL
+{
+ Text [ en-US ] = "Label" ;
+};
+
+String STR_OBJECT_DATALABELS
+{
+ Text [ en-US ] = "Data Labels" ;
+};
+String STR_OBJECT_DATAPOINT
+{
+ Text [ en-US ] = "Data Point" ;
+};
+String STR_OBJECT_DATAPOINTS
+{
+ Text [ en-US ] = "Data Points" ;
+};
+String STR_OBJECT_LEGEND_SYMBOL
+{
+ Text [ en-US ] = "Legend Key" ;
+};
+String STR_OBJECT_DATASERIES
+{
+ Text [ en-US ] = "Data Series" ;
+};
+String STR_OBJECT_DATASERIES_PLURAL
+{
+ Text [ en-US ] = "Data Series" ;
+};
+String STR_OBJECT_CURVE
+{
+ Text [ en-US ] = "Trend Line";
+};
+String STR_OBJECT_CURVES
+{
+ Text [ en-US ] = "Trend Lines";
+};
+String STR_OBJECT_CURVE_WITH_PARAMETERS
+{
+ Text [ en-US ] = "Trend line %FORMULA with accuracy R² = %RSQUARED";
+};
+String STR_OBJECT_AVERAGE_LINE
+{
+ Text [ en-US ] = "Mean Value Line";
+};
+String STR_OBJECT_CURVE_EQUATION
+{
+ Text[ en-US ] = "Equation";
+};
+
+String STR_OBJECT_ERROR_BARS
+{
+ Text [ en-US ] = "Error Bars";
+};
+String STR_OBJECT_STOCK_LOSS
+{
+ Text [ en-US ] = "Stock Loss";
+};
+
+String STR_OBJECT_STOCK_GAIN
+{
+ Text [ en-US ] = "Stock Gain";
+};
+
+String STR_OBJECT_PAGE
+{
+ Text [ en-US ] = "Chart Area" ;
+};
+String STR_OBJECT_DIAGRAM
+{
+ Text [ en-US ] = "Chart" ;
+};
+String STR_OBJECT_DIAGRAM_WALL
+{
+ Text [ en-US ] = "Chart Wall" ;
+};
+String STR_OBJECT_DIAGRAM_FLOOR
+{
+ Text [ en-US ] = "Chart Floor" ;
+};
+
+String STR_OBJECT_SHAPE
+{
+ Text [ en-US ] = "Drawing Object" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+String STR_TIP_SELECT_RANGE
+{
+ Text [ en-US ] = "Select data range" ;
+};
+
+String STR_TIP_CHOOSECOLOR
+{
+ Text [ en-US ] = "Select a color using the color dialog" ;
+};
+
+String STR_TIP_LIGHTSOURCE_X
+{
+ Text [ en-US ] = "Light Source %LIGHTNUMBER" ;
+};
+
+String STR_TIP_DATASERIES
+{
+ Text [ en-US ] = "Data Series '%SERIESNAME'" ;
+};
+
+String STR_TIP_DATAPOINT_INDEX
+{
+ Text [ en-US ] = "Data Point %POINTNUMBER";
+};
+
+String STR_TIP_DATAPOINT_VALUES
+{
+ Text [ en-US ] = "Values: %POINTVALUES";
+};
+
+String STR_TIP_CATEGORY_VALUE
+{
+ Text [ en-US ] = "'%CATEGORYVALUE'";
+};
+
+String STR_TIP_DATAPOINT
+{
+ Text [ en-US ] = "Data Point %POINTNUMBER, data series %SERIESNUMBER, values: %POINTVALUES";
+};
+
+String STR_STATUS_DATAPOINT_MARKED
+{
+ Text [ en-US ] = "Data point %POINTNUMBER in data series %SERIESNUMBER selected, values: %POINTVALUES";
+};
+
+String STR_STATUS_OBJECT_MARKED
+{
+ Text [ en-US ] = "%OBJECTNAME selected" ;
+};
+
+String STR_STATUS_PIE_SEGMENT_EXPLODED
+{
+ Text [ en-US ] = "Pie exploded by %PERCENTVALUE percent";
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+String STR_OBJECT_FOR_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for Data Series '%SERIESNAME'" ;
+};
+
+String STR_OBJECT_FOR_ALL_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for all Data Series" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+String STR_ACTION_EDIT_CHARTTYPE
+{
+ Text [ en-US ] = "Edit chart type" ;
+};
+String STR_ACTION_EDIT_DATA_RANGES
+{
+ Text [ en-US ] = "Edit data ranges" ;
+};
+String STR_ACTION_EDIT_3D_VIEW
+{
+ Text [ en-US ] = "Edit 3D view" ;
+};
+String STR_ACTION_EDIT_CHART_DATA
+{
+ Text [ en-US ] = "Edit chart data";
+};
+String STR_ACTION_TOGGLE_LEGEND
+{
+ Text [ en-US ] = "Legend on/off" ;
+};
+String STR_ACTION_TOGGLE_GRID_HORZ
+{
+ Text [ en-US ] = "Horizontal grid on/off" ;
+};
+String STR_ACTION_SCALE_TEXT
+{
+ Text [ en-US ] = "Scale Text" ;
+};
+String STR_ACTION_REARRANGE_CHART
+{
+ Text [ en-US ] = "Automatic Layout" ;
+};
+String STR_ACTION_NOTPOSSIBLE
+{
+ Text [ en-US ] = "This function cannot be completed with the selected objects." ;
+};
+
+String STR_COLUMN_LABEL
+{
+ Text [ en-US ] = "Column %COLUMNNUMBER" ;
+};
+String STR_ROW_LABEL
+{
+ Text [ en-US ] = "Row %ROWNUMBER" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//for range didalog
+String STR_DATA_ROLE_LABEL
+{
+ Text [ en-US ] = "Name" ;
+};
+
+String STR_DATA_ROLE_X
+{
+ Text [ en-US ] = "X-Values" ;
+};
+
+String STR_DATA_ROLE_Y
+{
+ Text [ en-US ] = "Y-Values" ;
+};
+
+String STR_DATA_ROLE_SIZE
+{
+ Text [ en-US ] = "Bubble Sizes" ;
+};
+
+String STR_DATA_ROLE_X_ERROR
+{
+ Text [ en-US ] = "X-Error-Bars" ;
+};
+String STR_DATA_ROLE_X_ERROR_POSITIVE
+{
+ Text [ en-US ] = "Positive X-Error-Bars" ;
+};
+String STR_DATA_ROLE_X_ERROR_NEGATIVE
+{
+ Text [ en-US ] = "Negative X-Error-Bars" ;
+};
+
+String STR_DATA_ROLE_Y_ERROR
+{
+ Text [ en-US ] = "Y-Error-Bars" ;
+};
+String STR_DATA_ROLE_Y_ERROR_POSITIVE
+{
+ Text [ en-US ] = "Positive Y-Error-Bars" ;
+};
+String STR_DATA_ROLE_Y_ERROR_NEGATIVE
+{
+ Text [ en-US ] = "Negative Y-Error-Bars" ;
+};
+
+String STR_DATA_ROLE_FIRST
+{
+ Text [ en-US ] = "Open Values" ;
+};
+
+String STR_DATA_ROLE_LAST
+{
+ Text [ en-US ] = "Close Values" ;
+};
+
+String STR_DATA_ROLE_MIN
+{
+ Text [ en-US ] = "Low Values" ;
+};
+
+String STR_DATA_ROLE_MAX
+{
+ Text [ en-US ] = "High Values" ;
+};
+
+String STR_DATA_ROLE_CATEGORIES
+{
+ Text [ en-US ] = "Categories";
+};
+
+String STR_DATA_UNNAMED_SERIES
+{
+ Text [ en-US ] = "Unnamed Series";
+};
+
+String STR_DATA_UNNAMED_SERIES_WITH_INDEX
+{
+ Text [ en-US ] = "Unnamed Series %NUMBER" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_SERIES
+{
+ Text [ en-US ] = "Select Range for %VALUETYPE of %SERIESNAME" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_CATEGORIES
+{
+ Text [ en-US ] = "Select Range for Categories" ;
+};
+
+String STR_DATA_SELECT_RANGE_FOR_DATALABELS
+{
+ Text [ en-US ] = "Select Range for data labels" ;
+};
+String STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS
+{
+ Text [ en-US ] = "Select Range for Positive Error Bars" ;
+};
+String STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS
+{
+ Text [ en-US ] = "Select Range for Negative Error Bars" ;
+};
+
+String STR_DATA_EDITOR_INCORRECT_INPUT
+{
+ Text [ en-US ] = "Your last input is incorrect.\nIgnore this change and close the dialog?" ;
+};
+
+// frame direction ------------------------------------------------------------
+
+String STR_TEXT_DIRECTION_LTR
+{
+ Text [ en-US ] = "Left-to-right";
+};
+
+String STR_TEXT_DIRECTION_RTL
+{
+ Text [ en-US ] = "Right-to-left";
+};
+
+String STR_TEXT_DIRECTION_SUPER
+{
+ Text [ en-US ] = "Use superordinate object settings";
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_AdditionalControls.src b/chart2/source/controller/dialogs/Strings_AdditionalControls.src
new file mode 100644
index 000000000000..f233ddaa7c20
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_AdditionalControls.src
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_3DSCHEME_SIMPLE
+{
+ Text [ en-US ] = "Simple";
+};
+String STR_3DSCHEME_REALISTIC
+{
+ Text [ en-US ] = "Realistic";
+};
+String STR_3DSCHEME_CUSTOM
+{
+ Text [ en-US ] = "Custom";
+};
+
+String STR_BAR_GEOMETRY
+{
+ Text [ en-US ] = "Shape";
+};
+
+String STR_NUMBER_OF_LINES
+{
+ Text [ en-US ] = "~Number of lines";
+};
+
+String STR_TEXT_SEPARATOR
+{
+ Text [ en-US ] = "Separator";
+};
+
+//-----------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src
new file mode 100644
index 000000000000..6c7fc5a752aa
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_TYPE_COLUMN
+{
+ Text [ en-US ] = "Column" ;
+};
+String STR_TYPE_BAR
+{
+ Text [ en-US ] = "Bar" ;
+};
+String STR_TYPE_AREA
+{
+ Text [ en-US ] = "Area" ;
+};
+String STR_TYPE_PIE
+{
+ Text [ en-US ] = "Pie" ;
+};
+String STR_PIE_EXPLODED
+{
+ Text [ en-US ] = "Exploded Pie Chart" ;
+};
+String STR_DONUT_EXPLODED
+{
+ Text [ en-US ] = "Exploded Donut Chart" ;
+};
+String STR_DONUT
+{
+ Text [ en-US ] = "Donut" ;
+};
+String STR_TYPE_LINE
+{
+ Text [ en-US ] = "Line" ;
+};
+String STR_TYPE_XY
+{
+ Text [ en-US ] = "XY (Scatter)" ;
+};
+String STR_POINTS_AND_LINES
+{
+ Text [ en-US ] = "Points and Lines" ;
+};
+String STR_POINTS_ONLY
+{
+ //@todo or symbols instead of points??
+ Text [ en-US ] = "Points Only" ;
+};
+String STR_LINES_ONLY
+{
+ Text [ en-US ] = "Lines Only" ;
+};
+String STR_LINES_3D
+{
+ Text [ en-US ] = "3D Lines" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_COMBI_COLUMN_LINE
+{
+ Text [ en-US ] = "Column and Line" ;
+};
+String STR_LINE_COLUMN
+{
+ Text [ en-US ] = "Columns and Lines" ;
+};
+String STR_LINE_STACKEDCOLUMN
+{
+ Text [ en-US ] = "Stacked Columns and Lines" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_NET
+{
+ Text [ en-US ] = "Net" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_STOCK
+{
+ Text [ en-US ] = "Stock";
+};
+String STR_STOCK_1
+{
+ Text [ en-US ] = "Stock Chart 1";
+};
+String STR_STOCK_2
+{
+ Text [ en-US ] = "Stock Chart 2";
+};
+String STR_STOCK_3
+{
+ Text [ en-US ] = "Stock Chart 3";
+};
+String STR_STOCK_4
+{
+ Text [ en-US ] = "Stock Chart 4";
+};
+//-----------------------------------------------------------------------------
+String STR_NORMAL
+{
+ Text [ en-US ] = "Normal" ;
+};
+String STR_STACKED
+{
+ Text [ en-US ] = "Stacked" ;
+};
+String STR_PERCENT
+{
+ Text [ en-US ] = "Percent Stacked" ;
+};
+
+String STR_DEEP
+{
+ Text [ en-US ] = "Deep" ;
+};
+String STR_FILLED
+{
+ Text [ en-US ] = "Filled" ;
+};
+//-----------------------------------------------------------------------------
+String STR_TYPE_BUBBLE
+{
+ Text [ en-US ] = "Bubble" ;
+};
+String STR_BUBBLE_1
+{
+ Text [ en-US ] = "Bubble Chart" ;
+};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/Strings_Scale.src b/chart2/source/controller/dialogs/Strings_Scale.src
new file mode 100644
index 000000000000..e7a3d6c2b1cf
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_Scale.src
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+String STR_INVALID_NUMBER
+{
+ Text [ en-US ] = "Numbers are required. Check your input." ;
+};
+String STR_STEP_GT_ZERO
+{
+ Text [ en-US ] = "The major interval requires a positive number. Check your input." ;
+};
+String STR_BAD_LOGARITHM
+{
+ Text [ en-US ] = "The logarithmic scale requires positive numbers. Check your input." ;
+};
+String STR_MIN_GREATER_MAX
+{
+ Text [ en-US ] = "The minimum must be lower than the maximum. Check your input." ;
+};
diff --git a/chart2/source/controller/dialogs/Strings_Statistic.src b/chart2/source/controller/dialogs/Strings_Statistic.src
new file mode 100644
index 000000000000..f2dc4235f783
--- /dev/null
+++ b/chart2/source/controller/dialogs/Strings_Statistic.src
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "Strings.hrc"
+
+//SchStatisticTabPage and SchDataStatisticsDlg
+String STR_INDICATE_BOTH
+{
+ Text [ en-US ] = "Negative and Positive" ;
+};
+String STR_INDICATE_DOWN
+{
+ Text [ en-US ] = "Negative" ;
+};
+String STR_INDICATE_UP
+{
+ Text [ en-US ] = "Positive" ;
+};
+
+// used for own data in error bar dialog
+String STR_CONTROLTEXT_ERROR_BARS_FROM_DATA
+{
+ Text [ en-US ] = "From Data Table" ;
+};
+
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
+String STR_REGRESSION_LINEAR
+{
+ Text [ en-US ] = "Linear Regression" ;
+};
+String STR_REGRESSION_LOG
+{
+ Text [ en-US ] = "Logarithmic Regression" ;
+};
+String STR_REGRESSION_EXP
+{
+ Text [ en-US ] = "Exponential Regression" ;
+};
+String STR_REGRESSION_POWER
+{
+ Text [ en-US ] = "Power Regression" ;
+};
+
+String STR_STATISTICS_IN_LEGEND
+{
+ Text [ en-US ] = "%REGRESSIONCURVE for %SERIESNAME" ;
+};
diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc
new file mode 100644
index 000000000000..1f445083738f
--- /dev/null
+++ b/chart2/source/controller/dialogs/TabPages.hrc
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TABPAGES_HRC
+#define CHART_TABPAGES_HRC
+
+#include "ResourceIds.hrc"
+
+//see attrib.hrc in old chart
+
+//#define TP_LEGEND_POS 900
+#define GRP_LEGEND 1
+#define FL_LEGEND_TEXTORIENT 2
+#define FT_LEGEND_TEXTDIR 3
+#define LB_LEGEND_TEXTDIR 4
+
+//#define TP_DATA_DESCR 901
+
+//#define TP_ALIGNMENT 902
+////#define FL_ORDER 2
+////#define RBT_SIDEBYSIDE 1
+////#define RBT_UPDOWN 2
+////#define RBT_DOWNUP 3
+////#define RBT_AUTOORDER 4
+
+#define FL_TEXTBREAK 3
+#define CBX_TEXTBREAK 2
+#define CBX_TEXTOVERLAP 4
+
+//Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
+// ID's for title rotation tabpage
+#define CTR_DIAL 6030
+#define BTN_TXTSTACKED 6031
+#define FT_DEGREES 6032
+#define NF_ORIENT 6033
+#define CTR_DUMMY 6034
+#define FT_DUMMY 6035
+#define FL_ALIGN 6037
+#define FT_TEXTDIR 6038
+#define LB_TEXTDIR 6039
+
+/*
+//Symbol-Tabpage (zum Teil sehr Aehnlich der SVX_AREA_TABPAGE) (obsolete)
+//#define TP_SYMBOL 906
+#define RBT_COLOR 1
+#define RBT_GRADIENT 2
+#define RBT_HATCHING 3
+#define RBT_BITMAP 4
+#define RBT_INVISIBLE 5
+#define LB_COLOR 1
+#define LB_GRADIENT 2
+#define LB_HATCHING 3
+#define LB_BITMAP 4
+
+#define GRP_FILL 1
+#define CTL_BITMAP_PREVIEW 6
+*/
+
+//------------
+//from old chart tplabel.hrc
+
+//#define TP_AXIS_LABEL 920
+
+#define CB_AXIS_LABEL_SCHOW_DESCR 1
+
+//#define FL_AXIS_LABEL_FORMATTING 2
+
+#define FL_AXIS_LABEL_ORIENTATION 3
+#define CT_AXIS_LABEL_DIAL 4
+#define PB_AXIS_LABEL_TEXTSTACKED 5
+#define FT_AXIS_LABEL_DEGREES 6
+#define NF_AXIS_LABEL_ORIENT 7
+#define FT_UNUSED 8
+#define CT_UNUSED 9
+
+#define FL_AXIS_LABEL_TEXTFLOW 10
+#define CB_AXIS_LABEL_TEXTOVERLAP 11
+#define CB_AXIS_LABEL_TEXTBREAK 12
+
+#define FL_AXIS_LABEL_ORDER 13
+#define RB_AXIS_LABEL_SIDEBYSIDE 14
+#define RB_AXIS_LABEL_UPDOWN 15
+#define RB_AXIS_LABEL_DOWNUP 16
+#define RB_AXIS_LABEL_AUTOORDER 17
+
+#define FL_SEPARATOR 18
+
+#define FT_AXIS_TEXTDIR 19
+#define LB_AXIS_TEXTDIR 20
+
+//#define TP_SCALE 903
+
+#define FL_SCALE 1
+
+#define TXT_MIN 1
+#define TXT_MAX 2
+#define TXT_STEP_MAIN 3
+#define TXT_STEP_HELP 4
+#define TXT_ORIGIN 5
+
+#define CBX_AUTO_MIN 1
+#define CBX_AUTO_MAX 2
+#define CBX_AUTO_STEP_MAIN 3
+#define CBX_AUTO_STEP_HELP 4
+#define CBX_AUTO_ORIGIN 5
+#define CBX_LOGARITHM 6
+#define CBX_REVERSE 7
+
+#define EDT_STEP_MAIN 1
+#define EDT_MAX 2
+#define EDT_MIN 3
+#define EDT_ORIGIN 4
+
+#define MT_STEPHELP 10
+
+//#define TP_AXIS_POSITIONS 904
+
+#define FL_AXIS_LINE 1
+#define FL_LABELS 2
+#define FL_TICKS 3
+#define FL_VERTICAL 4
+#define FL_GRIDS 5
+
+#define FT_CROSSES_OTHER_AXIS_AT 1
+#define FT_AXIS_LABEL_DISTANCE 2
+#define FT_PLACE_LABELS 3
+#define FT_MAJOR 4
+#define FT_MINOR 5
+#define FT_PLACE_TICKS 6
+
+#define LB_CROSSES_OTHER_AXIS_AT 1
+#define LB_PLACE_LABELS 2
+#define EDT_CROSSES_OTHER_AXIS_AT 3
+#define EDT_CROSSES_OTHER_AXIS_AT_CATEGORY 4
+#define EDT_AXIS_LABEL_DISTANCE 5
+#define LB_PLACE_TICKS 6
+
+#define CB_AXIS_BETWEEN_CATEGORIES 1
+#define CB_TICKS_INNER 2
+#define CB_TICKS_OUTER 3
+#define CB_MINOR_INNER 4
+#define CB_MINOR_OUTER 5
+#define CB_MAJOR_GRID 6
+#define CB_MINOR_GRID 7
+
+#define PB_MAJOR_GRID 1
+#define PB_MINOR_GRID 2
+
+#endif
diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
new file mode 100644
index 000000000000..23a1b4e806bd
--- /dev/null
+++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TextDirectionListBox.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include <svl/languageoptions.hxx>
+#include <vcl/window.hxx>
+
+namespace chart
+{
+
+TextDirectionListBox::TextDirectionListBox( Window* pParent, const ResId& rResId, Window* pWindow1, Window* pWindow2 ) :
+ svx::FrameDirectionListBox( pParent, rResId )
+{
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_LTR ) ), FRMDIR_HORI_LEFT_TOP );
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_RTL ) ), FRMDIR_HORI_RIGHT_TOP );
+ InsertEntryValue( String( SchResId( STR_TEXT_DIRECTION_SUPER ) ), FRMDIR_ENVIRONMENT );
+
+ if( !SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ Hide();
+ if( pWindow1 ) pWindow1->Hide();
+ if( pWindow2 ) pWindow2->Hide();
+ }
+}
+
+TextDirectionListBox::~TextDirectionListBox()
+{
+}
+
+} //namespace chart
+
diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
new file mode 100644
index 000000000000..f1af209697cc
--- /dev/null
+++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TimerTriggeredControllerLock.hxx"
+
+// header for define EDIT_UPDATEDATA_TIMEOUT
+#include <vcl/edit.hxx>
+
+//.............................................................................
+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.SetTimeoutHdl( LINK( this, TimerTriggeredControllerLock, TimerTimeout ) );
+}
+TimerTriggeredControllerLock::~TimerTriggeredControllerLock()
+{
+ m_aTimer.Stop();
+}
+
+void TimerTriggeredControllerLock::startTimer()
+{
+ if(!m_apControllerLockGuard.get())
+ m_apControllerLockGuard = std::auto_ptr< ControllerLockGuard >( new ControllerLockGuard(m_xModel) );
+ m_aTimer.Start();
+}
+IMPL_LINK( TimerTriggeredControllerLock, TimerTimeout, void*, EMPTYARG )
+{
+ m_apControllerLockGuard.reset();
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx
new file mode 100644
index 000000000000..8846b310cde4
--- /dev/null
+++ b/chart2/source/controller/dialogs/TitleDialogData.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TitleDialogData.hxx"
+#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+TitleDialogData::TitleDialogData( ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider )
+ : aPossibilityList(7)
+ , aExistenceList(7)
+ , aTextList(7)
+ , apReferenceSizeProvider( apRefSizeProvider )
+{
+ sal_Int32 nN = 0;
+ for(nN=7;nN--;)
+ aPossibilityList[nN]=sal_True;
+ for(nN=7;nN--;)
+ aExistenceList[nN]=sal_False;
+}
+
+void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChartModel )
+{
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(xChartModel);
+
+ //get possibilities
+ uno::Sequence< sal_Bool > aAxisPossibilityList;
+ AxisHelper::getAxisOrGridPossibilities( aAxisPossibilityList, xDiagram );
+ this->aPossibilityList[2]=aAxisPossibilityList[0];//x axis title
+ this->aPossibilityList[3]=aAxisPossibilityList[1];//y axis title
+ this->aPossibilityList[4]=aAxisPossibilityList[2];//z axis title
+ this->aPossibilityList[5]=aAxisPossibilityList[3];//secondary x axis title
+ this->aPossibilityList[6]=aAxisPossibilityList[4];//secondary y axis title
+
+ //find out which title exsist 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 );
+ nTitleIndex++)
+ {
+ uno::Reference< XTitle > xTitle = TitleHelper::getTitle(
+ static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel );
+ this->aExistenceList[nTitleIndex] = xTitle.is();
+ this->aTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle );
+ }
+}
+
+bool TitleDialogData::writeDifferenceToModel(
+ const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , 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 );
+ nN++)
+ {
+ if( !pOldState || ( pOldState->aExistenceList[nN] != this->aExistenceList[nN] ) )
+ {
+ if(this->aExistenceList[nN])
+ {
+ TitleHelper::createTitle(
+ static_cast< TitleHelper::eTitleType >( nN ), this->aTextList[nN], xChartModel, xContext,
+ apReferenceSizeProvider.get() );
+ bChanged = true;
+ }
+ else
+ {
+ TitleHelper::removeTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel );
+ bChanged = true;
+ }
+ }
+ else if( !pOldState || ( pOldState->aTextList[nN] != this->aTextList[nN] ) )
+ {
+ //change content
+ uno::Reference< XTitle > xTitle(
+ TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) );
+ if(xTitle.is())
+ {
+ TitleHelper::setCompleteString( this->aTextList[nN], xTitle, xContext );
+ bChanged = true;
+ }
+ }
+ }
+ return bChanged;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
new file mode 100644
index 000000000000..f446c52ac0de
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ChartType.hxx"
+#include "dlg_ChartType.hrc"
+#include "ResId.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "tp_ChartType.hxx"
+#include "macros.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+ChartTypeDialog::ChartTypeDialog( Window* pParent
+ , const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : ModalDialog( pParent, SchResId( DLG_DIAGRAM_TYPE ))
+ , m_aFL( this, SchResId( FL_BUTTONS ) )
+ , m_aBtnOK( this, SchResId( BTN_OK ) )
+ , m_aBtnCancel( this, SchResId( BTN_CANCEL ) )
+ , m_aBtnHelp( this, SchResId( BTN_HELP ) )
+ , m_pChartTypeTabPage(0)
+ , m_xChartModel(xChartModel)
+ , m_xCC( xContext )
+{
+ FreeResource();
+
+ this->SetText(String(SchResId(STR_PAGE_CHARTTYPE)));
+
+ //don't create the tabpages before FreeResource, otherwise the help ids are not matched correctly
+ m_pChartTypeTabPage = new ChartTypeTabPage(this,uno::Reference< XChartDocument >::query(m_xChartModel),m_xCC,true/*live update*/,true/*hide title description*/);
+ m_pChartTypeTabPage->initializePage();
+ m_pChartTypeTabPage->Show();
+ }
+
+ChartTypeDialog::~ChartTypeDialog()
+{
+ delete m_pChartTypeTabPage;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.hrc b/chart2/source/controller/dialogs/dlg_ChartType.hrc
new file mode 100644
index 000000000000..0b5c20dae05c
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define TABCTRL 1
+
+#define FL_BUTTONS 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.src b/chart2/source/controller/dialogs/dlg_ChartType.src
new file mode 100644
index 000000000000..57e1f281a613
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType.src
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_ChartType.hrc"
+#include "dlg_CreationWizard.hrc"
+#include "HelpIds.hrc"
+#include "SchSlotIds.hxx"
+
+// for BUTTONS_OK_CANCEL_HELP_STACKED
+#include "CommonResources.hrc"
+
+#define CHART_TYPE_DLG_HEIGHT (CHART_WIZARD_PAGEHEIGHT+18)
+#define CHART_TYPE_DLG_WIDTH (CHART_WIZARD_PAGEWIDTH - 7)
+
+ModalDialog DLG_DIAGRAM_TYPE
+{
+ HelpID = HID_DIAGRAM_TYPE ;
+
+ Size = MAP_APPFONT ( CHART_TYPE_DLG_WIDTH , CHART_TYPE_DLG_HEIGHT ) ;
+
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , CHART_TYPE_DLG_HEIGHT-24 ) ;
+ Size = MAP_APPFONT ( CHART_TYPE_DLG_WIDTH , 8 ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP( CHART_TYPE_DLG_WIDTH-161 ,CHART_TYPE_DLG_HEIGHT-17 , 53, 0 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
new file mode 100644
index 000000000000..aa9db2cdbbe4
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ChartType_UNO.hxx"
+#include "dlg_ChartType.hxx"
+#include "servicenames.hxx"
+#include <osl/mutex.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+uno::Reference< uno::XInterface >
+ SAL_CALL ChartTypeUnoDlg::Create(const uno::Reference< uno::XComponentContext >& _xContext)
+{
+ return *(new ChartTypeUnoDlg(_xContext));
+}
+// -----------------------------------------------------------------------------
+ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference< uno::XComponentContext >& _xContext )
+ : ChartTypeUnoDlg_BASE( _xContext )
+{
+}
+// -----------------------------------------------------------------------------
+ChartTypeUnoDlg::~ChartTypeUnoDlg()
+{
+ // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
+ // so this virtual-method-call the base class does does not work, we're already dead then ...
+ if (m_pDialog)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (m_pDialog)
+ destroyDialog();
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+//-------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ChartTypeUnoDlg::getImplementationName() throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//-------------------------------------------------------------------------
+::rtl::OUString ChartTypeUnoDlg::getImplementationName_Static() throw(uno::RuntimeException)
+{
+ return CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME;
+}
+
+//-------------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL ChartTypeUnoDlg::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+
+//-------------------------------------------------------------------------
+
+uno::Sequence< rtl::OUString > ChartTypeUnoDlg::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_TYPE_DIALOG_SERVICE_NAME;
+ return aSNS;
+}
+//-------------------------------------------------------------------------
+uno::Sequence< sal_Int8 > SAL_CALL ChartTypeUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
+{
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+}
+//------------------------------------------------------------------------------
+void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
+{
+ beans::PropertyValue aProperty;
+ if (_rValue >>= aProperty)
+ {
+ if (0 == aProperty.Name.compareToAscii("ChartModel"))
+ m_xChartModel.set(aProperty.Value,uno::UNO_QUERY);
+ else
+ ChartTypeUnoDlg_BASE::implInitialize(_rValue);
+ }
+ else
+ ChartTypeUnoDlg_BASE::implInitialize(_rValue);
+}
+//------------------------------------------------------------------------------
+Dialog* ChartTypeUnoDlg::createDialog(Window* _pParent)
+{
+ return new ChartTypeDialog( _pParent, m_xChartModel, m_aContext.getUNOContext() );
+}
+//-------------------------------------------------------------------------
+//-------------------------------------------------------------------------
+uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ return createPropertySetInfo( getInfoHelper() );
+}
+
+//-------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ChartTypeUnoDlg::getInfoHelper()
+{
+ return *const_cast<ChartTypeUnoDlg*>(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ChartTypeUnoDlg::createArrayHelper( ) const
+{
+ uno::Sequence< beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
new file mode 100644
index 000000000000..e7a7a8bd43d8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_CreationWizard.hxx"
+#include "dlg_CreationWizard.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "Strings.hrc"
+#include "HelpIds.hrc"
+
+#include "tp_ChartType.hxx"
+#include "tp_RangeChooser.hxx"
+#include "tp_Wizard_TitlesAndObjects.hxx"
+#include "tp_Location.hxx"
+
+#include "tp_DataSource.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DialogModel.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+//#define LOCATION_PAGE 1
+
+#define PATH_FULL 1
+#define STATE_FIRST 0
+#define STATE_CHARTTYPE STATE_FIRST
+#define STATE_SIMPLE_RANGE 1
+#define STATE_DATA_SERIES 2
+#define STATE_OBJECTS 3
+#define STATE_LOCATION 4
+
+#ifdef LOCATION_PAGE
+#define STATE_LAST STATE_LOCATION
+#else
+#define STATE_LAST STATE_OBJECTS
+#endif
+
+namespace
+{
+#ifdef LOCATION_PAGE
+ const sal_Int32 nPageCount = 5;
+#else
+ const sal_Int32 nPageCount = 4;
+#endif
+}
+
+CreationWizard::CreationWizard( Window* pParent, const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , sal_Int32 nOnePageOnlyIndex )
+ : svt::RoadmapWizard( pParent, SchResId(DLG_CHART_WIZARD)
+ , ( nOnePageOnlyIndex >= 0 && nOnePageOnlyIndex < nPageCount )
+ ? WZB_HELP | WZB_CANCEL | WZB_FINISH
+ : WZB_HELP | WZB_CANCEL | WZB_PREVIOUS | WZB_NEXT | WZB_FINISH
+ )
+ , m_xChartModel(xChartModel,uno::UNO_QUERY)
+ , m_xCC( xContext )
+ , m_bIsClosable(true)
+ , m_nOnePageOnlyIndex(nOnePageOnlyIndex)
+ , m_pTemplateProvider(0)
+ , m_nFirstState(STATE_FIRST)
+ , m_nLastState(STATE_LAST)
+ , m_aTimerTriggeredControllerLock( xChartModel )
+ , m_bCanTravel( true )
+{
+ m_apDialogModel.reset( new DialogModel( m_xChartModel, m_xCC ));
+ // Do not call FreeResource(), because there are no sub-elements defined in
+ // the dialog resource
+ ShowButtonFixedLine( TRUE );
+ defaultButton( WZB_FINISH );
+
+ if( m_nOnePageOnlyIndex < 0 || m_nOnePageOnlyIndex >= nPageCount )
+ {
+ m_nOnePageOnlyIndex = -1;
+ this->setTitleBase(String(SchResId(STR_DLG_CHART_WIZARD)));
+ }
+ else
+ this->setTitleBase(String());
+
+ declarePath( PATH_FULL
+ , STATE_CHARTTYPE
+ , STATE_SIMPLE_RANGE
+ , STATE_DATA_SERIES
+ , STATE_OBJECTS
+#ifdef LOCATION_PAGE
+ , STATE_LOCATION
+#endif
+ , WZS_INVALID_STATE
+ );
+ this->SetRoadmapHelpId( HID_SCH_WIZARD_ROADMAP );
+ this->SetRoadmapInteractive( sal_True );
+ Size aAdditionalRoadmapSize( LogicToPixel( Size( 85, 0 ), MAP_APPFONT ) );
+ Size aSize( this->GetSizePixel() );
+ aSize.Width() += aAdditionalRoadmapSize.Width();
+ this->SetSizePixel( aSize );
+
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
+ bool bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
+
+ if( bHasOwnData )
+ {
+ this->enableState( STATE_SIMPLE_RANGE, false );
+ this->enableState( STATE_DATA_SERIES, false );
+ }
+
+ // Call ActivatePage, to create and activate the first page
+ ActivatePage();
+}
+CreationWizard::~CreationWizard()
+{
+}
+
+svt::OWizardPage* CreationWizard::createPage(WizardState nState)
+{
+ svt::OWizardPage* pRet = 0;
+ if(m_nOnePageOnlyIndex!=-1 && m_nOnePageOnlyIndex!=nState)
+ return pRet;
+ bool bDoLiveUpdate = m_nOnePageOnlyIndex == -1;
+ switch( nState )
+ {
+ case STATE_CHARTTYPE:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ ChartTypeTabPage* pChartTypeTabPage = new ChartTypeTabPage(this,m_xChartModel,m_xCC,bDoLiveUpdate);
+ pRet = pChartTypeTabPage;
+ m_pTemplateProvider = pChartTypeTabPage;
+ if( m_pTemplateProvider &&
+ m_apDialogModel.get() )
+ m_apDialogModel->setTemplate( m_pTemplateProvider->getCurrentTemplate());
+ }
+ break;
+ case STATE_SIMPLE_RANGE:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new RangeChooserTabPage(this,*(m_apDialogModel.get()),m_pTemplateProvider,this);
+ }
+ break;
+ case STATE_DATA_SERIES:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new DataSourceTabPage(this,*(m_apDialogModel.get()),m_pTemplateProvider,this);
+ }
+ break;
+ case STATE_OBJECTS:
+ {
+ pRet = new TitlesAndObjectsTabPage(this,m_xChartModel,m_xCC);
+ m_aTimerTriggeredControllerLock.startTimer();
+ }
+ break;
+#ifdef LOCATION_PAGE
+ case STATE_LOCATION:
+ {
+ m_aTimerTriggeredControllerLock.startTimer();
+ pRet = new LocationTabPage(this,m_xChartModel,m_xCC);
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+ if(pRet)
+ pRet->SetText(String());//remove title of pages to not get them in the wizard title
+ return pRet;
+}
+
+sal_Bool CreationWizard::leaveState( WizardState /*_nState*/ )
+{
+ return m_bCanTravel;
+}
+
+svt::WizardTypes::WizardState CreationWizard::determineNextState( WizardState nCurrentState ) const
+{
+ if( !m_bCanTravel )
+ return WZS_INVALID_STATE;
+ if( nCurrentState == m_nLastState )
+ return WZS_INVALID_STATE;
+ svt::WizardTypes::WizardState nNextState = nCurrentState + 1;
+ while( !isStateEnabled( nNextState ) && nNextState <= m_nLastState )
+ ++nNextState;
+ return (nNextState==m_nLastState+1) ? WZS_INVALID_STATE : nNextState;
+}
+void CreationWizard::enterState(WizardState nState)
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ enableButtons( WZB_PREVIOUS, bool( nState > m_nFirstState ) );
+ enableButtons( WZB_NEXT, bool( nState < m_nLastState ) );
+ if( isStateEnabled( nState ))
+ svt::RoadmapWizard::enterState(nState);
+}
+
+bool CreationWizard::isClosable()
+{
+ //@todo
+ return m_bIsClosable;
+}
+
+void CreationWizard::setInvalidPage( TabPage * /* pTabPage */ )
+{
+ m_bCanTravel = false;
+}
+
+void CreationWizard::setValidPage( TabPage * /* pTabPage */ )
+{
+ m_bCanTravel = true;
+}
+
+String CreationWizard::getStateDisplayName( WizardState nState ) const
+{
+ USHORT nResId = 0;
+ switch( nState )
+ {
+ case STATE_CHARTTYPE:
+ nResId = STR_PAGE_CHARTTYPE;
+ break;
+ case STATE_SIMPLE_RANGE:
+ nResId = STR_PAGE_DATA_RANGE;
+ break;
+ case STATE_DATA_SERIES:
+ nResId = STR_OBJECT_DATASERIES_PLURAL;
+ break;
+ case STATE_OBJECTS:
+ nResId = STR_PAGE_CHART_ELEMENTS;
+ break;
+#ifdef LOCATION_PAGE
+ case STATE_LOCATION:
+ nResId = STR_PAGE_CHART_LOCATION;
+ break;
+#endif
+ default:
+ break;
+ }
+ return String(SchResId(nResId));
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.hrc b/chart2/source/controller/dialogs/dlg_CreationWizard.hrc
new file mode 100644
index 000000000000..48fa33484be8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define CHART_WIZARD_PAGEWIDTH 250
+#define CHART_WIZARD_PAGEHEIGHT 140
+//width 198 height 150
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.src b/chart2/source/controller/dialogs/dlg_CreationWizard.src
new file mode 100644
index 000000000000..90fe0e2993ed
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.src
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dlg_CreationWizard.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+
+ModalDialog DLG_CHART_WIZARD
+{
+ HelpID = HID_SCH_CHART_AUTO_FORMAT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT+30 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+};
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
new file mode 100644
index 000000000000..f9c25f94f7f3
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_CreationWizard_UNO.hxx"
+#include "dlg_CreationWizard.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "ContainerHelper.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+// header for define RET_CANCEL
+#include <vcl/msgbox.hxx>
+// header for class OImplementationId
+#include <cppuhelper/typeprovider.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/XDesktop.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+CreationWizardUnoDlg::CreationWizardUnoDlg( const uno::Reference< uno::XComponentContext >& xContext )
+ : OComponentHelper( m_aMutex )
+ , m_xChartModel( 0 )
+ , m_xCC( xContext )
+ , m_xParentWindow( 0 )
+ , m_pDialog( 0 )
+ , m_bUnlockControllersOnExecute(false)
+{
+ uno::Reference< frame::XDesktop > xDesktop(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ uno::Reference< frame::XTerminateListener > xListener( this );
+ xDesktop->addTerminateListener( xListener );
+ }
+}
+CreationWizardUnoDlg::~CreationWizardUnoDlg()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_pDialog )
+ {
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+APPHELPER_XSERVICEINFO_IMPL(CreationWizardUnoDlg,CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > CreationWizardUnoDlg
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_WIZARD_DIALOG_SERVICE_NAME;
+ return aSNS;
+}
+
+//-------------------------------------------------------------------------
+// XInterface
+uno::Any SAL_CALL CreationWizardUnoDlg::queryInterface( const uno::Type& aType ) throw (uno::RuntimeException)
+{
+ return OComponentHelper::queryInterface( aType );
+}
+void SAL_CALL CreationWizardUnoDlg::acquire() throw ()
+{
+ OComponentHelper::acquire();
+}
+void SAL_CALL CreationWizardUnoDlg::release() throw ()
+{
+ OComponentHelper::release();
+}
+uno::Any SAL_CALL CreationWizardUnoDlg::queryAggregation( uno::Type const & rType ) throw (uno::RuntimeException)
+{
+ if (rType == ::getCppuType( (uno::Reference< ui::dialogs::XExecutableDialog > const *)0 ))
+ {
+ void * p = static_cast< ui::dialogs::XExecutableDialog * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< lang::XServiceInfo > const *)0 ))
+ {
+ void * p = static_cast< lang::XTypeProvider * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< lang::XInitialization > const *)0 ))
+ {
+ void * p = static_cast< lang::XInitialization * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< frame::XTerminateListener > const *)0 ))
+ {
+ void * p = static_cast< frame::XTerminateListener * >( this );
+ return uno::Any( &p, rType );
+ }
+ else if (rType == ::getCppuType( (uno::Reference< beans::XPropertySet > const *)0 ))
+ {
+ void * p = static_cast< beans::XPropertySet * >( this );
+ return uno::Any( &p, rType );
+ }
+ return OComponentHelper::queryAggregation( rType );
+}
+
+//-------------------------------------------------------------------------
+#define LCL_CPPUTYPE(t) (::getCppuType( reinterpret_cast< const uno::Reference<t> *>(0)))
+
+uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes() throw(uno::RuntimeException)
+{
+ static uno::Sequence< uno::Type > aTypeList;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !aTypeList.getLength() )
+ {
+ ::std::vector< uno::Type > aTypes;
+ aTypes.push_back( LCL_CPPUTYPE( lang::XComponent ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XTypeProvider ));
+ aTypes.push_back( LCL_CPPUTYPE( uno::XAggregation ));
+ aTypes.push_back( LCL_CPPUTYPE( uno::XWeak ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XServiceInfo ));
+ aTypes.push_back( LCL_CPPUTYPE( lang::XInitialization ));
+ aTypes.push_back( LCL_CPPUTYPE( frame::XTerminateListener ));
+ aTypes.push_back( LCL_CPPUTYPE( ui::dialogs::XExecutableDialog ));
+ aTypes.push_back( LCL_CPPUTYPE( beans::XPropertySet ));
+ aTypeList = ::chart::ContainerHelper::ContainerToSequence( aTypes );
+ }
+
+ return aTypeList;
+ // \--
+}
+uno::Sequence< sal_Int8 > SAL_CALL CreationWizardUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+//-------------------------------------------------------------------------
+
+// XTerminateListener
+void SAL_CALL CreationWizardUnoDlg::queryTermination( const lang::EventObject& /*Event*/ ) throw( frame::TerminationVetoException, uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ // we will never give a veto here
+ if( m_pDialog && !m_pDialog->isClosable() )
+ {
+ m_pDialog->ToTop();
+ throw frame::TerminationVetoException();
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void SAL_CALL CreationWizardUnoDlg::notifyTermination( const lang::EventObject& /*Event*/ ) throw (uno::RuntimeException)
+{
+ // we are going down, so dispose us!
+ dispose();
+}
+
+void SAL_CALL CreationWizardUnoDlg::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
+{
+ //Listener should deregister himself and relaese all references to the closing object.
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL CreationWizardUnoDlg::setTitle( const ::rtl::OUString& /*rTitle*/ ) throw(uno::RuntimeException)
+{
+}
+//-------------------------------------------------------------------------
+void CreationWizardUnoDlg::createDialogOnDemand()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( !m_pDialog )
+ {
+ Window* pParent = NULL;
+ if( !m_xParentWindow.is() && m_xChartModel.is() )
+ {
+ uno::Reference< frame::XController > xController(
+ m_xChartModel->getCurrentController() );
+ if( xController.is() )
+ {
+ uno::Reference< frame::XFrame > xFrame(
+ xController->getFrame() );
+ if(xFrame.is())
+ m_xParentWindow = xFrame->getContainerWindow();
+ }
+ }
+ if( m_xParentWindow.is() )
+ {
+ VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
+ if (pImplementation)
+ pParent = pImplementation->GetWindow();
+ }
+ uno::Reference< XComponent > xComp( this );
+ if( m_xChartModel.is() )
+ {
+ m_pDialog = new CreationWizard( pParent, m_xChartModel, m_xCC );
+ m_pDialog->AddEventListener( LINK( this, CreationWizardUnoDlg, DialogEventHdl ) );
+ }
+ }
+}
+//-------------------------------------------------------------------------
+IMPL_LINK( CreationWizardUnoDlg, DialogEventHdl, VclWindowEvent*, pEvent )
+{
+ if(pEvent && (pEvent->GetId() == VCLEVENT_OBJECT_DYING) )
+ m_pDialog = 0;//avoid duplicate destruction of m_pDialog
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+sal_Int16 SAL_CALL CreationWizardUnoDlg::execute( ) throw(uno::RuntimeException)
+{
+ sal_Int16 nRet = RET_CANCEL;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( !m_pDialog )
+ return nRet;
+ TimerTriggeredControllerLock aTimerTriggeredControllerLock( m_xChartModel );
+ if( m_bUnlockControllersOnExecute && m_xChartModel.is() )
+ m_xChartModel->unlockControllers();
+ nRet = m_pDialog->Execute();
+ }
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(uno::Exception, uno::RuntimeException)
+{
+ const uno::Any* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ beans::PropertyValue aProperty;
+ if(*pArguments >>= aProperty)
+ {
+ if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xParentWindow;
+ }
+ else if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ChartModel" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xChartModel;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+// ____ OComponentHelper ____
+/// Called in dispose method after the listeners were notified.
+void SAL_CALL CreationWizardUnoDlg::disposing()
+{
+ m_xChartModel.clear();
+ m_xParentWindow.clear();
+
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_pDialog )
+ {
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.frame.Desktop" ), m_xCC ), uno::UNO_QUERY );
+ if( xDesktop.is() )
+ {
+ uno::Reference< frame::XTerminateListener > xListener( this );
+ xDesktop->removeTerminateListener( xListener );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ // \--
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL CreationWizardUnoDlg::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+ return 0;
+}
+
+void SAL_CALL CreationWizardUnoDlg::setPropertyValue( const ::rtl::OUString& rPropertyName
+ , const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException
+ , lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( rPropertyName.equals(C2U("Position")) )
+ {
+ awt::Point aPos;
+ if( ! (rValue >>= aPos) )
+ throw lang::IllegalArgumentException( C2U("Property 'Position' requires value of type awt::Point"), 0, 0 );
+
+ //set left upper outer corner relative to screen
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ m_pDialog->SetPosPixel( Point(0,0) );
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+
+ Point aNewOuterPos = Point( aPos.X - aRect.Left(), aPos.Y - aRect.Top() );
+ m_pDialog->SetPosPixel( aNewOuterPos );
+ }
+ }
+ else if( rPropertyName.equals(C2U("Size")) )
+ {
+ //read only property, do nothing
+ }
+ else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
+ {
+ if( ! (rValue >>= m_bUnlockControllersOnExecute) )
+ throw lang::IllegalArgumentException( C2U("Property 'UnlockControllers' requires value of type boolean"), 0, 0 );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to set to chart wizard"), 0 );
+}
+
+uno::Any SAL_CALL CreationWizardUnoDlg::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+ if( rPropertyName.equals(C2U("Position")) )
+ {
+ //get left upper outer corner relative to screen
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+ awt::Point aPoint(aRect.Left(),aRect.Top());
+ aRet = uno::makeAny( aPoint );
+ }
+ }
+ else if( rPropertyName.equals(C2U("Size")) )
+ {
+ //get outer size inclusive decoration
+ //pixels, screen position
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ createDialogOnDemand();
+ if( m_pDialog )
+ {
+ Rectangle aRect( m_pDialog->GetWindowExtentsRelative( 0 ) );
+ awt::Size aSize(aRect.GetWidth(),aRect.GetHeight());
+ aRet = uno::makeAny( aSize );
+ }
+ }
+ else if( rPropertyName.equals(C2U("UnlockControllersOnExecute")) )
+ {
+ aRet = uno::makeAny( m_bUnlockControllersOnExecute );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to get from chart wizard"), 0 );
+ return aRet;
+}
+
+void SAL_CALL CreationWizardUnoDlg::addPropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* xListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL CreationWizardUnoDlg::removePropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const uno::Reference< beans::XPropertyChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL CreationWizardUnoDlg::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL CreationWizardUnoDlg::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const uno::Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
new file mode 100644
index 000000000000..f1d441921a6a
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_DataEditor.hxx"
+#include "dlg_DataEditor.hrc"
+#include "Strings.hrc"
+#include "DataBrowser.hxx"
+
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "SchSlotIds.hxx"
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/taskpanelist.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/pathoptions.hxx>
+
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+
+#include <vcl/edit.hxx>
+
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+// for storing/reading the position and size of the dialog
+// #include <svtools/viewoptions.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+
+namespace chart
+{
+
+DataEditor::DataEditor(
+ Window* pParent,
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ const Reference< uno::XComponentContext > & xContext ) :
+ ModalDialog( pParent, SchResId( DLG_DIAGRAM_DATA )),
+ m_bReadOnly( false ),
+ m_apBrwData( new DataBrowser( this, SchResId( CTL_DATA ), true /* bLiveUpdate */)),
+ m_aTbxData( this, SchResId( TBX_DATA )),
+ m_xChartDoc( xChartDoc ),
+ m_xContext( xContext ),
+ m_aToolboxImageList( SchResId( IL_DIAGRAM_DATA )),
+ m_aToolboxImageListHighContrast( SchResId( IL_HC_DIAGRAM_DATA ))
+{
+ FreeResource();
+
+ // set min size to current size
+ SetMinOutputSizePixel( GetOutputSizePixel() );
+
+ ApplyImageList();
+
+ m_aTbxData.SetSizePixel( m_aTbxData.CalcWindowSizePixel() );
+ m_aTbxData.SetSelectHdl( LINK( this, DataEditor, ToolboxHdl ));
+
+ m_apBrwData->SetCursorMovedHdl( LINK( this, DataEditor, BrowserCursorMovedHdl ));
+ m_apBrwData->SetCellModifiedHdl( LINK( this, DataEditor, CellModified ));
+
+ UpdateData();
+ GrabFocus();
+ m_apBrwData->GrabFocus();
+
+ bool bReadOnly = true;
+ Reference< frame::XStorable > xStor( m_xChartDoc, uno::UNO_QUERY );
+ if( xStor.is())
+ bReadOnly = xStor->isReadonly();
+ SetReadOnly( bReadOnly );
+
+ // #101228# change buttons to flat-look if set so by user
+ SvtMiscOptions aMiscOptions;
+ const sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
+ // react on changes
+ aMiscOptions.AddListenerLink( LINK( this, DataEditor, MiscHdl ) );
+ m_aTbxData.SetOutStyle( nStyle );
+
+ // set good window width
+ Size aWinSize( GetOutputSizePixel());
+ Size aWinSizeWithBorder( GetSizePixel());
+ Point aWinPos( OutputToAbsoluteScreenPixel( GetPosPixel()));
+ sal_Int32 nMinWidth = aWinSize.getWidth();
+ sal_Int32 nMaxWidth = GetDesktopRectPixel().getWidth() -
+ (aWinSizeWithBorder.getWidth() - aWinSize.getWidth() + aWinPos.getX()) - 10; // leave some space
+ sal_Int32 nBrowserWidth = m_apBrwData->GetTotalWidth() + 12 + 16; // plus padding + 16?
+ sal_Int32 nWindowWidth = ::std::max( nMinWidth, nBrowserWidth );
+ nWindowWidth = ::std::min( nMaxWidth, nBrowserWidth );
+ aWinSize.setWidth( nWindowWidth );
+ SetOutputSizePixel( aWinSize );
+ AdaptBrowseBoxSize();
+
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+
+ // allow travelling to toolbar with F6
+ notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::AddWindow ));
+}
+
+DataEditor::~DataEditor()
+{
+ notifySystemWindow( this, & m_aTbxData, ::comphelper::mem_fun( & TaskPaneList::RemoveWindow ));
+
+ SvtMiscOptions aMiscOptions;
+ aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) );
+
+ OSL_TRACE( "DataEditor: DTOR" );
+}
+
+// react on click (or keypress) on toolbar icon
+IMPL_LINK( DataEditor, ToolboxHdl, void *, EMPTYARG )
+{
+ switch( m_aTbxData.GetCurItemId() )
+ {
+ case TBI_DATA_INSERT_ROW:
+ m_apBrwData->InsertRow();
+ break;
+ case TBI_DATA_INSERT_COL:
+ m_apBrwData->InsertColumn();
+ break;
+ case TBI_DATA_INSERT_TEXT_COL:
+ m_apBrwData->InsertTextColumn();
+ break;
+ case TBI_DATA_DELETE_ROW:
+ m_apBrwData->RemoveRow();
+ break;
+ case TBI_DATA_DELETE_COL:
+ m_apBrwData->RemoveColumn();
+ break;
+ case TBI_DATA_SWAP_COL :
+ m_apBrwData->SwapColumn ();
+ break;
+ case TBI_DATA_SWAP_ROW :
+ m_apBrwData->SwapRow ();
+ break;
+ }
+
+ return 0;
+}
+
+// refresh toolbar icons according to currently selected cell in brwose box
+IMPL_LINK( DataEditor, BrowserCursorMovedHdl, void *, EMPTYARG )
+{
+ if( m_bReadOnly )
+ return 0;
+
+ bool bIsDataValid = m_apBrwData->IsEnableItem();
+
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, bIsDataValid && m_apBrwData->MayInsertRow() );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, bIsDataValid && m_apBrwData->MayInsertColumn() );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, bIsDataValid && m_apBrwData->MayInsertColumn() );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, m_apBrwData->MayDeleteRow() );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, m_apBrwData->MayDeleteColumn() );
+
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, bIsDataValid && m_apBrwData->MaySwapColumns() );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, bIsDataValid && m_apBrwData->MaySwapRows() );
+
+ return 0;
+}
+
+// disable all modifying controls
+void DataEditor::SetReadOnly( bool bReadOnly )
+{
+ m_bReadOnly = bReadOnly;
+ if( m_bReadOnly )
+ {
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, FALSE );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, FALSE );
+ }
+
+ m_apBrwData->SetReadOnly( m_bReadOnly );
+}
+
+IMPL_LINK( DataEditor, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ sal_Int16 nStyle( aMiscOptions.GetToolboxStyle() );
+
+ m_aTbxData.SetOutStyle( nStyle );
+
+ return 0L;
+}
+
+IMPL_LINK( DataEditor, CellModified, void*, EMPTYARG )
+{
+ return 0;
+}
+
+// IMPL_LINK( DataEditor, BrowserColumnResized, void*, EMPTYARG )
+// {
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+// return 0;
+// }
+
+// IMPL_LINK( DataEditor, BrowserContentScrolled, void*, EMPTYARG )
+// {
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+// return 0;
+// }
+
+void DataEditor::UpdateData()
+{
+ m_apBrwData->SetDataFromModel( m_xChartDoc, m_xContext );
+}
+
+// react on the change of the underlying document by displaying the new data
+// void DataEditor::SFX_NOTIFY(
+// SfxBroadcaster& rBC,
+// const TypeId& rBCType,
+// const SfxHint& rHint,
+// const TypeId& rHintType )
+// {
+// if( rHint.Type() == TYPE(SfxSimpleHint) )
+// {
+// // note: if dynamic_cast works this should be changed
+// switch( static_cast< const SfxSimpleHint & >( rHint ).GetId())
+// {
+// case SFX_HINT_DOCCHANGED:
+// UpdateData();
+// break;
+
+// case SFX_HINT_DYING:
+// break;
+// }
+// }
+// }
+
+// {
+// BOOL bRet = TRUE;
+
+// // confirm changes currently made and not saved
+// m_apBrwData->EndEditing();
+
+// if( m_apBrwData->IsDirty() )
+// {
+// QueryBox aSafetyQuery( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+// String( SchResId( STR_DIAGRAM_DATA_SAFETY_QUERY )));
+// long nQueryResult = aSafetyQuery.Execute();
+
+// bRet = ( nQueryResult != RET_CANCEL );
+
+// if( nQueryResult == RET_YES )
+// {
+// // save changes
+// ApplyChangesToModel();
+// }
+// }
+
+// if( bRet )
+// {
+// // close child window
+// SfxBoolItem aItem( SID_DIAGRAM_DATA, FALSE );
+// if( m_pBindings )
+// {
+// SfxDispatcher* pDisp = m_pBindings->GetDispatcher();
+// if( pDisp )
+// pDisp->Execute( SID_DIAGRAM_DATA, SFX_CALLMODE_ASYNCHRON, &aItem, 0L);
+// else
+// DBG_ERROR( "Couldn't dispatch command" );
+// }
+// }
+
+// return ( bRet? SfxFloatingWindow::Close(): FALSE );
+// }
+
+void DataEditor::AdaptBrowseBoxSize()
+{
+ Size aSize( PixelToLogic( GetResizeOutputSizePixel(), MAP_APPFONT ));
+ Size aDataSize;
+
+ aDataSize.setWidth( aSize.getWidth() - 12 );
+ aDataSize.setHeight( aSize.getHeight() - 31 -24 );
+
+ m_apBrwData->SetSizePixel( LogicToPixel( aDataSize, MAP_APPFONT ));
+}
+
+void DataEditor::Resize()
+{
+ Dialog::Resize();
+ AdaptBrowseBoxSize();
+// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
+}
+
+BOOL DataEditor::Close()
+{
+ if( ApplyChangesToModel() )
+ return ModalDialog::Close();
+ else
+ return TRUE;
+}
+
+bool DataEditor::ApplyChangesToModel()
+{
+ return m_apBrwData->EndEditing();
+}
+
+// sets the correct toolbar icons depending on the current mode (e.g. high contrast)
+void DataEditor::ApplyImageList()
+{
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ ImageList& rImgLst = bIsHighContrast
+ ? m_aToolboxImageListHighContrast
+ : m_aToolboxImageList;
+
+ m_aTbxData.SetImageList( rImgLst );
+}
+
+// add/remove a window (the toolbar) to/from the global list, so that F6
+// travels/no longer travels over this window. _rMemFunc may be
+// TaskPaneList::AddWindow or TaskPaneList::RemoveWindow
+void DataEditor::notifySystemWindow(
+ Window* pWindow, Window* pToRegister,
+ ::comphelper::mem_fun1_t< TaskPaneList, Window* > rMemFunc )
+{
+ OSL_ENSURE( pWindow, "Window must not be null!" );
+ if( !pWindow )
+ return;
+ Window* pParent = pWindow->GetParent();
+ while( pParent && ! pParent->IsSystemWindow() )
+ {
+ pParent = pParent->GetParent();
+ }
+ if ( pParent && pParent->IsSystemWindow())
+ {
+ SystemWindow* pSystemWindow = static_cast< SystemWindow* >( pParent );
+ rMemFunc( pSystemWindow->GetTaskPaneList(),( pToRegister ));
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.hrc b/chart2/source/controller/dialogs/dlg_DataEditor.hrc
new file mode 100644
index 000000000000..d2675c5bb29e
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define DLG_DIAGRAM_DATA 744
+
+#define FT_POS 1
+#define TBX_EDIT 1
+#define EDT_FIELD 1
+#define TBX_DATA 2
+#define CTL_DATA 1
+
+// images for toolbox image list
+//the numbers correspond to the icon names: default_images\chart2\res\dataeditor_icon_xy
+#define TBI_DATA_INSERT_ROW 1
+#define TBI_DATA_INSERT_COL 2
+#define TBI_DATA_DELETE_ROW 3
+#define TBI_DATA_DELETE_COL 4
+#define TBI_DATA_SWAP_COL 5
+#define TBI_DATA_SWAP_ROW 6
+#define TBI_DATA_INSERT_TEXT_COL 7
+
+// image lists (normal and high-contrast) for toolbox
+#define IL_DIAGRAM_DATA 1
+#define IL_HC_DIAGRAM_DATA 2
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.src b/chart2/source/controller/dialogs/dlg_DataEditor.src
new file mode 100644
index 000000000000..02ccc98b7a82
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.src
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_DataEditor.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+
+// Mask Color for standard images
+#define IMAGE_BUTTON_STD_MASK_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+// Mask Color for high-contrast images
+#define IMAGE_BUTTON_HC_MASK_COLOR IMAGE_BUTTON_STD_MASK_COLOR
+
+#define ADDITIONAL_SPACE_ABOVE_TABLE 17
+
+ModalDialog DLG_DIAGRAM_DATA
+{
+ HelpID = HID_DIAGRAM_DATA ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 244 , 152 ) ;
+
+ Text [ en-US ] = "Data Table";
+
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = TRUE ;
+ Control CTL_DATA
+ {
+ HelpID = HID_SCH_CTL_DATA ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 + ADDITIONAL_SPACE_ABOVE_TABLE ) ;
+ Size = MAP_APPFONT ( 232 , 121 - ADDITIONAL_SPACE_ABOVE_TABLE ) ;
+ TabStop = TRUE ;
+ };
+ ToolBox TBX_DATA
+ {
+ HelpID = HID_SCH_TBX_DATA ;
+ SVLook = TRUE ;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 4 , 2 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_INSERT_ROW ;
+ Identifier = TBI_DATA_INSERT_ROW ;
+ Text [ en-US ] = "Insert Row" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_INSERT_COL ;
+ Identifier = TBI_DATA_INSERT_COL ;
+ Text [ en-US ] = "Insert Series" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_INSERT_TEXT_COL ;
+ Identifier = TBI_DATA_INSERT_TEXT_COL ;
+ Text [ en-US ] = "Insert Text Column" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_DELETE_ROW ;
+ Identifier = TBI_DATA_DELETE_ROW ;
+ Text [ en-US ] = "Delete Row" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_DELETE_COL ;
+ Identifier = TBI_DATA_DELETE_COL ;
+ Text [ en-US ] = "Delete Series" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_SWAP_COL ;
+ Identifier = TBI_DATA_SWAP_COL ;
+ Text [ en-US ] = "Move Series Right" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_SCH_TBI_DATA_SWAP_ROW ;
+ Identifier = TBI_DATA_SWAP_ROW ;
+ Text [ en-US ] = "Move Row Down" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ };
+ };
+
+#define IMAGE_ID_LIST \
+ IdList = \
+ { \
+ TBI_DATA_INSERT_ROW; \
+ TBI_DATA_INSERT_COL; \
+ TBI_DATA_INSERT_TEXT_COL; \
+ TBI_DATA_DELETE_ROW; \
+ TBI_DATA_DELETE_COL; \
+ TBI_DATA_SWAP_COL; \
+ TBI_DATA_SWAP_ROW; \
+ }; \
+ IdCount = { 7; }
+
+ ImageList IL_DIAGRAM_DATA
+ {
+ Prefix = "dataeditor_icon";
+ MaskColor = IMAGE_BUTTON_STD_MASK_COLOR;
+ IMAGE_ID_LIST;
+ };
+
+ ImageList IL_HC_DIAGRAM_DATA
+ {
+ Prefix = "dataeditor_icon_h";
+ MaskColor = IMAGE_BUTTON_HC_MASK_COLOR;
+ IMAGE_ID_LIST;
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
new file mode 100644
index 000000000000..9469293ae1c5
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_DataSource.hxx"
+#include "dlg_DataSource.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DiagramHelper.hxx"
+#include "DialogModel.hxx"
+#include "HelpIds.hrc"
+
+#include "tp_RangeChooser.hxx"
+#include "tp_DataSource.hxx"
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// --------------------------------------------------------------------------------
+
+
+namespace chart
+{
+
+// ----------------------------------------
+
+class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider
+{
+public:
+ DocumentChartTypeTemplateProvider(
+ const Reference< chart2::XChartDocument > & xDoc );
+ virtual ~DocumentChartTypeTemplateProvider();
+
+ // ____ ChartTypeTemplateProvider ____
+ virtual Reference< chart2::XChartTypeTemplate > getCurrentTemplate() const;
+
+private:
+ Reference< chart2::XChartTypeTemplate > m_xTemplate;
+};
+
+DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider(
+ const Reference< chart2::XChartDocument > & xDoc )
+{
+ if( xDoc.is())
+ {
+ Reference< chart2::XDiagram > xDia( xDoc->getFirstDiagram());
+ if( xDia.is())
+ {
+ DiagramHelper::tTemplateWithServiceName aResult(
+ DiagramHelper::getTemplateForDiagram(
+ xDia,
+ Reference< lang::XMultiServiceFactory >(
+ xDoc->getChartTypeManager(), uno::UNO_QUERY ) ));
+ m_xTemplate.set( aResult.first );
+ }
+ }
+}
+
+DocumentChartTypeTemplateProvider::~DocumentChartTypeTemplateProvider()
+{}
+
+Reference< chart2::XChartTypeTemplate > DocumentChartTypeTemplateProvider::getCurrentTemplate() const
+{
+ return m_xTemplate;
+}
+
+// ----------------------------------------
+
+class DataSourceTabControl : public TabControl
+{
+public:
+ DataSourceTabControl( Window* pParent, const ResId& rResId );
+ ~DataSourceTabControl();
+
+ virtual long DeactivatePage();
+
+ void DisableTabToggling();
+ void EnableTabToggling();
+
+private:
+ bool m_bTogglingEnabled;
+};
+
+DataSourceTabControl::DataSourceTabControl( Window* pParent, const ResId& rResId ) :
+ TabControl( pParent, rResId ),
+ m_bTogglingEnabled( true )
+{}
+
+DataSourceTabControl::~DataSourceTabControl()
+{}
+
+// Note that the result is long, but is intended to be a bool
+long DataSourceTabControl::DeactivatePage()
+{
+ bool bCanDeactivate( TabControl::DeactivatePage() != 0 );
+
+ bCanDeactivate = (bCanDeactivate && m_bTogglingEnabled);
+
+ return (bCanDeactivate ? 1 : 0 );
+}
+
+void DataSourceTabControl::DisableTabToggling()
+{
+ m_bTogglingEnabled = false;
+}
+
+void DataSourceTabControl::EnableTabToggling()
+{
+ m_bTogglingEnabled = true;
+}
+
+// ----------------------------------------
+
+// static
+USHORT DataSourceDialog::m_nLastPageId = 0;
+
+DataSourceDialog::DataSourceDialog(
+ Window * pParent,
+ const Reference< XChartDocument > & xChartDocument,
+ const Reference< uno::XComponentContext > & xContext ) :
+
+ TabDialog( pParent, SchResId( DLG_DATA_SOURCE )),
+
+ m_xChartDocument( xChartDocument ),
+ m_xContext( xContext ),
+ m_apDocTemplateProvider( new DocumentChartTypeTemplateProvider( xChartDocument )),
+ m_apDialogModel( new DialogModel( xChartDocument, xContext )),
+
+ m_pTabControl( new DataSourceTabControl( this, SchResId( TABCTRL ) )),
+ m_aBtnOK( this, SchResId( BTN_OK ) ),
+ m_aBtnCancel( this, SchResId( BTN_CANCEL ) ),
+ m_aBtnHelp( this, SchResId( BTN_HELP ) ),
+
+ m_pRangeChooserTabePage(0),
+ m_pDataSourceTabPage(0),
+ m_bRangeChooserTabIsValid( true ),
+ m_bDataSourceTabIsValid( true )
+{
+ FreeResource();
+
+ //don't create the tabpages before FreeResource, otherwise the help ids are not matched correctly
+ m_pRangeChooserTabePage = new RangeChooserTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
+ m_pDataSourceTabPage = new DataSourceTabPage( m_pTabControl, *(m_apDialogModel.get()),
+ m_apDocTemplateProvider.get(), this, true /* bHideDescription */ );
+
+ m_pTabControl->InsertPage( TP_RANGECHOOSER, String( SchResId( STR_PAGE_DATA_RANGE )));
+ m_pTabControl->InsertPage( TP_DATA_SOURCE, String( SchResId( STR_OBJECT_DATASERIES_PLURAL )));
+
+ m_pTabControl->SetTabPage( TP_RANGECHOOSER, m_pRangeChooserTabePage );
+ m_pTabControl->SetTabPage( TP_DATA_SOURCE, m_pDataSourceTabPage );
+
+ m_pTabControl->SelectTabPage( m_nLastPageId );
+
+ SetHelpId( HID_SCH_DLG_RANGES );
+}
+
+DataSourceDialog::~DataSourceDialog()
+{
+ delete m_pRangeChooserTabePage;
+ delete m_pDataSourceTabPage;
+
+ m_nLastPageId = m_pTabControl->GetCurPageId();
+ delete m_pTabControl;
+}
+
+short DataSourceDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pRangeChooserTabePage )
+ m_pRangeChooserTabePage->commitPage();
+ if( m_pDataSourceTabPage )
+ m_pDataSourceTabPage->commitPage();
+ }
+ return nResult;
+}
+
+void DataSourceDialog::setInvalidPage( TabPage * pTabPage )
+{
+ if( pTabPage == m_pRangeChooserTabePage )
+ m_bRangeChooserTabIsValid = false;
+ else if( pTabPage == m_pDataSourceTabPage )
+ m_bDataSourceTabIsValid = false;
+
+ if( ! (m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid ))
+ {
+ m_aBtnOK.Enable( FALSE );
+ OSL_ASSERT( m_pTabControl );
+ // note: there seems to be no suitable mechanism to address pages by
+ // identifier, at least it is unclear what the page identifiers are.
+ // @todo: change the fixed numbers to identifiers
+ if( m_bRangeChooserTabIsValid )
+ m_pTabControl->SetCurPageId( m_pTabControl->GetPageId( 1 ));
+ else if( m_bDataSourceTabIsValid )
+ m_pTabControl->SetCurPageId( m_pTabControl->GetPageId( 0 ));
+ m_pTabControl->DisableTabToggling();
+ }
+}
+
+void DataSourceDialog::setValidPage( TabPage * pTabPage )
+{
+ if( pTabPage == m_pRangeChooserTabePage )
+ m_bRangeChooserTabIsValid = true;
+ else if( pTabPage == m_pDataSourceTabPage )
+ m_bDataSourceTabIsValid = true;
+
+ if( m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid )
+ {
+ m_aBtnOK.Enable( TRUE );
+ OSL_ASSERT( m_pTabControl );
+ m_pTabControl->EnableTabToggling();
+ }
+}
+
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.hrc b/chart2/source/controller/dialogs/dlg_DataSource.hrc
new file mode 100644
index 000000000000..b8c5ff96bb33
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define TABCTRL 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.src b/chart2/source/controller/dialogs/dlg_DataSource.src
new file mode 100644
index 000000000000..08427a4e271b
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.src
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dlg_DataSource.hrc"
+#include "HelpIds.hrc"
+
+// for BUTTONS_OK_CANCEL_HELP_STACKED
+#include "CommonResources.hrc"
+
+TabDialog DLG_DATA_SOURCE
+{
+ HelpID = HID_SCH_DLG_RANGES ;
+
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Data Ranges" ;
+ TabControl TABCTRL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ };
+ BUTTONS_OK_CANCEL_HELP_STACKED( 200 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
new file mode 100644
index 000000000000..0a250b5bf874
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertAxis_Grid.hxx"
+#include "dlg_InsertAxis_Grid.hrc"
+
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "NoWarningThisInCTOR.hxx"
+#include "ObjectNameProvider.hxx"
+
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
+ : aPossibilityList(6)
+ , aExistenceList(6)
+{
+ sal_Int32 nN = 0;
+ for(nN=6;nN--;)
+ aPossibilityList[nN]=true;
+ for(nN=6;nN--;)
+ aExistenceList[nN]=false;
+}
+
+//==============================
+//
+// SchAxisDlg
+//
+//==============================
+
+SchAxisDlg::SchAxisDlg( Window* pWindow
+ , const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg )
+ :
+ ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )),
+
+ aFlPrimary( this, SchResId( FL_PRIMARY_AXIS )),
+ aFlPrimaryGrid( this, SchResId( FL_PRIMARY_GRID )),
+ aCbPrimaryX( this, SchResId( CB_X_PRIMARY )),
+ aCbPrimaryY( this, SchResId( CB_Y_PRIMARY )),
+ aCbPrimaryZ( this, SchResId( CB_Z_PRIMARY )),
+
+ aFlSecondary( this, SchResId( FL_SECONDARY_AXIS )),
+ aFlSecondaryGrid( this, SchResId( FL_SECONDARY_GRID )),
+ aCbSecondaryX( this, SchResId( CB_X_SECONDARY )),
+ aCbSecondaryY( this, SchResId( CB_Y_SECONDARY )),
+ aCbSecondaryZ( this, SchResId( CB_Z_SECONDARY )),
+
+ aPbOK( this, SchResId( BTN_OK )),
+ aPbCancel( this, SchResId( BTN_CANCEL )),
+ aPbHelp( this, SchResId( BTN_HELP ))
+
+ //rOutAttrs( rInAttrs )
+{
+ FreeResource();
+ if(!bAxisDlg)
+ {
+ SetHelpId( HID_INSERT_GRIDS );
+ SetText( ObjectNameProvider::getName(OBJECTTYPE_GRID,true) );
+
+ aCbPrimaryX.SetHelpId( HID_SCH_CB_XGRID );
+ aCbPrimaryY.SetHelpId( HID_SCH_CB_YGRID );
+ aCbPrimaryZ.SetHelpId( HID_SCH_CB_ZGRID );
+ aCbSecondaryX.SetHelpId( HID_SCH_CB_SECONDARY_XGRID );
+ aCbSecondaryY.SetHelpId( HID_SCH_CB_SECONDARY_YGRID );
+ aCbSecondaryZ.SetHelpId( HID_SCH_CB_SECONDARY_ZGRID );
+
+ aFlPrimary.Hide();
+ aFlSecondary.Hide();
+ aFlPrimaryGrid.Show();
+ aFlSecondaryGrid.Show();
+ }
+ else
+ {
+ SetText( ObjectNameProvider::getName(OBJECTTYPE_AXIS,true) );
+
+ //todo: remove if secondary z axis are possible somewhere
+ {
+ aCbSecondaryZ.Hide();
+
+ Size aSize( GetSizePixel() );
+ //aSize.Height() -= aCbSecondaryZ.GetSizePixel().Height();
+ aSize.Height() -= ( aCbSecondaryZ.GetPosPixel().Y() - aCbSecondaryY.GetPosPixel().Y() );
+ SetSizePixel(aSize);
+ }
+ }
+
+ aCbPrimaryX.Check( rInput.aExistenceList[0] );
+ aCbPrimaryY.Check( rInput.aExistenceList[1] );
+ aCbPrimaryZ.Check( rInput.aExistenceList[2] );
+ aCbSecondaryX.Check( rInput.aExistenceList[3] );
+ aCbSecondaryY.Check( rInput.aExistenceList[4] );
+ aCbSecondaryZ.Check( rInput.aExistenceList[5] );
+
+ aCbPrimaryX.Enable( rInput.aPossibilityList[0] );
+ aCbPrimaryY.Enable( rInput.aPossibilityList[1] );
+ aCbPrimaryZ.Enable( rInput.aPossibilityList[2] );
+ aCbSecondaryX.Enable( rInput.aPossibilityList[3] );
+ aCbSecondaryY.Enable( rInput.aPossibilityList[4] );
+ aCbSecondaryZ.Enable( rInput.aPossibilityList[5] );
+}
+
+SchAxisDlg::~SchAxisDlg()
+{
+}
+
+void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
+{
+ rOutput.aExistenceList[0]=aCbPrimaryX.IsChecked();
+ rOutput.aExistenceList[1]=aCbPrimaryY.IsChecked();
+ rOutput.aExistenceList[2]=aCbPrimaryZ.IsChecked();
+ rOutput.aExistenceList[3]=aCbSecondaryX.IsChecked();
+ rOutput.aExistenceList[4]=aCbSecondaryY.IsChecked();
+ rOutput.aExistenceList[5]=aCbSecondaryZ.IsChecked();
+}
+
+SchGridDlg::SchGridDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput )
+ : SchAxisDlg( pParent, rInput, false )//rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
+{
+}
+
+SchGridDlg::~SchGridDlg()
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc
new file mode 100644
index 000000000000..d069e893116c
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FL_PRIMARY_AXIS 1
+#define FL_SECONDARY_AXIS 2
+
+#define FL_PRIMARY_GRID 3
+#define FL_SECONDARY_GRID 4
+
+#define CB_X_PRIMARY 1
+#define CB_Y_PRIMARY 2
+#define CB_Z_PRIMARY 3
+
+#define CB_X_SECONDARY 4
+#define CB_Y_SECONDARY 5
+#define CB_Z_SECONDARY 6
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src
new file mode 100644
index 000000000000..0ee3f219c12c
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertAxis_Grid.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_SecondaryAxisCheckBoxes.hrc"
+
+ModalDialog DLG_AXIS_OR_GRID
+{
+ HelpID = HID_INSERT_AXIS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ //Size = MAP_APPFONT ( 160 , 99 ) ;
+ Size = MAP_APPFONT ( 160 , 113 ) ;
+ Moveable = TRUE ;
+
+ FixedLine FL_PRIMARY_AXIS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Axes" ;
+ };
+ FixedLine FL_PRIMARY_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Major grids" ;
+ };
+ CheckBox CB_X_PRIMARY
+ {
+ HelpID = HID_SCH_CB_XAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 14 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~X axis";
+ };
+ CheckBox CB_Y_PRIMARY
+ {
+ HelpID = HID_SCH_CB_YAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 28 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Y axis";
+ };
+ CheckBox CB_Z_PRIMARY
+ {
+ HelpID = HID_SCH_CB_ZAXIS;
+
+ Pos = MAP_APPFONT ( 12 , 42 );
+ Size = MAP_APPFONT ( 80 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Z axis";
+ };
+
+ FixedLine FL_SECONDARY_AXIS
+ {
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Secondary axes" ;
+ };
+ FixedLine FL_SECONDARY_GRID
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Minor grids" ;
+ };
+ SECONDARYAXISCHECKBOXES( 12, 69, 0, 14 )
+ BUTTONS_OK_CANCEL_HELP_STACKED(104)
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
new file mode 100644
index 000000000000..2105b0bb2c87
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertDataLabel.hxx"
+#include "dlg_InsertDataLabel.hrc"
+#include "ResId.hxx"
+#include "ObjectNameProvider.hxx"
+#include "res_DataLabel.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter) :
+ ModalDialog(pWindow, SchResId(DLG_DATA_DESCR)),
+ m_aBtnOK(this, SchResId(BTN_OK)),
+ m_aBtnCancel(this, SchResId(BTN_CANCEL)),
+ m_aBtnHelp(this, SchResId(BTN_HELP)),
+ m_apDataLabelResources( new DataLabelResources(this,rInAttrs) ),
+ m_rInAttrs(rInAttrs)
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_LABELS ) );
+
+ m_apDataLabelResources->SetNumberFormatter( pFormatter );
+ Reset();
+}
+
+DataLabelsDialog::~DataLabelsDialog()
+{
+}
+
+void DataLabelsDialog::Reset()
+{
+ m_apDataLabelResources->Reset(m_rInAttrs);
+}
+
+void DataLabelsDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apDataLabelResources->FillItemSet(rOutAttrs);
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc b/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc
new file mode 100644
index 000000000000..92f67309d6fc
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
new file mode 100644
index 000000000000..24ae2f63fce1
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertDataLabel.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+#include "res_DataLabel.hrc"
+
+ModalDialog DLG_DATA_DESCR
+{
+ HelpID = HID_INSERT_DESCRIPTION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 316 , 185 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED(260)
+ RESOURCE_DATALABEL( 6, 7 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
new file mode 100644
index 000000000000..9c4438b6f1ca
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertErrorBars.hxx"
+#include "dlg_InsertErrorBars.hrc"
+#include "res_ErrorBar.hxx"
+#include "ResourceIds.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ChartModelHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
+
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertErrorBarsDialog::InsertErrorBarsDialog(
+ Window* pParent, const SfxItemSet& rMyAttrs,
+ const uno::Reference< chart2::XChartDocument > & xChartDocument,
+ ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) :
+ ModalDialog( pParent, SchResId( DLG_DATA_YERRORBAR )),
+ rInAttrs( rMyAttrs ),
+ aBtnOK( this, SchResId( BTN_OK )),
+ aBtnCancel( this, SchResId( BTN_CANCEL )),
+ aBtnHelp( this, SchResId( BTN_HELP )),
+ m_apErrorBarResources( new ErrorBarResources(
+ this, this, rInAttrs,
+ /* bNoneAvailable = */ true, eType ))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) );
+
+ m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
+}
+
+InsertErrorBarsDialog::~InsertErrorBarsDialog()
+{
+}
+
+void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apErrorBarResources->FillItemSet(rOutAttrs);
+}
+
+void InsertErrorBarsDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ModalDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_apErrorBarResources->FillValueSets();
+}
+
+void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
+}
+
+//static
+double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
+ const Reference< frame::XModel >& xChartModel,
+ const Reference< uno::XInterface >& xChartView,
+ const OUString& rSelectedObjectCID )
+{
+ double fStepWidth = 0.001;
+
+ ExplicitValueProvider* pExplicitValueProvider( ExplicitValueProvider::getExplicitValueProvider(xChartView) );
+ if( pExplicitValueProvider )
+ {
+ Reference< XAxis > xAxis;
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
+ xAxis = DiagramHelper::getAttachedAxis( xSeries, xDiagram );
+ if(!xAxis.is())
+ xAxis = AxisHelper::getAxis( 1/*nDimensionIndex*/, true/*bMainAxis*/, xDiagram );
+ if(xAxis.is())
+ {
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement );
+
+ fStepWidth = aExplicitIncrement.Distance;
+ if( aExplicitIncrement.SubIncrements.getLength() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
+ fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
+ else
+ fStepWidth/=10;
+ }
+ }
+
+ return fStepWidth;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc b/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc
new file mode 100644
index 000000000000..2adeccb29d80
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.src b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src
new file mode 100644
index 000000000000..462c81211011
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertErrorBars.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_ErrorBar.hrc"
+
+ModalDialog DLG_DATA_YERRORBAR
+{
+ HelpID = "chart2:ModalDialog:DLG_DATA_YERRORBAR";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 300 , 156 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( 244 )
+ RESOURCE_ERRORBARS( 244 - 6, 14 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
new file mode 100644
index 000000000000..e722ede09c5a
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertLegend.hxx"
+#include "dlg_InsertLegend.hrc"
+#include "res_LegendPosition.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for enum SvxChartLegendPos
+#include <svx/chrtitem.hxx>
+// header for class SfxItemPool
+#include <svl/itempool.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+SchLegendDlg::SchLegendDlg(Window* pWindow, const uno::Reference< uno::XComponentContext>& xCC )
+ : ModalDialog(pWindow, SchResId(DLG_LEGEND))
+ , m_apLegendPositionResources( new LegendPositionResources(this,xCC) )
+ , aBtnOK(this, SchResId(BTN_OK))
+ , aBtnCancel(this, SchResId(BTN_CANCEL))
+ , aBtnHelp(this, SchResId(BTN_HELP))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName(OBJECTTYPE_LEGEND) );
+}
+
+SchLegendDlg::~SchLegendDlg()
+{
+}
+
+void SchLegendDlg::init( const uno::Reference< frame::XModel >& xChartModel )
+{
+ m_apLegendPositionResources->writeToResources( xChartModel );
+}
+
+bool SchLegendDlg::writeToModel( const uno::Reference< frame::XModel >& xChartModel ) const
+{
+ m_apLegendPositionResources->writeToModel( xChartModel );
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.hrc b/chart2/source/controller/dialogs/dlg_InsertLegend.hrc
new file mode 100644
index 000000000000..2adeccb29d80
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.src b/chart2/source/controller/dialogs/dlg_InsertLegend.src
new file mode 100644
index 000000000000..1f768f7c065b
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertLegend.src
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertLegend.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+#include "res_LegendPosition.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+ModalDialog DLG_LEGEND
+{
+ HelpID = HID_INSERT_CHART_LEGEND ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 156 , 80 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( 101 )
+ RESOURCE_LEGENDDISPLAY( 6, 6 )
+ RESOURCE_LEGENDPOSITION( 15, 6 + RSC_CD_FIXEDTEXT_HEIGHT +6 )
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.cxx b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
new file mode 100644
index 000000000000..bd98774c57a8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "dlg_InsertTitle.hxx"
+#include "dlg_InsertTitle.hrc"
+#include "res_Titles.hxx"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "ObjectNameProvider.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchTitleDlg::SchTitleDlg(Window* pWindow, const TitleDialogData& rInput )
+ : ModalDialog(pWindow, SchResId(DLG_TITLE))
+ , m_apTitleResources( new TitleResources(this,true) )
+ , aBtnOK(this, SchResId(BTN_OK))
+ , aBtnCancel(this, SchResId(BTN_CANCEL))
+ , aBtnHelp(this, SchResId(BTN_HELP))
+{
+ FreeResource();
+
+ this->SetText( ObjectNameProvider::getName(OBJECTTYPE_TITLE,true) );
+ m_apTitleResources->writeToResources( rInput );
+}
+
+SchTitleDlg::~SchTitleDlg()
+{
+}
+
+void SchTitleDlg::getResult( TitleDialogData& rOutput )
+{
+ m_apTitleResources->readFromResources( rOutput );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.hrc b/chart2/source/controller/dialogs/dlg_InsertTitle.hrc
new file mode 100644
index 000000000000..fc46db129b5b
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.src b/chart2/source/controller/dialogs/dlg_InsertTitle.src
new file mode 100644
index 000000000000..446763e93b9e
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTitle.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertTitle.hrc"
+#include "res_Titlesx.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+
+ModalDialog DLG_TITLE
+{
+ HelpID = HID_INSERT_TITLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 156 ) ;
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED(164)
+ TITLES(6,6,152,6,10)
+};
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
new file mode 100644
index 000000000000..58b29b4bdfe3
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertTrendline.hxx"
+#include "dlg_InsertTrendline.hrc"
+#include "res_Trendline.hxx"
+#include "ResourceIds.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ChartModelHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+#include <svtools/controldims.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+namespace
+{
+void lcl_SetControlXPos( Control & rControl, long nPosPixel )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setX( nPosPixel );
+ rControl.SetPosPixel( aPos );
+}
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs ) :
+ ModalDialog( pParent, SchResId( DLG_DATA_TRENDLINE )),
+ rInAttrs( rMyAttrs ),
+ aBtnOK( this, SchResId( BTN_OK )),
+ aBtnCancel( this, SchResId( BTN_CANCEL )),
+ aBtnHelp( this, SchResId( BTN_HELP )),
+ m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
+{
+ FreeResource();
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
+}
+
+InsertTrendlineDialog::~InsertTrendlineDialog()
+{
+}
+
+void InsertTrendlineDialog::adjustSize()
+{
+ long nControlsRightEdge = m_apTrendlineResources->adjustControlSizes();
+ long nButtonXPos = nControlsRightEdge +
+ LogicToPixel( Size( RSC_SP_CTRL_X, 10 ), MapMode( MAP_APPFONT )).getWidth();
+ lcl_SetControlXPos( aBtnOK, nButtonXPos );
+ lcl_SetControlXPos( aBtnCancel, nButtonXPos );
+ lcl_SetControlXPos( aBtnHelp, nButtonXPos );
+
+ Size aDialogSize( GetSizePixel());
+ aDialogSize.setWidth(
+ nControlsRightEdge +
+ LogicToPixel( Size( RSC_SP_CTRL_X + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT, 0 ),
+ MapMode( MAP_APPFONT )).getWidth());
+ SetSizePixel( aDialogSize );
+}
+
+void InsertTrendlineDialog::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apTrendlineResources->FillItemSet(rOutAttrs);
+}
+
+void InsertTrendlineDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ModalDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_apTrendlineResources->FillValueSets();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc b/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc
new file mode 100644
index 000000000000..2adeccb29d80
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.src b/chart2/source/controller/dialogs/dlg_InsertTrendline.src
new file mode 100644
index 000000000000..e7abd803fd87
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.src
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_InsertTrendline.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+#include "CommonResources.hrc"
+#include "res_Trendline.hrc"
+
+// is only an initial size, will be calculated to contain all controls
+#define DLG_DATA_TRENDLINE_RES_WIDTH 130
+#define DLG_DATA_TRENDLINE_ADD_TO_RES 62
+
+ModalDialog DLG_DATA_TRENDLINE
+{
+ HelpID = HID_INSERT_STATISTICS ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT( DLG_DATA_TRENDLINE_RES_WIDTH + DLG_DATA_TRENDLINE_ADD_TO_RES, 172 );
+ Moveable = TRUE ;
+ BUTTONS_OK_CANCEL_HELP_STACKED( DLG_DATA_TRENDLINE_RES_WIDTH + DLG_DATA_TRENDLINE_ADD_TO_RES )
+ RESOURCE_TRENDLINE( DLG_DATA_TRENDLINE_RES_WIDTH, 22 )
+};
+
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
new file mode 100644
index 000000000000..bf0dedfbc6e8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_NumberFormat.hxx"
+
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+
+// header for class SvxNumberInfoItem
+#define ITEMID_NUMBERINFO SID_ATTR_NUMBERFORMAT_INFO
+#include <svx/numinf.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/tabdlg.hxx>
+
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+NumberFormatDialog::NumberFormatDialog(Window* pParent, SfxItemSet& rSet)
+ : SfxSingleTabDialog( pParent, rSet, 0 )
+{
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
+ if ( fnCreatePage )
+ {
+ SfxTabPage* pTabPage = (*fnCreatePage)( this, rSet );
+ pTabPage->PageCreated(rSet);
+ SetTabPage(pTabPage);
+ }
+}
+
+NumberFormatDialog::~NumberFormatDialog()
+{
+}
+
+//static
+SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
+{
+ static const USHORT nWhichPairs[] =
+ {
+ 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 );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
new file mode 100644
index 000000000000..96cfb23c1f95
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DLG_NUMBERFORMAT_HXX
+#define CHART2_DLG_NUMBERFORMAT_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+class Window;
+class SfxItemSet;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class NumberFormatDialog : public SfxSingleTabDialog
+{
+public:
+ NumberFormatDialog(Window* pParent, SfxItemSet& rSet);
+ ~NumberFormatDialog();
+
+ static SfxItemSet CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
new file mode 100644
index 000000000000..2a41d35313e8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -0,0 +1,652 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#ifndef _ZFORLIST_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zforlist.hxx>
+#endif
+
+#include "dlg_ObjectProperties.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "TabPages.hrc"
+#include "tp_AxisLabel.hxx"
+#include "tp_DataLabel.hxx"
+#include "tp_LegendPosition.hxx"
+#include "tp_PointGeometry.hxx"
+#include "tp_Scale.hxx"
+#include "tp_AxisPositions.hxx"
+#include "tp_ErrorBars.hxx"
+#include "tp_Trendline.hxx"
+#include "tp_SeriesToAxis.hxx"
+#include "tp_TitleRotation.hxx"
+#include "tp_PolarOptions.hxx"
+#include "ResId.hxx"
+#include "ViewElementListProvider.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include "DiagramHelper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <svl/intitem.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <svx/svxids.hrc>
+
+#include <svx/drawitem.hxx>
+#include <svx/ofaitem.hxx>
+#include <svx/svxgrahicitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <editeng/flstitem.hxx>
+#include <svx/tabline.hxx>
+
+#include <svx/flagsdef.hxx>
+#include <svx/numinf.hxx>
+
+#include <svl/cjkoptions.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
+ : m_aObjectCID( rObjectCID )
+ , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
+ , m_bAffectsMultipleObjects(false)
+ , m_aLocalizedName()
+ , m_bHasGeometryProperties(false)
+ , m_bHasStatisticProperties(false)
+ , m_bProvidesSecondaryYAxis(false)
+ , m_bProvidesOverlapAndGapWidth(false)
+ , m_bProvidesBarConnectors(false)
+ , m_bHasAreaProperties(false)
+ , m_bHasSymbolProperties(false)
+ , m_bHasNumberProperties(false)
+ , m_bProvidesStartingAngle(false)
+ , m_bProvidesMissingValueTreatments(false)
+ , m_bHasScaleProperties(false)
+ , m_bCanAxisLabelsBeStaggered(false)
+ , m_bSupportingAxisPositioning(false)
+ , m_bShowAxisOrigin(false)
+ , m_bIsCrossingAxisIsCategoryAxis(false)
+ , m_aCategories()
+ , m_xChartDocument( 0 )
+{
+ rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
+ m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
+}
+ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
+{
+}
+ObjectType ObjectPropertiesDialogParameter::getObjectType() const
+{
+ return m_eObjectType;
+}
+rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
+{
+ return m_aLocalizedName;
+}
+
+void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& 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 );
+
+ bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
+ bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
+
+ if( bHasSeriesProperties || bHasDataPointproperties )
+ {
+ m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
+ m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
+ m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
+
+ if( bHasSeriesProperties )
+ {
+ m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
+ m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
+ m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
+ m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
+ m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
+
+ m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
+ .getLength() ? true : false;
+ }
+ }
+
+ if( OBJECTTYPE_DATA_ERRORS == m_eObjectType )
+ m_bHasStatisticProperties = true;
+
+ if( OBJECTTYPE_AXIS == m_eObjectType )
+ {
+ //show scale properties only for a single axis not for multiselection
+ m_bHasScaleProperties = !m_bAffectsMultipleObjects;
+
+ if( m_bHasScaleProperties )
+ {
+ uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
+ if( xAxis.is() )
+ {
+ //no scale page for series axis
+ ScaleData aData( xAxis->getScaleData() );
+ if( chart2::AxisType::SERIES == aData.AxisType )
+ m_bHasScaleProperties = false;
+ if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType )
+ m_bHasNumberProperties = true;
+
+ sal_Int32 nCooSysIndex=0;
+ sal_Int32 nDimensionIndex=0;
+ sal_Int32 nAxisIndex=0;
+ if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
+ {
+ xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
+ //show positioning controls only if they make sense
+ m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
+
+ //show axis origin only for secondary y axis
+ if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
+ m_bShowAxisOrigin = true;
+ }
+
+ //is the crossin main axis a category axes?:
+ uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
+ uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
+ if( xCrossingMainAxis.is() )
+ {
+ ScaleData aScale( xCrossingMainAxis->getScaleData() );
+ m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
+ if( m_bIsCrossingAxisIsCategoryAxis )
+ m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
+ }
+ }
+ }
+
+ //no staggering of labels for 3D axis
+ m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
+ }
+
+ //create gui name for this object
+ {
+ if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
+ {
+ m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
+ }
+ else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
+ {
+ m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
+ }
+ else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
+ {
+ m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
+ }
+ else
+ {
+ switch( m_eObjectType )
+ {
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ if( m_bAffectsMultipleObjects )
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
+ else
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
+ break;
+ default:
+ m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
+ break;
+ }
+ }
+ }
+}
+
+bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
+{
+ return m_bHasGeometryProperties;
+}
+bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
+{
+ return m_bHasStatisticProperties;
+}
+bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
+{
+ return m_bProvidesSecondaryYAxis;
+}
+bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
+{
+ return m_bProvidesOverlapAndGapWidth;
+}
+bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
+{
+ return m_bProvidesBarConnectors;
+}
+bool ObjectPropertiesDialogParameter::HasAreaProperties() const
+{
+ return m_bHasAreaProperties;
+}
+bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
+{
+ return m_bHasSymbolProperties;
+}
+bool ObjectPropertiesDialogParameter::HasScaleProperties() const
+{
+ return m_bHasScaleProperties;
+}
+bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
+{
+ return m_bCanAxisLabelsBeStaggered;
+}
+bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
+{
+ return m_bShowAxisOrigin;
+}
+bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
+{
+ return m_bSupportingAxisPositioning;
+}
+bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
+{
+ return m_bIsCrossingAxisIsCategoryAxis;
+}
+const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
+{
+ return m_aCategories;
+}
+bool ObjectPropertiesDialogParameter::HasNumberProperties() const
+{
+ return m_bHasNumberProperties;
+}
+bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
+{
+ return m_bProvidesStartingAngle;
+}
+bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
+{
+ return m_bProvidesMissingValueTreatments;
+}
+uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
+{
+ return m_xChartDocument;
+}
+
+//const USHORT nNoArrowDlg = 1100;
+const USHORT nNoArrowNoShadowDlg = 1101;
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
+ Graphic* pAutoSymbolGraphic )
+{
+ m_pSymbolShapeProperties = pSymbolShapeProperties;
+ m_pAutoSymbolGraphic = pAutoSymbolGraphic;
+}
+
+void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
+}
+
+SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
+ const SfxItemSet* pAttr,
+ const ObjectPropertiesDialogParameter* pDialogParameter,
+ const ViewElementListProvider* pViewElementListProvider,
+ const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ )
+ : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
+ , eObjectType(pDialogParameter->getObjectType())
+ , nDlgType(nNoArrowNoShadowDlg)
+ , nPageType(0)
+ , m_pParameter( pDialogParameter )
+ , m_pViewElementListProvider( pViewElementListProvider )
+ , m_pNumberFormatter(0)
+ , m_pSymbolShapeProperties(NULL)
+ , m_pAutoSymbolGraphic(NULL)
+ , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
+ , m_bOKPressed(false)
+{
+ FreeResource();
+
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
+
+ this->SetText( pDialogParameter->getLocalizedName() );
+
+ SvtCJKOptions aCJKOptions;
+
+ switch (eObjectType)
+ {
+ case OBJECTTYPE_TITLE:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+
+ case OBJECTTYPE_LEGEND:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_POINT:
+ if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
+ AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
+ if( m_pParameter->ProvidesStartingAngle())
+ AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
+
+ if( m_pParameter->HasGeometryProperties() )
+ AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
+
+ if(m_pParameter->HasAreaProperties())
+ {
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ }
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
+ break;
+
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+
+ break;
+
+ case OBJECTTYPE_AXIS:
+ {
+ if( m_pParameter->HasScaleProperties() )
+ AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
+
+ if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
+ AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
+ if( m_pParameter->HasNumberProperties() )
+ AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
+ break;
+ }
+
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_DATA_CURVE:
+ AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
+ break;
+
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ case OBJECTTYPE_PAGE:
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_DIAGRAM:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ break;
+
+ case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ case OBJECTTYPE_UNKNOWN:
+ // nothing
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
+ AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
+ AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
+ AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
+ AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
+ if( SvtLanguageOptions().IsCTLFontEnabled() )
+ /* When rotation is supported for equation text boxes, use
+ SchAlignmentTabPage::Create here. The special
+ SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
+ AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
+ break;
+ default:
+ break;
+ }
+
+ // used to find out if user left the dialog with OK. When OK is pressed but
+ // no changes were done, Cancel is returned by the SfxTabDialog. See method
+ // DialogWasClosedWithOK.
+ m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
+ GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
+}
+
+SchAttribTabDlg::~SchAttribTabDlg()
+{
+ delete m_pSymbolShapeProperties;
+ delete m_pAutoSymbolGraphic;
+}
+
+void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch (nId)
+ {
+ case TP_LAYOUT:
+ break;
+ case RID_SVXPAGE_LINE:
+ aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
+ aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
+ aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+
+ 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(SID_GRAPHIC,*m_pAutoSymbolGraphic));
+ }
+ rPage.PageCreated(aSet);
+ //rPage.ActivatePage(*GetInputSetImpl()); //what for?
+ break;
+
+ case RID_SVXPAGE_AREA:
+ aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
+ aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
+ aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
+ aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
+ aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ //rPage.ActivatePage(*GetInputSetImpl()); //what for?
+ break;
+
+ case RID_SVXPAGE_TRANSPARENCE:
+ aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
+ aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
+ rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_NAME:
+
+ //CHINA001 ((SvxCharNamePage&)rPage).
+ //CHINA001 SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
+ aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
+ rPage.PageCreated(aSet); //CHINA001
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
+ rPage.PageCreated(aSet);
+ break;
+
+ case TP_AXIS_LABEL:
+ {
+ bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
+ ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
+ break;
+ }
+
+ case TP_ALIGNMENT:
+ break;
+
+
+ case TP_AXIS_POSITIONS:
+ {
+ AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
+ if(pPage)
+ {
+ pPage->SetNumFormatter( m_pNumberFormatter );
+ if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
+ {
+ pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
+ pPage->SetCategories( m_pParameter->GetCategories() );
+ }
+ pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
+ }
+ }
+ break;
+
+ case TP_SCALE:
+ {
+ ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
+ if(pScaleTabPage)
+ {
+ pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
+ pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
+ }
+ }
+ break;
+
+ case TP_DATA_DESCR:
+ {
+ DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
+ if( pLabelPage )
+ pLabelPage->SetNumberFormatter( m_pNumberFormatter );
+ }
+ break;
+
+ case RID_SVXPAGE_NUMBERFORMAT:
+ aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+ rPage.PageCreated(aSet);
+ break;
+
+ case TP_YERRORBAR:
+ {
+ ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
+ OSL_ASSERT( pTabPage );
+ if( pTabPage )
+ {
+ pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
+ pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
+ pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
+ }
+ break;
+ }
+ case TP_OPTIONS:
+ {
+ SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
+ if( pTabPage && m_pParameter )
+ pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
+ m_pParameter->ProvidesBarConnectors() );
+ break;
+ }
+ }
+}
+
+IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
+{
+ m_bOKPressed = true;
+ return m_aOriginalOKClickHdl.Call( this );
+}
+
+bool SchAttribTabDlg::DialogWasClosedWithOK() const
+{
+ return m_bOKPressed;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.src b/chart2/source/controller/dialogs/dlg_ObjectProperties.src
new file mode 100644
index 000000000000..9eae934ce6df
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.src
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+TabDialog DLG_OBJECT_PROPERTIES
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
new file mode 100644
index 000000000000..280a1adecba2
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ShapeFont.hxx"
+#include "ViewElementListProvider.hxx"
+#include "ResId.hxx"
+#include "ResourceIds.hrc"
+
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+#include <editeng/flstitem.hxx>
+
+using ::com::sun::star::uno::Reference;
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ShapeFontDialog::ShapeFontDialog( Window* pParent, const SfxItemSet* pAttr,
+ const ViewElementListProvider* pViewElementListProvider )
+ :SfxTabDialog( pParent, SchResId( DLG_SHAPE_FONT ), pAttr )
+ ,m_pViewElementListProvider( pViewElementListProvider )
+{
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME );
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS );
+ AddTabPage( RID_SVXPAGE_CHAR_POSITION );
+}
+
+ShapeFontDialog::~ShapeFontDialog()
+{
+}
+
+void ShapeFontDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+{
+ SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
+ switch ( nId )
+ {
+ case RID_SVXPAGE_CHAR_NAME:
+ {
+ aSet.Put( SvxFontListItem( m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST ) );
+ rPage.PageCreated( aSet );
+ }
+ break;
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ {
+ aSet.Put( SfxUInt16Item( SID_DISABLE_CTL, DISABLE_CASEMAP ) );
+ rPage.PageCreated( aSet );
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.src b/chart2/source/controller/dialogs/dlg_ShapeFont.src
new file mode 100644
index 000000000000..2065bd940988
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ShapeFont.src
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include <svx/dialogs.hrc>
+
+TabDialog DLG_SHAPE_FONT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Character" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME ;
+ Text [ en-US ] = "Font";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS ;
+ Text [ en-US ] = "Font Effects";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_POSITION ;
+ Text [ en-US ] = "Font Position";
+ };
+ };
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
new file mode 100644
index 000000000000..2f0173fc8408
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_ShapeParagraph.hxx"
+#include "ResId.hxx"
+#include "ResourceIds.hrc"
+
+#include <svl/cjkoptions.hxx>
+#include <svl/intitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+
+using ::com::sun::star::uno::Reference;
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ShapeParagraphDialog::ShapeParagraphDialog( Window* pParent, const SfxItemSet* pAttr )
+ :SfxTabDialog( pParent, SchResId( DLG_SHAPE_PARAGRAPH ), pAttr )
+{
+ FreeResource();
+
+ SvtCJKOptions aCJKOptions;
+
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
+ if ( aCJKOptions.IsAsianTypographyEnabled() )
+ {
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN );
+ }
+ else
+ {
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+ }
+ AddTabPage( RID_SVXPAGE_TABULATOR );
+}
+
+ShapeParagraphDialog::~ShapeParagraphDialog()
+{
+}
+
+void ShapeParagraphDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+{
+ SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
+ switch ( nId )
+ {
+ case RID_SVXPAGE_TABULATOR:
+ {
+ aSet.Put( SfxUInt16Item( SID_SVXTABULATORTABPAGE_CONTROLFLAGS,
+ ( TABTYPE_ALL &~TABTYPE_LEFT ) | ( TABFILL_ALL &~TABFILL_NONE ) ) );
+ rPage.PageCreated( aSet );
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.src b/chart2/source/controller/dialogs/dlg_ShapeParagraph.src
new file mode 100644
index 000000000000..ff74fc1eef80
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.src
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include <svx/dialogs.hrc>
+
+TabDialog DLG_SHAPE_PARAGRAPH
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 289 , 176 ) ;
+ Text [ en-US ] = "Paragraph" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( 260 , 135 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH ;
+ Text [ en-US ] = "Indents & Spacing";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ;
+ Text [ en-US ] = "Alignment";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN ;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TABULATOR ;
+ Text [ en-US ] = "Tab";
+ };
+ };
+ };
+};
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
new file mode 100644
index 000000000000..26a726ac5156
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_View3D.hxx"
+#include "dlg_View3D.hrc"
+#include "Strings.hrc"
+#include "TabPages.hrc"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "tp_3D_SceneGeometry.hxx"
+#include "tp_3D_SceneAppearance.hxx"
+#include "tp_3D_SceneIllumination.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+// static
+USHORT View3DDialog::m_nLastPageId = 0;
+
+View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
+ : TabDialog(pParent,SchResId(DLG_3D_VIEW))
+ , m_aTabControl(this,SchResId(TABCTRL))
+ , m_aBtnOK(this,SchResId(BTN_OK))
+ , m_aBtnCancel(this,SchResId(BTN_CANCEL))
+ , m_aBtnHelp(this,SchResId(BTN_HELP))
+ , m_pGeometry(0)
+ , m_pAppearance(0)
+ , m_pIllumination(0)
+ , m_aControllerLocker(xChartModel)
+{
+ FreeResource();
+
+ uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+ m_pGeometry = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
+ m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
+ m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
+
+ m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
+ m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
+ m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
+
+ m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
+ m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
+ m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
+
+ m_aTabControl.SelectTabPage( m_nLastPageId );
+}
+
+View3DDialog::~View3DDialog()
+{
+ delete m_pGeometry;
+ delete m_pAppearance;
+ delete m_pIllumination;
+
+ m_nLastPageId = m_aTabControl.GetCurPageId();
+}
+
+short View3DDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pGeometry )
+ m_pGeometry->commitPendingChanges();
+ if( m_pAppearance )
+ m_pAppearance->commitPendingChanges();
+ if( m_pIllumination )
+ m_pIllumination->commitPendingChanges();
+ }
+ return nResult;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/dlg_View3D.hrc b/chart2/source/controller/dialogs/dlg_View3D.hrc
new file mode 100644
index 000000000000..59564a97b8b8
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+//position and size defines:
+#define VIEW3D_PAGE_WIDTH 160
+#define VIEW3D_PAGE_HEIGHT 110
+
+//resource ids:
+
+#define TABCTRL 1
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_HELP 3
diff --git a/chart2/source/controller/dialogs/dlg_View3D.src b/chart2/source/controller/dialogs/dlg_View3D.src
new file mode 100644
index 000000000000..7be2dd60b324
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+#include "CommonResources.hrc"
+#include "HelpIds.hrc"
+
+TabDialog DLG_3D_VIEW
+{
+ HelpID = HID_3D_VIEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT+40 ) ;
+ Text [ en-US ] = "3D View" ;
+ TabControl TABCTRL
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+ };
+ BUTTONS_OK_CANCEL_HELP_STACKED(VIEW3D_PAGE_HEIGHT+3)
+};
+
diff --git a/chart2/source/controller/dialogs/hidother.src b/chart2/source/controller/dialogs/hidother.src
new file mode 100644
index 000000000000..195115e93bd1
--- /dev/null
+++ b/chart2/source/controller/dialogs/hidother.src
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+
+hidspecial HID_SCH_CB_XAXIS {HelpId= HID_SCH_CB_XAXIS; };
+hidspecial HID_SCH_CB_YAXIS {HelpId= HID_SCH_CB_YAXIS; };
+hidspecial HID_SCH_CB_ZAXIS {HelpId= HID_SCH_CB_ZAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_XAXIS {HelpId= HID_SCH_CB_SECONDARY_XAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_YAXIS {HelpId= HID_SCH_CB_SECONDARY_YAXIS; };
+hidspecial HID_SCH_CB_SECONDARY_ZAXIS {HelpId= HID_SCH_CB_SECONDARY_ZAXIS; };
+
+hidspecial HID_SCH_CB_XGRID {HelpId= HID_SCH_CB_XGRID; };
+hidspecial HID_SCH_CB_YGRID {HelpId= HID_SCH_CB_YGRID; };
+hidspecial HID_SCH_CB_ZGRID {HelpId= HID_SCH_CB_ZGRID; };
+hidspecial HID_SCH_CB_SECONDARY_XGRID {HelpId= HID_SCH_CB_SECONDARY_XGRID; };
+hidspecial HID_SCH_CB_SECONDARY_YGRID {HelpId= HID_SCH_CB_SECONDARY_YGRID; };
+hidspecial HID_SCH_CB_SECONDARY_ZGRID {HelpId= HID_SCH_CB_SECONDARY_ZGRID; };
+
+hidspecial HID_SCH_CT_INDICATE {HelpId= HID_SCH_CT_INDICATE; };
+
+hidspecial HID_SCH_STATISTIK_MEANVALUE {HelpId= HID_SCH_STATISTIK_MEANVALUE; };
+hidspecial HID_SCH_STATISTIK_NO_ERROR {HelpId= HID_SCH_STATISTIK_NO_ERROR; };
+hidspecial HID_SCH_STATISTIK_VARIANT {HelpId= HID_SCH_STATISTIK_VARIANT; };
+hidspecial HID_SCH_STATISTIK_SIGMA {HelpId= HID_SCH_STATISTIK_SIGMA; };
+hidspecial HID_SCH_STATISTIK_PERCENT {HelpId= HID_SCH_STATISTIK_PERCENT; };
+hidspecial HID_SCH_STATISTIK_FUNCTION {HelpId= HID_SCH_STATISTIK_FUNCTION; };
+hidspecial HID_SCH_STATISTIK_RANGE {HelpId= HID_SCH_STATISTIK_RANGE; };
+hidspecial HID_SCH_STATISTIK_FUNCTION_LB {HelpId= HID_SCH_STATISTIK_FUNCTION_LB; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_VALUE {HelpId= HID_SCH_STATISTIK_POSITIVE_VALUE; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_RANGE {HelpId= HID_SCH_STATISTIK_POSITIVE_RANGE; };
+hidspecial HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER {HelpId= HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_VALUE {HelpId= HID_SCH_STATISTIK_NEGATIVE_VALUE; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_RANGE {HelpId= HID_SCH_STATISTIK_NEGATIVE_RANGE; };
+hidspecial HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER {HelpId= HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER; };
+hidspecial HID_SCH_STATISTIK_SAME_FOR_BOTH {HelpId= HID_SCH_STATISTIK_SAME_FOR_BOTH; };
+hidspecial HID_SCH_STATISTIK_SHOW_BOTH {HelpId= HID_SCH_STATISTIK_SHOW_BOTH; };
+hidspecial HID_SCH_STATISTIK_SHOW_POSITIVE {HelpId= HID_SCH_STATISTIK_SHOW_POSITIVE; };
+hidspecial HID_SCH_STATISTIK_SHOW_NEGATIVE {HelpId= HID_SCH_STATISTIK_SHOW_NEGATIVE; };
+hidspecial HID_SCH_STATISTIK_BIGERROR {HelpId= HID_SCH_STATISTIK_BIGERROR; };
+hidspecial HID_SCH_STATISTIK_CONSTERROR {HelpId= HID_SCH_STATISTIK_CONSTERROR; };
+hidspecial HID_SCH_STATISTIK_PERCENT_VALUE {HelpId= HID_SCH_STATISTIK_PERCENT_VALUE; };
+hidspecial HID_SCH_STATISTIK_BIGERROR_VALUE {HelpId= HID_SCH_STATISTIK_BIGERROR_VALUE; };
+hidspecial HID_SCH_STATISTIK_PLUS_VALUE {HelpId= HID_SCH_STATISTIK_PLUS_VALUE; };
+hidspecial HID_SCH_STATISTIK_MINUS_VALUE {HelpId= HID_SCH_STATISTIK_MINUS_VALUE; };
+
+hidspecial HID_SCH_LEGEND_SHOW {HelpId= HID_SCH_LEGEND_SHOW; };
+hidspecial HID_SCH_LEGEND_POS_LEFT {HelpId= HID_SCH_LEGEND_POS_LEFT; };
+hidspecial HID_SCH_LEGEND_POS_TOP {HelpId= HID_SCH_LEGEND_POS_TOP; };
+hidspecial HID_SCH_LEGEND_POS_RIGHT {HelpId= HID_SCH_LEGEND_POS_RIGHT; };
+hidspecial HID_SCH_LEGEND_POS_BOTTOM {HelpId= HID_SCH_LEGEND_POS_BOTTOM; };
+
+hidspecial HID_SCH_DATALABEL_VALUE {HelpId= HID_SCH_DATALABEL_VALUE; };
+hidspecial HID_SCH_DATALABEL_NUMBER {HelpId= HID_SCH_DATALABEL_NUMBER; };
+hidspecial HID_SCH_DATALABEL_PERCENT {HelpId= HID_SCH_DATALABEL_PERCENT; };
+hidspecial HID_SCH_DATALABEL_TEXT {HelpId= HID_SCH_DATALABEL_TEXT; };
+hidspecial HID_SCH_DATALABEL_SYMBOL {HelpId= HID_SCH_DATALABEL_SYMBOL; };
+hidspecial HID_SCH_PB_NUMBERFORMAT {HelpId= HID_SCH_PB_NUMBERFORMAT; };
+hidspecial HID_SCH_PB_PERCENT_NUMBERFORMAT {HelpId= HID_SCH_PB_PERCENT_NUMBERFORMAT; };
+hidspecial HID_SCH_DATALABEL_SEPARATOR {HelpId= HID_SCH_DATALABEL_SEPARATOR; };
+hidspecial HID_SCH_DATALABEL_PLACEMENT {HelpId= HID_SCH_DATALABEL_PLACEMENT; };
+hidspecial HID_SCH_TEXTDIRECTION {HelpId= HID_SCH_TEXTDIRECTION; };
+hidspecial HID_SCH_TEXTDIRECTION_TITLE {HelpId= HID_SCH_TEXTDIRECTION_TITLE; };
+hidspecial HID_SCH_TEXTDIRECTION_EQUATION {HelpId= HID_SCH_TEXTDIRECTION_EQUATION; };
+hidspecial HID_SCH_DATALABEL_ROTATION_KNOB {HelpId= HID_SCH_DATALABEL_ROTATION_KNOB; };
+hidspecial HID_SCH_DATALABEL_ROTATION_EDIT {HelpId= HID_SCH_DATALABEL_ROTATION_EDIT; };
+
+hidspecial HID_SCH_TITLE_MAIN {HelpId= HID_SCH_TITLE_MAIN; };
+hidspecial HID_SCH_TITLE_SUB {HelpId= HID_SCH_TITLE_SUB; };
+hidspecial HID_SCH_TITLE_X {HelpId= HID_SCH_TITLE_X; };
+hidspecial HID_SCH_TITLE_Y {HelpId= HID_SCH_TITLE_Y; };
+hidspecial HID_SCH_TITLE_Z {HelpId= HID_SCH_TITLE_Z; };
+hidspecial HID_SCH_TITLE_SECONDARY_X {HelpId= HID_SCH_TITLE_SECONDARY_X; };
+hidspecial HID_SCH_TITLE_SECONDARY_Y {HelpId= HID_SCH_TITLE_SECONDARY_Y; };
+
+hidspecial HID_SCH_NUM_OF_LINES {HelpId= HID_SCH_NUM_OF_LINES; };
+
+hidspecial HID_SCH_WIZARD_ROADMAP {HelpId= HID_SCH_WIZARD_ROADMAP; };
+hidspecial HID_SCH_WIN_DOCUMENT {HelpId= HID_SCH_WIN_DOCUMENT; };
+hidspecial HID_SCH_DATA_SERIES_LABEL {HelpId= HID_SCH_DATA_SERIES_LABEL; };
+
+hidspecial HID_SCH_STARTING_ANGLE_DIAL {HelpId= HID_SCH_STARTING_ANGLE_DIAL; };
+
+hidspecial HID_SCH_TRENDLINE_RB_NONE {HelpId= HID_SCH_TRENDLINE_RB_NONE; };
+hidspecial HID_SCH_TRENDLINE_RB_LINEAR {HelpId= HID_SCH_TRENDLINE_RB_LINEAR; };
+hidspecial HID_SCH_TRENDLINE_RB_LOGARITHMIC {HelpId= HID_SCH_TRENDLINE_RB_LOGARITHMIC; };
+hidspecial HID_SCH_TRENDLINE_RB_EXPONENTIAL {HelpId= HID_SCH_TRENDLINE_RB_EXPONENTIAL; };
+hidspecial HID_SCH_TRENDLINE_RB_POWER {HelpId= HID_SCH_TRENDLINE_RB_POWER; };
+hidspecial HID_SCH_TRENDLINE_SHOW_EQUATION {HelpId= HID_SCH_TRENDLINE_SHOW_EQUATION; };
+hidspecial HID_SCH_TRENDLINE_SHOW_R_SQUARED {HelpId= HID_SCH_TRENDLINE_SHOW_R_SQUARED; };
diff --git a/chart2/source/controller/dialogs/makefile.mk b/chart2/source/controller/dialogs/makefile.mk
new file mode 100644
index 000000000000..d22f5c83b081
--- /dev/null
+++ b/chart2/source/controller/dialogs/makefile.mk
@@ -0,0 +1,205 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcdialogs
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+GEN_HID_OTHER=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# i26518 the gcc-3.0.4 requires to enhance the template-depth
+# this seems to be a compiler issue, so we recommend not to use 3.0.x anymore
+.IF "$(COM)"=="GCC"
+ CFLAGS+=-ftemplate-depth-128
+.ENDIF
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= \
+ $(SLO)$/ObjectNameProvider.obj \
+ $(SLO)$/TimerTriggeredControllerLock.obj \
+ $(SLO)$/ChangingResource.obj \
+ $(SLO)$/DataBrowser.obj \
+ $(SLO)$/DataBrowserModel.obj \
+ $(SLO)$/DialogModel.obj \
+ $(SLO)$/TitleDialogData.obj \
+ $(SLO)$/res_Titles.obj \
+ $(SLO)$/res_TextSeparator.obj \
+ $(SLO)$/res_ErrorBar.obj \
+ $(SLO)$/res_Trendline.obj \
+ $(SLO)$/res_BarGeometry.obj \
+ $(SLO)$/res_LegendPosition.obj \
+ $(SLO)$/res_DataLabel.obj \
+ $(SLO)$/ChartTypeDialogController.obj \
+ $(SLO)$/tp_ChartType.obj \
+ $(SLO)$/tp_RangeChooser.obj \
+ $(SLO)$/tp_Wizard_TitlesAndObjects.obj \
+ $(SLO)$/tp_Location.obj \
+ $(SLO)$/tp_AxisLabel.obj \
+ $(SLO)$/tp_AxisPositions.obj \
+ $(SLO)$/tp_DataLabel.obj \
+ $(SLO)$/tp_DataSource.obj \
+ $(SLO)$/tp_DataSourceControls.obj \
+ $(SLO)$/tp_LegendPosition.obj \
+ $(SLO)$/tp_PointGeometry.obj \
+ $(SLO)$/tp_Scale.obj \
+ $(SLO)$/tp_Trendline.obj \
+ $(SLO)$/tp_ErrorBars.obj \
+ $(SLO)$/tp_SeriesToAxis.obj \
+ $(SLO)$/tp_TitleRotation.obj \
+ $(SLO)$/tp_3D_SceneGeometry.obj \
+ $(SLO)$/tp_3D_SceneAppearance.obj \
+ $(SLO)$/tp_3D_SceneIllumination.obj \
+ $(SLO)$/tp_PolarOptions.obj \
+ $(SLO)$/dlg_ObjectProperties.obj \
+ $(SLO)$/dlg_DataEditor.obj \
+ $(SLO)$/dlg_DataSource.obj \
+ $(SLO)$/dlg_View3D.obj \
+ $(SLO)$/dlg_InsertAxis_Grid.obj \
+ $(SLO)$/dlg_InsertDataLabel.obj \
+ $(SLO)$/dlg_InsertLegend.obj \
+ $(SLO)$/dlg_InsertTrendline.obj \
+ $(SLO)$/dlg_InsertErrorBars.obj \
+ $(SLO)$/dlg_InsertTitle.obj \
+ $(SLO)$/dlg_CreationWizard.obj \
+ $(SLO)$/dlg_CreationWizard_UNO.obj \
+ $(SLO)$/dlg_ChartType_UNO.obj \
+ $(SLO)$/dlg_ChartType.obj \
+ $(SLO)$/dlg_NumberFormat.obj \
+ $(SLO)$/dlg_ShapeFont.obj \
+ $(SLO)$/dlg_ShapeParagraph.obj \
+ $(SLO)$/RangeSelectionButton.obj \
+ $(SLO)$/RangeSelectionHelper.obj \
+ $(SLO)$/RangeSelectionListener.obj \
+ $(SLO)$/RangeEdit.obj \
+ $(SLO)$/TextDirectionListBox.obj
+
+# --- Resources ---------------------------------------------------------------
+
+# Bitmaps.src
+# Bitmaps_HC.src
+
+
+SRC1FILES= \
+ res_TextSeparator.src \
+ res_BarGeometry.src \
+ tp_ChartType.src \
+ tp_RangeChooser.src \
+ tp_Wizard_TitlesAndObjects.src \
+ tp_Location.src \
+ tp_AxisLabel.src \
+ tp_AxisPositions.src \
+ tp_DataLabel.src \
+ tp_DataSource.src \
+ tp_LegendPosition.src \
+ tp_PointGeometry.src \
+ tp_Scale.src \
+ tp_Trendline.src \
+ tp_ErrorBars.src \
+ tp_SeriesToAxis.src \
+ tp_TitleRotation.src \
+ tp_3D_SceneGeometry.src \
+ tp_3D_SceneAppearance.src \
+ tp_3D_SceneIllumination.src \
+ tp_PolarOptions.src \
+ dlg_ObjectProperties.src \
+ Strings_Statistic.src \
+ Strings_Scale.src \
+ Strings_ChartTypes.src \
+ Strings_AdditionalControls.src \
+ Strings.src \
+ Bitmaps.src \
+ Bitmaps_HC.src \
+ dlg_DataEditor.src \
+ dlg_DataSource.src \
+ dlg_View3D.src \
+ dlg_InsertAxis_Grid.src \
+ dlg_InsertDataLabel.src \
+ dlg_InsertLegend.src \
+ dlg_InsertTrendline.src \
+ dlg_InsertErrorBars.src \
+ dlg_InsertTitle.src \
+ dlg_ChartType.src \
+ dlg_CreationWizard.src \
+ dlg_ShapeFont.src \
+ dlg_ShapeParagraph.src
+
+SRS1NAME=$(TARGET)
+
+# --- Targets -----------------------------------------------------------------
+LOCALIZE_ME=res_DataLabel_tmpl.hrc res_LegendPosition_tmpl.hrc res_Trendline_tmpl.hrc res_ErrorBar_tmpl.hrc res_Titlesx_tmpl.hrc res_SecondaryAxisCheckBoxes_tmpl.hrc
+.INCLUDE: target.mk
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_DataLabel.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_LegendPosition.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_Trendline.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_ErrorBar.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_Titlesx.hrc
+$(SRS)$/chcdialogs.srs: $(INCCOM)$/res_SecondaryAxisCheckBoxes.hrc
+
+#dependencies:
+
+$(SRS)$/chcdialogs.srs: \
+ Bitmaps.hrc \
+ Bitmaps_HC.hrc \
+ CommonResources.hrc \
+ ResourceIds.hrc \
+ ..$/..$/inc$/Strings.hrc \
+ TabPages.hrc \
+ dlg_CreationWizard.hrc \
+ dlg_DataSource.hrc \
+ dlg_InsertAxis_Grid.hrc \
+ dlg_InsertDataLabel.hrc \
+ dlg_InsertLegend.hrc \
+ dlg_InsertTrendline.hrc \
+ dlg_InsertErrorBars.hrc \
+ dlg_InsertTitle.hrc \
+ dlg_View3D.hrc \
+ res_Titles.hrc \
+ tp_3D_SceneAppearance.hrc \
+ tp_3D_SceneGeometry.hrc \
+ tp_3D_SceneIllumination.hrc \
+ tp_PolarOptions.hrc \
+ tp_ChartType.hrc \
+ tp_DataSource.hrc \
+ tp_Location.hrc \
+ tp_RangeChooser.hrc \
+ tp_Wizard_TitlesAndObjects.hrc
+
+# res_DataLabel.hrc \
+# res_LegendPosition.hrc \
+# res_Statistic.hrc \
+
+#$(SRS)$/chcdialogs.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx
new file mode 100644
index 000000000000..f2c31fe461a9
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_BarGeometry.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+BarGeometryResources::BarGeometryResources( Window* pWindow )
+ : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
+ , m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
+{
+ m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
+ m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
+}
+void BarGeometryResources::SetPosPixel( const Point& rPosition )
+{
+ Window* pWindow( m_aFT_Geometry.GetParent() );
+
+ Size aDistanceSize( 2,2 );
+ if( pWindow )
+ aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
+
+ m_aFT_Geometry.SetPosPixel( rPosition );
+ m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
+}
+Size BarGeometryResources::GetSizePixel() const
+{
+ long nHeight = m_aLB_Geometry.GetPosPixel().Y()
+ - m_aFT_Geometry.GetPosPixel().Y();
+ nHeight += m_aLB_Geometry.GetSizePixel().Height();
+
+ long nWidth = m_aLB_Geometry.GetSizePixel().Width();
+ if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
+ nWidth = m_aFT_Geometry.GetSizePixel().Width();
+
+ return Size( nHeight, nWidth );
+}
+BarGeometryResources::~BarGeometryResources()
+{
+}
+
+void BarGeometryResources::SetSelectHdl( const Link& rLink )
+{
+ m_aLB_Geometry.SetSelectHdl( rLink );
+}
+
+void BarGeometryResources::Show( bool bShow )
+{
+ m_aFT_Geometry.Show( bShow );
+ m_aLB_Geometry.Show( bShow );
+}
+void BarGeometryResources::Enable( bool bEnable )
+{
+ m_aFT_Geometry.Enable( bEnable );
+ m_aLB_Geometry.Enable( bEnable );
+}
+
+USHORT BarGeometryResources::GetSelectEntryCount() const
+{
+ return m_aLB_Geometry.GetSelectEntryCount();
+}
+USHORT BarGeometryResources::GetSelectEntryPos() const
+{
+ return m_aLB_Geometry.GetSelectEntryPos();
+}
+void BarGeometryResources::SelectEntryPos( USHORT nPos )
+{
+ if( nPos < m_aLB_Geometry.GetEntryCount() )
+ m_aLB_Geometry.SelectEntryPos( nPos );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx
new file mode 100644
index 000000000000..db2f71e2f178
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_BARGEOMETRY_HXX
+#define _CHART2_RES_BARGEOMETRY_HXX
+
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BarGeometryResources
+{
+public:
+ BarGeometryResources( Window* pParent );
+ virtual ~BarGeometryResources();
+
+ void SetPosPixel( const Point& rPosition );
+ Size GetSizePixel() const;
+
+ void Show( bool bShow );
+ void Enable( bool bEnable );
+
+ USHORT GetSelectEntryCount() const;
+ USHORT GetSelectEntryPos() const;
+ void SelectEntryPos( USHORT nPos );
+
+ void SetSelectHdl( const Link& rLink );
+
+private:
+ FixedText m_aFT_Geometry;
+ ListBox m_aLB_Geometry;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.src b/chart2/source/controller/dialogs/res_BarGeometry.src
new file mode 100644
index 000000000000..ea481070132d
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_BarGeometry.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "HelpIds.hrc"
+
+ListBox LB_BAR_GEOMETRY
+{
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 89 , 38 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=FALSE;
+ DDExtraWidth = TRUE ;
+ HelpID = HID_SCH_LB_BAR_GEOMETRY;
+
+ StringList [ en-US ] =
+ {
+ "Box" ;
+ "Cylinder" ;
+ "Cone" ;
+ "Pyramid" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
new file mode 100644
index 000000000000..25d279eaad37
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_DataLabel.hxx"
+#include "res_DataLabel_IDs.hrc"
+
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "dlg_NumberFormat.hxx"
+
+// header for class SvxNumberInfoItem
+#include <svx/numinf.hxx>
+#include <svl/eitem.hxx>
+// for SfxUInt32Item
+#include <svl/intitem.hxx>
+// header for class SfxStringItem
+#include <svl/stritem.hxx>
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+#include <svx/svxids.hrc>
+// header for SvNumberFormatter
+#include <svl/zforlist.hxx>
+#include <svtools/controldims.hrc>
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+
+bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich, USHORT nSourceFormatWhich, ULONG& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
+{
+ bool bSet = false;
+ const SfxPoolItem *pItem1 = NULL;
+ if( rSet.GetItemState( nValueWhich, TRUE, &pItem1 ) == SFX_ITEM_SET )
+ {
+ const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
+ if( pNumItem )
+ {
+ rnFormatKeyOut = pNumItem->GetValue();
+ bSet = true;
+ }
+ }
+
+ rbSourceFormatMixedStateOut=true;
+ const SfxPoolItem *pItem2 = NULL;
+ if( rSet.GetItemState( nSourceFormatWhich, TRUE, &pItem2 ) == SFX_ITEM_SET )
+ {
+ const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
+ if( pBoolItem )
+ {
+ rbSourceFormatOut = pBoolItem->GetValue();
+ rbSourceFormatMixedStateOut=false;
+ }
+ }
+ return bSet;
+}
+
+void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, CheckBox& rCheckbox )
+{
+ rCheckbox.EnableTriState( FALSE );
+
+ const SfxPoolItem *pPoolItem = NULL;
+ if( rInAttrs.GetItemState(nWhichId, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
+ else
+ {
+ rCheckbox.EnableTriState( TRUE );
+ rCheckbox.SetState( STATE_DONTKNOW );
+ }
+}
+
+}//end anonymous namespace
+
+DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
+ : m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
+ m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
+ m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
+ m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)),
+ m_aCBCategory(pWindow, SchResId(CB_CATEGORY)),
+ m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)),
+ m_aSeparatorResources(pWindow),
+ m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
+ m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
+ m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
+ m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
+ m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
+ m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
+ m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
+ m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
+ m_pNumberFormatter(0),
+ m_bNumberFormatMixedState(true),
+ m_bPercentFormatMixedState(true),
+ m_nNumberFormatForValue(0),
+ m_nNumberFormatForPercent(11),
+ m_bSourceFormatMixedState(true),
+ m_bPercentSourceMixedState(true),
+ m_bSourceFormatForValue(true),
+ m_bSourceFormatForPercent(true),
+ m_pWindow(pWindow),
+ m_pPool(rInAttrs.GetPool())
+{
+ //fill label placement list
+ std::map< sal_Int32, XubString > aPlacementToStringMap;
+ for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
+ aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<USHORT>(nEnum));
+
+ ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
+ const SfxPoolItem *pPoolItem = NULL;
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
+
+ m_aLB_LabelPlacement.Clear();
+ for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
+ {
+ USHORT nListBoxPos = static_cast<USHORT>( nN );
+ sal_Int32 nPlacement = aAvailabelPlacementList[nN];
+ m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
+ m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
+ m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
+ }
+ m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
+
+ //replace&resize push buttons and resize checkboxes
+ Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
+ + 20; //the min with is to small to fit, hm... so add alittle
+ long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
+ long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
+ long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
+ if( nNewPBXPos + nPBWidth > nPageWidth )
+ {
+ if( nPBWidth > nPageWidth/2 )
+ nPBWidth = nPageWidth/2;
+ nNewPBXPos = nPageWidth-nPBWidth;
+ nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
+ }
+ m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
+ m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
+
+ Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
+ aPBSize.setWidth( nPBWidth );
+ m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
+ m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
+
+ Size aCBSize( m_aCBNumber.GetSizePixel() );
+ aCBSize.setWidth(nCBXWidth);
+ m_aCBNumber.SetSizePixel( aCBSize );
+ m_aCBPercent.SetSizePixel( aCBSize );
+
+ //place and align separator and label placement listboxes
+ Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
+ aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
+ m_aFT_LabelPlacement.SetSizePixel(aSize);
+
+ long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
+
+ m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
+ m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
+ m_aSeparatorResources.Show(true);
+
+ aSize = m_aLB_LabelPlacement.GetSizePixel();
+ aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
+ m_aLB_LabelPlacement.SetSizePixel(aSize);
+ m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
+
+ //some click handler
+ m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
+ m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
+ m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBCategory.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
+ m_aCBSymbol.SetClickHdl( 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) == SFX_ITEM_SET )
+ {
+ bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
+ if( bForbidPercentValue )
+ m_aCBPercent.Enable(false);
+ }
+
+ m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
+}
+
+DataLabelResources::~DataLabelResources()
+{
+}
+
+void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter )
+{
+ m_pNumberFormatter = pFormatter;
+}
+
+IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
+{
+ if( !m_pPool || !m_pNumberFormatter )
+ {
+ DBG_ERROR("Missing item pool or number formatter");
+ return 1;
+ }
+
+ if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked())
+ m_aCBNumber.Check();
+ else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked())
+ m_aCBPercent.Check();
+
+ SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
+ aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+
+ bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
+
+ ULONG& 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;
+
+ if(!rbMixedState)
+ aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
+ aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
+
+ NumberFormatDialog aDlg(m_pWindow, aNumberSet);
+ if( bPercent )
+ aDlg.SetText( String( SchResId( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ) );
+ if( RET_OK == aDlg.Execute() )
+ {
+ const SfxItemSet* pResult = aDlg.GetOutputItemSet();
+ if( pResult )
+ {
+ bool bOldSource = rUseSourceFormat;
+ ULONG nOldFormat = rnFormatKey;
+ bool bOldMixedState = rbMixedState || rbSourceMixedState;
+
+ rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
+
+ //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly
+ if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey )
+ rbMixedState = rbSourceMixedState = true;
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
+{
+ if( pBox )
+ pBox->EnableTriState( FALSE );
+ EnableControls();
+ return 0;
+}
+
+void DataLabelResources::EnableControls()
+{
+ m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
+
+ //enable separator
+ {
+ long nNumberOfCheckedLabelParts = 0;
+ if( m_aCBNumber.IsChecked() )
+ ++nNumberOfCheckedLabelParts;
+ if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
+ ++nNumberOfCheckedLabelParts;
+ if( m_aCBCategory.IsChecked() )
+ ++nNumberOfCheckedLabelParts;
+ m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
+ bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
+ m_aFT_TextDirection.Enable( bEnableTextDir );
+ m_aLB_TextDirection.Enable( bEnableTextDir );
+ bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1;
+ m_aFT_LabelPlacement.Enable( bEnablePlacement );
+ m_aLB_LabelPlacement.Enable( bEnablePlacement );
+ }
+
+ m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
+ m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
+
+ bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
+ m_aFL_Rotate.Enable( bEnableRotation );
+ m_aDC_Dial.Enable( bEnableRotation );
+ m_aFT_Degrees.Enable( bEnableRotation );
+ m_aNF_Degrees.Enable( bEnableRotation );
+}
+
+BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
+{
+ if( m_aCBNumber.IsChecked() )
+ {
+ if( !m_bNumberFormatMixedState )
+ rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue ));
+ if( !m_bSourceFormatMixedState )
+ rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue ));
+ }
+ if( m_aCBPercent.IsChecked() )
+ {
+ if( !m_bPercentFormatMixedState )
+ rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent ));
+ if( !m_bPercentSourceMixedState )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent ));
+ }
+
+ if( m_aCBNumber.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) );
+ if( m_aCBPercent.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) );
+ if( m_aCBCategory.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) );
+ if( m_aCBSymbol.GetState()!= STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) );
+
+ rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) );
+ ::std::map< USHORT, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
+ if(aIt!=m_aListBoxToPlacementMap.end())
+ {
+ sal_Int32 nValue = aIt->second;
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
+ }
+
+ if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
+
+ if( m_aDC_Dial.IsVisible() )
+ {
+ sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
+ rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ }
+
+ return TRUE;
+}
+
+void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
+{
+ // default state
+ m_aCBSymbol.Enable( FALSE );
+
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory );
+ lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol );
+
+ 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 = NULL;
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() );
+ else
+ m_aSeparatorResources.SetDefault();
+
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ ::std::map< sal_Int32, USHORT >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
+ if(aIt!=m_aPlacementToListBoxMap.end())
+ {
+ USHORT nPos = aIt->second;
+ m_aLB_LabelPlacement.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_LabelPlacement.SetNoSelection();
+ }
+ else
+ m_aLB_LabelPlacement.SetNoSelection();
+
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+
+ if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ m_aDC_Dial.SetRotation( nDegrees );
+ }
+ else
+ m_aDC_Dial.SetRotation( 0 );
+
+ EnableControls();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
new file mode 100644
index 000000000000..ef34e004bb07
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_DATALABEL_HXX
+#define CHART2_RES_DATALABEL_HXX
+
+#include "res_TextSeparator.hxx"
+// header for class CheckBox
+#include <vcl/button.hxx>
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+#include "TextDirectionListBox.hxx"
+
+#include <svx/dialcontrol.hxx>
+
+class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class DataLabelResources
+{
+public:
+ DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~DataLabelResources();
+
+ BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+ void Reset(const SfxItemSet& rInAttrs);
+
+ void SetNumberFormatter( SvNumberFormatter* pFormatter );
+
+private:
+ CheckBox m_aCBNumber;
+ PushButton m_aPB_NumberFormatForValue;
+ CheckBox m_aCBPercent;
+ PushButton m_aPB_NumberFormatForPercent;
+ CheckBox m_aCBCategory;
+ CheckBox m_aCBSymbol;
+
+ TextSeparatorResources m_aSeparatorResources;
+
+ FixedText m_aFT_LabelPlacement;
+ ListBox m_aLB_LabelPlacement;
+
+ FixedLine m_aFL_Rotate;
+ svx::DialControl m_aDC_Dial;
+ FixedText m_aFT_Degrees;
+ NumericField m_aNF_Degrees;
+
+ FixedText m_aFT_TextDirection;
+ TextDirectionListBox m_aLB_TextDirection;
+
+ ::std::map< sal_Int32, USHORT > m_aPlacementToListBoxMap;
+ ::std::map< USHORT, sal_Int32 > m_aListBoxToPlacementMap;
+
+ SvNumberFormatter* m_pNumberFormatter;
+ bool m_bNumberFormatMixedState;
+ bool m_bPercentFormatMixedState;
+ ULONG m_nNumberFormatForValue;
+ ULONG m_nNumberFormatForPercent;
+
+ bool m_bSourceFormatMixedState;
+ bool m_bPercentSourceMixedState;
+ bool m_bSourceFormatForValue;
+ bool m_bSourceFormatForPercent;
+
+ Window* m_pWindow;
+ SfxItemPool* m_pPool;
+
+ DECL_LINK(NumberFormatDialogHdl, PushButton * );
+ DECL_LINK(CheckHdl, CheckBox* );
+ void EnableControls();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
new file mode 100644
index 000000000000..5251841a2d9b
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CB_VALUE_AS_NUMBER 1
+#define CB_VALUE_AS_PERCENTAGE 2
+#define CB_CATEGORY 3
+#define CB_SYMBOL 4
+
+#define PB_NUMBERFORMAT 20
+#define PB_PERCENT_NUMBERFORMAT 21
+
+#define FT_LABEL_PLACEMENT 2
+#define LB_LABEL_PLACEMENT 2
+
+#define FT_LABEL_TEXTDIR 31
+#define LB_LABEL_TEXTDIR 32
+
+#define FL_LABEL_ROTATE 40
+#define CT_LABEL_DIAL 40
+#define FT_LABEL_DEGREES 40
+#define NF_LABEL_DEGREES 40
diff --git a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
new file mode 100644
index 000000000000..9501368f537e
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_DATALABEL_HXX
+#define _CHART2_RESOURCE_DATALABEL_HXX
+
+#include "HelpIds.hrc"
+#include "res_DataLabel_IDs.hrc"
+
+#define WORKAROUND \
+ StringList [ en-US ] = \
+ { \
+ "Best fit" ; \
+ "Center" ; \
+ "Above" ; \
+ "Top left" ; \
+ "Left" ; \
+ "Bottom left" ; \
+ "Below" ; \
+ "Bottom right" ; \
+ "Right" ; \
+ "Top right" ; \
+ "Inside" ; \
+ "Outside" ; \
+ "Near origin" ; \
+ };
+
+
+#define RESOURCE_DATALABEL( xpos, ypos ) \
+CheckBox CB_VALUE_AS_NUMBER \
+{ \
+ HelpID = HID_SCH_DATALABEL_VALUE; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 136 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show value as ~number" ; \
+}; \
+PushButton PB_NUMBERFORMAT \
+{ \
+ HelpID = HID_SCH_PB_NUMBERFORMAT; \
+ TabStop = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos-3 ) ; \
+ Size = MAP_APPFONT ( 100 , 14 ) ; \
+ Text [ en-US ] = "Number ~format..." ; \
+}; \
+CheckBox CB_VALUE_AS_PERCENTAGE \
+{ \
+ HelpID = HID_SCH_DATALABEL_PERCENT; \
+ Pos = MAP_APPFONT ( xpos , ypos+17 ) ; \
+ Size = MAP_APPFONT ( 136 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show value as ~percentage" ; \
+}; \
+PushButton PB_PERCENT_NUMBERFORMAT \
+{ \
+ HelpID = HID_SCH_PB_PERCENT_NUMBERFORMAT; \
+ TabStop = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+17-3 ) ; \
+ Size = MAP_APPFONT ( 100 , 14 ) ; \
+ Text [ en-US ] = "Percentage f~ormat..." ; \
+}; \
+CheckBox CB_CATEGORY \
+{ \
+ HelpID = HID_SCH_DATALABEL_TEXT; \
+ Pos = MAP_APPFONT ( xpos , ypos+33 ); \
+ Size = MAP_APPFONT ( 254 , 10 ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Show ~category"; \
+}; \
+CheckBox CB_SYMBOL \
+{ \
+ HelpID = HID_SCH_DATALABEL_SYMBOL; \
+ Pos = MAP_APPFONT ( xpos , ypos+49 ) ; \
+ Size = MAP_APPFONT ( 254 , 10 ) ; \
+ TabStop = TRUE ; \
+ Text [ en-US ] = "Show ~legend key" ; \
+}; \
+FixedText FT_LABEL_PLACEMENT \
+{ \
+ Pos = MAP_APPFONT ( xpos , ypos+84 ) ; \
+ Size = MAP_APPFONT ( 182 , 10 ) ; \
+ TabStop = FALSE ; \
+ Text [ en-US ] = "Place~ment"; \
+}; \
+ListBox LB_LABEL_PLACEMENT \
+{ \
+ HelpID = HID_SCH_DATALABEL_PLACEMENT; \
+ Border = TRUE ; \
+ AutoHScroll = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+100 , ypos+82 ) ; \
+ Size = MAP_APPFONT ( 89 , 12 ) ; \
+ TabStop = TRUE ; \
+ Group = TRUE ; \
+ DropDown=TRUE; \
+ DDExtraWidth = TRUE ; \
+ WORKAROUND \
+}; \
+FixedLine FL_LABEL_ROTATE \
+{ \
+ Pos = MAP_APPFONT ( xpos, ypos+103 ) ; \
+ Size = MAP_APPFONT ( 248, 8 ) ; \
+ Text [ en-US ] = "Rotate Text" ; \
+}; \
+Control CT_LABEL_DIAL \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_KNOB ; \
+ Pos = MAP_APPFONT ( xpos+6 , ypos+116 ) ; \
+ Size = MAP_APPFONT ( 43 , 43 ) ; \
+ Text = "ABCD" ; \
+}; \
+FixedText FT_LABEL_DEGREES \
+{ \
+ Pos = MAP_APPFONT ( xpos+87 , ypos+133 ) ; \
+ Size = MAP_APPFONT ( 46, 8 ) ; \
+ Text [ en-US ] = "~Degrees" ; \
+}; \
+NumericField NF_LABEL_DEGREES \
+{ \
+ HelpId = HID_SCH_DATALABEL_ROTATION_EDIT ; \
+ Pos = MAP_APPFONT ( xpos+55 , ypos+131 ) ; \
+ Size = MAP_APPFONT ( 28 , 12 ) ; \
+ Border = TRUE ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ Maximum = 359 ; \
+ SpinSize = 5 ; \
+}; \
+FixedText FT_LABEL_TEXTDIR \
+{ \
+ Pos = MAP_APPFONT ( xpos , ypos+162 ) ; \
+ Size = MAP_APPFONT ( 64 , 8 ) ; \
+ Text [ en-US ] = "Te~xt direction" ; \
+}; \
+ListBox LB_LABEL_TEXTDIR \
+{ \
+ HelpID = HID_SCH_TEXTDIRECTION; \
+ Pos = MAP_APPFONT ( xpos+66 , ypos+160 ) ; \
+ Size = MAP_APPFONT ( 170 , 100 ) ; \
+ Border = TRUE; \
+ TabStop = TRUE; \
+ DropDown = TRUE; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
new file mode 100644
index 000000000000..8b649072538e
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -0,0 +1,787 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_ErrorBar.hxx"
+#include "res_ErrorBar_IDs.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "RangeSelectionHelper.hxx"
+// for RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR
+#include "TabPageNotifiable.hxx"
+#include "macros.hxx"
+
+#include <rtl/math.hxx>
+#include <vcl/dialog.hxx>
+#include <svl/stritem.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+
+sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind )
+{
+ sal_uInt16 nResult = 0;
+ switch( eErrorKind )
+ {
+ // for these cases select the default in the list box
+ case CHERROR_NONE:
+ case CHERROR_PERCENT:
+ case CHERROR_CONST:
+ case CHERROR_RANGE:
+ nResult = CHART_LB_FUNCTION_STD_DEV;
+ break;
+ case CHERROR_VARIANT:
+ nResult = CHART_LB_FUNCTION_VARIANCE;
+ break;
+ case CHERROR_SIGMA:
+ nResult = CHART_LB_FUNCTION_STD_DEV;
+ break;
+ case CHERROR_BIGERROR:
+ nResult = CHART_LB_FUNCTION_ERROR_MARGIN;
+ break;
+ case CHERROR_STDERROR:
+ nResult = CHART_LB_FUNCTION_STD_ERROR;
+ break;
+ }
+ return nResult;
+}
+} // anonymous namespace
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+enum StatIndicator
+{
+ INDICATE_BOTH,
+ INDICATE_UP,
+ INDICATE_DOWN
+};
+
+ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog,
+ const SfxItemSet& rInAttrs, bool bNoneAvailable,
+ tErrorBarType eType /* = ERROR_BAR_Y */ ) :
+
+ m_aFlErrorCategory( pParent, SchResId( FL_ERROR )),
+ m_aRbNone( pParent, SchResId( RB_NONE )),
+ m_aRbConst( pParent, SchResId( RB_CONST )),
+ m_aRbPercent( pParent, SchResId( RB_PERCENT )),
+ m_aRbFunction( pParent, SchResId( RB_FUNCTION )),
+ m_aRbRange( pParent, SchResId( RB_RANGE )),
+ m_aLbFunction( pParent, SchResId( LB_FUNCTION )),
+
+ m_aFlParameters( pParent, SchResId( FL_PARAMETERS )),
+ m_aFtPositive( pParent, SchResId( FT_POSITIVE )),
+ m_aMfPositive( pParent, SchResId( MF_POSITIVE )),
+ m_aEdRangePositive( pParent, SchResId( ED_RANGE_POSITIVE )),
+ m_aIbRangePositive( pParent, SchResId( IB_RANGE_POSITIVE )),
+ m_aFtNegative( pParent, SchResId( FT_NEGATIVE )),
+ m_aMfNegative( pParent, SchResId( MF_NEGATIVE )),
+ m_aEdRangeNegative( pParent, SchResId( ED_RANGE_NEGATIVE )),
+ m_aIbRangeNegative( pParent, SchResId( IB_RANGE_NEGATIVE )),
+ m_aCbSyncPosNeg( pParent, SchResId( CB_SYN_POS_NEG )),
+
+ m_aFlIndicate( pParent, SchResId( FL_INDICATE )),
+ m_aRbBoth( pParent, SchResId( RB_BOTH )),
+ m_aRbPositive( pParent, SchResId( RB_POSITIVE )),
+ m_aRbNegative( pParent, SchResId( RB_NEGATIVE )),
+ m_aFiBoth( pParent, SchResId( FI_BOTH )),
+ m_aFiPositive( pParent, SchResId( FI_POSITIVE )),
+ m_aFiNegative( pParent, SchResId( FI_NEGATIVE )),
+
+ m_eErrorKind( CHERROR_NONE ),
+ m_eIndicate( CHINDICATE_BOTH ),
+ m_bErrorKindUnique( true ),
+ m_bIndicatorUnique( true ),
+ m_bPlusUnique( true ),
+ m_bMinusUnique( true ),
+ m_bRangePosUnique( true ),
+ m_bRangeNegUnique( true ),
+ m_bNoneAvailable( bNoneAvailable ),
+ m_eErrorBarType( eType ),
+ m_nConstDecimalDigits( 1 ),
+ m_nConstSpinSize( 1 ),
+ m_pParentWindow( pParent ),
+ m_pParentDialog( pParentDialog ),
+ m_pCurrentRangeChoosingField( 0 ),
+ m_bHasInternalDataProvider( true ),
+ m_bDisableDataTableDialog( false )
+{
+ if( m_bNoneAvailable )
+ m_aRbNone.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ else
+ m_aRbNone.Hide();
+
+ m_aRbConst.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbPercent.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbFunction.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+ m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen ));
+
+ m_aCbSyncPosNeg.Check( FALSE );
+ m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg ));
+
+ m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged ));
+ m_aEdRangePositive.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged ));
+ m_aEdRangeNegative.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged ));
+
+ m_aRbPositive.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+ m_aRbNegative.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+ m_aRbBoth.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged ));
+
+ m_aIbRangePositive.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange ));
+ m_aIbRangeNegative.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange ));
+ m_aIbRangePositive.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE )));
+ m_aIbRangeNegative.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE )));
+
+ FillValueSets();
+ Reset( rInAttrs );
+}
+
+ErrorBarResources::~ErrorBarResources()
+{
+}
+
+void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType )
+{
+ if( m_eErrorBarType != eNewType )
+ {
+ m_eErrorBarType = eNewType;
+ FillValueSets();
+ }
+}
+
+void ErrorBarResources::SetChartDocumentForRangeChoosing(
+ const uno::Reference< chart2::XChartDocument > & xChartDocument )
+{
+ if( xChartDocument.is())
+ {
+ m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider();
+ uno::Reference< beans::XPropertySet > xProps( xChartDocument, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ try
+ {
+ xProps->getPropertyValue( C2U( "DisableDataTableDialog" ) ) >>= m_bDisableDataTableDialog;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument ));
+
+ // has internal data provider => rename "cell range" to "from data"
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( m_bHasInternalDataProvider )
+ {
+ m_aRbRange.SetText( String( SchResId( STR_CONTROLTEXT_ERROR_BARS_FROM_DATA )));
+ }
+
+ if( m_aRbRange.IsChecked())
+ {
+ isRangeFieldContentValid( m_aEdRangePositive );
+ isRangeFieldContentValid( m_aEdRangeNegative );
+ }
+}
+
+void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ if( fMinorStepWidth < 0 )
+ fMinorStepWidth = -fMinorStepWidth;
+
+ sal_Int32 nExponent = static_cast< sal_Int32 >( ::rtl::math::approxFloor( log10( fMinorStepWidth )));
+ if( nExponent <= 0 )
+ {
+ // one digit precision more
+ m_nConstDecimalDigits = static_cast< sal_uInt16 >( (-nExponent) + 1 );
+ m_nConstSpinSize = 10;
+ }
+ else
+ {
+ m_nConstDecimalDigits = 0;
+ m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, (int)nExponent ));
+ }
+}
+
+void ErrorBarResources::UpdateControlStates()
+{
+ // function
+ bool bIsFunction = m_aRbFunction.IsChecked();
+ m_aLbFunction.Enable( bIsFunction );
+
+ // range buttons
+ m_aRbRange.Enable( !m_bHasInternalDataProvider || !m_bDisableDataTableDialog );
+ bool bShowRange = ( m_aRbRange.IsChecked());
+ bool bCanChooseRange =
+ ( bShowRange &&
+ m_apRangeSelectionHelper.get() &&
+ m_apRangeSelectionHelper->hasRangeSelection());
+
+ m_aMfPositive.Show( ! bShowRange );
+ m_aMfNegative.Show( ! bShowRange );
+
+ // use range but without range chooser => hide controls
+ m_aEdRangePositive.Show( bShowRange && ! m_bHasInternalDataProvider );
+ m_aIbRangePositive.Show( bCanChooseRange );
+ m_aEdRangeNegative.Show( bShowRange && ! m_bHasInternalDataProvider );
+ m_aIbRangeNegative.Show( bCanChooseRange );
+
+ bool bShowPosNegAndSync = ! (bShowRange && m_bHasInternalDataProvider);
+ m_aFtPositive.Show( bShowPosNegAndSync );
+ m_aFtNegative.Show( bShowPosNegAndSync );
+ m_aCbSyncPosNeg.Show( bShowPosNegAndSync );
+ m_aFlParameters.Show( bShowPosNegAndSync );
+
+ // unit for metric fields
+ bool bIsErrorMargin(
+ ( m_aRbFunction.IsChecked()) &&
+ ( m_aLbFunction.GetSelectEntryPos() == CHART_LB_FUNCTION_ERROR_MARGIN ));
+ bool bIsPercentage( m_aRbPercent.IsChecked() || bIsErrorMargin );
+ String aCustomUnit;
+
+ if( bIsPercentage )
+ {
+ aCustomUnit = String( RTL_CONSTASCII_USTRINGPARAM( " %" ));
+ m_aMfPositive.SetDecimalDigits( 1 );
+ m_aMfPositive.SetSpinSize( 10 );
+ m_aMfNegative.SetDecimalDigits( 1 );
+ m_aMfNegative.SetSpinSize( 10 );
+ }
+ else
+ {
+ m_aMfPositive.SetDecimalDigits( m_nConstDecimalDigits );
+ m_aMfPositive.SetSpinSize( m_nConstSpinSize );
+ m_aMfNegative.SetDecimalDigits( m_nConstDecimalDigits );
+ m_aMfNegative.SetSpinSize( m_nConstSpinSize );
+ }
+ m_aMfPositive.SetCustomUnitText( aCustomUnit );
+ m_aMfNegative.SetCustomUnitText( aCustomUnit );
+
+ // positive and negative value fields
+ bool bPosEnabled = ( m_aRbPositive.IsChecked() || m_aRbBoth.IsChecked());
+ bool bNegEnabled = ( m_aRbNegative.IsChecked() || m_aRbBoth.IsChecked());
+ if( !( bPosEnabled || bNegEnabled ))
+ {
+ // all three controls are not checked -> ambiguous state
+ bPosEnabled = true;
+ bNegEnabled = true;
+ }
+
+ // functions with only one parameter
+ bool bOneParameterCategory =
+ bIsErrorMargin || m_aRbPercent.IsChecked();
+ if( bOneParameterCategory )
+ {
+ m_aCbSyncPosNeg.Check();
+ }
+
+ if( m_aCbSyncPosNeg.IsChecked())
+ {
+ bPosEnabled = true;
+ bNegEnabled = false;
+ }
+
+ // all functions except error margin take no arguments
+ if( m_aRbFunction.IsChecked() &&
+ ( m_aLbFunction.GetSelectEntryPos() != CHART_LB_FUNCTION_ERROR_MARGIN ))
+ {
+ bPosEnabled = false;
+ bNegEnabled = false;
+ }
+
+ // enable/disable pos/neg fields
+ m_aFtPositive.Enable( bPosEnabled );
+ m_aFtNegative.Enable( bNegEnabled );
+ if( bShowRange )
+ {
+ m_aEdRangePositive.Enable( bPosEnabled );
+ m_aIbRangePositive.Enable( bPosEnabled );
+ m_aEdRangeNegative.Enable( bNegEnabled );
+ m_aIbRangeNegative.Enable( bNegEnabled );
+ }
+ else
+ {
+ m_aMfPositive.Enable( bPosEnabled );
+ m_aMfNegative.Enable( bNegEnabled );
+ }
+
+ m_aCbSyncPosNeg.Enable(
+ !bOneParameterCategory &&
+ ( bPosEnabled || bNegEnabled ));
+
+ // mark invalid entries in the range fields
+ if( bShowRange && ! m_bHasInternalDataProvider )
+ {
+ isRangeFieldContentValid( m_aEdRangePositive );
+ isRangeFieldContentValid( m_aEdRangeNegative );
+ }
+}
+
+IMPL_LINK( ErrorBarResources, CategoryChosen, void *, )
+{
+ m_bErrorKindUnique = true;
+ SvxChartKindError eOldError = m_eErrorKind;
+
+ if( m_aRbNone.IsChecked())
+ m_eErrorKind = CHERROR_NONE;
+ else if( m_aRbConst.IsChecked())
+ m_eErrorKind = CHERROR_CONST;
+ else if( m_aRbPercent.IsChecked())
+ m_eErrorKind = CHERROR_PERCENT;
+ else if( m_aRbRange.IsChecked())
+ m_eErrorKind = CHERROR_RANGE;
+ else if( m_aRbFunction.IsChecked())
+ {
+ if( m_aLbFunction.GetSelectEntryCount() == 1 )
+ {
+ switch( m_aLbFunction.GetSelectEntryPos())
+ {
+ case CHART_LB_FUNCTION_STD_ERROR:
+ m_eErrorKind = CHERROR_STDERROR; break;
+ case CHART_LB_FUNCTION_STD_DEV:
+ m_eErrorKind = CHERROR_SIGMA; break;
+ case CHART_LB_FUNCTION_VARIANCE:
+ m_eErrorKind = CHERROR_VARIANT; break;
+ case CHART_LB_FUNCTION_ERROR_MARGIN:
+ m_eErrorKind = CHERROR_BIGERROR; break;
+ default:
+ m_bErrorKindUnique = false;
+ }
+ }
+ else
+ m_bErrorKindUnique = false;
+ }
+ else
+ {
+ OSL_ENSURE( false, "Unknown category chosen" );
+ m_bErrorKindUnique = false;
+ }
+
+ // changed to range
+ if( m_eErrorKind == CHERROR_RANGE &&
+ eOldError != CHERROR_RANGE )
+ {
+ m_aCbSyncPosNeg.Check(
+ (m_aEdRangePositive.GetText().Len() > 0) &&
+ m_aEdRangePositive.GetText().Equals(
+ m_aEdRangeNegative.GetText()));
+ }
+ // changed from range
+ else if( m_eErrorKind != CHERROR_RANGE &&
+ eOldError == CHERROR_RANGE )
+ {
+ m_aCbSyncPosNeg.Check(
+ m_aMfPositive.GetValue() == m_aMfNegative.GetValue());
+ }
+
+ UpdateControlStates();
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, SynchronizePosAndNeg, void *, EMPTYARG )
+{
+ UpdateControlStates();
+ PosValueChanged( 0 );
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, PosValueChanged, void *, EMPTYARG )
+{
+ if( m_aCbSyncPosNeg.IsChecked())
+ {
+ if( m_aRbRange.IsChecked())
+ {
+ m_aEdRangeNegative.SetText( m_aEdRangePositive.GetText());
+ m_bRangeNegUnique = m_bRangePosUnique;
+ }
+ else
+ m_aMfNegative.SetValue( m_aMfPositive.GetValue());
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, IndicatorChanged, void *, EMPTYARG )
+{
+ m_bIndicatorUnique = true;
+ if( m_aRbBoth.IsChecked())
+ m_eIndicate = CHINDICATE_BOTH;
+ else if( m_aRbPositive.IsChecked())
+ m_eIndicate = CHINDICATE_UP;
+ else if( m_aRbNegative.IsChecked())
+ m_eIndicate = CHINDICATE_DOWN;
+ else
+ m_bIndicatorUnique = false;
+
+ UpdateControlStates();
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton )
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( ! m_apRangeSelectionHelper.get())
+ return 0;
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+
+ ::rtl::OUString aUIString;
+ if( pButton == &m_aIbRangePositive )
+ {
+ m_pCurrentRangeChoosingField = &m_aEdRangePositive;
+ aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS )));
+ }
+ else
+ {
+ m_pCurrentRangeChoosingField = &m_aEdRangeNegative;
+ aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS )));
+ }
+
+ OSL_ASSERT( m_pParentDialog );
+ if( m_pParentDialog )
+ {
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_apRangeSelectionHelper->chooseRange(
+ m_pCurrentRangeChoosingField->GetText(),
+ aUIString, *this );
+ }
+ else
+ m_pCurrentRangeChoosingField = 0;
+
+ return 0;
+}
+
+IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit )
+{
+ if( pEdit == & m_aEdRangePositive )
+ {
+ m_bRangePosUnique = true;
+ PosValueChanged( 0 );
+ }
+ else
+ {
+ m_bRangeNegUnique = true;
+ }
+
+ isRangeFieldContentValid( *pEdit );
+
+ return 0;
+}
+
+void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ // category
+ m_eErrorKind = CHERROR_NONE;
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem );
+ m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE );
+
+ if( aState == SFX_ITEM_SET )
+ m_eErrorKind = ((const SvxChartKindErrorItem*) pPoolItem)->GetValue();
+
+ m_aLbFunction.SelectEntryPos( lcl_getLbEntryPosByErrorKind( m_eErrorKind ));
+
+ if( m_bErrorKindUnique )
+ {
+ switch( m_eErrorKind )
+ {
+ case CHERROR_NONE:
+ m_aRbNone.Check();
+ break;
+ case CHERROR_PERCENT:
+ m_aRbPercent.Check();
+ break;
+ case CHERROR_CONST:
+ m_aRbConst.Check();
+ break;
+ case CHERROR_STDERROR:
+ case CHERROR_VARIANT:
+ case CHERROR_SIGMA:
+ case CHERROR_BIGERROR:
+ m_aRbFunction.Check();
+ break;
+ case CHERROR_RANGE:
+ m_aRbRange.Check();
+ break;
+ }
+ }
+ else
+ {
+ m_aRbNone.Check( FALSE );
+ m_aRbConst.Check( FALSE );
+ m_aRbPercent.Check( FALSE );
+ m_aRbFunction.Check( FALSE );
+ }
+
+ // parameters
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem );
+ m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE );
+ double fPlusValue = 0.0;
+ if( aState == SFX_ITEM_SET )
+ {
+ fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
+ sal_Int32 nPlusValue = static_cast< sal_Int32 >( fPlusValue * pow(10.0,m_aMfPositive.GetDecimalDigits()) );
+ m_aMfPositive.SetValue( nPlusValue );
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem );
+ m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE );
+ double fMinusValue = 0.0;
+ if( aState == SFX_ITEM_SET )
+ {
+ fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
+ sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_aMfNegative.GetDecimalDigits()) );
+ m_aMfNegative.SetValue( nMinusValue );
+
+ if( m_eErrorKind != CHERROR_RANGE &&
+ fPlusValue == fMinusValue )
+ m_aCbSyncPosNeg.Check();
+ }
+
+ // indicator
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, TRUE, &pPoolItem );
+ m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET)
+ m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue();
+
+ if( m_bIndicatorUnique )
+ {
+ switch( m_eIndicate )
+ {
+ case CHINDICATE_NONE :
+ // no longer used, use both as default
+ m_eIndicate = CHINDICATE_BOTH;
+ // fall-through intended to BOTH
+ case CHINDICATE_BOTH :
+ m_aRbBoth.Check(); break;
+ case CHINDICATE_UP :
+ m_aRbPositive.Check(); break;
+ case CHINDICATE_DOWN :
+ m_aRbNegative.Check(); break;
+ }
+ }
+ else
+ {
+ m_aRbBoth.Check( FALSE );
+ m_aRbPositive.Check( FALSE );
+ m_aRbNegative.Check( FALSE );
+ }
+
+ // ranges
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, TRUE, &pPoolItem );
+ m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ String sRangePositive = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue();
+ m_aEdRangePositive.SetText( sRangePositive );
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, TRUE, &pPoolItem );
+ m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ String sRangeNegative = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue();
+ m_aEdRangeNegative.SetText( sRangeNegative );
+ if( m_eErrorKind == CHERROR_RANGE &&
+ sRangeNegative.Len() > 0 &&
+ sRangeNegative.Equals( m_aEdRangePositive.GetText()))
+ m_aCbSyncPosNeg.Check();
+ }
+
+ UpdateControlStates();
+}
+
+BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const
+{
+ if( m_bErrorKindUnique )
+ rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR ));
+ if( m_bIndicatorUnique )
+ rOutAttrs.Put( SvxChartIndicateItem( m_eIndicate, SCHATTR_STAT_INDICATE ));
+
+ if( m_bErrorKindUnique )
+ {
+ if( m_eErrorKind == CHERROR_RANGE )
+ {
+ String aPosRange;
+ String aNegRange;
+ if( m_bHasInternalDataProvider )
+ {
+ // the strings aPosRange/aNegRange have to be set to a non-empty
+ // arbitrary string to generate error-bar sequences
+ aPosRange.Assign( sal_Unicode('x'));
+ aNegRange = aPosRange;
+ }
+ else
+ {
+ aPosRange = m_aEdRangePositive.GetText();
+ if( m_aCbSyncPosNeg.IsChecked())
+ aNegRange = aPosRange;
+ else
+ aNegRange = m_aEdRangeNegative.GetText();
+ }
+
+ if( m_bRangePosUnique )
+ rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_POS, aPosRange ));
+ if( m_bRangeNegUnique )
+ rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_NEG, aNegRange ));
+ }
+ else if( m_eErrorKind == CHERROR_CONST ||
+ m_eErrorKind == CHERROR_PERCENT ||
+ m_eErrorKind == CHERROR_BIGERROR )
+ {
+ double fPosValue = static_cast< double >( m_aMfPositive.GetValue()) /
+ pow( 10.0, m_aMfPositive.GetDecimalDigits());
+ double fNegValue = 0.0;
+
+ if( m_aCbSyncPosNeg.IsChecked())
+ fNegValue = fPosValue;
+ else
+ fNegValue = static_cast< double >( m_aMfNegative.GetValue()) /
+ pow( 10.0, m_aMfNegative.GetDecimalDigits());
+
+ rOutAttrs.Put( SvxDoubleItem( fPosValue, SCHATTR_STAT_CONSTPLUS ));
+ rOutAttrs.Put( SvxDoubleItem( fNegValue, SCHATTR_STAT_CONSTMINUS ));
+ }
+ }
+
+ return TRUE;
+}
+
+void ErrorBarResources::FillValueSets()
+{
+ bool bIsHighContrast = ( true && m_aRbConst.GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ // do not scale images, show then centered
+// m_aFiPositive.SetStyle( (m_aFiPositive.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+// m_aFiNegative.SetStyle( (m_aFiNegative.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+// m_aFiBoth.SetStyle( (m_aFiBoth.GetStyle() & (~WB_SCALE)) | WB_CENTER );
+
+ if( m_eErrorBarType == ERROR_BAR_Y )
+ {
+ m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_DOWN ));
+ m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_UP ));
+ m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_VERTI ));
+ }
+ else if( m_eErrorBarType == ERROR_BAR_X )
+ {
+ m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_LEFT ));
+ m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_RIGHT ));
+ m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_HORI ));
+ }
+}
+
+void ErrorBarResources::listeningFinished(
+ const ::rtl::OUString & rNewRange )
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( ! m_apRangeSelectionHelper.get())
+ return;
+
+ // rNewRange becomes invalid after removing the listener
+ ::rtl::OUString aRange( rNewRange );
+
+// m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_apRangeSelectionHelper->stopRangeListening();
+
+ // change edit field
+ if( m_pParentWindow )
+ {
+ m_pParentWindow->ToTop();
+ m_pParentWindow->GrabFocus();
+ }
+
+ if( m_pCurrentRangeChoosingField )
+ {
+ m_pCurrentRangeChoosingField->SetText( String( aRange ));
+ m_pCurrentRangeChoosingField->GrabFocus();
+ PosValueChanged( 0 );
+ }
+
+ m_pCurrentRangeChoosingField = 0;
+
+ UpdateControlStates();
+ OSL_ASSERT( m_pParentDialog );
+ if( m_pParentDialog )
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+
+void ErrorBarResources::disposingRangeSelection()
+{
+ OSL_ASSERT( m_apRangeSelectionHelper.get());
+ if( m_apRangeSelectionHelper.get())
+ m_apRangeSelectionHelper->stopRangeListening( false );
+}
+
+bool ErrorBarResources::isRangeFieldContentValid( Edit & rEdit )
+{
+ ::rtl::OUString aRange( rEdit.GetText());
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ ( m_apRangeSelectionHelper.get() &&
+ m_apRangeSelectionHelper->verifyCellRange( aRange ));
+
+ if( bIsValid || !rEdit.IsEnabled())
+ {
+ rEdit.SetControlForeground();
+ rEdit.SetControlBackground();
+ }
+ else
+ {
+ rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ }
+
+ return bIsValid;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc b/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc
new file mode 100644
index 000000000000..bab1051208f4
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar_IDs.hrc
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_ERROR 1
+#define FL_INDICATE 2
+#define FL_PARAMETERS 3
+
+#define FT_POSITIVE 1
+#define FT_NEGATIVE 2
+
+#define RB_NONE 1
+#define RB_CONST 2
+#define RB_PERCENT 3
+#define RB_FUNCTION 4
+#define RB_BOTH 5
+#define RB_POSITIVE 6
+#define RB_NEGATIVE 7
+#define RB_RANGE 8
+
+#define ED_RANGE_POSITIVE 1
+#define ED_RANGE_NEGATIVE 2
+
+#define FI_BOTH 1
+#define FI_POSITIVE 2
+#define FI_NEGATIVE 3
+#define IB_RANGE_POSITIVE 4
+#define IB_RANGE_NEGATIVE 5
+
+#define LB_FUNCTION 1
+
+#define MF_POSITIVE 1
+#define MF_NEGATIVE 2
+
+#define CB_SYN_POS_NEG 1
+
+#define CHART_LB_FUNCTION_STD_ERROR 0
+#define CHART_LB_FUNCTION_STD_DEV 1
+#define CHART_LB_FUNCTION_VARIANCE 2
+#define CHART_LB_FUNCTION_ERROR_MARGIN 3
diff --git a/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc b/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc
new file mode 100644
index 000000000000..0f4cf70e30c7
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_ERRORBARS_HXX
+#define _CHART2_RESOURCE_ERRORBARS_HXX
+
+#include "res_ErrorBar_IDs.hrc"
+#define WORKAROUND \
+StringList [ en-US ] = \
+ { \
+ < "Standard Error" ; CHART_LB_FUNCTION_STD_ERROR ; >; \
+ < "Standard Deviation" ; CHART_LB_FUNCTION_STD_DEV ; >; \
+ < "Variance" ; CHART_LB_FUNCTION_VARIANCE ; >; \
+ < "Error Margin" ; CHART_LB_FUNCTION_ERROR_MARGIN ; >; \
+ };
+
+
+#define RESOURCE_ERRORBARS(availablewidth, yoffset) \
+FixedLine FL_ERROR \
+{ \
+ Pos = MAP_APPFONT ( 6 , 6 ) ; \
+ Size = MAP_APPFONT ( 116 , 8 ) ; \
+ Text [ en-US ] = "Error Category" ; \
+}; \
+RadioButton RB_NONE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NO_ERROR; \
+ Pos = MAP_APPFONT ( 12 , 20 ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~None" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_CONST \
+{ \
+ HelpID = HID_SCH_STATISTIK_CONSTERROR; \
+ Pos = MAP_APPFONT ( 12 , 20 + yoffset ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~Constant Value" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_PERCENT \
+{ \
+ HelpID = HID_SCH_STATISTIK_PERCENT; \
+ Pos = MAP_APPFONT ( 12 , 34 + yoffset ) ; \
+ Size = MAP_APPFONT ( 110 , 10 ) ; \
+ Text [ en-US ] = "~Percentage" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_FUNCTION \
+{ \
+ HelpID = HID_SCH_STATISTIK_FUNCTION; \
+ Pos = MAP_APPFONT ( 12 , 48 + yoffset ) ; \
+ Size = MAP_APPFONT ( 12 , 10 ) ; \
+ Text [ en-US ] = "" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RB_RANGE \
+{ \
+ HelpID = HID_SCH_STATISTIK_RANGE; \
+ Pos = MAP_APPFONT( 12, 62 + yoffset ) ; \
+ Size = MAP_APPFONT( 110, 10 ) ; \
+ Text [ en-US ] = "Cell ~Range" ; \
+ TabStop = TRUE ; \
+}; \
+ListBox LB_FUNCTION \
+{ \
+ HelpID = HID_SCH_STATISTIK_FUNCTION_LB; \
+ Pos = MAP_APPFONT ( 22 , 46 + yoffset ) ; \
+ Size = MAP_APPFONT ( 94 , 59 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ WORKAROUND\
+}; \
+FixedLine FL_PARAMETERS \
+{ \
+ Pos = MAP_APPFONT ( 6 , 82 + yoffset ) ; \
+ Size = MAP_APPFONT ( availablewidth - 12, 8 ) ; \
+ Text [ en-US ] = "Parameters" ; \
+}; \
+FixedText FT_POSITIVE \
+{ \
+ Pos = MAP_APPFONT ( 12 , 94 + yoffset ) ; \
+ Size = MAP_APPFONT ( 46 , 8 ) ; \
+ Text [ en-US ] = "P~ositive (+)"; \
+}; \
+MetricField MF_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_VALUE; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 60 , 92 + yoffset ) ; \
+ Size = MAP_APPFONT ( 56 , 12 ) ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ StrictFormat = TRUE ; \
+ Unit = FUNIT_CUSTOM ; \
+ SpinSize = 100 ; \
+ DecimalDigits = 2 ; \
+}; \
+Edit ED_RANGE_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_RANGE; \
+ Border = TRUE ; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 60 , 92 + yoffset ) ; \
+ Size = MAP_APPFONT ( 90 , 12 ) ; \
+}; \
+ImageButton IB_RANGE_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 152 , 91 + yoffset ) ; \
+ Size = MAP_APPFONT ( 14 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+FixedText FT_NEGATIVE \
+{ \
+ Pos = MAP_APPFONT ( 12 , 110 + yoffset ) ; \
+ Size = MAP_APPFONT ( 46 , 8 ) ; \
+ Text [ en-US ] = "~Negative (-)"; \
+}; \
+MetricField MF_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_VALUE; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 60 , 108 + yoffset ) ; \
+ Size = MAP_APPFONT ( 56 , 12 ) ; \
+ TabStop = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 0 ; \
+ StrictFormat = TRUE ; \
+ Unit = FUNIT_CUSTOM ; \
+ SpinSize = 100 ; \
+ DecimalDigits = 2 ; \
+}; \
+Edit ED_RANGE_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_RANGE; \
+ Border = TRUE ; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 60 , 108 + yoffset ) ; \
+ Size = MAP_APPFONT ( 90 , 12 ) ; \
+}; \
+ImageButton IB_RANGE_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER; \
+ Hide = TRUE; \
+ Pos = MAP_APPFONT ( 152 , 107 + yoffset ) ; \
+ Size = MAP_APPFONT ( 14 , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+CheckBox CB_SYN_POS_NEG \
+{ \
+ HelpID = HID_SCH_STATISTIK_SAME_FOR_BOTH; \
+ Pos = MAP_APPFONT ( 12 , 126 + yoffset ); \
+ Size = MAP_APPFONT ( availablewidth - 12 , 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Same value for both"; \
+}; \
+FixedLine FL_INDICATE \
+{ \
+ Pos = MAP_APPFONT ( 130 , 6 ) ; \
+ Size = MAP_APPFONT ( availablewidth - 136 , 8 ) ; \
+ Text [ en-US ] = "Error Indicator" ; \
+}; \
+RadioButton RB_BOTH \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_BOTH; \
+ Pos = MAP_APPFONT ( 154 , 22 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Positive ~and Negative"; \
+}; \
+RadioButton RB_POSITIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_POSITIVE; \
+ Pos = MAP_APPFONT ( 154 , 43 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Pos~itive"; \
+}; \
+RadioButton RB_NEGATIVE \
+{ \
+ HelpID = HID_SCH_STATISTIK_SHOW_NEGATIVE; \
+ Pos = MAP_APPFONT ( 154 , 64 ); \
+ Size = MAP_APPFONT ( 90 , 10 ); \
+ Text[ en-US ] = "Ne~gative"; \
+}; \
+FixedImage FI_BOTH \
+{ \
+ Pos = MAP_APPFONT ( 134 , 18 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+}; \
+FixedImage FI_POSITIVE \
+{ \
+ Pos = MAP_APPFONT ( 134 , 39 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+}; \
+FixedImage FI_NEGATIVE \
+{ \
+ Pos = MAP_APPFONT ( 134 , 60 ); \
+ Size = MAP_APPFONT ( 18 , 18 ); \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
new file mode 100644
index 000000000000..c9206a5428df
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_LegendPosition.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "res_LegendPosition_IDs.hrc"
+#include "ResId.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "LegendHelper.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+
+//itemset stuff
+#include "chartview/ChartSfxItemIds.hxx"
+#include <svx/chrtitem.hxx>
+// header for class SfxItemPool
+#include <svl/itempool.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LegendPositionResources::LegendPositionResources( Window* pWindow )
+ : m_xCC() //unused in this scenario
+ , m_aCbxShow( pWindow ) //unused in this scenario
+ , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
+ , m_aRbtTop( pWindow, SchResId(RBT_TOP) )
+ , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) )
+ , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) )
+{
+ m_aCbxShow.Check();//legend is assumed to be visible in this scenario
+ impl_setRadioButtonToggleHdl();
+}
+
+LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Reference< uno::XComponentContext >& xCC )
+ : m_xCC( xCC )
+ , m_aCbxShow( pWindow, SchResId(CBX_SHOWLEGEND) )
+ , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) )
+ , m_aRbtTop( pWindow, SchResId(RBT_TOP) )
+ , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) )
+ , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) )
+{
+ m_aCbxShow.SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) );
+ impl_setRadioButtonToggleHdl();
+}
+
+void LegendPositionResources::impl_setRadioButtonToggleHdl()
+{
+ m_aRbtLeft.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtTop.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtRight.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+ m_aRbtBottom.SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) );
+}
+
+LegendPositionResources::~LegendPositionResources()
+{
+}
+
+void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel )
+{
+ try
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartModel );
+ uno::Reference< beans::XPropertySet > xProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ //show
+ sal_Bool bShowLegend = sal_False;
+ xProp->getPropertyValue( C2U("Show") ) >>= bShowLegend;
+ m_aCbxShow.Check( bShowLegend );
+ PositionEnableHdl(0);
+
+ //position
+ chart2::LegendPosition ePos;
+ xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos;
+ switch( ePos )
+ {
+ case chart2::LegendPosition_LINE_START:
+ m_aRbtLeft.Check();
+ break;
+ case chart2::LegendPosition_LINE_END:
+ m_aRbtRight.Check();
+ break;
+ case chart2::LegendPosition_PAGE_START:
+ m_aRbtTop.Check();
+ break;
+ case chart2::LegendPosition_PAGE_END:
+ m_aRbtBottom.Check();
+ break;
+
+ case chart2::LegendPosition_CUSTOM:
+ default:
+ m_aRbtRight.Check();
+ break;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Reference< frame::XModel >& xChartModel ) const
+{
+ try
+ {
+ sal_Bool bShowLegend = static_cast<sal_Bool>(m_aCbxShow.IsChecked());
+ uno::Reference< beans::XPropertySet > xProp( LegendHelper::getLegend( xChartModel,m_xCC,bShowLegend ), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ //show
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny( bShowLegend ));
+
+ //position
+ chart2::LegendPosition eNewPos;
+ chart2::LegendExpansion eExp = chart2::LegendExpansion_HIGH;
+
+ if( m_aRbtLeft.IsChecked() )
+ eNewPos = chart2::LegendPosition_LINE_START;
+ else if( m_aRbtRight.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_LINE_END;
+ }
+ else if( m_aRbtTop.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_PAGE_START;
+ eExp = chart2::LegendExpansion_WIDE;
+ }
+ else if( m_aRbtBottom.IsChecked() )
+ {
+ eNewPos = chart2::LegendPosition_PAGE_END;
+ eExp = chart2::LegendExpansion_WIDE;
+ }
+
+ xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos ));
+ xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExp ));
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::Any());
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG )
+{
+ BOOL bEnable = m_aCbxShow.IsChecked();
+
+ m_aRbtLeft.Enable( bEnable );
+ m_aRbtTop.Enable( bEnable );
+ m_aRbtRight.Enable( bEnable );
+ m_aRbtBottom.Enable( bEnable );
+
+ m_aChangeLink.Call(NULL);
+
+ return 0;
+}
+
+void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
+{
+ SvxChartLegendPos ePos = CHLEGEND_NONE;
+
+ const SfxPoolItem* pPoolItem = NULL;
+ if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS,
+ TRUE, &pPoolItem ) != SFX_ITEM_SET )
+ pPoolItem = &(rInAttrs.GetPool()->GetDefaultItem( SCHATTR_LEGEND_POS ));
+
+ if( pPoolItem )
+ ePos = ((const SvxChartLegendPosItem*)pPoolItem)->GetValue();
+
+ switch( ePos )
+ {
+ case CHLEGEND_LEFT:
+ m_aRbtLeft.Check(TRUE);
+ break;
+ case CHLEGEND_TOP:
+ m_aRbtTop.Check(TRUE);
+ break;
+ case CHLEGEND_RIGHT:
+ m_aRbtRight.Check(TRUE);
+ break;
+ case CHLEGEND_BOTTOM:
+ m_aRbtBottom.Check(TRUE);
+ break;
+ default:
+ break;
+ }
+}
+
+void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
+{
+ SvxChartLegendPos ePos;
+
+ if( m_aRbtLeft.IsChecked() )
+ ePos = CHLEGEND_LEFT;
+ else if( m_aRbtTop.IsChecked() )
+ ePos = CHLEGEND_TOP;
+ else if( m_aRbtRight.IsChecked() )
+ ePos = CHLEGEND_RIGHT;
+ else if( m_aRbtBottom.IsChecked() )
+ ePos = CHLEGEND_BOTTOM;
+ else
+ ePos = CHLEGEND_NONE;
+
+ rOutAttrs.Put(SvxChartLegendPosItem( ePos, SCHATTR_LEGEND_POS ));
+}
+
+IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio )
+{
+ //for each radio click ther are coming two change events
+ //first uncheck of previous button -> ignore that call
+ //the second call gives the check of the new button
+ if( pRadio && pRadio->IsChecked() )
+ m_aChangeLink.Call(NULL);
+ return 0;
+}
+
+void LegendPositionResources::SetChangeHdl( const Link& rLink )
+{
+ m_aChangeLink = rLink;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.hxx b/chart2/source/controller/dialogs/res_LegendPosition.hxx
new file mode 100644
index 000000000000..ee0ac5a7601c
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_LEGENPOSITION_HXX
+#define _CHART2_RES_LEGENPOSITION_HXX
+
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendPositionResources
+{
+public:
+ //constructor without Display checkbox
+ LegendPositionResources( Window* pParent );
+ //constructor inclusive Display checkbox
+ LegendPositionResources( Window* pParent, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext>& xCC );
+ virtual ~LegendPositionResources();
+
+ void writeToResources( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ void writeToModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel ) const;
+
+
+ void initFromItemSet( const SfxItemSet& rInAttrs );
+ void writeToItemSet( SfxItemSet& rOutAttrs ) const;
+
+ void SetChangeHdl( const Link& rLink );
+
+ DECL_LINK( PositionEnableHdl, void* );
+ DECL_LINK( PositionChangeHdl, RadioButton* );
+
+private:
+ void impl_setRadioButtonToggleHdl();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ CheckBox m_aCbxShow;
+
+ RadioButton m_aRbtLeft;
+ RadioButton m_aRbtTop;
+ RadioButton m_aRbtRight;
+ RadioButton m_aRbtBottom;
+
+ Link m_aChangeLink;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc b/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc
new file mode 100644
index 000000000000..4dd46e0c9df7
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition_IDs.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CBX_SHOWLEGEND 21
+#define RBT_LEFT 22
+#define RBT_TOP 23
+#define RBT_RIGHT 24
+#define RBT_BOTTOM 25
diff --git a/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc b/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc
new file mode 100644
index 000000000000..17f6518eabe4
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_LEGEND_HXX
+#define _CHART2_RESOURCE_LEGEND_HXX
+
+#include "HelpIds.hrc"
+#include "res_LegendPosition_IDs.hrc"
+
+#define RESOURCE_LEGENDDISPLAY( xpos , ypos ) \
+CheckBox CBX_SHOWLEGEND \
+{ \
+ HelpID = HID_SCH_LEGEND_SHOW ; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 95 , 12 ) ; \
+ Text [ en-US ] = "~Display legend" ; \
+ TabStop = TRUE ; \
+};
+
+#define RESOURCE_LEGENDPOSITION( xpos , ypos ) \
+RadioButton RBT_LEFT \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_LEFT ; \
+ Pos = MAP_APPFONT ( xpos , ypos ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Left" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_RIGHT \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_RIGHT ; \
+ Pos = MAP_APPFONT ( xpos , ypos+14 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Right" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_TOP \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_TOP ; \
+ Pos = MAP_APPFONT ( xpos , ypos+28 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Top" ; \
+ TabStop = TRUE ; \
+}; \
+RadioButton RBT_BOTTOM \
+{ \
+ HelpID = HID_SCH_LEGEND_POS_BOTTOM ; \
+ Pos = MAP_APPFONT ( xpos , ypos+42 ) ; \
+ Size = MAP_APPFONT ( 75 , 10 ) ; \
+ Text [ en-US ] = "~Bottom" ; \
+ TabStop = TRUE ; \
+};
+
+// height of RESOURCE_LEGENDPOSITION - don't forget to update when this is changed
+#define RESOURCE_LEGENDPOSITION_HEIGHT 52
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc b/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc
new file mode 100644
index 000000000000..7e9609e20763
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SECONDARYAXISCHECKBOXES_HXX
+#define _CHART2_SECONDARYAXISCHECKBOXES_HXX
+
+#define SECONDARYAXISCHECKBOXES_WIDTH 42
+#define SECONDARYAXISCHECKBOXES_HEIGHT 10
+
+#define SECONDARYAXISCHECKBOXES( xpos, ypos, xOffset, yOffset ) \
+CheckBox CB_X_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_XAXIS; \
+ Pos = MAP_APPFONT ( xpos , ypos ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "X ~axis"; \
+}; \
+CheckBox CB_Y_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_YAXIS; \
+ Pos = MAP_APPFONT ( xpos+xOffset , ypos+yOffset ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Y ax~is"; \
+}; \
+CheckBox CB_Z_SECONDARY \
+{ \
+ HelpID = HID_SCH_CB_SECONDARY_ZAXIS; \
+ Pos = MAP_APPFONT ( xpos+2*xOffset , ypos+2*yOffset ); \
+ Size = MAP_APPFONT ( SECONDARYAXISCHECKBOXES_WIDTH , SECONDARYAXISCHECKBOXES_HEIGHT ); \
+ TabStop = TRUE; \
+ Text [ en-US ] = "Z axi~s"; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx
new file mode 100644
index 000000000000..45efd2f5e5b3
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_TextSeparator.hxx"
+#include "ResourceIds.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TextSeparatorResources::TextSeparatorResources( Window* pWindow )
+ : m_aFT_Separator( pWindow, pWindow->GetStyle() )
+ , m_aLB_Separator( pWindow , SchResId( LB_TEXT_SEPARATOR ) )
+ , m_aEntryMap()
+ , m_nDefaultPos(0)
+{
+ m_aFT_Separator.SetText( String( SchResId( STR_TEXT_SEPARATOR )) );
+ m_aFT_Separator.SetSizePixel( m_aFT_Separator.CalcMinimumSize() );
+
+ m_aLB_Separator.SetDropDownLineCount(m_aLB_Separator.GetEntryCount());
+ m_aLB_Separator.SetSizePixel( m_aLB_Separator.CalcMinimumSize() );
+
+ m_aEntryMap[ C2U( " " ) ] = 0;
+ m_aEntryMap[ C2U( ", " ) ] = 1;
+ m_aEntryMap[ C2U( "; " ) ] = 2;
+ m_aEntryMap[ C2U( "\n" ) ] = 3;
+}
+TextSeparatorResources::~TextSeparatorResources()
+{
+}
+void TextSeparatorResources::Show( bool bShow )
+{
+ m_aFT_Separator.Show( bShow );
+ m_aLB_Separator.Show( bShow );
+}
+void TextSeparatorResources::Enable( bool bEnable )
+{
+ m_aFT_Separator.Enable( bEnable );
+ m_aLB_Separator.Enable( bEnable );
+}
+void TextSeparatorResources::PositionBelowControl( const Window& rWindow )
+{
+ Point aPoint( rWindow.GetPosPixel() );
+ Size aSize( rWindow.GetSizePixel() );
+ aPoint.Y() += aSize.Height();
+ Size aBigDistanceSize( rWindow.LogicToPixel( Size(0,RSC_SP_CTRL_Y), MapMode(MAP_APPFONT) ) );
+ aPoint.Y() += aBigDistanceSize.Height();
+
+ Size aDistanceSize( rWindow.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, (RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2), MapMode(MAP_APPFONT) ) );
+ aPoint.Y() += aDistanceSize.Height();
+
+ m_aFT_Separator.SetPosPixel( aPoint );
+ m_aLB_Separator.SetPosPixel( Point( aPoint.X()+m_aFT_Separator.GetSizePixel().Width()+aDistanceSize.Width(), aPoint.Y()-aDistanceSize.Height()-1) );
+}
+
+void TextSeparatorResources::AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/
+ , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/
+ , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ )
+{
+ long nMinPossibleLeftBorder = m_aFT_Separator.GetPosPixel().X() + m_aFT_Separator.GetSizePixel().Width() + 1 ;
+ if( nWantedLeftBorder >= 0 && nWantedLeftBorder>nMinPossibleLeftBorder )
+ {
+ Point aPos( m_aLB_Separator.GetPosPixel() );
+ aPos.X() = nWantedLeftBorder;
+ m_aLB_Separator.SetPosPixel( aPos );
+ }
+
+ long nMinPossibleRightBorder = m_aLB_Separator.GetPosPixel().X() + m_aLB_Separator.CalcMinimumSize().Width() - 1 ;
+ if( nWantedRightBorder < m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth )
+ nWantedRightBorder = m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth;
+
+ if( nWantedRightBorder >= 0 && nWantedRightBorder > nMinPossibleRightBorder )
+ {
+ Size aSize( m_aLB_Separator.GetSizePixel() );
+ aSize.Width() = nWantedRightBorder-m_aLB_Separator.GetPosPixel().X();
+ m_aLB_Separator.SetSizePixel(aSize);
+ }
+}
+
+Point TextSeparatorResources::GetCurrentListBoxPosition() const
+{
+ return m_aLB_Separator.GetPosPixel();
+}
+
+Size TextSeparatorResources::GetCurrentListBoxSize() const
+{
+ return m_aLB_Separator.GetSizePixel();
+}
+
+void TextSeparatorResources::SetValue( const rtl::OUString& rSeparator )
+{
+ ::std::map< ::rtl::OUString, USHORT >::iterator aIter( m_aEntryMap.find(rSeparator) );
+ if( aIter == m_aEntryMap.end() )
+ m_aLB_Separator.SelectEntryPos( m_nDefaultPos );
+ else
+ m_aLB_Separator.SelectEntryPos( aIter->second );
+}
+
+void TextSeparatorResources::SetDefault()
+{
+ m_aLB_Separator.SelectEntryPos( m_nDefaultPos );
+}
+
+rtl::OUString TextSeparatorResources::GetValue() const
+{
+ USHORT nPos = m_aLB_Separator.GetSelectEntryPos();
+ ::std::map< ::rtl::OUString, USHORT >::const_iterator aIter( m_aEntryMap.begin() );
+ while( aIter != m_aEntryMap.end() )
+ {
+ if(aIter->second==nPos )
+ return aIter->first;
+ ++aIter;
+ }
+ return C2U( " " );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx
new file mode 100644
index 000000000000..4895a442fa0b
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_TEXTSEPARATOR_HXX
+#define CHART2_RES_TEXTSEPARATOR_HXX
+
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+
+#include <map>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TextSeparatorResources
+{
+public:
+ TextSeparatorResources( Window* pParent );
+ virtual ~TextSeparatorResources();
+
+ void Show( bool bShow );
+ void Enable( bool bEnable );
+
+ void PositionBelowControl( const Window& rWindow );
+ void AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/
+ , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/
+ , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ );
+ Point GetCurrentListBoxPosition() const;
+ Size GetCurrentListBoxSize() const;
+
+ ::rtl::OUString GetValue() const;
+ void SetValue( const ::rtl::OUString& rSeparator );
+ void SetDefault();
+
+private:
+ FixedText m_aFT_Separator;
+ ListBox m_aLB_Separator;
+
+ ::std::map< ::rtl::OUString, USHORT > m_aEntryMap;
+
+ const USHORT m_nDefaultPos;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.src b/chart2/source/controller/dialogs/res_TextSeparator.src
new file mode 100644
index 000000000000..c0b95ea23c7d
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_TextSeparator.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "HelpIds.hrc"
+
+ListBox LB_TEXT_SEPARATOR
+{
+ HelpID = HID_SCH_DATALABEL_SEPARATOR; \
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Space" ;
+ "Comma" ;
+ "Semicolon" ;
+ "New line" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/res_Titles.cxx b/chart2/source/controller/dialogs/res_Titles.cxx
new file mode 100644
index 000000000000..225c8fe8748b
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "res_Titles.hxx"
+#include "res_Titles.hrc"
+#include "ResId.hxx"
+#include "TitleDialogData.hxx"
+
+ #ifndef _SVT_CONTROLDIMS_HRC_
+ #include <svtools/controldims.hrc>
+ #endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TitleResources::TitleResources( Window* pWindow, bool bShowSecondaryAxesTitle )
+ : m_aFT_Main(pWindow, SchResId(FT_MAINTITLE))
+ , m_aEd_Main(pWindow, SchResId(ED_MAINTITLE))
+ , m_aFT_Sub(pWindow, SchResId(FT_SUBTITLE))
+ , m_aEd_Sub(pWindow, SchResId(ED_SUBTITLE))
+ , m_aFL_Axes(pWindow, SchResId(FL_AXES))
+ , m_aFT_XAxis(pWindow, SchResId(FT_TITLE_X_AXIS))
+ , m_aEd_XAxis(pWindow, SchResId(ED_X_AXIS))
+ , m_aFT_YAxis(pWindow, SchResId(FT_TITLE_Y_AXIS))
+ , m_aEd_YAxis(pWindow, SchResId(ED_Y_AXIS))
+ , m_aFT_ZAxis(pWindow, SchResId(FT_TITLE_Z_AXIS))
+ , m_aEd_ZAxis(pWindow, SchResId(ED_Z_AXIS))
+ , m_aFL_SecondaryAxes(pWindow, SchResId(FL_SECONDARY_AXES))
+ , m_aFT_SecondaryXAxis(pWindow, SchResId(FT_TITLE_SECONDARY_X_AXIS))
+ , m_aEd_SecondaryXAxis(pWindow, SchResId(ED_SECONDARY_X_AXIS))
+ , m_aFT_SecondaryYAxis(pWindow, SchResId(FT_TITLE_SECONDARY_Y_AXIS))
+ , m_aEd_SecondaryYAxis(pWindow, SchResId(ED_SECONDARY_Y_AXIS))
+{
+ long nMaxTextWidth = ::std::max( m_aFT_Main.CalcMinimumSize().Width(),m_aFT_Sub.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_XAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_YAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_ZAxis.CalcMinimumSize().Width() ) ;
+ if( bShowSecondaryAxesTitle )
+ {
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryXAxis.CalcMinimumSize().Width() ) ;
+ nMaxTextWidth = ::std::max( nMaxTextWidth, m_aFT_SecondaryYAxis.CalcMinimumSize().Width() ) ;
+ }
+
+ Size aControlDistance( m_aFT_Main.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nEditFieldXPos = m_aFT_Main.GetPosPixel().X() + nMaxTextWidth + aControlDistance.Width();
+ long nEditFieldWidth = m_aEd_Main.GetPosPixel().X() + m_aEd_Main.GetSizePixel().Width() - nEditFieldXPos;
+
+ if( nEditFieldWidth > 10 )
+ {
+ Size aFTSize( m_aFT_Main.GetSizePixel() );
+ aFTSize.Width() = nMaxTextWidth;
+ m_aFT_Main.SetSizePixel(aFTSize);
+ m_aFT_Sub.SetSizePixel(aFTSize);
+ m_aFT_XAxis.SetSizePixel(aFTSize);
+ m_aFT_YAxis.SetSizePixel(aFTSize);
+ m_aFT_ZAxis.SetSizePixel(aFTSize);
+ if( bShowSecondaryAxesTitle )
+ {
+ m_aFT_SecondaryXAxis.SetSizePixel(aFTSize);
+ m_aFT_SecondaryYAxis.SetSizePixel(aFTSize);
+ }
+
+ m_aEd_Main.SetPosPixel( Point( nEditFieldXPos, m_aEd_Main.GetPosPixel().Y() ) );
+ m_aEd_Sub.SetPosPixel( Point( nEditFieldXPos, m_aEd_Sub.GetPosPixel().Y() ) );
+ m_aEd_XAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_XAxis.GetPosPixel().Y() ) );
+ m_aEd_YAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_YAxis.GetPosPixel().Y() ) );
+ m_aEd_ZAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_ZAxis.GetPosPixel().Y() ) );
+ if(bShowSecondaryAxesTitle)
+ {
+ m_aEd_SecondaryXAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryXAxis.GetPosPixel().Y() ) );
+ m_aEd_SecondaryYAxis.SetPosPixel( Point( nEditFieldXPos, m_aEd_SecondaryYAxis.GetPosPixel().Y() ) );
+ }
+
+ Size aEditSize( m_aEd_Main.GetSizePixel() );
+ aEditSize.Width() = nEditFieldWidth;
+ m_aEd_Main.SetSizePixel( aEditSize );
+ m_aEd_Sub.SetSizePixel( aEditSize );
+ m_aEd_XAxis.SetSizePixel( aEditSize );
+ m_aEd_YAxis.SetSizePixel( aEditSize );
+ m_aEd_ZAxis.SetSizePixel( aEditSize );
+ if(bShowSecondaryAxesTitle)
+ {
+ m_aEd_SecondaryXAxis.SetSizePixel( aEditSize );
+ m_aEd_SecondaryYAxis.SetSizePixel( aEditSize );
+ }
+ }
+
+ m_aFT_SecondaryXAxis.Show( bShowSecondaryAxesTitle );
+ m_aEd_SecondaryXAxis.Show( bShowSecondaryAxesTitle );
+ m_aFT_SecondaryYAxis.Show( bShowSecondaryAxesTitle );
+ m_aEd_SecondaryYAxis.Show( bShowSecondaryAxesTitle );
+}
+
+TitleResources::~TitleResources()
+{
+}
+
+void TitleResources::SetUpdateDataHdl( const Link& rLink )
+{
+ ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+
+ m_aEd_Main.EnableUpdateData( nTimeout );
+ m_aEd_Main.SetUpdateDataHdl( rLink );
+
+ m_aEd_Sub.EnableUpdateData( nTimeout );
+ m_aEd_Sub.SetUpdateDataHdl( rLink );
+
+ m_aEd_XAxis.EnableUpdateData( nTimeout );
+ m_aEd_XAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_YAxis.EnableUpdateData( nTimeout );
+ m_aEd_YAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_ZAxis.EnableUpdateData( nTimeout );
+ m_aEd_ZAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_SecondaryXAxis.EnableUpdateData( nTimeout );
+ m_aEd_SecondaryXAxis.SetUpdateDataHdl( rLink );
+
+ m_aEd_SecondaryYAxis.EnableUpdateData( nTimeout );
+ m_aEd_SecondaryYAxis.SetUpdateDataHdl( rLink );
+}
+
+bool TitleResources::IsModified()
+{
+ return m_aEd_Main.IsModified()
+ || m_aEd_Sub.IsModified()
+ || m_aEd_XAxis.IsModified()
+ || m_aEd_YAxis.IsModified()
+ || m_aEd_ZAxis.IsModified()
+ || m_aEd_SecondaryXAxis.IsModified()
+ || m_aEd_SecondaryYAxis.IsModified();
+}
+
+void TitleResources::ClearModifyFlag()
+{
+ m_aEd_Main.ClearModifyFlag();
+ m_aEd_Sub.ClearModifyFlag();
+ m_aEd_XAxis.ClearModifyFlag();
+ m_aEd_YAxis.ClearModifyFlag();
+ m_aEd_ZAxis.ClearModifyFlag();
+ m_aEd_SecondaryXAxis.ClearModifyFlag();
+ m_aEd_SecondaryYAxis.ClearModifyFlag();
+}
+
+void TitleResources::writeToResources( const TitleDialogData& rInput )
+{
+ m_aFT_Main.Enable( rInput.aPossibilityList[0] );
+ m_aFT_Sub.Enable( rInput.aPossibilityList[1] );
+ m_aFT_XAxis.Enable( rInput.aPossibilityList[2] );
+ m_aFT_YAxis.Enable( rInput.aPossibilityList[3] );
+ m_aFT_ZAxis.Enable( rInput.aPossibilityList[4] );
+ m_aFT_SecondaryXAxis.Enable( rInput.aPossibilityList[5] );
+ m_aFT_SecondaryYAxis.Enable( rInput.aPossibilityList[6] );
+
+ m_aEd_Main.Enable( rInput.aPossibilityList[0] );
+ m_aEd_Sub.Enable( rInput.aPossibilityList[1] );
+ m_aEd_XAxis.Enable( rInput.aPossibilityList[2] );
+ m_aEd_YAxis.Enable( rInput.aPossibilityList[3] );
+ m_aEd_ZAxis.Enable( rInput.aPossibilityList[4] );
+ m_aEd_SecondaryXAxis.Enable( rInput.aPossibilityList[5] );
+ m_aEd_SecondaryYAxis.Enable( rInput.aPossibilityList[6] );
+
+ m_aEd_Main.SetText(rInput.aTextList[0]);
+ m_aEd_Sub.SetText(rInput.aTextList[1]);
+ m_aEd_XAxis.SetText(rInput.aTextList[2]);
+ m_aEd_YAxis.SetText(rInput.aTextList[3]);
+ m_aEd_ZAxis.SetText(rInput.aTextList[4]);
+ m_aEd_SecondaryXAxis.SetText(rInput.aTextList[5]);
+ m_aEd_SecondaryYAxis.SetText(rInput.aTextList[6]);
+}
+
+void TitleResources::readFromResources( TitleDialogData& rOutput )
+{
+ rOutput.aExistenceList[0] = static_cast<sal_Bool>(m_aEd_Main.GetText().Len()!=0);
+ rOutput.aExistenceList[1] = static_cast<sal_Bool>(m_aEd_Sub.GetText().Len()!=0);
+ rOutput.aExistenceList[2] = static_cast<sal_Bool>(m_aEd_XAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[3] = static_cast<sal_Bool>(m_aEd_YAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[4] = static_cast<sal_Bool>(m_aEd_ZAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[5] = static_cast<sal_Bool>(m_aEd_SecondaryXAxis.GetText().Len()!=0);
+ rOutput.aExistenceList[6] = static_cast<sal_Bool>(m_aEd_SecondaryYAxis.GetText().Len()!=0);
+
+ rOutput.aTextList[0] = m_aEd_Main.GetText();
+ rOutput.aTextList[1] = m_aEd_Sub.GetText();
+ rOutput.aTextList[2] = m_aEd_XAxis.GetText();
+ rOutput.aTextList[3] = m_aEd_YAxis.GetText();
+ rOutput.aTextList[4] = m_aEd_ZAxis.GetText();
+ rOutput.aTextList[5] = m_aEd_SecondaryXAxis.GetText();
+ rOutput.aTextList[6] = m_aEd_SecondaryYAxis.GetText();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/controller/dialogs/res_Titles.hrc b/chart2/source/controller/dialogs/res_Titles.hrc
new file mode 100644
index 000000000000..c66aac02014c
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_HRC
+#define _CHART2_RES_TITLES_HRC
+
+#define ED_MAINTITLE 1
+#define ED_SUBTITLE 2
+#define ED_X_AXIS 3
+#define ED_Y_AXIS 4
+#define ED_Z_AXIS 5
+#define ED_SECONDARY_X_AXIS 6
+#define ED_SECONDARY_Y_AXIS 7
+#define FT_MAINTITLE 1
+#define FT_SUBTITLE 2
+#define FT_TITLE_X_AXIS 3
+#define FT_TITLE_Y_AXIS 4
+#define FT_TITLE_Z_AXIS 5
+#define FT_TITLE_SECONDARY_X_AXIS 6
+#define FT_TITLE_SECONDARY_Y_AXIS 7
+#define FL_AXES 1
+#define FL_SECONDARY_AXES 2
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Titles.hxx b/chart2/source/controller/dialogs/res_Titles.hxx
new file mode 100644
index 000000000000..c79550dd7be1
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titles.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_HXX
+#define _CHART2_RES_TITLES_HXX
+
+#include "TitleDialogData.hxx"
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TitleResources
+{
+public:
+ TitleResources( Window* pParent, bool bShowSecondaryAxesTitle );
+ virtual ~TitleResources();
+
+ void writeToResources( const TitleDialogData& rInput );
+ void readFromResources( TitleDialogData& rOutput );
+
+ void SetUpdateDataHdl( const Link& rLink );
+ bool IsModified();
+ void ClearModifyFlag();
+
+private:
+ FixedText m_aFT_Main;
+ Edit m_aEd_Main;
+ FixedText m_aFT_Sub;
+ Edit m_aEd_Sub;
+
+ FixedLine m_aFL_Axes;
+ FixedText m_aFT_XAxis;
+ Edit m_aEd_XAxis;
+ FixedText m_aFT_YAxis;
+ Edit m_aEd_YAxis;
+ FixedText m_aFT_ZAxis;
+ Edit m_aEd_ZAxis;
+
+ FixedLine m_aFL_SecondaryAxes;
+ FixedText m_aFT_SecondaryXAxis;
+ Edit m_aEd_SecondaryXAxis;
+ FixedText m_aFT_SecondaryYAxis;
+ Edit m_aEd_SecondaryYAxis;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc b/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc
new file mode 100644
index 000000000000..c64c71d78c21
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RES_TITLES_SRC
+#define _CHART2_RES_TITLES_SRC
+
+#include "res_Titles.hrc"
+#include "HelpIds.hrc"
+
+#define TITLES_HEIGHT 12
+#define indentLabel 3
+#define fixedLinesHeight RSC_CD_FIXEDLINE_HEIGHT
+
+#define TITLES( xpos, ypos, availableWidth, indentLabel, fixedLinesHeight ) \
+Edit ED_MAINTITLE \
+{ \
+ HelpID = HID_SCH_TITLE_MAIN; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SUBTITLE \
+{ \
+ HelpID = HID_SCH_TITLE_SUB; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+TITLES_HEIGHT+4 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_X_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_X; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+2*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_Y_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_Y; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+3*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_Z_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_Z; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+4*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SECONDARY_X_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_SECONDARY_X; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+5*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+Edit ED_SECONDARY_Y_AXIS \
+{ \
+ HelpID = HID_SCH_TITLE_SECONDARY_Y; \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( xpos+indentLabel+(availableWidth-2*indentLabel-4)/2+4 , ypos+6*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ TabStop = TRUE ; \
+}; \
+FixedText FT_MAINTITLE \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Title" ; \
+}; \
+FixedText FT_SUBTITLE \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+TITLES_HEIGHT+4 ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Subtitle" ; \
+}; \
+FixedLine FL_AXES \
+{ \
+ Pos = MAP_APPFONT( xpos ,ypos+2+2*(TITLES_HEIGHT+4)+0 ); \
+ Size = MAP_APPFONT( availableWidth ,fixedLinesHeight ); \
+ Text[ en-US ] = "Axes"; \
+}; \
+FixedText FT_TITLE_X_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+2*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~X axis" ; \
+}; \
+FixedText FT_TITLE_Y_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+3*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Y axis" ; \
+}; \
+FixedText FT_TITLE_Z_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+4*(TITLES_HEIGHT+4)+4+(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "~Z axis" ; \
+}; \
+FixedLine FL_SECONDARY_AXES \
+{ \
+ Pos = MAP_APPFONT( xpos ,ypos+2+5*(TITLES_HEIGHT+4)+3+(fixedLinesHeight+3) ); \
+ Size = MAP_APPFONT( availableWidth ,fixedLinesHeight ); \
+ Text[ en-US ] = "Secondary Axes"; \
+}; \
+FixedText FT_TITLE_SECONDARY_X_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+5*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "X ~axis" ; \
+}; \
+FixedText FT_TITLE_SECONDARY_Y_AXIS \
+{ \
+ Pos = MAP_APPFONT ( xpos+indentLabel , ypos+2+6*(TITLES_HEIGHT+4)+8+2*(fixedLinesHeight+3) ) ; \
+ Size = MAP_APPFONT ( (availableWidth-2*indentLabel-4)/2 , TITLES_HEIGHT ) ; \
+ Text [ en-US ] = "Y ax~is" ; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
new file mode 100644
index 000000000000..a395d32c2efa
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "dlg_InsertTrendline.hrc"
+#include "res_Trendline.hxx"
+#include "res_Trendline_IDs.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+
+#include <vector>
+#include <algorithm>
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+namespace
+{
+template< class T >
+ long lcl_getRightEdge( T & rControl )
+{
+ return rControl.CalcMinimumSize().Width() + rControl.GetPosPixel().X() - rControl.GetParent()->GetPosPixel().X();
+}
+
+template< class T >
+ void lcl_AdjustControlSize( T & rControl )
+{
+ Size aSize( rControl.GetSizePixel());
+ aSize.setWidth( rControl.CalcMinimumSize().Width());
+ rControl.SetSizePixel( aSize );
+}
+
+void lcl_AdjustControlSize( Control & rControl, long nRightEdge )
+{
+ Size aSize( rControl.GetSizePixel());
+ Point aPosition( rControl.GetPosPixel());
+ aSize.setWidth( nRightEdge - aPosition.getX());
+ rControl.SetSizePixel( aSize );
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+enum StatTrendLine
+{
+ TRENDLINE_NONE,
+ TRENDLINE_LINE,
+ TRENDLINE_LOG,
+ TRENDLINE_EXP,
+ TRENDLINE_POW
+};
+
+TrendlineResources::TrendlineResources( Window * pParent, const SfxItemSet& rInAttrs, bool bNoneAvailable ) :
+ m_aFLType( pParent, SchResId( FL_TYPE )),
+
+ m_aRBNone( pParent, SchResId( RB_NONE )),
+ m_aRBLinear( pParent, SchResId( RB_LINEAR )),
+ m_aRBLogarithmic( pParent, SchResId( RB_LOGARITHMIC )),
+ m_aRBExponential( pParent, SchResId( RB_EXPONENTIAL )),
+ m_aRBPower( pParent, SchResId( RB_POWER )),
+
+ m_aFINone( pParent, SchResId( FI_NONE )),
+ m_aFILinear( pParent, SchResId( FI_LINEAR )),
+ m_aFILogarithmic( pParent, SchResId( FI_LOGARITHMIC )),
+ m_aFIExponential( pParent, SchResId( FI_EXPONENTIAL )),
+ m_aFIPower( pParent, SchResId( FI_POWER )),
+
+ m_aFLEquation( pParent, SchResId( FL_EQUATION )),
+ m_aCBShowEquation( pParent, SchResId( CB_SHOW_EQUATION )),
+ m_aCBShowCorrelationCoeff( pParent, SchResId( CB_SHOW_CORRELATION_COEFF )),
+ m_eTrendLineType( CHREGRESS_NONE ),
+ m_bNoneAvailable( bNoneAvailable ),
+ m_bTrendLineUnique( true )
+{
+ FillValueSets();
+
+ if( m_bNoneAvailable )
+ m_aRBNone.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ else
+ m_aRBNone.Hide();
+
+ m_aRBLinear.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBLogarithmic.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBExponential.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+ m_aRBPower.SetClickHdl( LINK(this, TrendlineResources, SelectTrendLine ));
+
+ Reset( rInAttrs );
+ UpdateControlStates();
+}
+
+TrendlineResources::~TrendlineResources()
+{}
+
+long TrendlineResources::adjustControlSizes()
+{
+ // calculate right edge
+ ::std::vector< long > aControlRightEdges;
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBNone ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBLinear ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBLogarithmic ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBExponential ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aRBPower ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aCBShowEquation ));
+ aControlRightEdges.push_back( lcl_getRightEdge( m_aCBShowCorrelationCoeff ));
+
+ lcl_AdjustControlSize( m_aRBNone );
+ lcl_AdjustControlSize( m_aRBLinear );
+ lcl_AdjustControlSize( m_aRBLogarithmic );
+ lcl_AdjustControlSize( m_aRBExponential );
+ lcl_AdjustControlSize( m_aRBPower );
+ lcl_AdjustControlSize( m_aCBShowEquation );
+ lcl_AdjustControlSize( m_aCBShowCorrelationCoeff );
+
+ // Note: FixedLine has no CalcMinimumSize, workaround: use a FixedText
+ FixedText aDummyTextCtrl( m_aFLType.GetParent());
+ aDummyTextCtrl.SetText( m_aFLType.GetText());
+ aControlRightEdges.push_back( lcl_getRightEdge( aDummyTextCtrl ));
+ aDummyTextCtrl.SetText( m_aFLEquation.GetText());
+ aControlRightEdges.push_back( lcl_getRightEdge( aDummyTextCtrl ));
+
+ long nRightEdgeOfControls = *(::std::max_element( aControlRightEdges.begin(), aControlRightEdges.end()));
+ // leave some more space after the longest text
+ nRightEdgeOfControls += m_aFLType.LogicToPixel( Size( 6, 0 ), MapMode( MAP_APPFONT )).getWidth();
+
+ lcl_AdjustControlSize( m_aFLType, nRightEdgeOfControls );
+ lcl_AdjustControlSize( m_aFLEquation, nRightEdgeOfControls );
+
+ return nRightEdgeOfControls;
+}
+
+IMPL_LINK( TrendlineResources, SelectTrendLine, RadioButton *, pRadioButton )
+{
+ if( pRadioButton == &m_aRBLinear )
+ m_eTrendLineType = CHREGRESS_LINEAR;
+ else if( pRadioButton == &m_aRBLogarithmic )
+ m_eTrendLineType = CHREGRESS_LOG;
+ else if( pRadioButton == &m_aRBExponential )
+ m_eTrendLineType = CHREGRESS_EXP;
+ else if( pRadioButton == &m_aRBPower )
+ m_eTrendLineType = CHREGRESS_POWER;
+ else if( pRadioButton == &m_aRBNone )
+ {
+ OSL_ASSERT( m_bNoneAvailable );
+ m_eTrendLineType = CHREGRESS_NONE;
+ }
+ m_bTrendLineUnique = true;
+
+ UpdateControlStates();
+
+ return 0;
+}
+
+void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
+{
+ const SfxPoolItem *pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem );
+ m_bTrendLineUnique = ( aState != SFX_ITEM_DONTCARE );
+ if( aState == SFX_ITEM_SET )
+ {
+ const SvxChartRegressItem * pItem = dynamic_cast< const SvxChartRegressItem * >( pPoolItem );
+ if( pItem )
+ m_eTrendLineType = pItem->GetValue();
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, TRUE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ m_aCBShowEquation.EnableTriState( TRUE );
+ m_aCBShowEquation.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCBShowEquation.EnableTriState( FALSE );
+ if( aState == SFX_ITEM_SET )
+ m_aCBShowEquation.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, TRUE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ m_aCBShowCorrelationCoeff.EnableTriState( TRUE );
+ m_aCBShowCorrelationCoeff.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCBShowCorrelationCoeff.EnableTriState( FALSE );
+ if( aState == SFX_ITEM_SET )
+ m_aCBShowCorrelationCoeff.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
+ }
+
+ if( m_bTrendLineUnique )
+ {
+ switch( m_eTrendLineType )
+ {
+ case CHREGRESS_LINEAR :
+ m_aRBLinear.Check();
+ break;
+ case CHREGRESS_LOG :
+ m_aRBLogarithmic.Check();
+ break;
+ case CHREGRESS_EXP :
+ m_aRBExponential.Check();
+ break;
+ case CHREGRESS_POWER :
+ m_aRBPower.Check();
+ break;
+ case CHREGRESS_NONE:
+ OSL_ASSERT( m_bNoneAvailable );
+ m_aRBNone.Check();
+ break;
+ }
+ }
+}
+
+BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
+{
+ if( m_bTrendLineUnique )
+ rOutAttrs.Put( SvxChartRegressItem( m_eTrendLineType, SCHATTR_REGRESSION_TYPE ));
+ if( m_aCBShowEquation.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_EQUATION, m_aCBShowEquation.IsChecked() ));
+ if( m_aCBShowCorrelationCoeff.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_COEFF, m_aCBShowCorrelationCoeff.IsChecked() ));
+ return TRUE;
+}
+
+void TrendlineResources::FillValueSets()
+{
+ bool bIsHighContrast = ( true && m_aFLType.GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ if( m_bNoneAvailable )
+ m_aFINone.SetImage( SELECT_IMAGE( BMP_REGRESSION_NONE ));
+ m_aFILinear.SetImage( SELECT_IMAGE( BMP_REGRESSION_LINEAR ));
+ m_aFILogarithmic.SetImage( SELECT_IMAGE( BMP_REGRESSION_LOG ));
+ m_aFIExponential.SetImage( SELECT_IMAGE( BMP_REGRESSION_EXP ));
+ m_aFIPower.SetImage( SELECT_IMAGE( BMP_REGRESSION_POWER ));
+}
+
+void TrendlineResources::UpdateControlStates()
+{
+ if( m_bNoneAvailable )
+ {
+ bool bEnableEquationControls = !m_bTrendLineUnique || (m_eTrendLineType != CHREGRESS_NONE);
+ m_aCBShowEquation.Enable( bEnableEquationControls );
+ m_aCBShowCorrelationCoeff.Enable( bEnableEquationControls );
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
new file mode 100644
index 000000000000..248a677edd21
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_TRENDLINE_HXX
+#define CHART2_RES_TRENDLINE_HXX
+
+#include <vcl/window.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/itemset.hxx>
+#include <svx/chrtitem.hxx>
+
+namespace chart
+{
+
+class TrendlineResources
+{
+public:
+ TrendlineResources( Window* pParent, const SfxItemSet& rInAttrs, bool bNoneAvailable );
+ virtual ~TrendlineResources();
+
+ void Reset(const SfxItemSet& rInAttrs);
+ BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+
+ void FillValueSets();
+
+ long adjustControlSizes();
+
+private:
+ FixedLine m_aFLType;
+ RadioButton m_aRBNone;
+ RadioButton m_aRBLinear;
+ RadioButton m_aRBLogarithmic;
+ RadioButton m_aRBExponential;
+ RadioButton m_aRBPower;
+
+ FixedImage m_aFINone;
+ FixedImage m_aFILinear;
+ FixedImage m_aFILogarithmic;
+ FixedImage m_aFIExponential;
+ FixedImage m_aFIPower;
+
+ FixedLine m_aFLEquation;
+ CheckBox m_aCBShowEquation;
+ CheckBox m_aCBShowCorrelationCoeff;
+
+ SvxChartRegress m_eTrendLineType;
+
+ bool m_bNoneAvailable;
+ bool m_bTrendLineUnique;
+
+ void UpdateControlStates();
+ DECL_LINK( SelectTrendLine, RadioButton * );
+};
+
+} // namespace chart
+
+// CHART2_RES_TRENDLINE_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/res_Trendline_IDs.hrc b/chart2/source/controller/dialogs/res_Trendline_IDs.hrc
new file mode 100644
index 000000000000..0e857742af4e
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline_IDs.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_TYPE 1
+#define FL_EQUATION 2
+
+#define FI_NONE 1
+#define FI_LINEAR 2
+#define FI_LOGARITHMIC 3
+#define FI_EXPONENTIAL 4
+#define FI_POWER 5
+
+#define RB_NONE 1
+#define RB_LINEAR 2
+#define RB_LOGARITHMIC 3
+#define RB_EXPONENTIAL 4
+#define RB_POWER 5
+
+#define CB_SHOW_EQUATION 1
+#define CB_SHOW_CORRELATION_COEFF 2
diff --git a/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
new file mode 100644
index 000000000000..734384e200d8
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_RESOURCE_TRENDLINE_HXX
+#define _CHART2_RESOURCE_TRENDLINE_HXX
+
+#include "res_Trendline_IDs.hrc"
+#include "HelpIds.hrc"
+
+#define RESOURCE_TRENDLINE(availablewidth, yoffset) \
+FixedLine FL_TYPE \
+{ \
+ Pos = MAP_APPFONT( 6 ,6 ); \
+ Size = MAP_APPFONT( availablewidth - 12 ,8 ); \
+ Text[ en-US ] = "Regression Type"; \
+}; \
+RadioButton RB_NONE \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_NONE; \
+ Pos = MAP_APPFONT( 29, 22 ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~None"; \
+}; \
+RadioButton RB_LINEAR \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_LINEAR; \
+ Pos = MAP_APPFONT( 29, 22 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~Linear"; \
+}; \
+RadioButton RB_LOGARITHMIC \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_LOGARITHMIC; \
+ Pos = MAP_APPFONT( 29, 44 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "L~ogarithmic"; \
+}; \
+RadioButton RB_EXPONENTIAL \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_EXPONENTIAL; \
+ Pos = MAP_APPFONT( 29, 66 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "E~xponential"; \
+}; \
+RadioButton RB_POWER \
+{ \
+ HelpId = HID_SCH_TRENDLINE_RB_POWER; \
+ Pos = MAP_APPFONT( 29, 88 + yoffset ); \
+ Size = MAP_APPFONT( 100, 10 ); \
+ Text[ en-US ] = "~Power"; \
+}; \
+FixedImage FI_NONE \
+{ \
+ Pos = MAP_APPFONT( 10, 18 ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_LINEAR \
+{ \
+ Pos = MAP_APPFONT( 10, 18 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_LOGARITHMIC \
+{ \
+ Pos = MAP_APPFONT( 10, 40 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_EXPONENTIAL \
+{ \
+ Pos = MAP_APPFONT( 10, 62 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedImage FI_POWER \
+{ \
+ Pos = MAP_APPFONT( 10, 84 + yoffset ); \
+ Size = MAP_APPFONT( 18, 18 ); \
+}; \
+FixedLine FL_EQUATION \
+{ \
+ Pos = MAP_APPFONT( 6, 108 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 12, 8 ); \
+ Text[ en-US ] = "Equation"; \
+}; \
+CheckBox CB_SHOW_EQUATION \
+{ \
+ HelpId = HID_SCH_TRENDLINE_SHOW_EQUATION; \
+ Pos = MAP_APPFONT( 10, 120 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 20, 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Show ~equation"; \
+}; \
+CheckBox CB_SHOW_CORRELATION_COEFF \
+{ \
+ HelpId = HID_SCH_TRENDLINE_SHOW_R_SQUARED; \
+ Pos = MAP_APPFONT( 10, 134 + yoffset ); \
+ Size = MAP_APPFONT( availablewidth - 20, 10 ); \
+ TabStop = TRUE; \
+ Text[ en-US ] = "Show ~coefficient of determination (R²)"; \
+};
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
new file mode 100644
index 000000000000..6b3b63495126
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneAppearance.hxx"
+#include "tp_3D_SceneAppearance.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "NoWarningThisInCTOR.hxx"
+#include "ChartModelHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include "macros.hxx"
+#include <rtl/math.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+struct lcl_ModelProperties
+{
+ drawing::ShadeMode m_aShadeMode;
+ sal_Int32 m_nRoundedEdges;
+ sal_Int32 m_nObjectLines;
+ ::chart::ThreeDLookScheme m_eScheme;
+
+ lcl_ModelProperties() :
+ m_nRoundedEdges(-1),
+ m_nObjectLines(-1),
+ m_eScheme(::chart::ThreeDLookScheme_Unknown)
+ {}
+};
+
+lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel > & 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( C2U("D3DSceneShadeMode")) >>= aProps.m_aShadeMode;
+ ::chart::ThreeDHelper::getRoundedEdgesAndObjectLines( xDiagram, aProps.m_nRoundedEdges, aProps.m_nObjectLines );
+ aProps.m_eScheme = ::chart::ThreeDHelper::detectScheme( xDiagram );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aProps;
+}
+
+void lcl_setShadeModeAtModel( uno::Reference< frame::XModel > & xModel, drawing::ShadeMode aShadeMode )
+{
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp(
+ ::chart::ChartModelHelper::findDiagram( xModel ), uno::UNO_QUERY_THROW );
+ xDiaProp->setPropertyValue( C2U("D3DSceneShadeMode"), uno::makeAny( aShadeMode ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define POS_3DSCHEME_SIMPLE 0
+#define POS_3DSCHEME_REALISTIC 1
+#define POS_3DSCHEME_CUSTOM 2
+
+ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
+ Window* pWindow
+ , const uno::Reference< frame::XModel > & xChartModel
+ , ControllerLockHelper & rControllerLockHelper )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEAPPEARANCE ) )
+ , m_xChartModel ( xChartModel )
+ , m_aFT_Scheme ( this, SchResId( FT_SCHEME ) )
+ , m_aLB_Scheme ( this, SchResId( LB_SCHEME ) )
+ , m_aFL_Seperator ( this, SchResId( FL_SEPERATOR ) )
+ , m_aCB_RoundedEdge ( this, SchResId( CB_ROUNDEDEDGE ) )
+ , m_aCB_Shading ( this, SchResId( CB_SHADING ) )
+ , m_aCB_ObjectLines ( this, SchResId( CB_OBJECTLINES ) )
+ , m_bUpdateOtherControls( true )
+ , m_bCommitToModel( true )
+ , m_rControllerLockHelper( rControllerLockHelper )
+{
+ FreeResource();
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_SIMPLE)),POS_3DSCHEME_SIMPLE);
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_REALISTIC)),POS_3DSCHEME_REALISTIC);
+ m_aLB_Scheme.SetDropDownLineCount(2);
+
+ m_aLB_Scheme.SetSelectHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectSchemeHdl ) );
+
+ m_aCB_RoundedEdge.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
+ m_aCB_Shading.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectShading ) );
+ m_aCB_ObjectLines.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
+
+ m_aCB_RoundedEdge.EnableTriState( TRUE );
+ m_aCB_Shading.EnableTriState( TRUE );
+ m_aCB_ObjectLines.EnableTriState( TRUE );
+
+ initControlsFromModel();
+}
+
+ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage()
+{}
+
+void ThreeD_SceneAppearance_TabPage::ActivatePage()
+{
+ updateScheme();
+}
+
+void ThreeD_SceneAppearance_TabPage::commitPendingChanges()
+{
+}
+
+void ThreeD_SceneAppearance_TabPage::applyRoundedEdgeAndObjectLinesToModel()
+{
+ if(!m_bCommitToModel)
+ return;
+
+ sal_Int32 nObjectLines = -1;
+
+ switch( m_aCB_ObjectLines.GetState())
+ {
+ case STATE_NOCHECK:
+ nObjectLines = 0;
+ break;
+ case STATE_CHECK:
+ nObjectLines = 1;
+ break;
+ case STATE_DONTKNOW:
+ nObjectLines = -1;
+ break;
+ }
+
+ sal_Int32 nCurrentRoundedEdges = -1;
+ switch( m_aCB_RoundedEdge.GetState() )
+ {
+ case STATE_NOCHECK:
+ nCurrentRoundedEdges = 0;
+ break;
+ case STATE_CHECK:
+ nCurrentRoundedEdges = 5;
+ break;
+ case STATE_DONTKNOW:
+ nCurrentRoundedEdges = -1;
+ break;
+ }
+
+ // /-- locked controllers
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+ ThreeDHelper::setRoundedEdgesAndObjectLines(
+ ::chart::ChartModelHelper::findDiagram( m_xChartModel ), nCurrentRoundedEdges, nObjectLines );
+ // \-- locked controllers
+}
+
+void ThreeD_SceneAppearance_TabPage::applyShadeModeToModel()
+{
+ if(!m_bCommitToModel)
+ return;
+
+ drawing::ShadeMode aShadeMode = drawing::ShadeMode_PHONG;
+
+ switch( m_aCB_Shading.GetState())
+ {
+ case STATE_NOCHECK:
+ aShadeMode = drawing::ShadeMode_FLAT;
+ break;
+ case STATE_CHECK:
+ aShadeMode = drawing::ShadeMode_SMOOTH;
+ break;
+ case STATE_DONTKNOW:
+ // nothing
+ break;
+ }
+
+ lcl_setShadeModeAtModel( m_xChartModel, aShadeMode );
+}
+
+void ThreeD_SceneAppearance_TabPage::initControlsFromModel()
+{
+ m_bCommitToModel = false;
+ m_bUpdateOtherControls = false;
+
+ lcl_ModelProperties aProps( lcl_getPropertiesFromModel( m_xChartModel ));
+
+ if(aProps.m_aShadeMode == drawing::ShadeMode_FLAT)
+ {
+ m_aCB_Shading.EnableTriState( FALSE );
+ m_aCB_Shading.Check(FALSE);
+ }
+ else if(aProps.m_aShadeMode == drawing::ShadeMode_SMOOTH)
+ {
+ m_aCB_Shading.EnableTriState( FALSE );
+ m_aCB_Shading.Check(TRUE);
+ }
+ else
+ {
+ m_aCB_Shading.EnableTriState( TRUE );
+ m_aCB_Shading.SetState( STATE_DONTKNOW );
+ }
+
+ if(aProps.m_nObjectLines == 0)
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_aCB_ObjectLines.Check(FALSE);
+ }
+ else if(aProps.m_nObjectLines==1)
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_aCB_ObjectLines.Check(TRUE);
+ }
+ else
+ {
+ m_aCB_ObjectLines.EnableTriState( TRUE );
+ m_aCB_ObjectLines.SetState( STATE_DONTKNOW );
+ }
+
+ if(aProps.m_nRoundedEdges >= 5)
+ {
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.Check(TRUE);
+ }
+ else if(aProps.m_nRoundedEdges<0)
+ {
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ m_aCB_RoundedEdge.EnableTriState( TRUE );
+ m_aCB_RoundedEdge.Check(FALSE);
+ }
+ m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
+
+ updateScheme();
+
+ m_bCommitToModel = true;
+ m_bUpdateOtherControls = true;
+}
+
+void ThreeD_SceneAppearance_TabPage::updateScheme()
+{
+ lcl_ModelProperties aProps( lcl_getPropertiesFromModel( m_xChartModel ));
+
+ if( m_aLB_Scheme.GetEntryCount() == (POS_3DSCHEME_CUSTOM+1) )
+ {
+ m_aLB_Scheme.RemoveEntry(POS_3DSCHEME_CUSTOM);
+ m_aLB_Scheme.SetDropDownLineCount(2);
+ }
+ switch( aProps.m_eScheme )
+ {
+ case ThreeDLookScheme_Simple:
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_SIMPLE );
+ break;
+ case ThreeDLookScheme_Realistic:
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_REALISTIC );
+ break;
+ case ThreeDLookScheme_Unknown:
+ {
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_CUSTOM)),POS_3DSCHEME_CUSTOM);
+ m_aLB_Scheme.SelectEntryPos( POS_3DSCHEME_CUSTOM );
+ m_aLB_Scheme.SetDropDownLineCount(3);
+ }
+ break;
+ }
+}
+
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, void*, EMPTYARG )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ {
+ // /-- locked controllers
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) );
+
+ if( m_aLB_Scheme.GetSelectEntryPos() == POS_3DSCHEME_REALISTIC )
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ else if( m_aLB_Scheme.GetSelectEntryPos() == POS_3DSCHEME_SIMPLE )
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
+ else
+ {
+ OSL_ENSURE( false, "Invalid Entry selected" );
+ }
+ // \-- locked controllers
+ }
+
+ // update other controls
+ initControlsFromModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectShading, void*, EMPTYARG )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ m_aCB_Shading.EnableTriState( FALSE );
+ applyShadeModeToModel();
+ updateScheme();
+ return 0;
+}
+IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, CheckBox*, pCheckBox )
+{
+ if( !m_bUpdateOtherControls )
+ return 0;
+
+ if( pCheckBox == &m_aCB_ObjectLines )
+ {
+ m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_bUpdateOtherControls = false;
+ m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
+ if(!m_aCB_RoundedEdge.IsEnabled())
+ m_aCB_RoundedEdge.Check(FALSE);
+ m_bUpdateOtherControls = true;
+ }
+ else
+ m_aCB_RoundedEdge.EnableTriState( FALSE );
+ applyRoundedEdgeAndObjectLinesToModel();
+ updateScheme();
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc
new file mode 100644
index 000000000000..e01be1c35072
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_SCHEME 1
+
+#define CB_OBJECTLINES 1
+#define CB_SHADING 2
+#define CB_ROUNDEDEDGE 3
+
+#define FL_SEPERATOR 1
+
+#define LB_SHADING 1
+#define LB_SCHEME 2
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
new file mode 100644
index 000000000000..252c5c21669b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_APPEARANCE_HXX
+#define _CHART2_TP_3D_SCENE_APPEARANCE_HXX
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ThreeD_SceneAppearance_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneAppearance_TabPage(
+ Window* pWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
+ ControllerLockHelper & rControllerLockHelper );
+ virtual ~ThreeD_SceneAppearance_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+ virtual void ActivatePage();
+
+private:
+ DECL_LINK( SelectSchemeHdl, void* );
+ DECL_LINK( SelectShading, void* );
+ DECL_LINK( SelectRoundedEdgeOrObjectLines, CheckBox* );
+
+ void initControlsFromModel();
+ void applyShadeModeToModel();
+ void applyRoundedEdgeAndObjectLinesToModel();
+ void updateScheme();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ m_xChartModel;
+
+ FixedText m_aFT_Scheme;
+ ListBox m_aLB_Scheme;
+
+ FixedLine m_aFL_Seperator;
+
+ CheckBox m_aCB_RoundedEdge;
+ CheckBox m_aCB_Shading;
+ CheckBox m_aCB_ObjectLines;
+
+ bool m_bUpdateOtherControls;
+ bool m_bCommitToModel;
+
+ ControllerLockHelper & m_rControllerLockHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src
new file mode 100644
index 000000000000..47e43e8c45b3
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneAppearance.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+
+#define WIDTH_FL 108
+#define WIDTH_LB 57
+#define WIDTH_FT 41
+
+#define HEIGHT_FL 8
+#define HEIGHT_LB 12
+#define HEIGHT_FT 10
+
+#define POS_X_0 6
+#define POS_X_1 6
+#define POS_X_2 POS_X_1+WIDTH_FT+4
+
+#define POS_Y_SCHEME 8
+#define POS_Y_SEPERATOR (POS_Y_SCHEME+13)
+
+#define POS_Y_SHADING (POS_Y_SEPERATOR+16)
+#define POS_Y_OBJECTLINES (POS_Y_SHADING+16)
+#define POS_Y_ROUNDEDEDGE (POS_Y_OBJECTLINES+16)
+
+
+TabPage TP_3D_SCENEAPPEARANCE
+{
+ HelpID = "chart2:TabPage:TP_3D_SCENEAPPEARANCE";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ FixedText FT_SCHEME
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_SCHEME ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "Sche~me" ;
+ };
+ ListBox LB_SCHEME
+ {
+ HelpID = "chart2:ListBox:TP_3D_SCENEAPPEARANCE:LB_SCHEME";
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_SCHEME-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ };
+ FixedLine FL_SEPERATOR
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_SEPERATOR ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_FL ) ;
+ };
+
+ CheckBox CB_SHADING
+ {
+ HelpID = "chart2:CheckBox:TP_3D_SCENEAPPEARANCE:CB_SHADING";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_SHADING ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Shading" ;
+ };
+ CheckBox CB_OBJECTLINES
+ {
+ HelpID = "chart2:CheckBox:TP_3D_SCENEAPPEARANCE:CB_OBJECTLINES";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_OBJECTLINES ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Object borders" ;
+ };
+ Checkbox CB_ROUNDEDEDGE
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_ROUNDEDEDGE ) ;
+ Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ;
+ Text [ en-US ] = "~Rounded edges" ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
new file mode 100644
index 000000000000..39175695a48b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneGeometry.hxx"
+#include "tp_3D_SceneGeometry.hrc"
+#include "ResId.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "BaseGFXHelper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include <rtl/math.hxx>
+#include <editeng/unoprnms.hxx>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+namespace
+{
+
+void lcl_shiftAngleToValidRange( sal_Int64& rnAngleDegree )
+{
+ //valid range: ]-180,180]
+ while( rnAngleDegree<=-180 )
+ rnAngleDegree+=360;
+ while( rnAngleDegree>180 )
+ rnAngleDegree-=360;
+}
+
+void lcl_SetMetricFieldLimits( MetricField& rField, sal_Int64 nLimit )
+{
+ rField.SetMin(-1*nLimit);
+ rField.SetFirst(-1*nLimit);
+ rField.SetMax(nLimit);
+ rField.SetLast(nLimit);
+}
+
+}
+ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( Window* pWindow
+ , const uno::Reference< beans::XPropertySet > & xSceneProperties
+ , ControllerLockHelper & rControllerLockHelper )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEGEOMETRY ) )
+ , m_xSceneProperties( xSceneProperties )
+ , m_aCbxRightAngledAxes( this, SchResId( CBX_RIGHT_ANGLED_AXES ) )
+ , m_aFtXRotation ( this, SchResId( FT_X_ROTATION ) )
+ , m_aMFXRotation ( this, SchResId( MTR_FLD_X_ROTATION ) )
+ , m_aFtYRotation ( this, SchResId( FT_Y_ROTATION ) )
+ , m_aMFYRotation ( this, SchResId( MTR_FLD_Y_ROTATION ) )
+ , m_aFtZRotation ( this, SchResId( FT_Z_ROTATION ) )
+ , m_aMFZRotation ( this, SchResId( MTR_FLD_Z_ROTATION ) )
+ , m_aCbxPerspective ( this, SchResId( CBX_PERSPECTIVE ) )
+ , m_aMFPerspective ( this, SchResId( MTR_FLD_PERSPECTIVE ) )
+ , m_nXRotation(0)
+ , m_nYRotation(0)
+ , m_nZRotation(0)
+ , m_bAngleChangePending( false )
+ , m_bPerspectiveChangePending( false )
+ , m_rControllerLockHelper( rControllerLockHelper )
+{
+ FreeResource();
+
+ double fXAngle, fYAngle, fZAngle;
+ ThreeDHelper::getRotationAngleFromDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+
+ fXAngle = BaseGFXHelper::Rad2Deg( fXAngle );
+ fYAngle = BaseGFXHelper::Rad2Deg( fYAngle );
+ fZAngle = BaseGFXHelper::Rad2Deg( fZAngle );
+
+ DBG_ASSERT( fZAngle>=-90 && fZAngle<=90, "z angle is out of valid range" );
+
+ lcl_SetMetricFieldLimits( m_aMFZRotation, 90 );
+
+ m_nXRotation = ::basegfx::fround(fXAngle*pow(10.0,m_aMFXRotation.GetDecimalDigits()));
+ m_nYRotation = ::basegfx::fround(-1.0*fYAngle*pow(10.0,m_aMFYRotation.GetDecimalDigits()));
+ m_nZRotation = ::basegfx::fround(-1.0*fZAngle*pow(10.0,m_aMFZRotation.GetDecimalDigits()));
+
+ lcl_shiftAngleToValidRange( m_nXRotation );
+ lcl_shiftAngleToValidRange( m_nYRotation );
+ lcl_shiftAngleToValidRange( m_nZRotation );
+
+ m_aMFXRotation.SetValue(m_nXRotation);
+ m_aMFYRotation.SetValue(m_nYRotation);
+ m_aMFZRotation.SetValue(m_nZRotation);
+
+ const ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+ Link aAngleChangedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged ));
+ Link aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited ));
+
+ m_aMFXRotation.EnableUpdateData( nTimeout );
+ m_aMFXRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFXRotation.SetModifyHdl( aAngleEditedLink );
+
+ m_aMFYRotation.EnableUpdateData( nTimeout );
+ m_aMFYRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFYRotation.SetModifyHdl( aAngleEditedLink );
+
+ m_aMFZRotation.EnableUpdateData( nTimeout );
+ m_aMFZRotation.SetUpdateDataHdl( aAngleChangedLink );
+ m_aMFZRotation.SetModifyHdl( aAngleEditedLink );
+
+ drawing::ProjectionMode aProjectionMode = drawing::ProjectionMode_PERSPECTIVE;
+ m_xSceneProperties->getPropertyValue( C2U("D3DScenePerspective")) >>= aProjectionMode;
+ m_aCbxPerspective.Check( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE );
+ m_aCbxPerspective.SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled ));
+
+ sal_Int32 nPerspectivePercentage = 20;
+ m_xSceneProperties->getPropertyValue( C2U("Perspective")) >>= nPerspectivePercentage;
+ m_aMFPerspective.SetValue( nPerspectivePercentage );
+
+ m_aMFPerspective.EnableUpdateData( nTimeout );
+ m_aMFPerspective.SetUpdateDataHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveChanged ) );
+ m_aMFPerspective.SetModifyHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveEdited ) );
+ m_aMFPerspective.Enable( m_aCbxPerspective.IsChecked() );
+
+
+ //RightAngledAxes
+ sal_Bool bRightAngledAxes = false;
+
+ uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY );
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ {
+ m_xSceneProperties->getPropertyValue( C2U("RightAngledAxes")) >>= bRightAngledAxes;
+ m_aCbxRightAngledAxes.SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
+ m_aCbxRightAngledAxes.Check( bRightAngledAxes );
+ }
+ else
+ {
+ m_aCbxRightAngledAxes.Enable(false);
+ }
+}
+
+ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage()
+{
+}
+
+void ThreeD_SceneGeometry_TabPage::commitPendingChanges()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ if( m_bAngleChangePending )
+ applyAnglesToModel();
+ if( m_bPerspectiveChangePending )
+ applyPerspectiveToModel();
+}
+
+void ThreeD_SceneGeometry_TabPage::applyAnglesToModel()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ double fXAngle = 0.0, fYAngle = 0.0, fZAngle = 0.0;
+
+ if( !m_aMFZRotation.IsEmptyFieldValue() )
+ m_nZRotation = m_aMFZRotation.GetValue();
+
+ fXAngle = double(m_nXRotation)/double(pow(10.0,m_aMFXRotation.GetDecimalDigits()));
+ fYAngle = double(-1.0*m_nYRotation)/double(pow(10.0,m_aMFYRotation.GetDecimalDigits()));
+ fZAngle = double(-1.0*m_nZRotation)/double(pow(10.0,m_aMFZRotation.GetDecimalDigits()));
+
+ fXAngle = BaseGFXHelper::Deg2Rad( fXAngle );
+ fYAngle = BaseGFXHelper::Deg2Rad( fYAngle );
+ fZAngle = BaseGFXHelper::Deg2Rad( fZAngle );
+
+ ThreeDHelper::setRotationAngleToDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
+
+ m_bAngleChangePending = false;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, AngleEdited, void*, EMPTYARG )
+{
+ m_nXRotation = m_aMFXRotation.GetValue();
+ m_nYRotation = m_aMFYRotation.GetValue();
+
+ m_bAngleChangePending = true;
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, AngleChanged, void*, EMPTYARG )
+{
+ applyAnglesToModel();
+ return 0;
+}
+
+void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel()
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ drawing::ProjectionMode aMode = m_aCbxPerspective.IsChecked()
+ ? drawing::ProjectionMode_PERSPECTIVE
+ : drawing::ProjectionMode_PARALLEL;
+
+ try
+ {
+ m_xSceneProperties->setPropertyValue( C2U("D3DScenePerspective"), uno::makeAny( aMode ));
+ m_xSceneProperties->setPropertyValue( C2U("Perspective"), uno::makeAny( (sal_Int32)m_aMFPerspective.GetValue() ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ m_bPerspectiveChangePending = false;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveEdited, void*, EMPTYARG )
+{
+ m_bPerspectiveChangePending = true;
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveChanged, void*, EMPTYARG )
+{
+ applyPerspectiveToModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, PerspectiveToggled, void*, EMPTYARG )
+{
+ m_aMFPerspective.Enable( m_aCbxPerspective.IsChecked() );
+ applyPerspectiveToModel();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, void*, EMPTYARG )
+{
+ ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
+
+ bool bEnableZ = !m_aCbxRightAngledAxes.IsChecked();
+ m_aFtZRotation.Enable( bEnableZ );
+ m_aMFZRotation.Enable( bEnableZ );
+ m_aMFZRotation.EnableEmptyFieldValue( !bEnableZ );
+ if( !bEnableZ )
+ {
+ m_nXRotation = m_aMFXRotation.GetValue();
+ m_nYRotation = m_aMFYRotation.GetValue();
+ m_nZRotation = m_aMFZRotation.GetValue();
+
+ m_aMFXRotation.SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nXRotation), ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes())));
+ m_aMFYRotation.SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nYRotation), ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes())));
+ m_aMFZRotation.SetEmptyFieldValue();
+
+ lcl_SetMetricFieldLimits( m_aMFXRotation, static_cast<sal_Int64>(ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()));
+ lcl_SetMetricFieldLimits( m_aMFYRotation, static_cast<sal_Int64>(ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()));
+ }
+ else
+ {
+ lcl_SetMetricFieldLimits( m_aMFXRotation, 180 );
+ lcl_SetMetricFieldLimits( m_aMFYRotation, 180 );
+
+ m_aMFXRotation.SetValue(m_nXRotation);
+ m_aMFYRotation.SetValue(m_nYRotation);
+ m_aMFZRotation.SetValue(m_nZRotation);
+ }
+
+ ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_aCbxRightAngledAxes.IsChecked(), true /*bRotateLights*/ );
+
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc
new file mode 100644
index 000000000000..e84bc84012e9
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_X_ROTATION 1
+#define FT_Y_ROTATION 2
+#define FT_Z_ROTATION 3
+
+#define MTR_FLD_X_ROTATION 1
+#define MTR_FLD_Y_ROTATION 2
+#define MTR_FLD_Z_ROTATION 3
+#define MTR_FLD_PERSPECTIVE 4
+
+#define CBX_PERSPECTIVE 1
+#define CBX_RIGHT_ANGLED_AXES 2
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
new file mode 100644
index 000000000000..95aeb7f6a02a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_GEOMETRY_HXX
+#define _CHART2_TP_3D_SCENE_GEOMETRY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class OKButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ThreeD_SceneGeometry_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneGeometry_TabPage( Window* pWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSceneProperties,
+ ControllerLockHelper & rControllerLockHelper );
+ virtual ~ThreeD_SceneGeometry_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+ // is called by timer to apply changes to model
+ DECL_LINK( AngleChanged, void* );
+ // is called immediately when a field changes
+ DECL_LINK( AngleEdited, void* );
+
+ // is called by timer to apply changes to model
+ DECL_LINK( PerspectiveChanged, void* );
+ // is called immediately when a field changes
+ DECL_LINK( PerspectiveEdited, void* );
+ DECL_LINK( PerspectiveToggled, void* );
+ DECL_LINK( RightAngledAxesToggled, void* );
+
+private:
+ void fillDialogAnglesFromModel() const;
+ void applyAnglesToModel();
+ void applyPerspectiveToModel();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xSceneProperties;
+
+ CheckBox m_aCbxRightAngledAxes;
+
+ FixedText m_aFtXRotation;
+ MetricField m_aMFXRotation;
+
+ FixedText m_aFtYRotation;
+ MetricField m_aMFYRotation;
+
+ FixedText m_aFtZRotation;
+ MetricField m_aMFZRotation;
+
+ CheckBox m_aCbxPerspective;
+ MetricField m_aMFPerspective;
+
+ //to keep old values when switching to right angled axes
+ sal_Int64 m_nXRotation;
+ sal_Int64 m_nYRotation;
+ sal_Int64 m_nZRotation;
+
+ bool m_bAngleChangePending;
+ bool m_bPerspectiveChangePending;
+
+ ControllerLockHelper & m_rControllerLockHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src
new file mode 100644
index 000000000000..733212e6652a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneGeometry.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+#include "HelpIds.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define WIDTH_FL 108
+#define WIDTH_MF 57
+#define WIDTH_FT 50
+
+#define HEIGHT_FL 8
+#define HEIGHT_MF 12
+#define HEIGHT_FT 10
+
+#define POS_X_0 6
+#define POS_X_1 6
+#define POS_X_2 POS_X_1+WIDTH_FT+4
+
+#define POS_Y_0 (8)
+#define POS_Y_1 (POS_Y_0+RSC_CD_FIXEDTEXT_HEIGHT+10)
+#define POS_Y_2 (POS_Y_1+RSC_CD_FIXEDTEXT_HEIGHT+8)
+#define POS_Y_3 (POS_Y_2+RSC_CD_FIXEDTEXT_HEIGHT+8)
+#define POS_Y_4 (POS_Y_3+RSC_CD_FIXEDTEXT_HEIGHT+12)
+
+#define CUSTOMUNITTEXT_DEGREE \
+Border = TRUE ; \
+TabStop = TRUE ; \
+Repeat = TRUE ; \
+Spin = TRUE ; \
+Minimum = -180 ; \
+Maximum = 180 ; \
+StrictFormat = TRUE ; \
+DecimalDigits = 0 ; \
+First = -180 ; \
+Last = 180 ; \
+SpinSize = 1 ; \
+Unit = FUNIT_CUSTOM ; \
+CustomUnitText [ en-US ] = " degrees" ;
+
+TabPage TP_3D_SCENEGEOMETRY
+{
+ HelpID = HID_3D_VIEW ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ CheckBox CBX_RIGHT_ANGLED_AXES
+ {
+ HelpID = "chart2:CheckBox:TP_3D_SCENEGEOMETRY:CBX_RIGHT_ANGLED_AXES";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_0 ) ;
+ Size = MAP_APPFONT ( (WIDTH_FT+WIDTH_MF) , HEIGHT_FT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Right-angled axes" ;
+ };
+ FixedText FT_X_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_1 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~X rotation" ;
+ };
+ FixedText FT_Y_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Y rotation" ;
+ };
+ FixedText FT_Z_ROTATION
+ {
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_3 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Z rotation" ;
+ };
+ MetricField MTR_FLD_X_ROTATION
+ {
+ HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_X_ROTATION";
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_1-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+ MetricField MTR_FLD_Y_ROTATION
+ {
+ HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_Y_ROTATION";
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_2-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+ MetricField MTR_FLD_Z_ROTATION
+ {
+ HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_Z_ROTATION";
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_3-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ CUSTOMUNITTEXT_DEGREE
+ };
+
+ CheckBox CBX_PERSPECTIVE
+ {
+ HelpID = "chart2:CheckBox:TP_3D_SCENEGEOMETRY:CBX_PERSPECTIVE";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_4 ) ;
+ Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Perspective" ;
+ };
+ MetricField MTR_FLD_PERSPECTIVE
+ {
+ HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_PERSPECTIVE";
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_4-2 ) ;
+ Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 0 ;
+ First = 0 ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
new file mode 100644
index 000000000000..25b379481b7e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -0,0 +1,650 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_3D_SceneIllumination.hxx"
+#include "tp_3D_SceneIllumination.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "Bitmaps.hrc"
+#include "Bitmaps_HC.hrc"
+#include "CommonConverters.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+#ifndef _SVX_DIALOGS_HRC
+#include "svx/dialogs.hrc"
+#endif
+// header for define SVX_RES
+#include <svx/dialmgr.hxx>
+#include <rtl/math.hxx>
+
+// header for class SvColorDialog
+#include <svtools/colrdlg.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+
+#include <svx/svx3ditems.hxx>
+#include <svx/svddef.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LightButton::LightButton( Window* pParent, const ResId& rResId, sal_Int32 nLightNumber )
+ : ImageButton( pParent, rResId )
+ , m_bLightOn(false)
+{
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF_H) ), BMP_COLOR_HIGHCONTRAST );
+
+ String aTipHelpStr( SchResId(STR_TIP_LIGHTSOURCE_X) );
+ rtl::OUString aTipHelp( aTipHelpStr );
+ const rtl::OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%LIGHTNUMBER" ));
+ sal_Int32 nIndex = aTipHelp.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ {
+ aTipHelp = aTipHelp.replaceAt(nIndex, aReplacementStr.getLength(),
+ rtl::OUString::valueOf( nLightNumber ) );
+ }
+ this->SetQuickHelpText( String( aTipHelp ) );
+}
+LightButton::~LightButton()
+{
+}
+void LightButton::switchLightOn(bool bOn)
+{
+ if( m_bLightOn==bOn )
+ return;
+ m_bLightOn = bOn;
+ if(m_bLightOn)
+ {
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_ON) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_ON_H) ), BMP_COLOR_HIGHCONTRAST );
+ }
+ else
+ {
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_LIGHT_OFF_H) ), BMP_COLOR_HIGHCONTRAST );
+ }
+}
+bool LightButton::isLightOn() const
+{
+ return m_bLightOn;
+}
+
+//-----------------------------------------------------------------------------
+
+ColorButton::ColorButton( Window* pParent, const ResId& rResId )
+ : ImageButton( pParent, rResId )
+{
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_COLORDLG) ), BMP_COLOR_NORMAL );
+ SetModeImage( Image( SVX_RES(RID_SVXIMAGE_COLORDLG_H) ), BMP_COLOR_HIGHCONTRAST );
+
+ this->SetQuickHelpText( String( SchResId(STR_TIP_CHOOSECOLOR) ) );
+}
+ColorButton::~ColorButton()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+struct LightSource
+{
+ long nDiffuseColor;
+ ::com::sun::star::drawing::Direction3D aDirection;
+ bool bIsEnabled;
+
+ LightSource() :
+ nDiffuseColor( 0xcccccc ),
+ aDirection( 1.0, 1.0, -1.0 ),
+ bIsEnabled( false )
+ {}
+};
+
+struct LightSourceInfo
+{
+ LightButton* pButton;
+ LightSource aLightSource;
+
+ LightSourceInfo();
+ void initButtonFromSource();
+};
+
+LightSourceInfo::LightSourceInfo()
+ : pButton(0)
+ , aLightSource()
+{
+ aLightSource.nDiffuseColor = 0xffffff; // white
+ aLightSource.aDirection = drawing::Direction3D(1,1,1);
+ aLightSource.bIsEnabled = sal_False;
+}
+void LightSourceInfo::initButtonFromSource()
+{
+ if(!pButton)
+ return;
+ pButton->SetModeImage( Image( SVX_RES( aLightSource.bIsEnabled ? RID_SVXIMAGE_LIGHT_ON : RID_SVXIMAGE_LIGHT_OFF ) ), BMP_COLOR_NORMAL );
+ pButton->SetModeImage( Image( SVX_RES( aLightSource.bIsEnabled ? RID_SVXIMAGE_LIGHT_ON_H : RID_SVXIMAGE_LIGHT_OFF_H ) ), BMP_COLOR_HIGHCONTRAST );
+}
+
+//-----------------------------------------------------------------------------
+
+namespace
+{
+ rtl::OUString lcl_makeColorName( Color rColor )
+ {
+ String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
+ aStr += String::CreateFromInt32((INT32)rColor.GetRed());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
+ aStr += String::CreateFromInt32((INT32)rColor.GetGreen());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
+ aStr += String::CreateFromInt32((INT32)rColor.GetBlue());
+ return aStr;
+ }
+ void lcl_selectColor( ColorListBox& rListBox, const Color& rColor )
+ {
+ rListBox.SetNoSelection();
+ rListBox.SelectEntry( rColor );
+ if( rListBox.GetSelectEntryCount() == 0 )
+ {
+ USHORT nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) );
+ rListBox.SelectEntryPos( nPos );
+ }
+ }
+
+ ::chart::LightSource lcl_getLightSourceFromProperties(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ sal_Int32 nIndex )
+ {
+ ::chart::LightSource aResult;
+ if( 0 <= nIndex && nIndex < 8 )
+ {
+ ::rtl::OUString aColorPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor"));
+ ::rtl::OUString aDirectionPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection"));
+ ::rtl::OUString aEnabledPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn"));
+ ::rtl::OUString aIndex( ::rtl::OUString::valueOf( nIndex + 1 ));
+
+ try
+ {
+ xSceneProperties->getPropertyValue( aColorPropertyPrefix + aIndex ) >>= aResult.nDiffuseColor;
+ xSceneProperties->getPropertyValue( aDirectionPropertyPrefix + aIndex ) >>= aResult.aDirection;
+ xSceneProperties->getPropertyValue( aEnabledPropertyPrefix + aIndex ) >>= aResult.bIsEnabled;
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ return aResult;
+ }
+
+ void lcl_setLightSource(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ const ::chart::LightSource & rLightSource,
+ sal_Int32 nIndex )
+ {
+ if( 0 <= nIndex && nIndex < 8 )
+ {
+ ::rtl::OUString aColorPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor"));
+ ::rtl::OUString aDirectionPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection"));
+ ::rtl::OUString aEnabledPropertyPrefix( RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn"));
+ ::rtl::OUString aIndex( ::rtl::OUString::valueOf( nIndex + 1 ));
+
+ try
+ {
+ xSceneProperties->setPropertyValue( aColorPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.nDiffuseColor ));
+ xSceneProperties->setPropertyValue( aDirectionPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.aDirection ));
+ xSceneProperties->setPropertyValue( aEnabledPropertyPrefix + aIndex,
+ uno::makeAny( rLightSource.bIsEnabled ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ }
+
+ Color lcl_getAmbientColor(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties )
+ {
+ sal_Int32 nResult = 0x000000;
+ try
+ {
+ xSceneProperties->getPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor"))) >>= nResult;
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ return Color( nResult );
+ }
+
+ void lcl_setAmbientColor(
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ const Color & rColor )
+ {
+ try
+ {
+ xSceneProperties->setPropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")),
+ uno::makeAny( rColor.GetColor()));
+ }
+ catch( const uno::Exception & ex )
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property Exception caught. Message: " )) +
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWindow
+ , const uno::Reference< beans::XPropertySet > & xSceneProperties
+ , const uno::Reference< frame::XModel >& xChartModel
+ , XColorTable* pColorTable )
+ : TabPage ( pWindow, SchResId( TP_3D_SCENEILLUMINATION ) )
+ , m_aFT_LightSource( this, SchResId( FT_LIGHTSOURCE ) )
+ , m_aBtn_Light1( this, SchResId( BTN_LIGHT_1 ), 1 )
+ , m_aBtn_Light2( this, SchResId( BTN_LIGHT_2 ), 2 )
+ , m_aBtn_Light3( this, SchResId( BTN_LIGHT_3 ), 3 )
+ , m_aBtn_Light4( this, SchResId( BTN_LIGHT_4 ), 4 )
+ , m_aBtn_Light5( this, SchResId( BTN_LIGHT_5 ), 5 )
+ , m_aBtn_Light6( this, SchResId( BTN_LIGHT_6 ), 6 )
+ , m_aBtn_Light7( this, SchResId( BTN_LIGHT_7 ), 7 )
+ , m_aBtn_Light8( this, SchResId( BTN_LIGHT_8 ), 8 )
+ , m_aLB_LightSource( this, SchResId( LB_LIGHTSOURCE ) )
+ , m_aBtn_LightSource_Color( this, SchResId( BTN_LIGHTSOURCE_COLOR ) )
+ , m_aFT_AmbientLight( this, SchResId( FT_AMBIENTLIGHT ) )
+ , m_aLB_AmbientLight( this, SchResId( LB_AMBIENTLIGHT ) )
+ , m_aBtn_AmbientLight_Color( this, SchResId( BTN_AMBIENT_COLOR ) )
+ , m_aCtl_Preview( this, SchResId( CTL_LIGHT_PREVIEW ) )
+ , m_pLightSourceInfoList(0)
+ , m_xSceneProperties( xSceneProperties )
+ , m_aTimerTriggeredControllerLock( xChartModel )
+ , m_bInCommitToModel( false )
+ , m_aModelChangeListener( LINK( this, ThreeD_SceneIllumination_TabPage, fillControlsFromModel ) )
+ , m_xChartModel( xChartModel )
+{
+ FreeResource();
+
+ if(pColorTable)
+ {
+ m_aLB_AmbientLight.Fill( pColorTable );
+ m_aLB_LightSource.Fill( pColorTable );
+ }
+ m_aLB_AmbientLight.SetDropDownLineCount(10);
+ m_aLB_LightSource.SetDropDownLineCount(10);
+
+ m_pLightSourceInfoList = new LightSourceInfo[8];
+ 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(0);
+
+ m_aBtn_Light1.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light2.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light3.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light4.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light5.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light6.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light7.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_aBtn_Light8.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+
+ m_aLB_AmbientLight.SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+ m_aLB_LightSource.SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+
+ m_aBtn_AmbientLight_Color.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+ m_aBtn_LightSource_Color.SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+
+ m_aCtl_Preview.SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
+ m_aCtl_Preview.SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
+
+ ClickLightSourceButtonHdl(&m_aBtn_Light2);
+
+ //m_aDelyedModelChangeTimer.SetTimeout( 4*EDIT_UPDATEDATA_TIMEOUT );
+
+ m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) );
+}
+
+ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
+{
+ delete[] m_pLightSourceInfoList;
+}
+
+void ThreeD_SceneIllumination_TabPage::commitPendingChanges()
+{
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void *, EMPTYARG )
+{
+ if( m_bInCommitToModel )//don't read own changes
+ return 0;
+
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ m_pLightSourceInfoList[nL].aLightSource = lcl_getLightSourceFromProperties( m_xSceneProperties, nL );
+ for( nL=0; nL<8; nL++)
+ m_pLightSourceInfoList[nL].initButtonFromSource();
+
+ lcl_selectColor( m_aLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
+
+ this->updatePreview();
+
+ return 0;
+}
+
+void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
+{
+ ControllerLockGuard aGuard( m_xChartModel );
+ m_bInCommitToModel = true;
+ sal_Int32 nIndex( nLightNumber );
+ lcl_setLightSource( m_xSceneProperties, m_pLightSourceInfoList[nIndex].aLightSource, nIndex );
+ m_bInCommitToModel = false;
+}
+
+void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aGuard( m_xChartModel );
+ for( sal_Int32 nL=0; nL<8; nL++)
+ applyLightSourceToModel( nL );
+ m_aTimerTriggeredControllerLock.startTimer();
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, void*, EMPTYARG )
+{
+ m_aTimerTriggeredControllerLock.startTimer();
+
+ //update m_pLightSourceInfoList from preview
+ const SfxItemSet a3DLightAttributes(m_aCtl_Preview.GetSvx3DLightControl().Get3DAttributes());
+ LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
+
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection1Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[1];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection2Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[2];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection3Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[3];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection4Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[4];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection5Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[5];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection6Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[6];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection7Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
+
+ pInfo = &m_pLightSourceInfoList[7];
+ pInfo->aLightSource.nDiffuseColor = ((const Svx3DLightcolor8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().GetColor();
+ pInfo->aLightSource.bIsEnabled = ((const Svx3DLightOnOff8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
+ pInfo->aLightSource.aDirection = B3DVectorToDirection3D(((const Svx3DLightDirection8Item&)a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
+
+ applyLightSourcesToModel();
+
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, void*, EMPTYARG )
+{
+ sal_uInt32 nLightNumber = m_aCtl_Preview.GetSvx3DLightControl().GetSelectedLight();
+ if(nLightNumber<8)
+ {
+ LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
+ if(!pButton->IsChecked())
+ ClickLightSourceButtonHdl(pButton);
+
+ applyLightSourcesToModel();
+ }
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton )
+{
+ bool bIsAmbientLight = (pButton==&m_aBtn_AmbientLight_Color);
+ ColorLB* pListBox = ( bIsAmbientLight ? &m_aLB_AmbientLight : &m_aLB_LightSource);
+
+ SvColorDialog aColorDlg( this );
+ aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
+ if( aColorDlg.Execute() == RET_OK )
+ {
+ Color aColor( aColorDlg.GetColor());
+ lcl_selectColor( *pListBox, aColor );
+ if( bIsAmbientLight )
+ {
+ m_bInCommitToModel = true;
+ lcl_setAmbientColor( m_xSceneProperties, aColor );
+ m_bInCommitToModel = false;
+ }
+ else
+ {
+ //get active lightsource:
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ if(pInfo->pButton->IsChecked())
+ break;
+ pInfo = 0;
+ }
+ if(pInfo)
+ applyLightSourceToModel( nL );
+ }
+ SelectColorHdl( pListBox );
+ }
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ColorLB*, pListBox )
+{
+ if(pListBox==&m_aLB_AmbientLight)
+ {
+ m_bInCommitToModel = true;
+ lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor().GetColor());
+ m_bInCommitToModel = false;
+ }
+ else if(pListBox==&m_aLB_LightSource)
+ {
+ //get active lightsource:
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ if(pInfo->pButton->IsChecked())
+ break;
+ pInfo = 0;
+ }
+ if(pInfo)
+ {
+ pInfo->aLightSource.nDiffuseColor = pListBox->GetSelectEntryColor().GetColor();
+ applyLightSourceToModel( nL );
+ }
+ }
+ this->updatePreview();
+ return 0;
+}
+
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, LightButton*, pButton )
+{
+ if( !pButton )
+ return 0;
+
+ LightSourceInfo* pInfo = 0;
+ sal_Int32 nL=0;
+ for( nL=0; nL<8; nL++)
+ {
+ if( m_pLightSourceInfoList[nL].pButton == pButton )
+ {
+ pInfo = &m_pLightSourceInfoList[nL];
+ break;
+ }
+ }
+
+ //update light button
+ bool bIsChecked = pButton->IsChecked();
+ if(bIsChecked)
+ {
+ pButton->switchLightOn(!pButton->isLightOn());
+ if(pInfo)
+ {
+ pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
+ applyLightSourceToModel( nL );
+ }
+ }
+ else
+ {
+ ControllerLockGuard aGuard( m_xChartModel );
+ for( nL=0; nL<8; nL++)
+ {
+ LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
+ pLightButton->Check( pLightButton == pButton );
+ }
+ }
+
+ //update color list box
+ if(pInfo)
+ {
+ lcl_selectColor( m_aLB_LightSource, pInfo->aLightSource.nDiffuseColor );
+ }
+ this->updatePreview();
+ return 0;
+}
+
+void ThreeD_SceneIllumination_TabPage::updatePreview()
+{
+ SfxItemSet aItemSet(m_aCtl_Preview.GetSvx3DLightControl().Get3DAttributes());
+ LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
+
+ // AmbientColor
+ aItemSet.Put(Svx3DAmbientcolorItem(m_aLB_AmbientLight.GetSelectEntryColor()));
+
+ aItemSet.Put(Svx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection1Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[1];
+ aItemSet.Put(Svx3DLightcolor2Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff2Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection2Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[2];
+ aItemSet.Put(Svx3DLightcolor3Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff3Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection3Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[3];
+ aItemSet.Put(Svx3DLightcolor4Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff4Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection4Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[4];
+ aItemSet.Put(Svx3DLightcolor5Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff5Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection5Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[5];
+ aItemSet.Put(Svx3DLightcolor6Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff6Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection6Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[6];
+ aItemSet.Put(Svx3DLightcolor7Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff7Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection7Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ pInfo = &m_pLightSourceInfoList[7];
+ aItemSet.Put(Svx3DLightcolor8Item(pInfo->aLightSource.nDiffuseColor));
+ aItemSet.Put(Svx3DLightOnOff8Item(pInfo->aLightSource.bIsEnabled));
+ aItemSet.Put(Svx3DLightDirection8Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
+
+ // set lights and ambient light
+ m_aCtl_Preview.GetSvx3DLightControl().Set3DAttributes(aItemSet);
+
+ // select light
+ for(sal_uInt32 a(0); a < 8; a++)
+ {
+ if(m_pLightSourceInfoList[a].pButton->IsChecked())
+ {
+ m_aCtl_Preview.GetSvx3DLightControl().SelectLight(a);
+ m_aCtl_Preview.CheckSelection();
+ break;
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc
new file mode 100644
index 000000000000..e2d031955867
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+
+#define FT_AMBIENTLIGHT 1
+#define FT_LIGHTSOURCE 2
+
+#define LB_AMBIENTLIGHT 1
+#define LB_LIGHTSOURCE 2
+
+#define BTN_AMBIENT_COLOR 1
+#define BTN_LIGHTSOURCE_COLOR 2
+#define BTN_LIGHT_1 3
+#define BTN_LIGHT_2 4
+#define BTN_LIGHT_3 5
+#define BTN_LIGHT_4 6
+#define BTN_LIGHT_5 7
+#define BTN_LIGHT_6 8
+#define BTN_LIGHT_7 9
+#define BTN_LIGHT_8 10
+
+#define CTL_LIGHT_PREVIEW 1
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
new file mode 100644
index 000000000000..8c104187797e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_3D_SCENE_ILLUMIMATION_HXX
+#define _CHART2_TP_3D_SCENE_ILLUMIMATION_HXX
+
+#include "ModifyListenerCallBack.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+
+// #ifndef _COM_SUN_STAR_CHART2_SCENEDESCRIPTOR_HPP_
+// #include <com/sun/star/chart2/SceneDescriptor.hpp>
+// #endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+// header for class TabPage
+#include <vcl/tabpage.hxx>
+// header for class FixedText
+#include <vcl/fixed.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class ColorLB
+#include <svx/dlgctrl.hxx>
+// header for class SvxLightCtl3D
+#include <svx/dlgctl3d.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LightButton : public ImageButton
+{
+public:
+ LightButton( Window* pParent, const ResId& rResId, sal_Int32 nLightNumber );
+ virtual ~LightButton();
+
+ void switchLightOn(bool bOn);
+ bool isLightOn() const;
+
+private:
+ bool m_bLightOn;
+};
+
+class ColorButton : public ImageButton
+{
+public:
+ ColorButton( Window* pParent, const ResId& rResId );
+ virtual ~ColorButton();
+};
+
+struct LightSourceInfo;
+
+class ThreeD_SceneIllumination_TabPage : public TabPage
+{
+public:
+ ThreeD_SceneIllumination_TabPage(
+ Window* pWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSceneProperties,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
+ XColorTable* pColorTable=0 );
+ virtual ~ThreeD_SceneIllumination_TabPage();
+
+ // has to be called in case the dialog was closed with OK
+ void commitPendingChanges();
+
+private:
+ DECL_LINK( ClickLightSourceButtonHdl, LightButton* );
+ DECL_LINK( SelectColorHdl, ColorLB* );
+ DECL_LINK( ColorDialogHdl, Button* );
+ DECL_LINK( PreviewChangeHdl, void* );
+ DECL_LINK( PreviewSelectHdl, void* );
+
+ void updatePreview();
+
+private:
+ DECL_LINK(fillControlsFromModel, void *);
+
+ void applyLightSourceToModel( sal_uInt32 nLightNumber );
+ void applyLightSourcesToModel();
+
+ FixedText m_aFT_LightSource;
+
+ 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;
+
+ ColorLB m_aLB_LightSource;
+ ColorButton m_aBtn_LightSource_Color;
+
+ FixedText m_aFT_AmbientLight;
+ ColorLB m_aLB_AmbientLight;
+ ColorButton m_aBtn_AmbientLight_Color;
+
+ SvxLightCtl3D m_aCtl_Preview;
+
+ LightSourceInfo* m_pLightSourceInfoList;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xSceneProperties;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+
+ bool m_bInCommitToModel;
+
+ ModifyListenerCallBack m_aModelChangeListener;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src
new file mode 100644
index 000000000000..0b052f4d00c6
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_3D_SceneIllumination.hrc"
+#include "dlg_View3D.hrc"
+#include "SchSlotIds.hxx"
+
+#define WIDTH_HEAD 108
+#define WIDTH_FT 41
+#define WIDTH_LB 57
+#define WIDTH_IB 12
+#define BUTTON_DISTANCE 14
+
+#define HEIGHT_IB 12
+#define HEIGHT_FT 10
+#define HEIGHT_LB 12
+
+#define POS_X_0 6
+#define POS_X_1 (POS_X_0+WIDTH_LB+4)
+#define POS_X_2 (POS_X_1+WIDTH_IB+6)
+
+#define WIDTH_PREVIEW (VIEW3D_PAGE_WIDTH-POS_X_2-6)
+
+#define POS_Y_LIGHTSOURCE_HEAD 3
+#define POS_Y_LIGHTSOURCE_BUTTONS (POS_Y_LIGHTSOURCE_HEAD+12)
+#define POS_Y_LIGHTSOURCE_BUTTONS_2 (POS_Y_LIGHTSOURCE_BUTTONS+HEIGHT_IB+2)
+#define POS_Y_LIGHTSOURCE (POS_Y_LIGHTSOURCE_BUTTONS_2+16)
+
+#define POS_Y_AMBIENT_HEAD (POS_Y_LIGHTSOURCE+18)
+#define POS_Y_AMBIENT (POS_Y_AMBIENT_HEAD+12)
+
+#define POS_Y_PREVIEW POS_Y_LIGHTSOURCE_BUTTONS
+
+#define HEIGHT_PREVIEW POS_Y_AMBIENT+HEIGHT_LB-POS_Y_PREVIEW
+
+TabPage TP_3D_SCENEILLUMINATION
+{
+ HelpID = "chart2:TabPage:TP_3D_SCENEILLUMINATION";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( VIEW3D_PAGE_WIDTH , VIEW3D_PAGE_HEIGHT ) ;
+
+ FixedText FT_LIGHTSOURCE
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_HEAD ) ;
+ Size = MAP_APPFONT ( WIDTH_HEAD , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Light source" ;
+ };
+ ImageButton BTN_LIGHT_1
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_1";
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_2
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_2";
+ Pos = MAP_APPFONT ( POS_X_0+BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_3
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_3";
+ Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_4
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_4";
+ Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_5
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_5";
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_6
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_6";
+ Pos = MAP_APPFONT ( POS_X_0+1*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_7
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_7";
+ Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ImageButton BTN_LIGHT_8
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_8";
+ Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ };
+ ListBox LB_LIGHTSOURCE
+ {
+ HelpID = "chart2:ListBox:TP_3D_SCENEILLUMINATION:LB_LIGHTSOURCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_LIGHTSOURCE_COLOR
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHTSOURCE_COLOR";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_LIGHTSOURCE ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ TabStop = TRUE ;
+ };
+
+
+
+
+ FixedText FT_AMBIENTLIGHT
+ {
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_AMBIENT_HEAD ) ;
+ Size = MAP_APPFONT ( WIDTH_HEAD , HEIGHT_FT ) ;
+ Text [ en-US ] = "~Ambient light" ;
+ };
+ ListBox LB_AMBIENTLIGHT
+ {
+ HelpID = "chart2:ListBox:TP_3D_SCENEILLUMINATION:LB_AMBIENTLIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_0 , POS_Y_AMBIENT ) ;
+ Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_AMBIENT_COLOR
+ {
+ HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_AMBIENT_COLOR";
+ Pos = MAP_APPFONT ( POS_X_1 , POS_Y_AMBIENT ) ;
+ Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ;
+ TabStop = TRUE ;
+ };
+
+
+
+ Control CTL_LIGHT_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_2 , POS_Y_PREVIEW ) ;
+ Size = MAP_APPFONT ( WIDTH_PREVIEW , HEIGHT_PREVIEW ) ;
+ TabStop = TRUE ;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
new file mode 100644
index 000000000000..3dcaa3092e57
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_AxisLabel.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for SvxChartTextOrientItem / SvxChartTextOrderItem
+#include <svx/chrtitem.hxx>
+
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_AXIS_LABEL ), rInAttrs ),
+
+ aCbShowDescription( this, SchResId( CB_AXIS_LABEL_SCHOW_DESCR ) ),
+
+ aFlOrder( this, SchResId( FL_AXIS_LABEL_ORDER ) ),
+ aRbSideBySide( this, SchResId( RB_AXIS_LABEL_SIDEBYSIDE ) ),
+ aRbUpDown( this, SchResId( RB_AXIS_LABEL_UPDOWN ) ),
+ aRbDownUp( this, SchResId( RB_AXIS_LABEL_DOWNUP ) ),
+ aRbAuto( this, SchResId( RB_AXIS_LABEL_AUTOORDER ) ),
+
+ aFlSeparator( this, SchResId( FL_SEPARATOR ) ),
+ aFlTextFlow( this, SchResId( FL_AXIS_LABEL_TEXTFLOW ) ),
+ aCbTextOverlap( this, SchResId( CB_AXIS_LABEL_TEXTOVERLAP ) ),
+ aCbTextBreak( this, SchResId( CB_AXIS_LABEL_TEXTBREAK ) ),
+
+ aFlOrient( this, SchResId( FL_AXIS_LABEL_ORIENTATION ) ),
+ aCtrlDial( this, SchResId( CT_AXIS_LABEL_DIAL ) ),
+ aFtRotate( this, SchResId( FT_AXIS_LABEL_DEGREES ) ),
+ aNfRotate( this, SchResId( NF_AXIS_LABEL_ORIENT ) ),
+ aCbStacked( this, SchResId( PB_AXIS_LABEL_TEXTSTACKED ) ),
+ aOrientHlp( aCtrlDial, aNfRotate, aCbStacked ),
+
+ m_aFtTextDirection( this, SchResId( FT_AXIS_TEXTDIR ) ),
+ m_aLbTextDirection( this, SchResId( LB_AXIS_TEXTDIR ), &m_aFtTextDirection ),
+
+ m_bShowStaggeringControls( true ),
+
+ m_nInitialDegrees( 0 ),
+ m_bHasInitialDegrees( true ),
+ m_bInitialStacking( false ),
+ m_bHasInitialStacking( true )
+{
+ FreeResource();
+
+ aCbStacked.EnableTriState( FALSE );
+ aOrientHlp.AddDependentWindow( aFlOrient );
+ aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
+
+ aCbShowDescription.SetClickHdl( LINK( this, SchAxisLabelTabPage, ToggleShowLabel ) );
+
+ // Make the fixed line separator vertical.
+ aFlSeparator.SetStyle (aFlSeparator.GetStyle() | WB_VERT);
+
+ Construct();
+}
+
+SchAxisLabelTabPage::~SchAxisLabelTabPage()
+{}
+
+void SchAxisLabelTabPage::Construct()
+{
+}
+
+
+SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAttrs )
+{
+ return new SchAxisLabelTabPage( pParent, rAttrs );
+}
+
+BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ bool bStacked = false;
+ if( aOrientHlp.GetStackedState() != STATE_DONTKNOW )
+ {
+ bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
+ if( !m_bHasInitialStacking || (bStacked != m_bInitialStacking) )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
+ }
+
+ if( aCtrlDial.HasRotation() )
+ {
+ sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
+ if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+ }
+
+ if( m_bShowStaggeringControls )
+ {
+ SvxChartTextOrder eOrder = CHTXTORDER_SIDEBYSIDE;
+ bool bRadioButtonChecked = true;
+
+ if( aRbUpDown.IsChecked())
+ eOrder = CHTXTORDER_UPDOWN;
+ else if( aRbDownUp.IsChecked())
+ eOrder = CHTXTORDER_DOWNUP;
+ else if( aRbAuto.IsChecked())
+ eOrder = CHTXTORDER_AUTO;
+ else if( aRbSideBySide.IsChecked())
+ eOrder = CHTXTORDER_SIDEBYSIDE;
+ else
+ bRadioButtonChecked = false;
+
+ if( bRadioButtonChecked )
+ rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_TEXT_ORDER ));
+ }
+
+ if( aCbTextOverlap.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_OVERLAP, aCbTextOverlap.IsChecked() ) );
+ if( aCbTextBreak.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXTBREAK, aCbTextBreak.IsChecked() ) );
+ if( aCbShowDescription.GetState() != STATE_DONTKNOW )
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, aCbShowDescription.IsChecked() ) );
+
+ if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
+
+ return TRUE;
+}
+
+void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ const SfxPoolItem* pPoolItem = NULL;
+ SfxItemState aState = SFX_ITEM_UNKNOWN;
+
+ // show description ----------
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbShowDescription.EnableTriState( TRUE );
+ aCbShowDescription.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbShowDescription.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbShowDescription.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ aCbShowDescription.Hide();
+ }
+
+ // Rotation as orient item or in degrees ----------
+
+ // check new degree item
+ m_nInitialDegrees = 0;
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+
+ m_bHasInitialDegrees = aState != SFX_ITEM_DONTCARE;
+ if( m_bHasInitialDegrees )
+ aCtrlDial.SetRotation( m_nInitialDegrees );
+ else
+ aCtrlDial.SetNoRotation();
+
+ // check stacked item
+ m_bInitialStacking = false;
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+
+ m_bHasInitialStacking = aState != SFX_ITEM_DONTCARE;
+ if( m_bHasInitialDegrees )
+ aOrientHlp.SetStackedState( m_bInitialStacking ? STATE_CHECK : STATE_NOCHECK );
+ else
+ aOrientHlp.SetStackedState( STATE_DONTKNOW );
+
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+
+ // Text overlap ----------
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbTextOverlap.EnableTriState( TRUE );
+ aCbTextOverlap.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbTextOverlap.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbTextOverlap.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ aCbTextOverlap.Hide();
+ }
+
+ // text break ----------
+ aState = rInAttrs.GetItemState( SCHATTR_TEXTBREAK, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_DONTCARE )
+ {
+ aCbTextBreak.EnableTriState( TRUE );
+ aCbTextBreak.SetState( STATE_DONTKNOW );
+ }
+ else
+ {
+ aCbTextBreak.EnableTriState( FALSE );
+ BOOL bCheck = FALSE;
+ if( aState == SFX_ITEM_SET )
+ bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCbTextBreak.Check( bCheck );
+
+ if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
+ {
+ aCbTextBreak.Hide();
+ if( ! aCbTextOverlap.IsVisible() )
+ aFlTextFlow.Hide();
+ }
+ }
+
+ // text order ----------
+ if( m_bShowStaggeringControls )
+ {
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_ORDER, FALSE, &pPoolItem );
+ if( aState == SFX_ITEM_SET )
+ {
+ SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
+
+ switch( eOrder )
+ {
+ case CHTXTORDER_SIDEBYSIDE:
+ aRbSideBySide.Check();
+ break;
+ case CHTXTORDER_UPDOWN:
+ aRbUpDown.Check();
+ break;
+ case CHTXTORDER_DOWNUP:
+ aRbDownUp.Check();
+ break;
+ case CHTXTORDER_AUTO:
+ aRbAuto.Check();
+ break;
+ }
+ }
+ }
+
+ ToggleShowLabel( (void*)0 );
+}
+
+void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls )
+{
+ m_bShowStaggeringControls = bShowStaggeringControls;
+
+ if( !m_bShowStaggeringControls )
+ {
+ aRbSideBySide.Hide();
+ aRbUpDown.Hide();
+ aRbDownUp.Hide();
+ aRbAuto.Hide();
+ aFlOrder.Hide();
+ }
+}
+
+// event handling routines
+// -----------------------
+
+IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG )
+{
+ BOOL bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK );
+
+ aOrientHlp.Enable( bEnable );
+ aFlOrder.Enable( bEnable );
+ aRbSideBySide.Enable( bEnable );
+ aRbUpDown.Enable( bEnable );
+ aRbDownUp.Enable( bEnable );
+ aRbAuto.Enable( bEnable );
+
+ aFlTextFlow.Enable( bEnable );
+ aCbTextOverlap.Enable( bEnable );
+ aCbTextBreak.Enable( bEnable );
+
+ m_aFtTextDirection.Enable( bEnable );
+ m_aLbTextDirection.Enable( bEnable );
+
+ return 0L;
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
new file mode 100644
index 000000000000..6043b16001ac
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_AXISLABEL_HXX
+#define _CHART2_TP_AXISLABEL_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svx/dialcontrol.hxx>
+#include <svx/wrapfield.hxx>
+#include <svx/orienthelper.hxx>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class SchAxisLabelTabPage : public SfxTabPage
+{
+private:
+ CheckBox aCbShowDescription;
+
+ FixedLine aFlOrder;
+ RadioButton aRbSideBySide;
+ RadioButton aRbUpDown;
+ RadioButton aRbDownUp;
+ RadioButton aRbAuto;
+
+ FixedLine aFlSeparator;
+ FixedLine aFlTextFlow;
+ CheckBox aCbTextOverlap;
+ CheckBox aCbTextBreak;
+
+ FixedLine aFlOrient;
+ svx::DialControl aCtrlDial;
+ FixedText aFtRotate;
+ svx::WrapField aNfRotate;
+ TriStateBox aCbStacked;
+ svx::OrientationHelper aOrientHlp;
+
+ FixedText m_aFtTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
+
+ BOOL m_bShowStaggeringControls;
+
+ sal_Int32 m_nInitialDegrees;
+ bool m_bHasInitialDegrees; /// false = DialControl in tristate
+ bool m_bInitialStacking;
+ bool m_bHasInitialStacking; /// false = checkbox in tristate
+
+ DECL_LINK ( ToggleShowLabel, void* );
+
+public:
+ SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~SchAxisLabelTabPage();
+
+ void Construct();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ void ShowStaggeringControls( BOOL bShowStaggeringControls );
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.src b/chart2/source/controller/dialogs/tp_AxisLabel.src
new file mode 100644
index 000000000000..75da7dc5e653
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.src
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_AXIS_LABEL
+{
+ HelpID = HID_SCH_TP_AXIS_LABEL;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+
+ CheckBox CB_AXIS_LABEL_SCHOW_DESCR
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_SCHOW_DESCR";
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+
+ Text [ en-US ] = "Sho~w labels";
+ };
+
+ FixedLine FL_AXIS_LABEL_ORIENTATION
+ {
+ Pos = MAP_APPFONT ( 6 , 91 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+
+ Text [ en-US ] = "Text orientation" ;
+ };
+ Control CT_AXIS_LABEL_DIAL
+ {
+ HelpId = HID_SCH_ALIGNMENT_CTR_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ Text = "ABCD" ;
+ };
+ TriStateBox PB_AXIS_LABEL_TEXTSTACKED
+ {
+ HelpId = HID_SCH_ALIGNMENT_STACKED ;
+ Pos = MAP_APPFONT ( 139 , 105 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ve~rtically stacked";
+ };
+ FixedText FT_AXIS_LABEL_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 122 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_AXIS_LABEL_ORIENT
+ {
+ HelpId = HID_SCH_ALIGNMENT_DEGREES ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 61 , 120 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ SpinSize = 5 ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ };
+ FixedText FT_UNUSED
+ {
+ //only necessary for constructor of SvxWinOrientation
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 117 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ };
+ Control CT_UNUSED
+ {
+ //only necessary for constructor of SvxWinOrientation
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 128 , 33 ) ;
+ Size = MAP_APPFONT ( 4 , 52 ) ;
+ };
+
+ FixedLine FL_AXIS_LABEL_TEXTFLOW
+ {
+ Pos = MAP_APPFONT ( 133 , 22 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+
+ Text [ en-US ] = "Text flow" ;
+ };
+ CheckBox CB_AXIS_LABEL_TEXTOVERLAP
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_TEXTOVERLAP";
+ Pos = MAP_APPFONT ( 139 , 33 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "O~verlap" ;
+ };
+ CheckBox CB_AXIS_LABEL_TEXTBREAK
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_TEXTBREAK";
+ Pos = MAP_APPFONT ( 139 , 47 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "~Break" ;
+ };
+
+
+ FixedLine FL_AXIS_LABEL_ORDER
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+
+ Text [ en-US ] = "Order" ;
+ };
+ RadioButton RB_AXIS_LABEL_SIDEBYSIDE
+ {
+ HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_SIDEBYSIDE";
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "~Tile" ;
+ };
+ RadioButton RB_AXIS_LABEL_UPDOWN
+ {
+ HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_UPDOWN";
+ Pos = MAP_APPFONT ( 12 , 47 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "St~agger odd" ;
+ };
+ RadioButton RB_AXIS_LABEL_DOWNUP
+ {
+ HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_DOWNUP";
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "Stagger ~even" ;
+ };
+ RadioButton RB_AXIS_LABEL_AUTOORDER
+ {
+ HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_AUTOORDER";
+ Pos = MAP_APPFONT ( 12 , 75 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ TabStop = TRUE ;
+
+ Text [ en-US ] = "A~utomatic" ;
+ };
+
+ FixedText FT_AXIS_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 156 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_AXIS_TEXTDIR
+ {
+ HelpID = "chart2:ListBox:TP_AXIS_LABEL:LB_AXIS_TEXTDIR";
+ Pos = MAP_APPFONT ( 78 , 154 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
new file mode 100644
index 000000000000..ab4e36ff1f84
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_AxisPositions.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "Strings.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "AxisHelper.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <rtl/math.hxx>
+// header for class SvxDoubleItem
+#include <svx/chrtitem.hxx>
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+
+// header for class WarningBox
+#include <vcl/msgbox.hxx>
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+void lcl_newXPos( Control& rControl, long nXPos )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.X() = nXPos;
+ rControl.SetPosPixel(aPos);
+}
+
+void lcl_shiftY( Control& rControl, long nYDiff )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.Y() += nYDiff;
+ rControl.SetPosPixel(aPos);
+}
+
+}
+
+AxisPositionsTabPage::AxisPositionsTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, SchResId(TP_AXIS_POSITIONS), rInAttrs)
+
+ , m_aFL_AxisLine(this,SchResId(FL_AXIS_LINE))
+ , m_aFT_CrossesAt(this,SchResId(FT_CROSSES_OTHER_AXIS_AT))
+ , m_aLB_CrossesAt(this,SchResId(LB_CROSSES_OTHER_AXIS_AT))
+ , m_aED_CrossesAt(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT))
+ , m_aED_CrossesAtCategory(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT_CATEGORY))
+ , m_aCB_AxisBetweenCategories(this, SchResId(CB_AXIS_BETWEEN_CATEGORIES))
+
+ , m_aFL_Labels(this,SchResId(FL_LABELS))
+ , m_aFT_PlaceLabels( this, SchResId( FT_PLACE_LABELS ) )
+ , m_aLB_PlaceLabels( this, SchResId( LB_PLACE_LABELS ) )
+ , m_aFT_LabelDistance( this, SchResId( FT_AXIS_LABEL_DISTANCE ) )
+ , m_aED_LabelDistance( this, SchResId( EDT_AXIS_LABEL_DISTANCE ) )
+
+ , m_aFL_Ticks(this,SchResId(FL_TICKS))
+ , m_aFT_Major(this,SchResId(FT_MAJOR))
+ , m_aCB_TicksInner(this,SchResId(CB_TICKS_INNER))
+ , m_aCB_TicksOuter(this,SchResId(CB_TICKS_OUTER))
+ , m_aFT_Minor(this,SchResId(FT_MINOR))
+ , m_aCB_MinorInner(this,SchResId(CB_MINOR_INNER))
+ , m_aCB_MinorOuter(this,SchResId(CB_MINOR_OUTER))
+
+ , m_aFL_Vertical(this,SchResId(FL_VERTICAL))
+ , m_aFT_PlaceTicks(this,SchResId(FT_PLACE_TICKS))
+ , m_aLB_PlaceTicks(this,SchResId(LB_PLACE_TICKS))
+
+ , m_aFL_Grids(this,SchResId(FL_GRIDS))
+ , m_aCB_MajorGrid(this,SchResId(CB_MAJOR_GRID))
+ , m_aPB_MajorGrid(this,SchResId(PB_MAJOR_GRID))
+ , m_aCB_MinorGrid(this,SchResId(CB_MINOR_GRID))
+ , m_aPB_MinorGrid(this,SchResId(PB_MINOR_GRID))
+
+ , m_pNumFormatter(NULL)
+ , m_bCrossingAxisIsCategoryAxis(false)
+ , m_aCategories()
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ const long nDialogWidth = GetSizePixel().Width();
+ const long nDistance = LogicToPixel( Size(RSC_SP_CTRL_X, 0), MapMode(MAP_APPFONT) ).Width();
+
+ //axis line controls
+ {
+ if( m_aFT_CrossesAt.CalcMinimumSize().Width() < m_aFT_CrossesAt.GetSizePixel().Width() )
+ {
+ m_aFT_CrossesAt.SetSizePixel(m_aFT_CrossesAt.CalcMinimumSize());
+ long nXPos = m_aFT_CrossesAt.GetPosPixel().X() + m_aFT_CrossesAt.GetSizePixel().Width() + nDistance;
+ lcl_newXPos( m_aLB_CrossesAt, nXPos );
+
+ nXPos += m_aLB_CrossesAt.GetSizePixel().Width() + nDistance;
+ lcl_newXPos( m_aED_CrossesAt, nXPos );
+ lcl_newXPos( m_aED_CrossesAtCategory, nXPos );
+ }
+ }
+
+ long nFixTextHeight = m_aFT_PlaceLabels.GetSizePixel().Height();
+ long nLabelPlacementWidth = m_aFT_PlaceLabels.CalcMinimumSize().Width();
+ long nMarkPlacementWidth = m_aFT_PlaceTicks.CalcMinimumSize().Width();
+
+
+ long nWidth_0 = ::std::max( m_aFT_Major.CalcMinimumSize().Width(), m_aFT_Minor.CalcMinimumSize().Width() );
+ nWidth_0 = ::std::max( nWidth_0, nLabelPlacementWidth );
+ nWidth_0 = ::std::max( nWidth_0, nMarkPlacementWidth );
+ nLabelPlacementWidth = nMarkPlacementWidth = nWidth_0;
+
+ //label placement
+ {
+ m_aFT_PlaceLabels.SetSizePixel( Size( nLabelPlacementWidth, nFixTextHeight ) );
+ long nXPos = m_aFT_PlaceLabels.GetPosPixel().X() + nLabelPlacementWidth + nDistance;
+ lcl_newXPos( m_aLB_PlaceLabels, nXPos );
+ m_aLB_PlaceLabels.SetSizePixel(m_aLB_PlaceLabels.CalcMinimumSize());
+ }
+
+ //tickmark placement
+ {
+ m_aFT_PlaceTicks.SetSizePixel( Size( nMarkPlacementWidth, nFixTextHeight ) );
+ long nXPos = m_aFT_PlaceTicks.GetPosPixel().X() + nMarkPlacementWidth + nDistance;
+ lcl_newXPos( m_aLB_PlaceTicks, nXPos );
+ m_aLB_PlaceTicks.SetSizePixel( m_aLB_PlaceTicks.CalcMinimumSize() );
+ }
+
+ //tickmark controls
+ {
+ long nWidth_1 = ::std::max( m_aCB_TicksInner.CalcMinimumSize().Width(), m_aCB_MinorInner.CalcMinimumSize().Width() );
+ long nWidth_2 = ::std::max( m_aCB_TicksOuter.CalcMinimumSize().Width(), m_aCB_MinorOuter.CalcMinimumSize().Width() );
+
+ long nLeftSpace = nDialogWidth - nWidth_0 - nWidth_1 - nWidth_2 - 3*nDistance;
+
+ if(nLeftSpace>=0)
+ {
+ m_aFT_Major.SetSizePixel(m_aFT_Major.CalcMinimumSize());
+ m_aFT_Minor.SetSizePixel(m_aFT_Minor.CalcMinimumSize());
+
+ m_aCB_TicksInner.SetSizePixel( m_aCB_TicksInner.CalcMinimumSize() );
+ m_aCB_MinorInner.SetSizePixel( m_aCB_MinorInner.CalcMinimumSize() );
+
+ m_aCB_TicksOuter.SetSizePixel( m_aCB_TicksOuter.CalcMinimumSize() );
+ m_aCB_MinorOuter.SetSizePixel( m_aCB_MinorOuter.CalcMinimumSize() );
+
+ long nXPos = m_aFT_Major.GetPosPixel().X() + nWidth_0 + nDistance;
+ lcl_newXPos( m_aCB_TicksInner, nXPos );
+ lcl_newXPos( m_aCB_MinorInner, nXPos );
+
+ nXPos += nWidth_1 + nDistance;
+ lcl_newXPos( m_aCB_TicksOuter, nXPos );
+ lcl_newXPos( m_aCB_MinorOuter, nXPos );
+
+ nXPos += nWidth_2 + nDistance;
+ lcl_newXPos( m_aFL_Vertical, nXPos );
+ }
+ }
+
+ //right alignement of listboxes:
+ {
+ long nLabelRightBorder = m_aLB_PlaceLabels.GetPosPixel().X() + m_aLB_PlaceLabels.GetSizePixel().Width();
+ long nTickmarksRightBorder = m_aLB_PlaceTicks.GetPosPixel().X() + m_aLB_PlaceTicks.GetSizePixel().Width();
+
+ long nNewRightBorder = ::std::max( m_aLB_CrossesAt.GetPosPixel().X() + m_aLB_CrossesAt.GetSizePixel().Width(), nLabelRightBorder);
+ nNewRightBorder = ::std::max( nTickmarksRightBorder, nNewRightBorder );
+
+ long nListBoxHeight = m_aLB_PlaceLabels.GetSizePixel().Height();
+ m_aLB_PlaceLabels.SetSizePixel( Size( m_aLB_PlaceLabels.GetSizePixel().Width()+nNewRightBorder-nLabelRightBorder, nListBoxHeight ) );
+ m_aLB_PlaceTicks.SetSizePixel( Size( m_aLB_PlaceTicks.GetSizePixel().Width()+nNewRightBorder-nTickmarksRightBorder, nListBoxHeight ) );
+ }
+
+ m_aLB_CrossesAt.SetSelectHdl( LINK( this, AxisPositionsTabPage, CrossesAtSelectHdl ) );
+ m_aLB_CrossesAt.SetDropDownLineCount( m_aLB_CrossesAt.GetEntryCount() );
+
+ m_aLB_PlaceLabels.SetSelectHdl( LINK( this, AxisPositionsTabPage, PlaceLabelsSelectHdl ) );
+ m_aLB_PlaceLabels.SetDropDownLineCount( m_aLB_PlaceLabels.GetEntryCount() );
+ m_aLB_PlaceTicks.SetDropDownLineCount( m_aLB_PlaceTicks.GetEntryCount() );
+}
+
+SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new AxisPositionsTabPage(pWindow, rOutAttrs);
+}
+
+BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ // axis line
+ USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 ));
+ if( 2==nPos )
+ {
+ double fCrossover = m_aED_CrossesAt.GetValue();
+ if( m_bCrossingAxisIsCategoryAxis )
+ fCrossover = m_aED_CrossesAtCategory.GetSelectEntryPos()+1;
+ rOutAttrs.Put(SvxDoubleItem(fCrossover,SCHATTR_AXIS_POSITION_VALUE));
+ }
+
+ // labels
+ USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+ if( nLabelPos != LISTBOX_ENTRY_NOTFOUND )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos ));
+
+ // tick marks
+ long nTicks=0;
+ long nMinorTicks=0;
+
+ if(m_aCB_MinorInner.IsChecked())
+ nMinorTicks|=CHAXIS_MARK_INNER;
+ if(m_aCB_MinorOuter.IsChecked())
+ nMinorTicks|=CHAXIS_MARK_OUTER;
+ if(m_aCB_TicksInner.IsChecked())
+ nTicks|=CHAXIS_MARK_INNER;
+ if(m_aCB_TicksOuter.IsChecked())
+ nTicks|=CHAXIS_MARK_OUTER;
+
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks));
+
+ USHORT nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos();
+ if( nMarkPos != LISTBOX_ENTRY_NOTFOUND )
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos ));
+
+ return TRUE;
+}
+
+void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ //init and enable controls
+ m_aED_CrossesAt.Show( !m_bCrossingAxisIsCategoryAxis );
+ m_aED_CrossesAtCategory.Show( m_bCrossingAxisIsCategoryAxis );
+ const sal_Int32 nMaxCount = LISTBOX_ENTRY_NOTFOUND;
+ if( m_bCrossingAxisIsCategoryAxis )
+ {
+ for( sal_Int32 nN=0; nN<m_aCategories.getLength() && nN<nMaxCount; nN++ )
+ m_aED_CrossesAtCategory.InsertEntry( m_aCategories[nN] );
+
+ USHORT nCount = m_aED_CrossesAtCategory.GetEntryCount();
+ if( nCount>30 )
+ nCount=30;
+ m_aED_CrossesAtCategory.SetDropDownLineCount( nCount );
+ }
+
+ if( m_aLB_CrossesAt.GetEntryCount() > 3 )
+ {
+ if( m_bCrossingAxisIsCategoryAxis )
+ m_aLB_CrossesAt.RemoveEntry(2);
+ else
+ m_aLB_CrossesAt.RemoveEntry(3);
+ }
+
+ //fill controls
+ const SfxPoolItem *pPoolItem = NULL;
+
+ //axis line
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ {
+ bool bZero = false;
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if(nPos==0)
+ {
+ //switch to value
+ bZero = true;
+ nPos = 2;
+ }
+ else
+ nPos--;
+
+ if( nPos < m_aLB_CrossesAt.GetEntryCount() )
+ m_aLB_CrossesAt.SelectEntryPos( nPos );
+ CrossesAtSelectHdl( (void*)0 );
+
+ if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,TRUE, &pPoolItem)== SFX_ITEM_SET || bZero )
+ {
+ double fCrossover = 0.0;
+ if( !bZero )
+ fCrossover = (((const SvxDoubleItem*)pPoolItem)->GetValue());
+ if( m_bCrossingAxisIsCategoryAxis )
+ m_aED_CrossesAtCategory.SelectEntryPos( static_cast<USHORT>(::rtl::math::round(fCrossover-1.0)) );
+ else
+ m_aED_CrossesAt.SetValue(fCrossover);
+ }
+ else
+ {
+ m_aED_CrossesAtCategory.SetNoSelection();
+ m_aED_CrossesAt.SetTextValue(XubString());
+ }
+ }
+ else
+ {
+ m_aLB_CrossesAt.SetNoSelection();
+ m_aED_CrossesAt.Enable( FALSE );
+ }
+
+ // Labels
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if( nPos < m_aLB_PlaceLabels.GetEntryCount() )
+ m_aLB_PlaceLabels.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_PlaceLabels.SetNoSelection();
+ PlaceLabelsSelectHdl( (void*)0 );
+
+ // Tick marks
+ long nTicks=0,nMinorTicks=0;
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ nTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ nMinorTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ m_aCB_TicksInner.Check(BOOL(nTicks&CHAXIS_MARK_INNER));
+ m_aCB_TicksOuter.Check(BOOL(nTicks&CHAXIS_MARK_OUTER));
+ m_aCB_MinorInner.Check(BOOL(nMinorTicks&CHAXIS_MARK_INNER));
+ m_aCB_MinorOuter.Check(BOOL(nMinorTicks&CHAXIS_MARK_OUTER));
+
+ // Tick position
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ if( nPos < m_aLB_PlaceTicks.GetEntryCount() )
+ m_aLB_PlaceTicks.SelectEntryPos( nPos );
+ }
+ else
+ m_aLB_PlaceTicks.SetNoSelection();
+
+
+ if( !m_bSupportAxisPositioning )
+ {
+ m_aFL_AxisLine.Show(false);
+ m_aFT_CrossesAt.Show(false);
+ m_aLB_CrossesAt.Show(false);
+ m_aED_CrossesAt.Show(false);
+ m_aED_CrossesAtCategory.Show(false);
+ m_aCB_AxisBetweenCategories.Show(false);
+
+ m_aFL_Labels.Show(false);
+ m_aFT_PlaceLabels.Show(false);
+ m_aLB_PlaceLabels.Show(false);
+ m_aFT_LabelDistance.Show(false);
+ m_aED_LabelDistance.Show(false);
+
+ m_aFL_Vertical.Show(false);
+ m_aFT_PlaceTicks.Show(false);
+ m_aLB_PlaceTicks.Show(false);
+
+ long nYDiff = m_aFL_AxisLine.GetPosPixel().Y() - m_aFL_Ticks.GetPosPixel().Y();
+ lcl_shiftY( m_aFL_Ticks, nYDiff );
+ lcl_shiftY( m_aFT_Major, nYDiff );
+ lcl_shiftY( m_aCB_TicksInner, nYDiff );
+ lcl_shiftY( m_aCB_TicksOuter, nYDiff );
+
+ lcl_shiftY( m_aFT_Minor, nYDiff );
+ lcl_shiftY( m_aCB_MinorInner, nYDiff );
+ lcl_shiftY( m_aCB_MinorOuter, nYDiff );
+ }
+ else if( !AxisHelper::isAxisPositioningEnabled() )
+ {
+ m_aFL_AxisLine.Enable(false);
+ m_aFT_CrossesAt.Enable(false);
+ m_aLB_CrossesAt.Enable(false);
+ m_aED_CrossesAt.Enable(false);
+ m_aED_CrossesAtCategory.Enable(false);
+ m_aCB_AxisBetweenCategories.Enable(false);
+
+ m_aFL_Labels.Enable(false);
+ m_aFT_PlaceLabels.Enable(false);
+ m_aLB_PlaceLabels.Enable(false);
+ m_aFT_LabelDistance.Enable(false);
+ m_aED_LabelDistance.Enable(false);
+
+ m_aFL_Vertical.Enable(false);
+ m_aFT_PlaceTicks.Enable(false);
+ m_aLB_PlaceTicks.Enable(false);
+
+ //todo: maybe set a special help id to all those controls
+ }
+}
+
+int AxisPositionsTabPage::DeactivatePage(SfxItemSet* pItemSet)
+{
+ if( pItemSet )
+ FillItemSet( *pItemSet );
+
+ return LEAVE_PAGE;
+}
+
+void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
+{
+ m_pNumFormatter = pFormatter;
+ m_aED_CrossesAt.SetFormatter( m_pNumFormatter );
+ m_aED_CrossesAt.UseInputStringForFormatting();
+
+ const SfxPoolItem *pPoolItem = NULL;
+ if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+ m_aED_CrossesAt.SetFormatKey( nFmt );
+ }
+}
+
+void AxisPositionsTabPage::SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis )
+{
+ m_bCrossingAxisIsCategoryAxis = bCrossingAxisIsCategoryAxis;
+}
+
+void AxisPositionsTabPage::SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories )
+{
+ m_aCategories = rCategories;
+}
+
+void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning )
+{
+ m_bSupportAxisPositioning = bSupportAxisPositioning;
+}
+
+IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG )
+{
+ USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis );
+ m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis );
+
+ if(! m_aED_CrossesAt.GetText().Len() )
+ m_aED_CrossesAt.SetValue(0.0);
+ if( 0 == m_aED_CrossesAtCategory.GetSelectEntryCount() )
+ m_aED_CrossesAtCategory.SelectEntryPos(0);
+
+ PlaceLabelsSelectHdl( (void*)0 );
+ return 0;
+}
+
+IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG )
+{
+ USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+
+ bool bEnableTickmarkPlacement = (nLabelPos>1);
+ if( bEnableTickmarkPlacement )
+ {
+ USHORT nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ if( nLabelPos-2 == nAxisPos )
+ bEnableTickmarkPlacement=false;
+ }
+ m_aFT_PlaceTicks.Enable(bEnableTickmarkPlacement);
+ m_aLB_PlaceTicks.Enable(bEnableTickmarkPlacement);
+
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
new file mode 100644
index 000000000000..0784a7854c5e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_AXISPOSITIONS_HXX
+#define _CHART2_TP_AXISPOSITIONS_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <svtools/fmtfield.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+//class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class AxisPositionsTabPage : public SfxTabPage
+{
+public:
+ AxisPositionsTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
+
+ void SetNumFormatter( SvNumberFormatter* pFormatter );
+
+ void SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis );
+ void SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories );
+
+ void SupportAxisPositioning( bool bSupportAxisPositioning );
+
+private: //methods:
+ DECL_LINK( CrossesAtSelectHdl, void* );
+ DECL_LINK( PlaceLabelsSelectHdl, void* );
+
+private: //member:
+ FixedLine m_aFL_AxisLine;
+ FixedText m_aFT_CrossesAt;
+ ListBox m_aLB_CrossesAt;
+ FormattedField m_aED_CrossesAt;
+ ComboBox m_aED_CrossesAtCategory;
+ CheckBox m_aCB_AxisBetweenCategories;
+
+ FixedLine m_aFL_Labels;
+ FixedText m_aFT_PlaceLabels;
+ ListBox m_aLB_PlaceLabels;
+ FixedText m_aFT_LabelDistance;
+ FormattedField m_aED_LabelDistance;
+
+ FixedLine m_aFL_Ticks;
+
+ FixedText m_aFT_Major;
+ CheckBox m_aCB_TicksInner;
+ CheckBox m_aCB_TicksOuter;
+
+ FixedText m_aFT_Minor;
+ CheckBox m_aCB_MinorInner;
+ CheckBox m_aCB_MinorOuter;
+
+ FixedLine m_aFL_Vertical;
+ FixedText m_aFT_PlaceTicks;
+ ListBox m_aLB_PlaceTicks;
+
+ FixedLine m_aFL_Grids;
+ CheckBox m_aCB_MajorGrid;
+ PushButton m_aPB_MajorGrid;
+ CheckBox m_aCB_MinorGrid;
+ PushButton m_aPB_MinorGrid;
+
+ SvNumberFormatter* m_pNumFormatter;
+
+ bool m_bCrossingAxisIsCategoryAxis;
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories;
+
+ bool m_bSupportAxisPositioning;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.src b/chart2/source/controller/dialogs/tp_AxisPositions.src
new file mode 100644
index 000000000000..1173b841354a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.src
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+#define Y0 3
+#define Y1 (Y0+13)
+#define Y2 (Y1)
+#define Y3 (Y2+16)
+#define Y4 (Y3+13)
+#define Y5 (Y4)
+#define Y6 (Y5+16)
+#define Y7 (Y6+13)
+#define Y8 (Y7+16)
+#define Y9 (Y8+16)
+#define Y10 (Y9+16)
+#define Y11 (Y10+13)
+#define Y12 (Y11+16)
+
+#define EDITWIDTH 50
+#define LABELWIDTH 88
+#define MAXLABELWIDTH 138
+
+#define X1 6
+#define X2 11
+#define X3 (X2+LABELWIDTH+4)
+#define X4 (X2+MAXLABELWIDTH+4)
+#define X5 (X4+EDITWIDTH+5)
+
+#define XTICK_1 X2
+#define XTICK_2 (XTICK_1+60)
+#define XTICK_3 (XTICK_2+60)
+#define XTICK_4 (XTICK_3+60)
+#define XTICK_5 (XTICK_4+6)
+#define TICKWIDTH 59
+
+TabPage TP_AXIS_POSITIONS
+{
+ HelpID = "chart2:TabPage:TP_AXIS_POSITIONS";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ FixedLine FL_AXIS_LINE
+ {
+ Pos = MAP_APPFONT ( X1 , Y0 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Axis line" ;
+ };
+
+ FixedText FT_CROSSES_OTHER_AXIS_AT
+ {
+ Pos = MAP_APPFONT ( X2 , Y1 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Cross other axis at" ;
+ };
+ ListBox LB_CROSSES_OTHER_AXIS_AT
+ {
+ HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_CROSSES_OTHER_AXIS_AT";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Start" ;
+ "End" ;
+ "Value" ;
+ "Category" ;
+ };
+ };
+ SpinField EDT_CROSSES_OTHER_AXIS_AT
+ {
+ HelpID = "chart2:SpinField:TP_AXIS_POSITIONS:EDT_CROSSES_OTHER_AXIS_AT";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ ComboBox EDT_CROSSES_OTHER_AXIS_AT_CATEGORY
+ {
+ HelpID = "chart2:ComboBox:TP_AXIS_POSITIONS:EDT_CROSSES_OTHER_AXIS_AT_CATEGORY";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CB_AXIS_BETWEEN_CATEGORIES
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_AXIS_BETWEEN_CATEGORIES";
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Axis ~between categories" ;
+ };
+
+ FixedLine FL_LABELS
+ {
+ Pos = MAP_APPFONT ( X1 , Y3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Labels" ;
+ };
+ FixedText FT_PLACE_LABELS
+ {
+ Pos = MAP_APPFONT ( X2 , Y4 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Place labels" ;
+ };
+ ListBox LB_PLACE_LABELS
+ {
+ HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_PLACE_LABELS";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y4-2 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Near axis" ;
+ "Near axis (other side)" ;
+ "Outside start" ;
+ "Outside end" ;
+ };
+ };
+
+ FixedText FT_AXIS_LABEL_DISTANCE
+ {
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Distance" ;
+ };
+ SpinField EDT_AXIS_LABEL_DISTANCE
+ {
+ HelpID = "chart2:SpinField:TP_AXIS_POSITIONS:EDT_AXIS_LABEL_DISTANCE";
+ Hide = TRUE;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X4 , Y5-2 ) ;
+ Size = MAP_APPFONT ( 89 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine FL_TICKS
+ {
+ Pos = MAP_APPFONT ( X1 , Y6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Interval marks";
+ };
+ FixedText FT_MAJOR
+ {
+ Pos = MAP_APPFONT ( XTICK_1 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 8 ) ;
+ Text [ en-US ] = "Major:" ;
+ };
+ CheckBox CB_TICKS_INNER
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_TICKS_INNER";
+ Pos = MAP_APPFONT ( XTICK_2 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "~Inner";
+ };
+ CheckBox CB_TICKS_OUTER
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_TICKS_OUTER";
+ Pos = MAP_APPFONT ( XTICK_3 , Y7 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "~Outer";
+ };
+
+ FixedText FT_MINOR
+ {
+ Pos = MAP_APPFONT ( XTICK_1 , Y8 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 8 ) ;
+ Text [ en-US ] = "Minor:" ;
+ };
+ CheckBox CB_MINOR_INNER
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_INNER";
+ Pos = MAP_APPFONT ( XTICK_2 , Y8 );
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "I~nner";
+ };
+ CheckBox CB_MINOR_OUTER
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_OUTER";
+ Pos = MAP_APPFONT ( XTICK_3 , Y8 ) ;
+ Size = MAP_APPFONT ( TICKWIDTH , 10 ) ;
+ Text [ en-US ] = "O~uter";
+ };
+
+ FixedLine FL_VERTICAL
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( XTICK_4 , Y7 ) ;
+ Size = MAP_APPFONT ( 6 , 25 ) ;
+ Vert = TRUE ;
+ };
+
+ FixedText FT_PLACE_TICKS
+ {
+ Pos = MAP_APPFONT ( X2 , Y9 );
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Place ~marks";
+ };
+ ListBox LB_PLACE_TICKS
+ {
+ HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_PLACE_TICKS";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y9-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "At labels" ;
+ "At axis" ;
+ "At axis and labels" ;
+ };
+ };
+
+
+ FixedLine FL_GRIDS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X1 , Y10 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Grids";
+ };
+ CheckBox CB_MAJOR_GRID
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MAJOR_GRID";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X2 , Y11 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show major ~grid" ;
+ };
+ PushButton PB_MAJOR_GRID
+ {
+ HelpID = "chart2:PushButton:TP_AXIS_POSITIONS:PB_MAJOR_GRID";
+ Hide = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( X3 , Y11-2 );
+ Size = MAP_APPFONT ( 54 , 14 );
+ Text [ en-US ] = "Mo~re...";
+ };
+ CheckBox CB_MINOR_GRID
+ {
+ HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_GRID";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( X2 , Y12 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Show minor grid" ;
+ };
+ PushButton PB_MINOR_GRID
+ {
+ HelpID = "chart2:PushButton:TP_AXIS_POSITIONS:PB_MINOR_GRID";
+ Hide = TRUE ;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( X3 , Y12-2 );
+ Size = MAP_APPFONT ( 54 , 14 );
+ Text [ en-US ] = "Mor~e...";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
new file mode 100644
index 000000000000..ec6c1d2a1c10
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -0,0 +1,1183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_ChartType.hxx"
+#include "tp_ChartType.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "res_BarGeometry.hxx"
+#include "ControllerLockGuard.hxx"
+#include "macros.hxx"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+#include <tools/debug.hxx>
+
+//for auto_ptr
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+// macro for selecting a normal or high contrast bitmap the stack variable
+// bIsHighContrast must exist and reflect the correct state
+#define SELECT_BITMAP(name) Bitmap( SchResId( bIsHighContrast ? name ## _HC : name ))
+#define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+namespace
+{
+ long lcl_getDistance()
+ {
+ return 6;
+ }
+
+ sal_Bool lcl_getSortByXValues( const uno::Reference< chart2::XChartDocument >& xChartDoc )
+ {
+ sal_Bool bRet = sal_False;
+ if( xChartDoc.is() )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bRet;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return bRet;
+ }
+}
+
+//--------------------------------------------------------------------------
+class AxisTypeResourceGroup : public ChangingResource
+{
+public:
+ AxisTypeResourceGroup( Window* pWindow );
+ virtual ~AxisTypeResourceGroup();
+
+ void showControls( bool bShow );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( AxisTypeCheckHdl, CheckBox* );
+private:
+ CheckBox m_aCB_XAxis_Categories;
+};
+AxisTypeResourceGroup::AxisTypeResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_XAxis_Categories( pWindow, SchResId( CB_X_AXIS_CATEGORIES ) )
+{
+ m_aCB_XAxis_Categories.SetToggleHdl( LINK( this, AxisTypeResourceGroup, AxisTypeCheckHdl ) );
+}
+AxisTypeResourceGroup::~AxisTypeResourceGroup()
+{
+}
+void AxisTypeResourceGroup::showControls( bool bShow )
+{
+ m_aCB_XAxis_Categories.Show(bShow);
+}
+Point AxisTypeResourceGroup::getPosition()
+{
+ return m_aCB_XAxis_Categories.GetPosPixel();
+}
+long AxisTypeResourceGroup::getHeight()
+{
+ return m_aCB_XAxis_Categories.GetSizePixel().Height();
+}
+void AxisTypeResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_XAxis_Categories.SetPosPixel(rPoint);
+}
+void AxisTypeResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_XAxis_Categories.Check(!rParameter.bXAxisWithValues);
+}
+void AxisTypeResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.bXAxisWithValues = !m_aCB_XAxis_Categories.IsChecked();
+}
+IMPL_LINK( AxisTypeResourceGroup, AxisTypeCheckHdl, CheckBox*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+
+#define POS_3DSCHEME_SIMPLE 0
+#define POS_3DSCHEME_REALISTIC 1
+
+class Dim3DLookResourceGroup : public ChangingResource
+{
+public:
+ Dim3DLookResourceGroup( Window* pWindow );
+ virtual ~Dim3DLookResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( Dim3DLookCheckHdl, CheckBox* );
+ DECL_LINK( SelectSchemeHdl, void* );
+
+private:
+ CheckBox m_aCB_3DLook;
+ ListBox m_aLB_Scheme;
+};
+Dim3DLookResourceGroup::Dim3DLookResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_3DLook( pWindow, SchResId( CB_3D_LOOK ) )
+ , m_aLB_Scheme( pWindow, SchResId( LB_3D_SCHEME ) )
+{
+ m_aCB_3DLook.SetToggleHdl( LINK( this, Dim3DLookResourceGroup, Dim3DLookCheckHdl ) );
+
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_SIMPLE)));
+ m_aLB_Scheme.InsertEntry(String(SchResId(STR_3DSCHEME_REALISTIC)));
+ m_aLB_Scheme.SetDropDownLineCount(2);
+
+ m_aLB_Scheme.SetSelectHdl( LINK( this, Dim3DLookResourceGroup, SelectSchemeHdl ) );
+}
+Dim3DLookResourceGroup::~Dim3DLookResourceGroup()
+{
+}
+void Dim3DLookResourceGroup::showControls( bool bShow )
+{
+ m_aCB_3DLook.Show(bShow);
+ m_aLB_Scheme.Show(bShow);
+}
+long Dim3DLookResourceGroup::getHeight()
+{
+ return m_aCB_3DLook.GetSizePixel().Height() + m_aLB_Scheme.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+}
+void Dim3DLookResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_3DLook.SetPosPixel(rPoint);
+ Size aSize( m_aCB_3DLook.CalcMinimumSize() );
+ m_aCB_3DLook.SetPosSizePixel(rPoint,aSize);
+ Point aLBPos(rPoint);
+ aLBPos.X() += aSize.Width()
+ + m_aLB_Scheme.LogicToPixel( Size(6,0), MapMode(MAP_APPFONT) ).Width();
+ aLBPos.Y() -= m_aLB_Scheme.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+ m_aLB_Scheme.SetPosPixel(aLBPos);
+}
+void Dim3DLookResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_3DLook.Check(rParameter.b3DLook);
+ m_aLB_Scheme.Enable(rParameter.b3DLook);
+
+ if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple )
+ m_aLB_Scheme.SelectEntryPos(POS_3DSCHEME_SIMPLE);
+ else if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic )
+ m_aLB_Scheme.SelectEntryPos(POS_3DSCHEME_REALISTIC);
+ else
+ m_aLB_Scheme.SetNoSelection();
+}
+void Dim3DLookResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = m_aCB_3DLook.IsChecked();
+ USHORT nPos = m_aLB_Scheme.GetSelectEntryPos();
+ if( POS_3DSCHEME_SIMPLE == nPos )
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
+ else if( POS_3DSCHEME_REALISTIC == nPos )
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ else
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
+}
+IMPL_LINK( Dim3DLookResourceGroup, Dim3DLookCheckHdl, CheckBox*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+IMPL_LINK( Dim3DLookResourceGroup, SelectSchemeHdl, void*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class SortByXValuesResourceGroup : public ChangingResource
+{
+public:
+ SortByXValuesResourceGroup( Window* pWindow );
+ virtual ~SortByXValuesResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( SortByXValuesCheckHdl, CheckBox* );
+
+private:
+ CheckBox m_aCB_XValueSorting;
+};
+SortByXValuesResourceGroup::SortByXValuesResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_XValueSorting( pWindow, SchResId( CB_XVALUE_SORTING ) )
+{
+ m_aCB_XValueSorting.SetToggleHdl( LINK( this, SortByXValuesResourceGroup, SortByXValuesCheckHdl ) );
+}
+SortByXValuesResourceGroup::~SortByXValuesResourceGroup()
+{
+}
+void SortByXValuesResourceGroup::showControls( bool bShow )
+{
+ m_aCB_XValueSorting.Show(bShow);
+}
+long SortByXValuesResourceGroup::getHeight()
+{
+ return m_aCB_XValueSorting.GetSizePixel().Height();
+}
+void SortByXValuesResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aCB_XValueSorting.SetPosPixel(rPoint);
+}
+void SortByXValuesResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_XValueSorting.Check( rParameter.bSortByXValues );
+}
+void SortByXValuesResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.bSortByXValues = m_aCB_XValueSorting.IsChecked();
+}
+IMPL_LINK( SortByXValuesResourceGroup, SortByXValuesCheckHdl, CheckBox*, EMPTYARG )
+{
+ if(m_pChangeListener)
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+class StackingResourceGroup : public ChangingResource
+{
+public:
+ StackingResourceGroup( Window* pWindow );
+ virtual ~StackingResourceGroup();
+
+ void showControls( bool bShow, bool bShowDeepStacking );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( StackingChangeHdl, RadioButton* );
+ DECL_LINK( StackingEnableHdl, void* );
+
+private:
+ CheckBox m_aCB_Stacked;
+ RadioButton m_aRB_Stack_Y;
+ RadioButton m_aRB_Stack_Y_Percent;
+ RadioButton m_aRB_Stack_Z;
+
+ bool m_bShowDeepStacking;
+};
+StackingResourceGroup::StackingResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_Stacked( pWindow, SchResId( CB_STACKED ) )
+ , m_aRB_Stack_Y( pWindow, SchResId( RB_STACK_Y ) )
+ , m_aRB_Stack_Y_Percent( pWindow, SchResId( RB_STACK_Y_PERCENT ) )
+ , m_aRB_Stack_Z( pWindow, SchResId( RB_STACK_Z ) )
+ , m_bShowDeepStacking(true)
+{
+ m_aCB_Stacked.SetToggleHdl( LINK( this, StackingResourceGroup, StackingEnableHdl ) );
+ m_aRB_Stack_Y.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+ m_aRB_Stack_Y_Percent.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+ m_aRB_Stack_Z.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
+}
+StackingResourceGroup::~StackingResourceGroup()
+{
+}
+void StackingResourceGroup::showControls( bool bShow, bool bShowDeepStacking )
+{
+ m_bShowDeepStacking = bShowDeepStacking;
+ m_aCB_Stacked.Show(bShow);
+ m_aRB_Stack_Y.Show(bShow);
+ m_aRB_Stack_Y_Percent.Show(bShow);
+ m_aRB_Stack_Z.Show(bShow&&bShowDeepStacking);
+}
+Point StackingResourceGroup::getPosition()
+{
+ return m_aCB_Stacked.GetPosPixel();
+}
+long StackingResourceGroup::getHeight()
+{
+ RadioButton& rLastButton = m_bShowDeepStacking ? m_aRB_Stack_Z : m_aRB_Stack_Y_Percent;
+
+ long nHeight = rLastButton.GetPosPixel().Y()
+ - m_aCB_Stacked.GetPosPixel().Y();
+ nHeight += rLastButton.GetSizePixel().Height();
+ return nHeight;
+}
+void StackingResourceGroup::setPosition( const Point& rPoint )
+{
+ Point aOld = this->getPosition();
+ long nDiffY = rPoint.Y() - aOld.Y();
+ long nDiffX = rPoint.X() - aOld.X();
+ m_aCB_Stacked.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Y.GetPosPixel();
+ m_aRB_Stack_Y.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Y_Percent.GetPosPixel();
+ m_aRB_Stack_Y_Percent.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+
+ aOld = m_aRB_Stack_Z.GetPosPixel();
+ m_aRB_Stack_Z.SetPosPixel( Point( aOld.X()+nDiffX, aOld.Y()+nDiffY ) );
+}
+void StackingResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_Stacked.Check( rParameter.eStackMode!=GlobalStackMode_NONE
+ && rParameter.eStackMode!=GlobalStackMode_STACK_Z ); //todo remove this condition if z stacking radio button is really used
+ switch( rParameter.eStackMode )
+ {
+ case GlobalStackMode_STACK_Y:
+ m_aRB_Stack_Y.Check();
+ break;
+ case GlobalStackMode_STACK_Y_PERCENT:
+ m_aRB_Stack_Y_Percent.Check();
+ break;
+ case GlobalStackMode_STACK_Z:
+ //todo uncomment this condition if z stacking radio button is really used
+ /*
+ if( rParameter.b3DLook )
+ m_aRB_Stack_Z.Check();
+ else
+ */
+ m_aRB_Stack_Y.Check();
+ break;
+ default:
+ m_aRB_Stack_Y.Check();
+ break;
+ }
+ //dis/enabling
+ m_aCB_Stacked.Enable( !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Y.Enable( m_aCB_Stacked.IsChecked() && !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Y_Percent.Enable( m_aCB_Stacked.IsChecked() && !rParameter.bXAxisWithValues );
+ m_aRB_Stack_Z.Enable( m_aCB_Stacked.IsChecked() && rParameter.b3DLook );
+}
+void StackingResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ if(!m_aCB_Stacked.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_NONE;
+ else if(m_aRB_Stack_Y.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Y;
+ else if(m_aRB_Stack_Y_Percent.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Y_PERCENT;
+ else if(m_aRB_Stack_Z.IsChecked())
+ rParameter.eStackMode = GlobalStackMode_STACK_Z;
+}
+IMPL_LINK( StackingResourceGroup, StackingChangeHdl, RadioButton*, pRadio )
+{
+ //for each radio click ther are coming two change events
+ //first uncheck of previous button -> ignore that call
+ //the second call gives the check of the new button
+ if( m_pChangeListener && pRadio && pRadio->IsChecked() )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+IMPL_LINK( StackingResourceGroup, StackingEnableHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+//--------------------------------------------------------------------------
+class SplinePropertiesDialog : public ModalDialog
+{
+public:
+ SplinePropertiesDialog( Window* pParent );
+ virtual ~SplinePropertiesDialog();
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines );
+
+ virtual void StateChanged( StateChangedType nType );
+
+private:
+ DECL_LINK( SplineModeRadioHdl, RadioButton* );
+
+ void adjustControlPositions();
+ void adjustSize();
+
+private:
+ RadioButton m_aRB_Splines_Cubic;
+ RadioButton m_aRB_Splines_B;
+
+ FixedLine m_aFL_SplineSeparator;
+
+ FixedText m_aFT_SplineResolution;
+ MetricField m_aMF_SplineResolution;
+ FixedText m_aFT_SplineOrder;
+ MetricField m_aMF_SplineOrder;
+
+ FixedLine m_aFL_DialogButtons;
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+};
+
+SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent )
+ : ModalDialog( pParent, SchResId( DLG_SPLINE_PROPERTIES ) )
+ , m_aRB_Splines_Cubic( this, SchResId( RB_SPLINES_CUBIC ) )
+ , m_aRB_Splines_B( this, SchResId( RB_SPLINES_B ) )
+ , m_aFL_SplineSeparator( this, SchResId( FL_SPLINE_SEPARATOR ) )
+ , m_aFT_SplineResolution( this, SchResId( FT_SPLINE_RESOLUTION ) )
+ , m_aMF_SplineResolution( this, SchResId( MF_SPLINE_RESOLUTION ) )
+ , m_aFT_SplineOrder( this, SchResId( FT_SPLINE_ORDER ) )
+ , m_aMF_SplineOrder( this, SchResId( MF_SPLINE_ORDER ) )
+ , m_aFL_DialogButtons( this, SchResId( FL_SPLINE_DIALOGBUTTONS ) )
+ , m_aBP_OK( this, SchResId(BTN_OK) )
+ , m_aBP_Cancel( this, SchResId(BTN_CANCEL) )
+ , m_aBP_Help( this, SchResId(BTN_HELP) )
+{
+ FreeResource();
+
+ this->SetText( String( SchResId( STR_DLG_SMOOTH_LINE_PROPERTIES ) ) );
+
+ m_aRB_Splines_Cubic.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+ m_aRB_Splines_B.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+}
+
+SplinePropertiesDialog::~SplinePropertiesDialog()
+{
+}
+
+void SplinePropertiesDialog::StateChanged( StateChangedType nType )
+{
+ Dialog::StateChanged( nType );
+
+ if( nType == STATE_CHANGE_INITSHOW )
+ {
+ adjustControlPositions();
+ adjustSize();
+ }
+}
+
+void SplinePropertiesDialog::adjustControlPositions()
+{
+ //position of controls:
+ //----------------
+ //fixed line and Fixed texts as near as possible to radio controls
+ long nRBWidth = ::std::max( m_aRB_Splines_Cubic.CalcMinimumSize().Width(), m_aRB_Splines_B.CalcMinimumSize().Width());
+ long nFLXPos = m_aRB_Splines_Cubic.GetPosPixel().X()+nRBWidth+m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+ long nFTXPos = nFLXPos + m_aFL_SplineSeparator.GetSizePixel().Width() + m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+
+ m_aRB_Splines_Cubic.SetSizePixel( Size( nRBWidth, m_aRB_Splines_Cubic.GetSizePixel().Height() ) );
+ m_aRB_Splines_B.SetSizePixel( Size( nRBWidth, m_aRB_Splines_B.GetSizePixel().Height() ) );
+
+ m_aFL_SplineSeparator.SetPosPixel( Point( nFLXPos, m_aFL_SplineSeparator.GetPosPixel().Y() ) );
+
+ m_aFT_SplineOrder.SetPosPixel( Point( nFTXPos, m_aFT_SplineOrder.GetPosPixel().Y() ) );
+ m_aFT_SplineResolution.SetPosPixel( Point( nFTXPos, m_aFT_SplineResolution.GetPosPixel().Y() ) );
+
+ //----------------
+ //move metric controls as near to text as possible
+ long nFTWidth = ::std::max( m_aFT_SplineOrder.CalcMinimumSize().Width(), m_aFT_SplineResolution.CalcMinimumSize().Width());
+ long nMFXPos = m_aFT_SplineOrder.GetPosPixel().X()+nFTWidth+m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,0), MapMode(MAP_APPFONT) ).Width();
+
+ m_aFT_SplineOrder.SetSizePixel( Size( nFTWidth, m_aFT_SplineOrder.GetSizePixel().Height() ) );
+ m_aFT_SplineResolution.SetSizePixel( Size( nFTWidth, m_aFT_SplineResolution.GetSizePixel().Height() ) );
+
+ m_aMF_SplineOrder.SetPosPixel( Point( nMFXPos, m_aMF_SplineOrder.GetPosPixel().Y() ) );
+ m_aMF_SplineResolution.SetPosPixel( Point( nMFXPos, m_aMF_SplineResolution.GetPosPixel().Y() ) );
+}
+
+void SplinePropertiesDialog::adjustSize()
+{
+ Size aDlgSize( this->GetSizePixel() );
+ long nBorder = m_aRB_Splines_Cubic.GetPosPixel().X();
+ long nX = m_aMF_SplineOrder.GetPosPixel().X() + m_aMF_SplineOrder.GetSizePixel().Width();
+ if(aDlgSize.Width()< (nX+nBorder) )
+ {
+ aDlgSize.Width() = (nX+nBorder);
+ this->SetSizePixel(aDlgSize);
+
+ Size aLineSize( m_aFL_DialogButtons.GetSizePixel() );
+ aLineSize.Width() = aDlgSize.Width();
+ m_aFL_DialogButtons.SetSizePixel(aLineSize);
+ }
+}
+void SplinePropertiesDialog::fillControls( const ChartTypeParameter& rParameter )
+{
+ switch(rParameter.eCurveStyle)
+ {
+ case CurveStyle_CUBIC_SPLINES:
+ m_aRB_Splines_Cubic.Check();
+ break;
+ case CurveStyle_B_SPLINES:
+ m_aRB_Splines_B.Check();
+ break;
+ default:
+ m_aRB_Splines_Cubic.Check();
+ break;
+ }
+ m_aMF_SplineOrder.SetValue( rParameter.nSplineOrder );
+ m_aMF_SplineResolution.SetValue( rParameter.nCurveResolution );
+
+ //dis/enabling
+ m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+}
+void SplinePropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines )
+{
+ if(!bSmoothLines)
+ rParameter.eCurveStyle=CurveStyle_LINES;
+ else if(m_aRB_Splines_Cubic.IsChecked())
+ rParameter.eCurveStyle=CurveStyle_CUBIC_SPLINES;
+ else if(m_aRB_Splines_B.IsChecked())
+ rParameter.eCurveStyle=CurveStyle_B_SPLINES;
+
+ rParameter.nCurveResolution = static_cast< sal_Int32 >( m_aMF_SplineResolution.GetValue());
+ rParameter.nSplineOrder = static_cast< sal_Int32 >( m_aMF_SplineOrder.GetValue());
+}
+IMPL_LINK( SplinePropertiesDialog, SplineModeRadioHdl, RadioButton*, EMPTYARG )
+{
+ m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class SplineResourceGroup : public ChangingResource
+{
+public:
+ SplineResourceGroup( Window* pWindow );
+ virtual ~SplineResourceGroup();
+
+ void showControls( bool bShow );
+ Point getPosition();
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( SplineChangeHdl, void* );
+ DECL_LINK( SplineDetailsDialogHdl, void* );
+ SplinePropertiesDialog& getSplinePropertiesDialog();
+
+private:
+ CheckBox m_aCB_Splines;
+ PushButton m_aPB_DetailsDialog;
+ ::std::auto_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
+};
+SplineResourceGroup::SplineResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aCB_Splines( pWindow, SchResId( CB_SPLINES ) )
+ , m_aPB_DetailsDialog( pWindow, SchResId( PB_SPLINE_DIALOG ) )
+ , m_pSplinePropertiesDialog()
+{
+ m_aCB_Splines.SetToggleHdl( LINK( this, SplineResourceGroup, SplineChangeHdl ) );
+ m_aPB_DetailsDialog.SetClickHdl( LINK( this, SplineResourceGroup, SplineDetailsDialogHdl ) );
+ m_aPB_DetailsDialog.SetQuickHelpText( String( SchResId(STR_DLG_SMOOTH_LINE_PROPERTIES) ) );
+
+ Size aButtonSize( m_aPB_DetailsDialog.GetSizePixel() );
+ Size aMinSize( m_aPB_DetailsDialog.CalcMinimumSize() );
+ sal_Int32 nDistance = 10;
+ if( pWindow )
+ {
+ Size aDistanceSize( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,2), MapMode(MAP_APPFONT) ) );
+ nDistance = 2*aDistanceSize.Width();
+ }
+ aButtonSize.Width() = aMinSize.Width() + nDistance;
+ m_aPB_DetailsDialog.SetSizePixel( aButtonSize );
+}
+SplineResourceGroup::~SplineResourceGroup()
+{
+}
+SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog()
+{
+ if( !m_pSplinePropertiesDialog.get() )
+ m_pSplinePropertiesDialog = ::std::auto_ptr< SplinePropertiesDialog >( new SplinePropertiesDialog( m_aPB_DetailsDialog.GetParent() ) );
+ return *m_pSplinePropertiesDialog;
+}
+void SplineResourceGroup::showControls( bool bShow )
+{
+ m_aCB_Splines.Show(bShow);
+ m_aPB_DetailsDialog.Show(bShow);
+}
+Point SplineResourceGroup::getPosition()
+{
+ return m_aCB_Splines.GetPosPixel();
+}
+long SplineResourceGroup::getHeight()
+{
+ return m_aCB_Splines.GetSizePixel().Height() + m_aPB_DetailsDialog.LogicToPixel( Size(0,2), MapMode(MAP_APPFONT) ).Height();
+}
+void SplineResourceGroup::setPosition( const Point& rPoint )
+{
+ Size aSize( m_aCB_Splines.CalcMinimumSize() );
+ Size aDistanceSize( m_aCB_Splines.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,1), MapMode(MAP_APPFONT) ) );
+ m_aCB_Splines.SetSizePixel( aSize );
+
+ Point aOld = this->getPosition();
+ long nDiffY = rPoint.Y() - aOld.Y();
+ long nDiffX = rPoint.X() - aOld.X();
+
+ Point aNew( aOld.X()+nDiffX, aOld.Y()+nDiffY );
+ m_aCB_Splines.SetPosPixel( aNew );
+
+ aNew.X() += ( aSize.Width() + aDistanceSize.Width() );
+ aNew.Y() -= 3*aDistanceSize.Height();
+ m_aPB_DetailsDialog.SetPosPixel( aNew );
+}
+
+void SplineResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ m_aCB_Splines.Check( rParameter.eCurveStyle!=CurveStyle_LINES );
+ getSplinePropertiesDialog().fillControls( rParameter );
+}
+void SplineResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ getSplinePropertiesDialog().fillParameter( rParameter, m_aCB_Splines.IsChecked() );
+}
+IMPL_LINK( SplineResourceGroup, SplineChangeHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+IMPL_LINK( SplineResourceGroup, SplineDetailsDialogHdl, void*, EMPTYARG )
+{
+
+ ChartTypeParameter aOldParameter;
+ getSplinePropertiesDialog().fillParameter( aOldParameter, m_aCB_Splines.IsChecked() );
+
+ BOOL bOldSmoothLines = m_aCB_Splines.IsChecked();
+ m_aCB_Splines.Check();
+ if( RET_OK == getSplinePropertiesDialog().Execute() )
+ {
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ }
+ else
+ {
+ //restore old state:
+ m_aCB_Splines.Check( bOldSmoothLines );
+ getSplinePropertiesDialog().fillControls( aOldParameter );
+ }
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+
+class GeometryResourceGroup : public ChangingResource
+{
+public:
+ GeometryResourceGroup( Window* pWindow );
+ virtual ~GeometryResourceGroup();
+
+ void showControls( bool bShow );
+ long getHeight();
+ void setPosition( const Point& rPoint );
+
+ void fillControls( const ChartTypeParameter& rParameter );
+ void fillParameter( ChartTypeParameter& rParameter );
+
+private:
+ DECL_LINK( GeometryChangeHdl, void* );
+
+private:
+ BarGeometryResources m_aGeometryResources;
+};
+GeometryResourceGroup::GeometryResourceGroup( Window* pWindow )
+ : ChangingResource()
+ , m_aGeometryResources( pWindow )
+{
+ m_aGeometryResources.SetSelectHdl( LINK( this, GeometryResourceGroup, GeometryChangeHdl ) );
+}
+GeometryResourceGroup::~GeometryResourceGroup()
+{
+}
+void GeometryResourceGroup::showControls( bool bShow )
+{
+ m_aGeometryResources.Show(bShow);
+}
+long GeometryResourceGroup::getHeight()
+{
+ return m_aGeometryResources.GetSizePixel().Height();
+}
+void GeometryResourceGroup::setPosition( const Point& rPoint )
+{
+ m_aGeometryResources.SetPosPixel( rPoint );
+}
+
+void GeometryResourceGroup::fillControls( const ChartTypeParameter& rParameter )
+{
+ USHORT nGeometry3D = static_cast<USHORT>(rParameter.nGeometry3D);
+ m_aGeometryResources.SelectEntryPos(nGeometry3D);
+ m_aGeometryResources.Enable(rParameter.b3DLook);
+}
+void GeometryResourceGroup::fillParameter( ChartTypeParameter& rParameter )
+{
+ rParameter.nGeometry3D = 1;
+ if( m_aGeometryResources.GetSelectEntryCount() )
+ rParameter.nGeometry3D = m_aGeometryResources.GetSelectEntryPos();
+}
+IMPL_LINK( GeometryResourceGroup, GeometryChangeHdl, void*, EMPTYARG )
+{
+ if( m_pChangeListener )
+ m_pChangeListener->stateChanged(this);
+ return 0;
+}
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+ChartTypeTabPage::ChartTypeTabPage( Window* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , bool bDoLiveUpdate, bool bHideDescription )
+ : OWizardPage( pParent, SchResId(TP_CHARTTYPE) )
+ , m_aFT_ChooseType( this, SchResId( FT_CHARTTYPE ) )
+ , m_aMainTypeList( this, SchResId( LB_CHARTTYPE ) )
+ , m_aSubTypeList( this, SchResId( CT_CHARTVARIANT ) )
+ , m_pAxisTypeResourceGroup( new AxisTypeResourceGroup(this) )
+ , m_pDim3DLookResourceGroup( new Dim3DLookResourceGroup(this) )
+ , m_pStackingResourceGroup( new StackingResourceGroup(this) )
+ , m_pSplineResourceGroup( new SplineResourceGroup(this) )
+ , m_pGeometryResourceGroup( new GeometryResourceGroup( this ) )
+ , m_pSortByXValuesResourceGroup( new SortByXValuesResourceGroup( this ) )
+ , m_nYTopPos(0)
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+ , m_aChartTypeDialogControllerList(0)
+ , m_pCurrentMainType(0)
+ , m_nChangingCalls(0)
+ , m_bDoLiveUpdate(bDoLiveUpdate)
+ , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ m_aFT_ChooseType.Hide();
+ long nYDiff = m_aMainTypeList.GetPosPixel().Y() - m_aFT_ChooseType.GetPosPixel().Y();
+
+ Point aOldPos( m_aMainTypeList.GetPosPixel() );
+ m_aMainTypeList.SetPosPixel( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ aOldPos = m_aSubTypeList.GetPosPixel();
+ m_aSubTypeList.SetPosPixel( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ aOldPos = m_pAxisTypeResourceGroup->getPosition();
+ m_pAxisTypeResourceGroup->setPosition( Point( aOldPos.X(), aOldPos.Y() - nYDiff ) );
+
+ Size aSize( this->GetSizePixel() );
+ this->SetSizePixel( Size( aSize.Width(), aSize.Height()-nYDiff+3 ) );
+ }
+ else
+ {
+ Font aFont( m_aFT_ChooseType.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_ChooseType.SetControlFont( aFont );
+
+ m_aFT_ChooseType.SetStyle( m_aFT_ChooseType.GetStyle() | WB_NOLABEL );
+ }
+
+ this->SetText( String(SchResId(STR_PAGE_CHARTTYPE)) );
+
+ m_aMainTypeList.SetStyle(m_aMainTypeList.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_FLATVALUESET | WB_3DLOOK );
+ m_aMainTypeList.SetSelectHdl( LINK( this, ChartTypeTabPage, SelectMainTypeHdl ) );
+ m_aSubTypeList.SetSelectHdl( LINK( this, ChartTypeTabPage, SelectSubTypeHdl ) );
+
+ m_aSubTypeList.SetStyle(m_aSubTypeList.GetStyle() |
+ WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
+ m_aSubTypeList.SetColCount(4);
+ m_aSubTypeList.SetLineCount(1);
+
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ bool bDisableComplexChartTypes = false;
+ uno::Reference< beans::XPropertySet > xProps( m_xChartModel, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ try
+ {
+ xProps->getPropertyValue( C2U( "DisableComplexChartTypes" ) ) >>= bDisableComplexChartTypes;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ m_aChartTypeDialogControllerList.push_back(new ColumnChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BarChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new PieChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
+ if ( !bDisableComplexChartTypes )
+ {
+ m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
+ }
+ m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
+ if ( !bDisableComplexChartTypes )
+ {
+ m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
+ }
+ m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
+
+ ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ m_aMainTypeList.InsertEntry( (*aIter)->getName(), (*aIter)->getImage( bIsHighContrast ) );
+ (*aIter)->setChangeListener( this );
+ }
+
+ m_nYTopPos = m_pAxisTypeResourceGroup->getPosition().Y();
+
+ m_pAxisTypeResourceGroup->setChangeListener( this );
+ m_pDim3DLookResourceGroup->setChangeListener( this );
+ m_pStackingResourceGroup->setChangeListener( this );
+ m_pSplineResourceGroup->setChangeListener( this );
+ m_pGeometryResourceGroup->setChangeListener( this );
+ m_pSortByXValuesResourceGroup->setChangeListener( this );
+}
+
+ChartTypeTabPage::~ChartTypeTabPage()
+{
+ //delete all dialog controller
+ ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ delete *aIter;
+ }
+ m_aChartTypeDialogControllerList.clear();
+
+ //delete all resource helper
+ delete m_pAxisTypeResourceGroup;
+ delete m_pDim3DLookResourceGroup;
+ delete m_pStackingResourceGroup;
+ delete m_pSplineResourceGroup;
+ delete m_pGeometryResourceGroup;
+ delete m_pSortByXValuesResourceGroup;
+}
+ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
+{
+ ChartTypeParameter aParameter;
+ aParameter.nSubTypeIndex = static_cast<sal_Int32>( m_aSubTypeList.GetSelectItemId() );
+ m_pAxisTypeResourceGroup->fillParameter( aParameter );
+ m_pDim3DLookResourceGroup->fillParameter( aParameter );
+ m_pStackingResourceGroup->fillParameter( aParameter );
+ m_pSplineResourceGroup->fillParameter( aParameter );
+ m_pGeometryResourceGroup->fillParameter( aParameter );
+ m_pSortByXValuesResourceGroup->fillParameter( aParameter );
+ return aParameter;
+}
+void ChartTypeTabPage::commitToModel( const ChartTypeParameter& rParameter )
+{
+ if( !m_pCurrentMainType )
+ return;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ ControllerLockGuard aLockedControllers( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) );
+ m_pCurrentMainType->commitToModel( rParameter, m_xChartModel );
+}
+void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
+{
+ if(m_nChangingCalls)
+ return;
+ m_nChangingCalls++;
+
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ if( m_pCurrentMainType )
+ {
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ m_pCurrentMainType->adjustSubTypeAndEnableControls( aParameter );
+ }
+ if( m_bDoLiveUpdate )
+ commitToModel( aParameter );
+
+ //detect the new ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
+ aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+ //the controls have to be enabled/disabled accordingly
+ this->fillAllControls( aParameter );
+
+ m_nChangingCalls--;
+}
+ChartTypeDialogController* ChartTypeTabPage::getSelectedMainType()
+{
+ ChartTypeDialogController* pTypeController = 0;
+ ::std::vector< ChartTypeDialogController* >::size_type nM = static_cast< ::std::vector< ChartTypeDialogController* >::size_type >(
+ m_aMainTypeList.GetSelectEntryPos() );
+ if( nM<m_aChartTypeDialogControllerList.size() )
+ pTypeController = m_aChartTypeDialogControllerList[nM];
+ return pTypeController;
+}
+IMPL_LINK( ChartTypeTabPage, SelectSubTypeHdl, void *, EMPTYARG )
+{
+ if( m_pCurrentMainType )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ this->fillAllControls( aParameter, false );
+ if( m_bDoLiveUpdate )
+ commitToModel( aParameter );
+ }
+ return 0;
+}
+
+IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG )
+{
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+
+ if( m_pCurrentMainType )
+ {
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ m_pCurrentMainType->hideExtraControls();
+ }
+
+ m_pCurrentMainType = this->getSelectedMainType();
+ if( m_pCurrentMainType )
+ {
+ this->showAllControls(*m_pCurrentMainType);
+
+ m_pCurrentMainType->adjustParameterToMainType( aParameter );
+ if( m_bDoLiveUpdate )
+ 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.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+ this->fillAllControls( aParameter );
+ uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY );
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
+ }
+ return 0;
+}
+
+void ChartTypeTabPage::showAllControls( ChartTypeDialogController& rTypeController )
+{
+ m_aSubTypeList.Show();
+
+ long nYPos = m_nYTopPos;
+
+ //------
+ bool bShow = rTypeController.shouldShow_XAxisTypeControl();
+ long nXPos = m_pAxisTypeResourceGroup->getPosition().X();
+ m_pAxisTypeResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pAxisTypeResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pAxisTypeResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_3DLookControl();
+ m_pDim3DLookResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pDim3DLookResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pDim3DLookResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_StackingControl();
+ m_pStackingResourceGroup->showControls( bShow, rTypeController.shouldShow_DeepStackingControl() );
+ if(bShow)
+ {
+ long nStackingXPos = nXPos;
+ if( rTypeController.shouldShow_XAxisTypeControl() )
+ nStackingXPos += this->LogicToPixel( Size(RSC_SP_CHK_TEXTINDENT,0), MapMode(MAP_APPFONT) ).Width();
+ m_pStackingResourceGroup->setPosition( Point( nStackingXPos, nYPos ) );
+ nYPos += m_pStackingResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_SplineControl();
+ m_pSplineResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pSplineResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pSplineResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_GeometryControl();
+ m_pGeometryResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pGeometryResourceGroup->setPosition( Point( nXPos+17, nYPos ) );
+ nYPos += m_pGeometryResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ bShow = rTypeController.shouldShow_SortByXValuesResourceGroup();
+ m_pSortByXValuesResourceGroup->showControls( bShow );
+ if(bShow)
+ {
+ m_pSortByXValuesResourceGroup->setPosition( Point( nXPos, nYPos ) );
+ nYPos += m_pSortByXValuesResourceGroup->getHeight() + lcl_getDistance();
+ }
+ //------
+ Size aPageSize( this->GetSizePixel() );
+ Size aRemainingSize = Size( aPageSize.Width()-nXPos, aPageSize.Height()-nYPos );
+ rTypeController.showExtraControls( this, Point( nXPos, nYPos ), aRemainingSize );
+}
+
+void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList )
+{
+ m_nChangingCalls++;
+ if( m_pCurrentMainType && bAlsoResetSubTypeList )
+ {
+ bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
+ m_pCurrentMainType->fillSubTypeList( m_aSubTypeList, bIsHighContrast, rParameter );
+ }
+ m_aSubTypeList.SelectItem( static_cast<USHORT>( rParameter.nSubTypeIndex) );
+ m_pAxisTypeResourceGroup->fillControls( rParameter );
+ m_pDim3DLookResourceGroup->fillControls( rParameter );
+ m_pStackingResourceGroup->fillControls( rParameter );
+ m_pSplineResourceGroup->fillControls( rParameter );
+ m_pGeometryResourceGroup->fillControls( rParameter );
+ m_pSortByXValuesResourceGroup->fillControls( rParameter );
+ m_nChangingCalls--;
+}
+
+void ChartTypeTabPage::initializePage()
+{
+ if( !m_xChartModel.is() )
+ return;
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
+ DiagramHelper::tTemplateWithServiceName aTemplate =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager );
+ ::rtl::OUString aServiceName( aTemplate.second );
+
+ bool bFound = false;
+
+ ::std::vector< ChartTypeDialogController* >::iterator aIter = m_aChartTypeDialogControllerList.begin();
+ const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
+ for( USHORT nM=0; aIter != aEnd; aIter++, nM++ )
+ {
+ if( (*aIter)->isSubType(aServiceName) )
+ {
+ bFound = true;
+
+ m_aMainTypeList.SelectEntryPos( nM );
+ this->showAllControls( **aIter );
+ uno::Reference< beans::XPropertySet > xTemplateProps( aTemplate.first, uno::UNO_QUERY );
+ ChartTypeParameter aParameter = (*aIter)->getChartTypeParameterForService( aServiceName, xTemplateProps );
+ m_pCurrentMainType = this->getSelectedMainType();
+
+ //set ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
+ if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
+ aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
+
+ aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
+
+ this->fillAllControls( aParameter );
+ if( m_pCurrentMainType )
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
+ break;
+ }
+ }
+
+ if( !bFound )
+ {
+ m_aSubTypeList.Hide();
+ m_pAxisTypeResourceGroup->showControls( false );
+ m_pDim3DLookResourceGroup->showControls( false );
+ m_pStackingResourceGroup->showControls( false, false );
+ m_pSplineResourceGroup->showControls( false );
+ m_pGeometryResourceGroup->showControls( false );
+ m_pSortByXValuesResourceGroup->showControls( false );
+ }
+}
+
+sal_Bool ChartTypeTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
+{
+ //commit changes to model
+ if( !m_bDoLiveUpdate && m_pCurrentMainType )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ commitToModel( aParameter );
+ }
+
+ return sal_True;//return false if this page should not be left
+}
+
+uno::Reference< XChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const
+{
+ if( m_pCurrentMainType && m_xChartModel.is() )
+ {
+ ChartTypeParameter aParameter( this->getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
+ return m_pCurrentMainType->getCurrentTemplate( aParameter, xTemplateManager );
+ }
+ return 0;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hrc b/chart2/source/controller/dialogs/tp_ChartType.hrc
new file mode 100644
index 000000000000..dc017f836dc7
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define LB_3D_SCHEME 1
+#define LB_CHARTTYPE 2
+#define CT_CHARTVARIANT 3
+
+#define FL_SPLINE_SEPARATOR 2
+#define FL_SPLINE_DIALOGBUTTONS 3
+
+#define FT_CHARTTYPE 1
+#define FT_SPLINE_ORDER 3
+#define FT_SPLINE_RESOLUTION 4
+
+#define CB_X_AXIS_CATEGORIES 1
+#define CB_3D_LOOK 2
+#define CB_STACKED 3
+#define CB_SPLINES 4
+#define CB_XVALUE_SORTING 5
+
+#define PB_SPLINE_DIALOG 1
+
+#define RB_STACK_Y 2
+#define RB_STACK_Y_PERCENT 3
+#define RB_STACK_Z 4
+
+#define RB_SPLINES_CUBIC 5
+#define RB_SPLINES_B 6
+
+#define MF_SPLINE_ORDER 1
+#define MF_SPLINE_RESOLUTION 2
+
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
new file mode 100644
index 000000000000..b40cbb1956db
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_CHARTTYPE_HXX
+#define _CHART2_TP_CHARTTYPE_HXX
+
+#include <vector>
+
+#include "ChartTypeDialogController.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <svtools/valueset.hxx>
+#include <vcl/fixed.hxx>
+// header for class MetricField
+#include <vcl/field.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChartTypeResourceGroup;
+class AxisTypeResourceGroup;
+class Dim3DLookResourceGroup;
+class StackingResourceGroup;
+class SplineResourceGroup;
+class GeometryResourceGroup;
+class ChartTypeParameter;
+class SortByXValuesResourceGroup;
+
+class ChartTypeTabPage : public ResourceChangeListener, public svt::OWizardPage, public ChartTypeTemplateProvider
+{
+public:
+ ChartTypeTabPage( Window* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ , bool bDoLiveUpdate, bool bHideDescription = false );
+ virtual ~ChartTypeTabPage();
+
+ virtual void initializePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const;
+
+protected:
+ ChartTypeDialogController* getSelectedMainType();
+ void showAllControls( ChartTypeDialogController& rTypeController );
+ void fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList=true );
+ ChartTypeParameter getCurrentParamter() const;
+
+ virtual void stateChanged( ChangingResource* pResource );
+
+ void commitToModel( const ChartTypeParameter& rParameter );
+
+ DECL_LINK( SelectMainTypeHdl, void* );
+ DECL_LINK( SelectSubTypeHdl, void* );
+
+protected:
+ FixedText m_aFT_ChooseType;
+ ListBox m_aMainTypeList;
+ ValueSet m_aSubTypeList;
+
+ AxisTypeResourceGroup* m_pAxisTypeResourceGroup;
+ Dim3DLookResourceGroup* m_pDim3DLookResourceGroup;
+ StackingResourceGroup* m_pStackingResourceGroup;
+ SplineResourceGroup* m_pSplineResourceGroup;
+ GeometryResourceGroup* m_pGeometryResourceGroup;
+ SortByXValuesResourceGroup* m_pSortByXValuesResourceGroup;
+
+ long m_nYTopPos;//top y position of the different ResourceGroups (AxisTypeResourceGroup, etc)
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xCC;
+
+ ::std::vector< ChartTypeDialogController* > m_aChartTypeDialogControllerList;
+ ChartTypeDialogController* m_pCurrentMainType;
+
+ sal_Int32 m_nChangingCalls;
+ bool m_bDoLiveUpdate;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ChartType.src b/chart2/source/controller/dialogs/tp_ChartType.src
new file mode 100644
index 000000000000..69c33cd14021
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ChartType.src
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_ChartType.hrc"
+#include "SchSlotIds.hxx"
+#include "dlg_CreationWizard.hrc"
+#include "CommonResources.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+
+#define WIDTH_MAINLIST 75
+#define HEIGHT_MAINLIST 122
+#define WIDTH_IMAGELIST 150
+#define HEIGHT_IMAGELIST 50
+#define WIDTH_3D 100
+#define POS_X_MAINLIST 6
+#define POS_X_IMAGELIST (POS_X_MAINLIST+WIDTH_MAINLIST+6)
+#define POS_Y1 8
+#define POS_Y_LIST (POS_Y1+RSC_CD_FIXEDTEXT_HEIGHT+4)
+#define POS_Y_VALUE_X_AXIS (POS_Y_LIST+HEIGHT_IMAGELIST+RSC_SP_CTRL_Y+2)
+#define POS_Y_3D_LOOK (POS_Y_VALUE_X_AXIS+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define POS_Y_STACKING (POS_Y_3D_LOOK+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define POS_Y_SPLINES (POS_Y_STACKING+4*12+12)
+#define POS_Y_XVALUE_SORTING (POS_Y_SPLINES+4+12)
+
+#define POS_X_SPLINES_1 (8)
+#define POS_Y_SPLINES_2 (8)
+#define POS_Y_SPLINES_3 (POS_Y_SPLINES_2+13)
+#define POS_Y_SPLINES_4 (POS_Y_SPLINES_3+13)
+#define POS_Y_SPLINES_5 (POS_Y_SPLINES_4+RSC_CD_FIXEDTEXT_HEIGHT)
+
+#define SPLINES_WIDTH_RADIO 45
+#define SPLINES_WIDTH_METRIC_TEXT 60
+#define POS_X_SPLINE_EXTRAS (POS_X_SPLINES_1+SPLINES_WIDTH_RADIO+RSC_SP_FLGR_SPACE_X+RSC_CD_FIXEDLINE_WIDTH+2*RSC_SP_FLGR_SPACE_X)
+#define WIZ_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-POS_X_MAINLIST-6)
+#define WIDTH_XVALUE_SORTING (WIDTH_IMAGELIST)
+
+#define SPLINE_DIALOG_WIDTH 172
+#define SPLINE_DIALOG_HEIGHT 59
+
+TabPage TP_CHARTTYPE
+{
+ Hide = TRUE ;
+ HelpID = HID_DIAGRAM_TYPE;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedText FT_CHARTTYPE
+ {
+ Pos = MAP_APPFONT ( POS_X_MAINLIST-1 , POS_Y1 ) ;
+ Size = MAP_APPFONT ( WIZ_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ TabStop = FALSE ;
+ Text [ en-US ] = "Choose a chart type";
+ };
+ ListBox LB_CHARTTYPE
+ {
+ HelpId = HID_SCH_CTL_TYPE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_MAINLIST , POS_Y_LIST ) ;
+ Size = MAP_APPFONT ( WIDTH_MAINLIST, HEIGHT_MAINLIST ) ;
+ };
+ Control CT_CHARTVARIANT
+ {
+ HelpId = HID_SCH_CTL_VARIANT ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_LIST ) ;
+ Size = MAP_APPFONT ( WIDTH_IMAGELIST , HEIGHT_IMAGELIST ) ;
+ TabStop = TRUE ;
+ };
+
+ CheckBox CB_X_AXIS_CATEGORIES
+ {
+ HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_X_AXIS_CATEGORIES";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_VALUE_X_AXIS ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "X axis with Categories" ;
+ };
+ CheckBox CB_3D_LOOK
+ {
+ HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_3D_LOOK";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_3D_LOOK ) ;
+ Size = MAP_APPFONT ( WIDTH_3D , 10 ) ;
+ Text [ en-US ] = "~3D Look" ;
+ };
+ ListBox LB_3D_SCHEME
+ {
+ HelpID = "chart2:ListBox:TP_CHARTTYPE:LB_3D_SCHEME";
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+WIDTH_3D+4 , POS_Y_3D_LOOK ) ;
+ Size = MAP_APPFONT ( 60, 12 ) ;
+ };
+
+ CheckBox CB_STACKED
+ {
+ HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_STACKED";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_STACKING ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "~Stack series" ;
+ };
+ RadioButton RB_STACK_Y
+ {
+ HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Y";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ //Uebereinander (summiere Y-Werte)
+ //On top (sum Y-values)
+ Text [ en-US ] = "On top";
+ };
+ RadioButton RB_STACK_Y_PERCENT
+ {
+ HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Y_PERCENT";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+2*12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Percent";
+ };
+ RadioButton RB_STACK_Z
+ {
+ HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Z";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+3*12 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ //Hintereinander (verteile Datenreihen auf der Z-Achse)
+ //Deep (spread series on Z-Axis)
+ Text [ en-US ] = "Deep";
+ };
+
+ CheckBox CB_SPLINES
+ {
+ HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_SPLINES";
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "S~mooth lines" ;
+ };
+
+ PushButton PB_SPLINE_DIALOG
+ {
+ HelpID = "chart2:PushButton:TP_CHARTTYPE:PB_SPLINE_DIALOG";
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES-6 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ Text [ en-US ] = "Properties..." ;
+ };
+
+ CheckBox CB_XVALUE_SORTING
+ {
+ HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_XVALUE_SORTING";
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_XVALUE_SORTING ) ;
+ Size = MAP_APPFONT ( WIDTH_XVALUE_SORTING , 10 ) ;
+ Text [ en-US ] = "~Sort by X values" ;
+ };
+
+};
+
+ModalDialog DLG_SPLINE_PROPERTIES
+{
+ HelpID = HID_SCH_DLG_SPLINE_PROPERTIES;
+ Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , SPLINE_DIALOG_HEIGHT ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ RadioButton RB_SPLINES_CUBIC
+ {
+ HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_CUBIC";
+ Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cubic spline";
+ };
+ RadioButton RB_SPLINES_B
+ {
+ HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_B";
+ Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_3 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "B-Spline";
+ };
+
+ FixedLine FL_SPLINE_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS-RSC_CD_FIXEDLINE_WIDTH-RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 2*12 ) ;
+ Vert = TRUE ;
+ };
+
+ FixedText FT_SPLINE_RESOLUTION
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_2 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
+ Text [ en-US ] = "~Resolution" ;
+ };
+ MetricField MF_SPLINE_RESOLUTION
+ {
+ HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_RESOLUTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2-2 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+
+ FixedText FT_SPLINE_ORDER
+ {
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_3 ) ;
+ Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
+ Text [ en-US ] = "~Data points order" ;
+ };
+ MetricField MF_SPLINE_ORDER
+ {
+ HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_ORDER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_3-2 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_SPLINE_DIALOGBUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , POS_Y_SPLINES_4 ) ;
+ Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ };
+ BUTTONS_HELP_OK_CANCEL_NEXT(POS_X_SPLINES_1,POS_Y_SPLINES_5)
+};
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
new file mode 100644
index 000000000000..909c263ba83b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_DataLabel.hxx"
+
+#include "TabPages.hrc"
+#include "ResId.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_DATA_DESCR), rInAttrs),
+ m_aDataLabelResources(this, rInAttrs)
+{
+ FreeResource();
+}
+
+DataLabelsTabPage::~DataLabelsTabPage()
+{
+}
+
+SfxTabPage* DataLabelsTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new DataLabelsTabPage(pWindow, rOutAttrs);
+}
+
+BOOL DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ return m_aDataLabelResources.FillItemSet(rOutAttrs);
+}
+
+void DataLabelsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ m_aDataLabelResources.Reset(rInAttrs);
+}
+
+void DataLabelsTabPage::SetNumberFormatter( SvNumberFormatter* pFormatter )
+{
+ m_aDataLabelResources.SetNumberFormatter( pFormatter );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
new file mode 100644
index 000000000000..25bdf977ef0e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_DATALABEL_HXX
+#define _CHART2_TP_DATALABEL_HXX
+
+#include "res_DataLabel.hxx"
+#include <sfx2/tabdlg.hxx>
+
+class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class DataLabelsTabPage : public SfxTabPage
+{
+public:
+ DataLabelsTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~DataLabelsTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+
+ void SetNumberFormatter( SvNumberFormatter* pFormatter );
+
+ virtual void Reset(const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+
+private:
+ DataLabelResources m_aDataLabelResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src
new file mode 100644
index 000000000000..615e81c2c550
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_DataLabel.hrc"
+
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+
+TabPage TP_DATA_DESCR
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_DATA_DESCR ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_DATALABEL( 6, 8 )
+};
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
new file mode 100644
index 000000000000..70a478ea8c39
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -0,0 +1,1076 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_DataSource.hxx"
+#include "tp_DataSource.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "macros.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "RangeSelectionHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "tp_DataSourceControls.hxx"
+#include "ControllerLockGuard.hxx"
+#include "DataSourceHelper.hxx"
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <functional>
+#include <algorithm>
+#include <map>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// --------------------------------------------------------------------------------
+
+namespace
+{
+
+const OUString lcl_aLabelRole( RTL_CONSTASCII_USTRINGPARAM( "label" ));
+
+String lcl_GetRoleLBEntry(
+ const OUString & rRole, const OUString & rRange )
+{
+ String aEntry( rRole );
+ aEntry += '\t';
+ aEntry += String(
+ ::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
+ aEntry += '\t';
+ aEntry += String( rRange );
+
+ return aEntry;
+}
+
+void lcl_UpdateCurrentRange(
+ SvTabListBox & rOutListBox,
+ const OUString & rRole, const OUString & rRange )
+{
+ SvLBoxEntry * pEntry = rOutListBox.FirstSelected();
+ if( pEntry )
+ rOutListBox.SetEntryText( lcl_GetRoleLBEntry( rRole, rRange ), pEntry );
+}
+
+bool lcl_UpdateCurrentSeriesName(
+ SvTreeListBox & rOutListBox )
+{
+ bool bResult = false;
+ ::chart::SeriesEntry * pEntry = dynamic_cast< ::chart::SeriesEntry * >( rOutListBox.FirstSelected());
+ if( pEntry &&
+ pEntry->m_xDataSeries.is() &&
+ pEntry->m_xChartType.is())
+ {
+ String aLabel( ::chart::DataSeriesHelper::getDataSeriesLabel(
+ pEntry->m_xDataSeries,
+ pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel()));
+ if( aLabel.Len())
+ {
+ rOutListBox.SetEntryText( pEntry, aLabel );
+ bResult = true;
+ }
+ }
+ return bResult;
+}
+
+OUString lcl_GetSelectedRole( const SvTabListBox & rRoleListBox, bool bUITranslated = false )
+{
+ OUString aResult;
+ SvLBoxEntry * pEntry = rRoleListBox.FirstSelected();
+ if( pEntry )
+ aResult = OUString( rRoleListBox.GetEntryText( pEntry,
+ bUITranslated ? 1 : 0 ));
+ return aResult;
+}
+
+OUString lcl_GetSelectedRolesRange( const SvTabListBox & rRoleListBox )
+{
+ OUString aResult;
+ SvLBoxEntry * pEntry = rRoleListBox.FirstSelected();
+ if( pEntry )
+ aResult = OUString( rRoleListBox.GetEntryText( pEntry, 2 ));
+ return aResult;
+}
+
+OUString lcl_GetSequenceNameForLabel( ::chart::SeriesEntry * pEntry )
+{
+ OUString aResult( RTL_CONSTASCII_USTRINGPARAM("values-y"));
+ if( pEntry &&
+ pEntry->m_xChartType.is())
+ {
+ aResult = pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel();
+ }
+ return aResult;
+}
+
+static long lcl_pRoleListBoxTabs[] =
+ { 3, // Number of Tabs
+ 0, 0, 75
+ };
+
+void lcl_ShowChooserButton(
+ ::chart::RangeSelectionButton & rChooserButton,
+ Edit & rEditField,
+ BOOL bShow )
+{
+ if( rChooserButton.IsVisible() != bShow )
+ {
+ rChooserButton.Show( bShow );
+ sal_Int32 nWidhtDiff = 12 + 4;
+ if( bShow )
+ nWidhtDiff = -nWidhtDiff;
+ Size aSize = rChooserButton.PixelToLogic( rEditField.GetSizePixel(), MAP_APPFONT );
+ aSize.setWidth( aSize.getWidth() + nWidhtDiff );
+ rEditField.SetSizePixel( rChooserButton.LogicToPixel( aSize, MAP_APPFONT ));
+ }
+}
+
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+
+void lcl_addLSequenceToDataSource(
+ const Reference< chart2::data::XLabeledDataSequence > & xLSequence,
+ const Reference< chart2::data::XDataSource > & xSource )
+{
+ Reference< data::XDataSink > xSink( xSource, uno::UNO_QUERY );
+ if( xSink.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
+ aData.realloc( aData.getLength() + 1 );
+ aData[ aData.getLength() - 1 ] = xLSequence;
+ xSink->setData( aData );
+ }
+}
+
+Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
+ const Reference< chart2::data::XDataSource > & xDataSource )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
+
+ for( sal_Int32 i=0; i<aSequences.getLength(); ++i )
+ {
+ // no values are set but a label exists
+ if( ! aSequences[i]->getValues().is() &&
+ aSequences[i]->getLabel().is())
+ {
+ xResult.set( aSequences[i] );
+ break;
+ }
+ }
+
+ return xResult;
+}
+
+void lcl_shiftControlY( Control & rControl, long nYOffset )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setY( aPos.getY() + nYOffset );
+ rControl.SetPosPixel( aPos );
+}
+
+void lcl_increaseHeightOfControl( Control & rControl, long nYOffset )
+{
+ Size aSize( rControl.GetSizePixel());
+ aSize.setHeight( aSize.getHeight () + nYOffset );
+ rControl.SetSizePixel( aSize );
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+DataSourceTabPage::DataSourceTabPage(
+ Window * pParent,
+ DialogModel & rDialogModel,
+ ChartTypeTemplateProvider* pTemplateProvider,
+ Dialog * pParentDialog,
+ bool bHideDescription /* = false */ ) :
+ ::svt::OWizardPage( pParent, SchResId( TP_DATA_SOURCE )),
+
+ m_aFT_CAPTION ( this, SchResId( FT_CAPTION_FOR_WIZARD )),
+ m_aFT_SERIES ( this, SchResId( FT_SERIES )),
+ m_apLB_SERIES( new SeriesListBox( this, SchResId( LB_SERIES ))),
+ m_aBTN_ADD ( this, SchResId( BTN_ADD )),
+ m_aBTN_REMOVE ( this, SchResId( BTN_REMOVE )),
+ m_aBTN_UP ( this, SchResId( BTN_UP )),
+ m_aBTN_DOWN ( this, SchResId( BTN_DOWN )),
+ m_aFT_ROLE ( this, SchResId( FT_ROLE )),
+ m_aLB_ROLE ( this, SchResId( LB_ROLE )),
+ m_aFT_RANGE ( this, SchResId( FT_RANGE )),
+ m_aEDT_RANGE ( this, SchResId( EDT_RANGE )),
+ m_aIMB_RANGE_MAIN ( this, SchResId( IMB_RANGE_MAIN )),
+ m_aFT_CATEGORIES ( this, SchResId( FT_CATEGORIES )),
+ m_aFT_DATALABELS ( this, SchResId( FT_DATALABELS )),
+ m_aEDT_CATEGORIES ( this, SchResId( EDT_CATEGORIES )),
+ m_aIMB_RANGE_CAT ( this, SchResId( IMB_RANGE_CAT )),
+
+ m_pTemplateProvider( pTemplateProvider ),
+ m_rDialogModel( rDialogModel ),
+
+ m_pCurrentRangeChoosingField( 0 ),
+ m_bIsDirty( false ),
+ m_pParentDialog( pParentDialog ),
+ m_pTabPageNotifiable( dynamic_cast< TabPageNotifiable * >( pParentDialog ))
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ // note: the offset should be a negative value for shifting upwards, the
+ // 4 is for the offset difference between a wizard page and a tab-page
+ long nYOffset = - ( m_aFT_SERIES.GetPosPixel().getY() - m_aFT_CAPTION.GetPosPixel().getY() + 4 );
+ long nUpShift = - 2;
+ long nYResize = - (nYOffset - nUpShift);
+ m_aFT_CAPTION.Hide();
+
+ // shift list boxes and enlarge them by the space saved by hiding the caption
+ lcl_shiftControlY( m_aFT_SERIES, nYOffset );
+ lcl_shiftControlY( *(m_apLB_SERIES.get()), nYOffset );
+ lcl_increaseHeightOfControl( *(m_apLB_SERIES.get()), nYResize );
+
+ lcl_shiftControlY( m_aFT_ROLE, nYOffset );
+ lcl_shiftControlY( m_aLB_ROLE, nYOffset );
+ lcl_increaseHeightOfControl( m_aLB_ROLE, nYResize );
+
+ lcl_shiftControlY( m_aBTN_ADD, nUpShift );
+ lcl_shiftControlY( m_aBTN_REMOVE, nUpShift );
+ lcl_shiftControlY( m_aBTN_UP, nUpShift );
+ lcl_shiftControlY( m_aBTN_DOWN, nUpShift );
+ lcl_shiftControlY( m_aFT_RANGE, nUpShift );
+ lcl_shiftControlY( m_aEDT_RANGE, nUpShift );
+ lcl_shiftControlY( m_aIMB_RANGE_MAIN, nUpShift );
+ lcl_shiftControlY( m_aFT_CATEGORIES, nUpShift );
+ lcl_shiftControlY( m_aFT_DATALABELS, nUpShift );
+ lcl_shiftControlY( m_aEDT_CATEGORIES, nUpShift );
+ lcl_shiftControlY( m_aIMB_RANGE_CAT, nUpShift );
+ }
+ else
+ {
+ // make font of caption bold
+ Font aFont( m_aFT_CAPTION.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_CAPTION.SetControlFont( aFont );
+
+ // no mnemonic
+ m_aFT_CAPTION.SetStyle( m_aFT_CAPTION.GetStyle() | WB_NOLABEL );
+ }
+
+ m_aFixedTextRange = OUString( m_aFT_RANGE.GetText() );
+ this->SetText( String( SchResId( STR_OBJECT_DATASERIES_PLURAL ) ) );
+
+ // set handlers
+ m_apLB_SERIES->SetSelectHdl( LINK( this, DataSourceTabPage, SeriesSelectionChangedHdl ));
+
+ m_aLB_ROLE.SetStyle( m_aLB_ROLE.GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
+ m_aLB_ROLE.SetSelectionMode( SINGLE_SELECTION );
+ m_aLB_ROLE.SetSelectHdl( LINK( this, DataSourceTabPage, RoleSelectionChangedHdl ));
+
+ m_aEDT_RANGE.SetKeyInputHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
+ m_aEDT_CATEGORIES.SetKeyInputHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
+
+ m_aIMB_RANGE_MAIN.SetClickHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
+ m_aIMB_RANGE_CAT.SetClickHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
+
+ m_aBTN_ADD.SetClickHdl( LINK( this, DataSourceTabPage, AddButtonClickedHdl ));
+ m_aBTN_REMOVE.SetClickHdl( LINK( this, DataSourceTabPage, RemoveButtonClickedHdl ));
+
+ m_aBTN_UP.SetClickHdl( LINK( this, DataSourceTabPage, UpButtonClickedHdl ));
+ m_aBTN_DOWN.SetClickHdl( LINK( this, DataSourceTabPage, DownButtonClickedHdl ));
+
+ m_aEDT_RANGE.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
+ m_aEDT_CATEGORIES.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
+ m_aEDT_RANGE.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
+ m_aEDT_CATEGORIES.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
+
+ // #i75179# enable setting the background to a different color
+ m_aEDT_RANGE.SetStyle( m_aEDT_RANGE.GetStyle() | WB_FORCECTRLBACKGROUND );
+ m_aEDT_CATEGORIES.SetStyle( m_aEDT_CATEGORIES.GetStyle() | WB_FORCECTRLBACKGROUND );
+
+ // set symbol font for arrows
+ // note: StarSymbol is substituted to OpenSymbol for OOo
+ Font aSymbolFont( m_aBTN_UP.GetFont());
+ aSymbolFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )));
+ m_aBTN_UP.SetControlFont( aSymbolFont );
+ m_aBTN_DOWN.SetControlFont( aSymbolFont );
+
+ // set button text
+ sal_Unicode cBlackUpPointingTriangle( 0x25b2 );
+ sal_Unicode cBlackDownPointingTriangle( 0x25bc );
+ m_aBTN_UP.SetText( String( cBlackUpPointingTriangle ));
+ m_aBTN_DOWN.SetText( String( cBlackDownPointingTriangle ));
+
+ // init controls
+ m_aLB_ROLE.SetTabs( lcl_pRoleListBoxTabs, MAP_APPFONT );
+ m_aLB_ROLE.Show();
+
+ updateControlsFromDialogModel();
+
+ // select first series
+ if( m_apLB_SERIES->First())
+ m_apLB_SERIES->Select( m_apLB_SERIES->First());
+ m_apLB_SERIES->GrabFocus();
+}
+
+DataSourceTabPage::~DataSourceTabPage()
+{}
+
+void DataSourceTabPage::ActivatePage()
+{
+ OWizardPage::ActivatePage();
+ updateControlsFromDialogModel();
+}
+
+void DataSourceTabPage::initializePage()
+{
+}
+
+void DataSourceTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void DataSourceTabPage::commitPage()
+{
+ commitPage(::svt::WizardTypes::eFinish);
+}
+
+sal_Bool DataSourceTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ updateModelFromControl( 0 /*update all*/ );
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
+bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit )
+{
+ OUString aRange( rEdit.GetText());
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ m_rDialogModel.getRangeSelectionHelper()->verifyCellRange( aRange );
+
+ if( bIsValid )
+ {
+ rEdit.SetControlForeground();
+ rEdit.SetControlBackground();
+ }
+ else
+ {
+ rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ }
+
+ return bIsValid;
+}
+
+bool DataSourceTabPage::isValid()
+{
+ bool bRoleRangeValid = true;
+ bool bCategoriesRangeValid = true;
+ bool bHasSelectedEntry = (m_apLB_SERIES->FirstSelected() != 0);
+
+ if( bHasSelectedEntry )
+ bRoleRangeValid = isRangeFieldContentValid( m_aEDT_RANGE );
+ if( m_aEDT_CATEGORIES.IsEnabled() )
+ bCategoriesRangeValid = isRangeFieldContentValid( m_aEDT_CATEGORIES );
+ bool bValid = ( bRoleRangeValid && bCategoriesRangeValid );
+
+ if( m_pTabPageNotifiable )
+ {
+ if( bValid )
+ m_pTabPageNotifiable->setValidPage( this );
+ else
+ m_pTabPageNotifiable->setInvalidPage( this );
+ }
+
+ return bValid;
+}
+
+void DataSourceTabPage::setDirty()
+{
+ m_bIsDirty = true;
+}
+
+void DataSourceTabPage::updateControlsFromDialogModel()
+{
+ // series
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl( 0 );
+
+ // categories
+ m_aEDT_CATEGORIES.SetText( String( m_rDialogModel.getCategoriesRange() ));
+
+ updateControlState();
+}
+
+void DataSourceTabPage::fillSeriesListBox()
+{
+ m_apLB_SERIES->SetUpdateMode( FALSE );
+
+ Reference< XDataSeries > xSelected;
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ if( pEntry )
+ xSelected.set( pEntry->m_xDataSeries );
+
+ bool bHasSelectedEntry = (pEntry != 0);
+ SvLBoxEntry * pSelectedEntry = 0;
+ m_apLB_SERIES->Clear();
+
+ ::std::vector< DialogModel::tSeriesWithChartTypeByName > aSeries(
+ m_rDialogModel.getAllDataSeriesWithLabel() );
+
+ sal_Int32 nUnnamedSeriesIndex = 1;
+ for( ::std::vector< DialogModel::tSeriesWithChartTypeByName >::const_iterator aIt = aSeries.begin();
+ aIt != aSeries.end(); ++aIt )
+ {
+ String aLabel( (*aIt).first );
+ if( !aLabel.Len())
+ {
+ if( nUnnamedSeriesIndex > 1 )
+ {
+ OUString aResString( String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES_WITH_INDEX )));
+
+ // replace index of unnamed series
+ const OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%NUMBER" ));
+ sal_Int32 nIndex = aResString.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ aLabel = String( aResString.replaceAt(
+ nIndex, aReplacementStr.getLength(),
+ String::CreateFromInt32( nUnnamedSeriesIndex )));
+ }
+ if( aLabel.Len() == 0 )
+ aLabel = String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES ));
+
+ ++nUnnamedSeriesIndex;
+ }
+ pEntry = dynamic_cast< SeriesEntry * >(
+ m_apLB_SERIES->InsertEntry( aLabel ));
+ if( pEntry )
+ {
+ pEntry->m_xDataSeries.set( (*aIt).second.first );
+ pEntry->m_xChartType.set( (*aIt).second.second );
+ if( bHasSelectedEntry && ((*aIt).second.first == xSelected))
+ pSelectedEntry = pEntry;
+ }
+ }
+
+ if( bHasSelectedEntry && pSelectedEntry )
+ m_apLB_SERIES->Select( pSelectedEntry );
+
+ m_apLB_SERIES->SetUpdateMode( TRUE );
+}
+
+void DataSourceTabPage::fillRoleListBox()
+{
+ SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pSeriesEntry != 0);
+
+ SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
+ ULONG nRoleIndex = SAL_MAX_UINT32;
+ if( pRoleEntry )
+ nRoleIndex = m_aLB_ROLE.GetModel()->GetAbsPos( pRoleEntry );
+
+ if( bHasSelectedEntry )
+ {
+ DialogModel::tRolesWithRanges aRoles(
+ m_rDialogModel.getRolesWithRanges(
+ pSeriesEntry->m_xDataSeries,
+ lcl_GetSequenceNameForLabel( pSeriesEntry ),
+ pSeriesEntry->m_xChartType ));
+
+ // fill role list
+ m_aLB_ROLE.SetUpdateMode( FALSE );
+ m_aLB_ROLE.Clear();
+ m_aLB_ROLE.RemoveSelection();
+
+ for( DialogModel::tRolesWithRanges::const_iterator aIt( aRoles.begin());
+ aIt != aRoles.end(); ++ aIt )
+ {
+ m_aLB_ROLE.InsertEntry( lcl_GetRoleLBEntry( aIt->first, aIt->second ));
+ }
+
+ // series may contain no roles, check listbox size before selecting entries
+ if( m_aLB_ROLE.GetEntryCount() > 0 )
+ {
+ if( nRoleIndex >= m_aLB_ROLE.GetEntryCount())
+ nRoleIndex = 0;
+ m_aLB_ROLE.Select( m_aLB_ROLE.GetEntry( nRoleIndex ));
+ }
+
+ m_aLB_ROLE.SetUpdateMode( TRUE );
+ }
+}
+
+void DataSourceTabPage::updateControlState()
+{
+ SvLBoxEntry * pSeriesEntry = m_apLB_SERIES->FirstSelected();
+ bool bHasSelectedSeries = (pSeriesEntry != 0);
+ bool bHasValidRole = false;
+ bool bHasRangeChooser = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
+
+ if( bHasSelectedSeries )
+ {
+ SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
+ bHasValidRole = (pRoleEntry != 0);
+ }
+
+ m_aBTN_ADD.Enable( true );
+ m_aBTN_REMOVE.Enable( bHasSelectedSeries );
+
+ m_aBTN_UP.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->First()));
+ m_aBTN_DOWN.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->Last()));
+
+ bool bHasCategories = m_rDialogModel.isCategoryDiagram();
+
+ m_aFT_DATALABELS.Show(!bHasCategories);
+ m_aFT_CATEGORIES.Show( bHasCategories);
+ BOOL bShowIB = bHasRangeChooser;
+ lcl_ShowChooserButton( m_aIMB_RANGE_CAT, m_aEDT_CATEGORIES, bShowIB );
+
+ m_aFT_SERIES.Enable();
+ m_apLB_SERIES->Enable();
+
+ m_aFT_ROLE.Enable( bHasSelectedSeries );
+ m_aLB_ROLE.Enable( bHasSelectedSeries );
+
+ m_aFT_RANGE.Enable( bHasValidRole );
+ m_aEDT_RANGE.Enable( bHasValidRole );
+ lcl_ShowChooserButton( m_aIMB_RANGE_MAIN, m_aEDT_RANGE, bShowIB );
+ isValid();
+}
+
+IMPL_LINK( DataSourceTabPage, SeriesSelectionChangedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ if( m_apLB_SERIES->FirstSelected())
+ {
+ fillRoleListBox();
+ RoleSelectionChangedHdl( 0 );
+ }
+ updateControlState();
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RoleSelectionChangedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SvLBoxEntry * pEntry = m_aLB_ROLE.FirstSelected();
+ if( pEntry )
+ {
+ OUString aRange( m_aEDT_RANGE.GetText());
+ OUString aSelectedRoleUI = lcl_GetSelectedRole( m_aLB_ROLE, true );
+ OUString aSelectedRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
+
+ // replace role in fixed text label
+ const OUString aReplacementStr( RTL_CONSTASCII_USTRINGPARAM( "%VALUETYPE" ));
+ sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ {
+ m_aFT_RANGE.SetText(
+ String( m_aFixedTextRange.replaceAt(
+ nIndex, aReplacementStr.getLength(), aSelectedRoleUI )));
+ }
+
+ m_aEDT_RANGE.SetText( String( aSelectedRange ));
+ isValid();
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, MainRangeButtonClickedHdl, void *, EMPTYARG )
+{
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+ m_pCurrentRangeChoosingField = & m_aEDT_RANGE;
+ if( m_aEDT_RANGE.GetText().Len() > 0 &&
+ ! updateModelFromControl( m_pCurrentRangeChoosingField ))
+ return 0;
+
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ OUString aSelectedRolesRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
+
+ if( bHasSelectedEntry && (m_aLB_ROLE.FirstSelected() != 0))
+ {
+ String aStr( SchResId( STR_DATA_SELECT_RANGE_FOR_SERIES ));
+ OUString aUIStr( aStr );
+
+ // replace role
+ OUString aReplacement( RTL_CONSTASCII_USTRINGPARAM( "%VALUETYPE" ));
+ sal_Int32 nIndex = aUIStr.indexOf( aReplacement );
+ if( nIndex != -1 )
+ {
+ aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
+ lcl_GetSelectedRole( m_aLB_ROLE, true ));
+ }
+ // replace series name
+ aReplacement = C2U( "%SERIESNAME" );
+ nIndex = aUIStr.indexOf( aReplacement );
+ if( nIndex != -1 )
+ {
+ aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
+ OUString( m_apLB_SERIES->GetEntryText( pEntry )));
+ }
+
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange( aSelectedRolesRange, aUIStr, *this );
+ }
+ else
+ m_pCurrentRangeChoosingField = 0;
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, CategoriesRangeButtonClickedHdl, void *, EMPTYARG )
+{
+ OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
+ m_pCurrentRangeChoosingField = & m_aEDT_CATEGORIES;
+ if( m_aEDT_CATEGORIES.GetText().Len() > 0 &&
+ ! updateModelFromControl( m_pCurrentRangeChoosingField ))
+ return 0;
+
+ String aStr( SchResId( m_aFT_CATEGORIES.IsVisible() ? STR_DATA_SELECT_RANGE_FOR_CATEGORIES : STR_DATA_SELECT_RANGE_FOR_DATALABELS ));
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange(
+ m_rDialogModel.getCategoriesRange(), OUString( aStr ), *this );
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, AddButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ Reference< XDataSeries > xSeriesToInsertAfter;
+ Reference< XChartType > xChartTypeForNewSeries;
+ if( m_pTemplateProvider )
+ m_rDialogModel.setTemplate( m_pTemplateProvider->getCurrentTemplate());
+
+ if( pEntry )
+ {
+ xSeriesToInsertAfter.set( pEntry->m_xDataSeries );
+ xChartTypeForNewSeries.set( pEntry->m_xChartType );
+ }
+ else
+ {
+ ::std::vector< Reference< XDataSeriesContainer > > aCntVec(
+ m_rDialogModel.getAllDataSeriesContainers());
+ if( ! aCntVec.empty())
+ xChartTypeForNewSeries.set( aCntVec.front(), uno::UNO_QUERY );
+ }
+ OSL_ENSURE( xChartTypeForNewSeries.is(), "Cannot insert new series" );
+
+ m_rDialogModel.insertSeriesAfter( xSeriesToInsertAfter, xChartTypeForNewSeries );
+ setDirty();
+
+ fillSeriesListBox();
+ // note the box was cleared and refilled, so pEntry is invalid now
+ SvLBoxEntry * pSelEntry = m_apLB_SERIES->FirstSelected();
+ if( pSelEntry )
+ {
+ SvLBoxEntry * pNextEntry = m_apLB_SERIES->Next( pSelEntry );
+ if( pNextEntry )
+ m_apLB_SERIES->Select( pNextEntry );
+ }
+ SeriesSelectionChangedHdl( 0 );
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RemoveButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ if( pEntry )
+ {
+ Reference< XDataSeries > xNewSelSeries;
+ SeriesEntry * pNewSelEntry = dynamic_cast< SeriesEntry * >(
+ m_apLB_SERIES->Next( pEntry ));
+ if( pNewSelEntry )
+ xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
+ else
+ {
+ pNewSelEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Prev( pEntry ));
+ if( pNewSelEntry )
+ xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
+ }
+
+ m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
+ setDirty();
+
+ m_apLB_SERIES->RemoveSelection();
+ fillSeriesListBox();
+
+ // select previous or next series
+ //@improve: see methods GetModel()->GetAbsPos()/GetEntry() for absoulte list positions
+ if( xNewSelSeries.is())
+ {
+ pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->First());
+ while( pEntry )
+ {
+ if( pEntry->m_xDataSeries == xNewSelSeries )
+ {
+ m_apLB_SERIES->Select( pEntry );
+ break;
+ }
+ pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Next( pEntry ));
+ }
+ }
+ SeriesSelectionChangedHdl( 0 );
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, UpButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_UP );
+ setDirty();
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl(0);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, DownButtonClickedHdl, void *, EMPTYARG )
+{
+ m_rDialogModel.startControllerLockTimer();
+ SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_DOWN );
+ setDirty();
+ fillSeriesListBox();
+ SeriesSelectionChangedHdl(0);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RangeModifiedHdl, Edit*, pEdit )
+{
+ if( isRangeFieldContentValid( *pEdit ))
+ setDirty();
+
+ // enable/disable OK button
+ isValid();
+
+ return 0;
+}
+
+IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
+{
+ // note: isValid sets the color of the edit field
+ if( isRangeFieldContentValid( *pEdit ))
+ {
+ setDirty();
+ updateModelFromControl( pEdit );
+ if( pEdit== &m_aEDT_RANGE )
+ {
+ if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
+ fillSeriesListBox();
+ }
+ }
+ // enable/disable OK button
+ isValid();
+
+ return 0;
+}
+
+void DataSourceTabPage::listeningFinished(
+ const ::rtl::OUString & rNewRange )
+{
+ // rNewRange becomes invalid after removing the listener
+ OUString aRange( rNewRange );
+
+ m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
+
+ // change edit field
+ ToTop();
+ GrabFocus();
+ if( m_pCurrentRangeChoosingField )
+ {
+ m_pCurrentRangeChoosingField->SetText( String( aRange ));
+ m_pCurrentRangeChoosingField->GrabFocus();
+ }
+
+ if( m_pCurrentRangeChoosingField == & m_aEDT_RANGE )
+ {
+ m_aEDT_RANGE.SetText( String( aRange ));
+ setDirty();
+ }
+ else if( m_pCurrentRangeChoosingField == & m_aEDT_CATEGORIES )
+ {
+ m_aEDT_CATEGORIES.SetText( String( aRange ));
+ setDirty();
+ }
+
+ updateModelFromControl( m_pCurrentRangeChoosingField );
+ if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
+ fillSeriesListBox();
+
+ m_pCurrentRangeChoosingField = 0;
+
+ updateControlState();
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+
+void DataSourceTabPage::disposingRangeSelection()
+{
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
+}
+
+bool DataSourceTabPage::updateModelFromControl( Edit * pField )
+{
+ if( !m_bIsDirty )
+ return true;
+
+ ControllerLockGuard aLockedControllers( m_rDialogModel.getChartModel() );
+
+ // @todo: validity check of field content
+ bool bResult = true;
+ bool bAll = (pField == 0);
+ Reference< data::XDataProvider > xDataProvider( m_rDialogModel.getDataProvider());
+
+ if( bAll || (pField == & m_aEDT_CATEGORIES) )
+ {
+ Reference< data::XLabeledDataSequence > xLabeledSeq( m_rDialogModel.getCategories() );
+ if( xDataProvider.is())
+ {
+ OUString aRange( m_aEDT_CATEGORIES.GetText());
+ if( aRange.getLength())
+ {
+ // create or change categories
+ if( !xLabeledSeq.is())
+ {
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ m_rDialogModel.setCategories( xLabeledSeq );
+ }
+ try
+ {
+ xLabeledSeq->setValues( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else if( xLabeledSeq.is())
+ {
+ // clear existing categories
+ xLabeledSeq.set(0);
+ m_rDialogModel.setCategories( xLabeledSeq );
+ }
+ }
+ }
+
+ SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
+ bool bHasSelectedEntry = (pSeriesEntry != 0);
+
+ if( bHasSelectedEntry )
+ {
+ if( bAll || (pField == & m_aEDT_RANGE) )
+ {
+ try
+ {
+ OUString aSelectedRole = lcl_GetSelectedRole( m_aLB_ROLE );
+ OUString aRange( m_aEDT_RANGE.GetText());
+ OUString aSequenceRole( aSelectedRole );
+ bool bIsLabel = aSequenceRole.equals( lcl_aLabelRole );
+ OUString aSequenceNameForLabel( lcl_GetSequenceNameForLabel( pSeriesEntry ));
+
+ if( bIsLabel )
+ aSequenceRole = aSequenceNameForLabel;
+
+ Reference< data::XDataSource > xSource( pSeriesEntry->m_xDataSeries, uno::UNO_QUERY_THROW );
+ Reference< data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, aSequenceRole ));
+
+ if( xDataProvider.is())
+ {
+ if( bIsLabel )
+ {
+ if( ! xLabeledSeq.is())
+ {
+ // check if there is already an "orphan" label sequence
+ xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ if( ! xLabeledSeq.is())
+ {
+ // no corresponding labeled data sequence for label found
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ }
+ }
+ if( xLabeledSeq.is())
+ {
+ if( aRange.getLength())
+ {
+ Reference< data::XDataSequence > xNewSeq;
+ try
+ {
+ xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ if( xNewSeq.is())
+ {
+ // update range name by the full string provided
+ // by the data provider. E.g. "a1" might become
+ // "$Sheet1.$A$1"
+ aRange = xNewSeq->getSourceRangeRepresentation();
+ Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( lcl_aLabelRole ));
+ xLabeledSeq->setLabel( xNewSeq );
+ }
+ }
+ else
+ {
+ xLabeledSeq->setLabel( Reference< data::XDataSequence >());
+ }
+ }
+ }
+ else
+ {
+ if( aRange.getLength())
+ {
+ Reference< data::XDataSequence > xNewSeq;
+ try
+ {
+ xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ // should work as validation should have happened before
+ ASSERT_EXCEPTION( ex );
+ }
+ if( xNewSeq.is())
+ {
+ // update range name by the full string provided
+ // by the data provider. E.g. "a1:e1" might become
+ // "$Sheet1.$A$1:$E$1"
+ aRange = xNewSeq->getSourceRangeRepresentation();
+
+ Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( aSelectedRole ));
+ if( !xLabeledSeq.is())
+ {
+ if( aSelectedRole.equals( aSequenceNameForLabel ))
+ xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
+ if( ! xLabeledSeq.is())
+ {
+ xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
+ lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
+ }
+ }
+ xLabeledSeq->setValues( xNewSeq );
+ }
+ }
+ else if( xLabeledSeq.is())
+ {
+ // values cannot be deleted. This would also delete the Role (for labels)
+// xLabeledSeq->setValues( Reference< data::XDataSequence >());
+ }
+ }
+ }
+
+ lcl_UpdateCurrentRange( m_aLB_ROLE, aSelectedRole, aRange );
+ }
+ catch( uno::Exception & ex )
+ {
+ bResult = false;
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // update View
+ // @todo remove this when automatic view updates from calc, writer and own data sequences are available
+ if( bResult )
+ {
+ try
+ {
+ Reference< util::XModifiable > xModifiable( m_rDialogModel.getChartModel(), uno::UNO_QUERY );
+ if( xModifiable.is() )
+ xModifiable->setModified( sal_True );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hrc b/chart2/source/controller/dialogs/tp_DataSource.hrc
new file mode 100644
index 000000000000..cf8147d5f775
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FT_CAPTION_FOR_WIZARD 1
+
+#define FT_SERIES 10
+#define LB_SERIES 20
+#define BTN_ADD 30
+#define BTN_REMOVE 40
+
+#define FT_ROLE 50
+#define LB_ROLE 60
+
+#define FT_RANGE 70
+#define EDT_RANGE 80
+#define IMB_RANGE_MAIN 90
+
+#define FT_CATEGORIES 110
+#define FT_DATALABELS 111
+#define EDT_CATEGORIES 120
+#define IMB_RANGE_CAT 130
+
+#define BTN_UP 140
+#define BTN_DOWN 150
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
new file mode 100644
index 000000000000..e65b503bfcc2
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATASOURCETABPAGE_HXX
+#define CHART2_DATASOURCETABPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+
+#include "DialogModel.hxx"
+#include "TabPageNotifiable.hxx"
+
+// header for class Edit
+#include <vcl/edit.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+// header for class PushButton, OKButton, CancelButton, HelpButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class FixedText, FixedLine
+#include <vcl/fixed.hxx>
+// header for class SvTabListBox
+#include <svtools/svtabbx.hxx>
+// header for class SvTreeListBox
+#include <svtools/svtreebx.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+
+#include <utility>
+#include <vector>
+#include <memory>
+
+#include "RangeSelectionListener.hxx"
+#include "RangeSelectionButton.hxx"
+#include "RangeEdit.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartType;
+}}}}
+
+namespace chart
+{
+
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class DataSourceTabPage :
+ public ::svt::OWizardPage,
+ public RangeSelectionListenerParent
+{
+public:
+ explicit DataSourceTabPage(
+ Window * pParent,
+ DialogModel & rDialogModel,
+ ChartTypeTemplateProvider* pTemplateProvider,
+ Dialog * pParentDialog,
+ bool bHideDescription = false );
+ virtual ~DataSourceTabPage();
+
+ void commitPage();
+
+protected:
+ // OWizardPage
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
+
+ virtual void initializePage();
+
+ DECL_LINK( SeriesSelectionChangedHdl, void* );
+ DECL_LINK( RoleSelectionChangedHdl, void* );
+ DECL_LINK( MainRangeButtonClickedHdl, void* );
+ DECL_LINK( CategoriesRangeButtonClickedHdl, void* );
+ DECL_LINK( AddButtonClickedHdl, void* );
+ DECL_LINK( RemoveButtonClickedHdl, void* );
+ DECL_LINK( RangeModifiedHdl, Edit* );
+ DECL_LINK( RangeUpdateDataHdl, Edit* );
+ DECL_LINK( UpButtonClickedHdl, void* );
+ DECL_LINK( DownButtonClickedHdl, void* );
+
+ // ____ RangeSelectionListenerParent ____
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange );
+ virtual void disposingRangeSelection();
+
+ void updateControlState();
+
+protected:
+ /** updates the internal data according to the content of the given edit
+ field. If pField is 0, all relevant fields are used
+
+ @return
+ <TRUE/> if the text from the field is a valid format to the internal
+ data was valid
+ */
+ bool updateModelFromControl( Edit * pField = 0 );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener >
+ getSelectionRangeListener();
+
+ /** @return </TRUE>, if the edit field contains a valid range entry. if no
+ XCellRangesAccess can be obtained, </TRUE> is returned.
+ */
+ bool isRangeFieldContentValid( Edit & rEdit );
+
+ /** @return </TRUE>, if the tab-page is in a consistent (commitable) state
+ */
+ bool isValid();
+ void setDirty();
+
+ void updateControlsFromDialogModel();
+
+ void fillSeriesListBox();
+ void fillRoleListBox();
+
+private:
+ FixedText m_aFT_CAPTION;
+ FixedText m_aFT_SERIES;
+ ::std::auto_ptr< SvTreeListBox > m_apLB_SERIES;
+ PushButton m_aBTN_ADD;
+ PushButton m_aBTN_REMOVE;
+ PushButton m_aBTN_UP;
+ PushButton m_aBTN_DOWN;
+
+ FixedText m_aFT_ROLE;
+ SvTabListBox m_aLB_ROLE;
+ FixedText m_aFT_RANGE;
+ RangeEdit m_aEDT_RANGE;
+ RangeSelectionButton m_aIMB_RANGE_MAIN;
+
+ FixedText m_aFT_CATEGORIES;
+ FixedText m_aFT_DATALABELS;//used for xy charts
+ RangeEdit m_aEDT_CATEGORIES;
+ RangeSelectionButton m_aIMB_RANGE_CAT;
+
+ ::rtl::OUString m_aFixedTextRange;
+
+ ChartTypeTemplateProvider * m_pTemplateProvider;
+ DialogModel & m_rDialogModel;
+ Edit * m_pCurrentRangeChoosingField;
+ bool m_bIsDirty;
+ sal_Int32 m_nLastChartTypeGroupIndex;
+
+ Dialog * m_pParentDialog;
+ TabPageNotifiable * m_pTabPageNotifiable;
+};
+
+} // namespace chart
+
+// CHART2_DATASOURCETABPAGE_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/tp_DataSource.src b/chart2/source/controller/dialogs/tp_DataSource.src
new file mode 100644
index 000000000000..9173a9c709ab
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSource.src
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "tp_DataSource.hrc"
+#include "HelpIds.hrc"
+
+TabPage TP_DATA_SOURCE
+{
+ HelpID = "chart2:TabPage:TP_DATA_SOURCE";
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 248, 140 );
+ SVLook = TRUE ;
+
+ // ----------------------------------------
+
+ FixedText FT_CAPTION_FOR_WIZARD
+ {
+ Pos = MAP_APPFONT ( 5 , 8 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ Text [ en-US ] = "Customize data ranges for individual data series" ;
+ };
+
+ FixedText FT_SERIES
+ {
+ Pos = MAP_APPFONT ( 6 , 22 );
+ Size = MAP_APPFONT ( 72 , 8 );
+
+ Text [ en-US ] = "Data ~series";
+ };
+ Control LB_SERIES
+ {
+ HelpID = HID_SCH_SERIES_LIST ;
+ Border = TRUE;
+ TabStop = TRUE;
+ // DropDown = FALSE;
+ Pos = MAP_APPFONT ( 6 , 32 );
+ Size = MAP_APPFONT ( 72 , 69 );
+ };
+
+ FixedText FT_ROLE
+ {
+ Pos = MAP_APPFONT ( 82 , 22 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "~Data ranges";
+ };
+ Control LB_ROLE
+ {
+ HelpID = HID_SCH_DATA_RANGES_LIST ;
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 32 );
+ Size = MAP_APPFONT ( 160 , 43 );
+ };
+
+ // ----------------------------------------
+
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 82 , 79 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "Ran~ge for %VALUETYPE";
+ };
+ Edit EDT_RANGE
+ {
+ HelpID = "chart2:Edit:TP_DATA_SOURCE:EDT_RANGE";
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 89 );
+ Size = MAP_APPFONT ( 144 , 12 );
+ };
+ ImageButton IMB_RANGE_MAIN
+ {
+ HelpID = "chart2:ImageButton:TP_DATA_SOURCE:IMB_RANGE_MAIN";
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 228 , 88 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // ----------------------------------------
+
+ FixedText FT_CATEGORIES
+ {
+ Pos = MAP_APPFONT ( 82 , 107 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "~Categories";
+ };
+
+ FixedText FT_DATALABELS
+ {
+ Pos = MAP_APPFONT ( 82 , 107 );
+ Size = MAP_APPFONT ( 160 , 8 );
+
+ Text [ en-US ] = "Data ~labels" ;
+ };
+
+ Edit EDT_CATEGORIES
+ {
+ HelpID = "chart2:Edit:TP_DATA_SOURCE:EDT_CATEGORIES";
+ Border = TRUE;
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 82 , 117 );
+ Size = MAP_APPFONT ( 144 , 12 );
+ };
+ ImageButton IMB_RANGE_CAT
+ {
+ HelpID = "chart2:ImageButton:TP_DATA_SOURCE:IMB_RANGE_CAT";
+ TabStop = TRUE;
+ Pos = MAP_APPFONT ( 228 , 116 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // ----------------------------------------
+
+ PushButton BTN_ADD
+ {
+ HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_ADD";
+ TabStop = TRUE;
+ Disable = FALSE;
+ Pos = MAP_APPFONT ( 6 , 105 );
+ Size = MAP_APPFONT ( 54 , 14 );
+
+ Text [ en-US ] = "~Add";
+ };
+ PushButton BTN_REMOVE
+ {
+ HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_REMOVE";
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 6 , 121 );
+ Size = MAP_APPFONT ( 54 , 14 );
+
+ Text [ en-US ] = "~Remove";
+ };
+
+ // Note: Text is only a black triangle symbol
+ PushButton BTN_UP
+ {
+ HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_UP";
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 64 , 105 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+
+ // Note: Text is only a black triangle symbol
+ PushButton BTN_DOWN
+ {
+ HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_DOWN";
+ TabStop = TRUE;
+ Disable = TRUE;
+ Pos = MAP_APPFONT ( 64 , 121 );
+ Size = MAP_APPFONT ( 14 , 14 );
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_DataSourceControls.cxx b/chart2/source/controller/dialogs/tp_DataSourceControls.cxx
new file mode 100644
index 000000000000..b6f7ad680591
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSourceControls.cxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_DataSourceControls.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+SeriesEntry::~SeriesEntry()
+{}
+
+SeriesListBox::SeriesListBox( Window* pParent, const ResId & rResId ) :
+ SvTreeListBox( pParent, rResId )
+{}
+
+SeriesListBox::~SeriesListBox()
+{}
+
+SvLBoxEntry* SeriesListBox::CreateEntry() const
+{
+ return new SeriesEntry();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/dialogs/tp_DataSourceControls.hxx b/chart2/source/controller/dialogs/tp_DataSourceControls.hxx
new file mode 100644
index 000000000000..c1ebf512911c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataSourceControls.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_TP_DATASOURCECONTROLS_HXX
+#define CHART2_TP_DATASOURCECONTROLS_HXX
+
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+
+// header for class SvTabListBox
+#include <svtools/svtabbx.hxx>
+// header for class SvTreeListBox
+#include <svtools/svtreebx.hxx>
+
+namespace chart
+{
+
+class SeriesEntry : public ::SvLBoxEntry
+{
+public:
+ virtual ~SeriesEntry();
+
+ /// the corresponding data series
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >
+ m_xDataSeries;
+
+ /// the chart type that contains the series (via XDataSeriesContainer)
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ m_xChartType;
+};
+
+class SeriesListBox : public ::SvTreeListBox
+{
+public:
+ explicit SeriesListBox( Window* pParent, const ResId & rResId );
+ ~SeriesListBox( );
+
+ virtual SvLBoxEntry* CreateEntry() const;
+};
+
+} // namespace chart
+
+// CHART2_TP_DATASOURCECONTROLS_HXX
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
new file mode 100644
index 000000000000..395c956372ea
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_ErrorBars.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "TabPageNotifiable.hxx"
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ErrorBarsTabPage::ErrorBarsTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_YERRORBAR ), rInAttrs ),
+ m_aErrorBarResources(
+ this,
+ // the parent is the tab control, of which the parent is the dialog
+ dynamic_cast< Dialog * >( pParent->GetParent() ),
+ rInAttrs, /* bNoneAvailable = */ false )
+{
+ FreeResource();
+}
+
+ErrorBarsTabPage::~ErrorBarsTabPage()
+{
+}
+
+SfxTabPage* ErrorBarsTabPage::Create(
+ Window* pParent, const SfxItemSet& rOutAttrs )
+{
+ return new ErrorBarsTabPage( pParent, rOutAttrs );
+}
+
+BOOL ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ return m_aErrorBarResources.FillItemSet( rOutAttrs );
+}
+
+void ErrorBarsTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ m_aErrorBarResources.Reset( rInAttrs );
+}
+
+void ErrorBarsTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_aErrorBarResources.FillValueSets();
+}
+
+void ErrorBarsTabPage::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
+{
+ m_aErrorBarResources.SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
+}
+
+void ErrorBarsTabPage::SetErrorBarType( ErrorBarResources::tErrorBarType eNewType )
+{
+ m_aErrorBarResources.SetErrorBarType( eNewType );
+}
+
+void ErrorBarsTabPage::SetChartDocumentForRangeChoosing(
+ const uno::Reference< chart2::XChartDocument > & xChartDocument )
+{
+ m_aErrorBarResources.SetChartDocumentForRangeChoosing( xChartDocument );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
new file mode 100644
index 000000000000..f6d6779d34a9
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_ERRORBARS_HXX
+#define _CHART2_TP_ERRORBARS_HXX
+
+#include "res_ErrorBar.hxx"
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ErrorBarsTabPage : public SfxTabPage
+{
+public:
+ ErrorBarsTabPage ( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~ErrorBarsTabPage ();
+
+ void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
+ void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType );
+ void SetChartDocumentForRangeChoosing(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ ErrorBarResources m_aErrorBarResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.src b/chart2/source/controller/dialogs/tp_ErrorBars.src
new file mode 100644
index 000000000000..b649cb4474c9
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.src
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_ErrorBar.hrc"
+
+TabPage TP_YERRORBAR
+{
+ HelpID = "chart2:TabPage:TP_YERRORBAR";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_ERRORBARS( 260 - 12, 0 )
+};
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
new file mode 100644
index 000000000000..e3d23366a820
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_LegendPosition.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "res_LegendPosition.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include <svx/chrtitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchLegendPosTabPage::SchLegendPosTabPage(Window* pWindow,
+ const SfxItemSet& rInAttrs)
+ : SfxTabPage( pWindow, SchResId(TP_LEGEND_POS), rInAttrs )
+ , aGrpLegend( this, SchResId(GRP_LEGEND) )
+ , m_apLegendPositionResources( new LegendPositionResources(this) )
+ , m_aFlTextOrient( this, SchResId( FL_LEGEND_TEXTORIENT ) )
+ , m_aFtTextDirection( this, SchResId( FT_LEGEND_TEXTDIR ) )
+ , m_aLbTextDirection( this, SchResId( LB_LEGEND_TEXTDIR ), &m_aFlTextOrient, &m_aFtTextDirection )
+{
+ FreeResource();
+}
+
+SchLegendPosTabPage::~SchLegendPosTabPage()
+{
+}
+
+SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new SchLegendPosTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ m_apLegendPositionResources->writeToItemSet(rOutAttrs);
+
+ if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
+
+ return TRUE;
+}
+
+void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ m_apLegendPositionResources->initFromItemSet(rInAttrs);
+
+ const SfxPoolItem* pPoolItem = 0;
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
new file mode 100644
index 000000000000..4c0e7ce545d7
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_LEGENDPOSITION_HXX
+#define _CHART2_TP_LEGENDPOSITION_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+//for auto_ptr
+#include <memory>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendPositionResources;
+class SchLegendPosTabPage : public SfxTabPage
+{
+private:
+ FixedLine aGrpLegend;
+
+ ::std::auto_ptr< LegendPositionResources > m_apLegendPositionResources;
+
+ FixedLine m_aFlTextOrient;
+ FixedText m_aFtTextDirection;
+ TextDirectionListBox m_aLbTextDirection;
+
+public:
+ SchLegendPosTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchLegendPosTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.src b/chart2/source/controller/dialogs/tp_LegendPosition.src
new file mode 100644
index 000000000000..1ac64330108a
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.src
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_LegendPosition.hrc"
+
+TabPage TP_LEGEND_POS
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_LEGEND_POS ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine GRP_LEGEND
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ RESOURCE_LEGENDPOSITION( 12, 14 )
+
+ FixedLine FL_LEGEND_TEXTORIENT
+ {
+ Pos = MAP_APPFONT ( 6 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text orientation" ;
+ };
+ FixedText FT_LEGEND_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 19 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_LEGEND_TEXTDIR
+ {
+ HelpID = "chart2:ListBox:TP_LEGEND_POS:LB_LEGEND_TEXTDIR";
+ Pos = MAP_APPFONT ( 78 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 17 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_Location.cxx b/chart2/source/controller/dialogs/tp_Location.cxx
new file mode 100644
index 000000000000..a8a4d1317be8
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Location.hxx"
+#include "tp_Location.hrc"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "NoWarningThisInCTOR.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+#ifdef LOCATION_PAGE
+
+LocationTabPage::LocationTabPage( svt::OWizardMachine* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : OWizardPage( pParent, SchResId(TP_LOCATION) )
+ , m_aFL_Table( this, SchResId( FL_TABLE ) )
+ , m_aFT_Table( this, SchResId( FT_TABLE ) )
+ , m_aLB_Table( this, SchResId( LB_TABLE ) )
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+{
+ FreeResource();
+ this->SetText( String( SchResId( STR_PAGE_CHART_LOCATION ) ) );
+}
+
+LocationTabPage::~LocationTabPage()
+{
+}
+
+bool LocationTabPage::canAdvance() const
+{
+ return false;
+}
+#endif
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Location.hrc b/chart2/source/controller/dialogs/tp_Location.hrc
new file mode 100644
index 000000000000..419daa68721f
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FL_TABLE 1
+#define FT_TABLE 1
+#define LB_TABLE 1
diff --git a/chart2/source/controller/dialogs/tp_Location.hxx b/chart2/source/controller/dialogs/tp_Location.hxx
new file mode 100644
index 000000000000..4b5b2c24727d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_LOCATION_HXX
+#define _CHART2_TP_LOCATION_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+
+// header for class FixedText, FixedLine
+#include <vcl/fixed.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+#ifdef LOCATION_PAGE
+class LocationTabPage : public svt::OWizardPage
+{
+public:
+ LocationTabPage( svt::OWizardMachine* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~LocationTabPage();
+
+ virtual bool canAdvance() const;
+
+protected:
+ FixedLine m_aFL_Table;
+ FixedText m_aFT_Table;
+ ListBox m_aLB_Table;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+};
+#endif
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Location.src b/chart2/source/controller/dialogs/tp_Location.src
new file mode 100644
index 000000000000..be0033d436dd
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Location.src
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_Location.hrc"
+#include "dlg_CreationWizard.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+#define WIZ_POSX1 6
+#define WIZ_POSY1 6
+#define WIZ_POSX2 (6+4)
+#define WIZ_POSY2 (WIZ_POSY1+RSC_CD_FIXEDTEXT_HEIGHT+4)
+#define TEXT_WIDTH 50
+#define WIZ_POSX3 (WIZ_POSX2+TEXT_WIDTH+6)
+#define WIZ_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-WIZ_POSX1-6)
+#define WIZ_LISTBOX_WIDTH (CHART_WIZARD_PAGEWIDTH-WIZ_POSX2-TEXT_WIDTH-6-6)
+
+
+TabPage TP_LOCATION
+{
+ HelpID = "chart2:TabPage:TP_LOCATION";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedLine FL_TABLE
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY1 ) ;
+ Size = MAP_APPFONT ( WIZ_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+
+ Text [ en-US ] = "Place chart" ;
+ };
+ FixedText FT_TABLE
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX2 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( TEXT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+
+ Text [ en-US ] = "~Insert in sheet" ;
+ };
+ ListBox LB_TABLE
+ {
+ HelpID = "chart2:ListBox:TP_LOCATION:LB_TABLE";
+ Border = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( WIZ_POSX3 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( WIZ_LISTBOX_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
new file mode 100644
index 000000000000..661bae6ac326
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_PointGeometry.hxx"
+#include "TabPages.hrc"
+#include "res_BarGeometry.hxx"
+#include "ResId.hxx"
+
+#include "chartview/ChartSfxItemIds.hxx"
+
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+// header for class Svx3DHorizontalSegmentsItem
+#include <svx/svx3ditems.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchLayoutTabPage::SchLayoutTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, SchResId(TP_LAYOUT), rInAttrs)
+ , m_pGeometryResources(0)
+{
+ Size aPageSize( this->GetSizePixel() );
+ Point aPos( this->LogicToPixel( Point(6,6), MapMode(MAP_APPFONT) ) );
+ m_pGeometryResources = new BarGeometryResources( this );
+ m_pGeometryResources->SetPosPixel( aPos );
+}
+
+SchLayoutTabPage::~SchLayoutTabPage()
+{
+ if( m_pGeometryResources )
+ delete m_pGeometryResources;
+}
+
+SfxTabPage* SchLayoutTabPage::Create(Window* pWindow,
+ const SfxItemSet& rOutAttrs)
+{
+ return new SchLayoutTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+
+ if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount())
+ {
+ long nShape=CHART_SHAPE3D_SQUARE;
+ long nSegs=32;
+
+ nShape = m_pGeometryResources->GetSelectEntryPos();
+ if(nShape==CHART_SHAPE3D_PYRAMID)
+ nSegs=4;
+
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
+ rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs));
+ }
+ return TRUE;
+}
+
+void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(m_pGeometryResources)
+ {
+ m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal));
+ m_pGeometryResources->Show( true );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
new file mode 100644
index 000000000000..d26ce62732eb
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_POINTGEOMETRY_HXX
+#define _CHART2_TP_POINTGEOMETRY_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BarGeometryResources;
+class SchLayoutTabPage : public SfxTabPage
+{
+public:
+ SchLayoutTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchLayoutTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+private:
+ BarGeometryResources* m_pGeometryResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.src b/chart2/source/controller/dialogs/tp_PointGeometry.src
new file mode 100644
index 000000000000..b6862cba3b77
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.src
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "ResourceIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_LAYOUT
+{
+ HelpID = "chart2:TabPage:TP_LAYOUT";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+};
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
new file mode 100644
index 000000000000..9a193c028e05
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+#include "tp_PolarOptions.hxx"
+#include "tp_PolarOptions.hrc"
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svtools/controldims.hrc>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+PolarOptionsTabPage::PolarOptionsTabPage( Window* pWindow,const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pWindow, SchResId(TP_POLAROPTIONS), rInAttrs ),
+ m_aCB_Clockwise( this, SchResId( CB_CLOCKWISE ) ),
+ m_aFL_StartingAngle( this, SchResId( FL_STARTING_ANGLE ) ),
+ m_aAngleDial( this, SchResId( CT_ANGLE_DIAL ) ),
+ m_aFT_Degrees( this, SchResId( FT_ROTATION_DEGREES ) ),
+ m_aNF_StartingAngle( this, SchResId( NF_STARTING_ANGLE ) ),
+ m_aFL_PlotOptions( this, SchResId( FL_PLOT_OPTIONS_POLAR ) ),
+ m_aCB_IncludeHiddenCells( this, SchResId( CB_INCLUDE_HIDDEN_CELLS_POLAR ) )
+{
+ FreeResource();
+
+ m_aAngleDial.SetLinkedField( &m_aNF_StartingAngle );
+}
+
+PolarOptionsTabPage::~PolarOptionsTabPage()
+{
+}
+
+SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutAttrs )
+{
+ return new PolarOptionsTabPage( pWindow, rOutAttrs );
+}
+
+BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ if( m_aAngleDial.IsVisible() )
+ {
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_STARTING_ANGLE,
+ static_cast< sal_Int32 >(m_aAngleDial.GetRotation()/100)));
+ }
+
+ if( m_aCB_Clockwise.IsVisible() )
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked()));
+
+ if (m_aCB_IncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
+
+ return TRUE;
+}
+
+void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ long nTmp;
+ if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ m_aAngleDial.SetRotation( nTmp*100 );
+ }
+ else
+ {
+ m_aFL_StartingAngle.Show(FALSE);
+ m_aAngleDial.Show(FALSE);
+ m_aNF_StartingAngle.Show(FALSE);
+ m_aFT_Degrees.Show(FALSE);
+ }
+ if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ m_aCB_Clockwise.Check(bCheck);
+ }
+ else
+ {
+ m_aCB_Clockwise.Show(FALSE);
+ }
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCB_IncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCB_IncludeHiddenCells.Show(FALSE);
+ m_aFL_PlotOptions.Show(FALSE);
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hrc b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
new file mode 100644
index 000000000000..b60e50fa654e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define CB_CLOCKWISE 1
+#define CB_INCLUDE_HIDDEN_CELLS_POLAR 2
+
+#define FL_STARTING_ANGLE 1
+#define FL_PLOT_OPTIONS_POLAR 2
+
+#define CT_ANGLE_DIAL 1
+
+#define NF_STARTING_ANGLE 1
+
+#define FT_ROTATION_DEGREES 1
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
new file mode 100644
index 000000000000..1465790c34bd
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_POLAROPTIONS_HXX
+#define _CHART2_TP_POLAROPTIONS_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <svx/dialcontrol.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class PolarOptionsTabPage : public SfxTabPage
+{
+
+public:
+ PolarOptionsTabPage(Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~PolarOptionsTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+private:
+ CheckBox m_aCB_Clockwise;
+ FixedLine m_aFL_StartingAngle;
+ svx::DialControl m_aAngleDial;
+ FixedText m_aFT_Degrees;
+ NumericField m_aNF_StartingAngle;
+
+ FixedLine m_aFL_PlotOptions;
+ CheckBox m_aCB_IncludeHiddenCells;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.src b/chart2/source/controller/dialogs/tp_PolarOptions.src
new file mode 100644
index 000000000000..96463a97341b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.src
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tp_PolarOptions.hrc"
+#include "HelpIds.hrc"
+
+TabPage TP_POLAROPTIONS
+{
+ HelpID = "chart2:TabPage:TP_POLAROPTIONS";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ CheckBox CB_CLOCKWISE
+ {
+ HelpID = "chart2:CheckBox:TP_POLAROPTIONS:CB_CLOCKWISE";
+ Pos = MAP_APPFONT ( 12 , 8 );
+ Size = MAP_APPFONT ( 248 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Clockwise direction";
+ };
+ FixedLine FL_STARTING_ANGLE
+ {
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 248 , 12 ) ;
+ Text [ en-US ] = "Starting angle" ;
+ };
+ Control CT_ANGLE_DIAL
+ {
+ HelpId = HID_SCH_STARTING_ANGLE_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 38 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ };
+ FixedText FT_ROTATION_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 55 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_STARTING_ANGLE
+ {
+ HelpID = "chart2:NumericField:TP_POLAROPTIONS:NF_STARTING_ANGLE";
+ Pos = MAP_APPFONT ( 61 , 53 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_PLOT_OPTIONS_POLAR
+ {
+ Pos = MAP_APPFONT ( 6 , 90 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+ CheckBox CB_INCLUDE_HIDDEN_CELLS_POLAR
+ {
+ HelpID = "chart2:CheckBox:TP_POLAROPTIONS:CB_INCLUDE_HIDDEN_CELLS_POLAR";
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
new file mode 100644
index 000000000000..3ba6ca0f74b2
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -0,0 +1,414 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_RangeChooser.hxx"
+#include "tp_RangeChooser.hrc"
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "DataSourceHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeTemplateProvider.hxx"
+#include "DialogModel.hxx"
+#include "RangeSelectionHelper.hxx"
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+
+namespace
+{
+void lcl_ShowChooserButton(
+ ::chart::RangeSelectionButton & rChooserButton,
+ Edit & rEditField,
+ BOOL bShow )
+{
+ if( rChooserButton.IsVisible() != bShow )
+ {
+ rChooserButton.Show( bShow );
+ sal_Int32 nWidhtDiff = 10 + 2;
+ if( bShow )
+ nWidhtDiff = -nWidhtDiff;
+ Size aSize = rChooserButton.PixelToLogic( rEditField.GetSizePixel(), MAP_APPFONT );
+ aSize.setWidth( aSize.getWidth() + nWidhtDiff );
+ rEditField.SetSizePixel( rChooserButton.LogicToPixel( aSize, MAP_APPFONT ));
+ }
+}
+void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
+{
+ if( pDialog )
+ {
+ pDialog->Show( bEnable ? FALSE : TRUE );
+ pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ }
+}
+void lcl_shiftControlY( Control & rControl, long nYOffset )
+{
+ Point aPos( rControl.GetPosPixel());
+ aPos.setY( aPos.getY() + nYOffset );
+ rControl.SetPosPixel( aPos );
+}
+} // anonymous namespace
+
+//.............................................................................
+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;
+
+
+RangeChooserTabPage::RangeChooserTabPage( Window* pParent
+ , DialogModel & rDialogModel
+ , ChartTypeTemplateProvider* pTemplateProvider
+ , Dialog * pParentDialog
+ , bool bHideDescription /* = false */ )
+
+ : OWizardPage( pParent, SchResId(TP_RANGECHOOSER) )
+
+ , m_aFT_Caption( this, SchResId( FT_CAPTION_FOR_WIZARD ) )
+ , m_aFT_Range( this, SchResId( FT_RANGE ) )
+ , m_aED_Range( this, SchResId( ED_RANGE ) )
+ , m_aIB_Range( this, SchResId( IB_RANGE ) )
+ , m_aRB_Rows( this, SchResId( RB_DATAROWS ) )
+ , m_aRB_Columns( this, SchResId( RB_DATACOLS ) )
+ , m_aCB_FirstRowAsLabel( this, SchResId( CB_FIRST_ROW_ASLABELS ) )
+ , m_aCB_FirstColumnAsLabel( this, SchResId( CB_FIRST_COLUMN_ASLABELS ) )
+ , m_nChangingControlCalls(0)
+ , m_bIsDirty(false)
+ , m_xDataProvider( 0 )
+ , m_aLastValidRangeString()
+ , m_xCurrentChartTypeTemplate(0)
+ , m_pTemplateProvider(pTemplateProvider)
+ , m_rDialogModel( rDialogModel )
+ , m_pParentDialog( pParentDialog )
+ , m_pTabPageNotifiable( dynamic_cast< TabPageNotifiable * >( pParentDialog ))
+{
+ FreeResource();
+
+ if( bHideDescription )
+ {
+ // note: the offset should be a negative value for shifting upwards, the
+ // 4 is for the offset difference between a wizard page and a tab-page
+ long nYOffset = - ( m_aFT_Range.GetPosPixel().getY() - m_aFT_Caption.GetPosPixel().getY() + 4 );
+ m_aFT_Caption.Hide();
+
+ // shift all controls by the offset space saved by hiding the caption
+ lcl_shiftControlY( m_aFT_Range, nYOffset );
+ lcl_shiftControlY( m_aED_Range, nYOffset );
+ lcl_shiftControlY( m_aIB_Range, nYOffset );
+ lcl_shiftControlY( m_aRB_Rows, nYOffset );
+ lcl_shiftControlY( m_aRB_Columns, nYOffset );
+ lcl_shiftControlY( m_aCB_FirstRowAsLabel, nYOffset );
+ lcl_shiftControlY( m_aCB_FirstColumnAsLabel, nYOffset );
+ }
+ else
+ {
+ // make font of caption bold
+ Font aFont( m_aFT_Caption.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_Caption.SetControlFont( aFont );
+
+ // no mnemonic
+ m_aFT_Caption.SetStyle( m_aFT_Caption.GetStyle() | WB_NOLABEL );
+ }
+
+ this->SetText( String(SchResId(STR_PAGE_DATA_RANGE)) );
+ m_aIB_Range.SetQuickHelpText( String(SchResId(STR_TIP_SELECT_RANGE)) );
+
+ // set defaults as long as DetectArguments does not work
+ m_aRB_Columns.Check();
+ m_aCB_FirstColumnAsLabel.Check();
+ m_aCB_FirstRowAsLabel.Check();
+
+ // BM: Note, that the range selection is not available, if there is no view.
+ // This happens for charts having their own embedded spreadsheet. If you
+ // force to get the range selection here, this would mean when entering this
+ // page the calc view would be created in this case. So, I enable the
+ // button here, and in the worst case nothing happens when it is pressed.
+ // Not nice, but I see no better solution for the moment.
+ m_aIB_Range.SetClickHdl( LINK( this, RangeChooserTabPage, ChooseRangeHdl ));
+ m_aED_Range.SetKeyInputHdl( LINK( this, RangeChooserTabPage, ChooseRangeHdl ));
+
+ // #i75179# enable setting the background to a different color
+ m_aED_Range.SetStyle( m_aED_Range.GetStyle() | WB_FORCECTRLBACKGROUND );
+
+ m_aED_Range.SetUpdateDataHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ));
+ m_aED_Range.SetModifyHdl( LINK( this, RangeChooserTabPage, ControlEditedHdl ));
+ m_aRB_Rows.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+ m_aCB_FirstRowAsLabel.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+ m_aCB_FirstColumnAsLabel.SetToggleHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
+}
+
+RangeChooserTabPage::~RangeChooserTabPage()
+{
+}
+
+void RangeChooserTabPage::ActivatePage()
+{
+ OWizardPage::ActivatePage();
+ initControlsFromModel();
+}
+
+void RangeChooserTabPage::initControlsFromModel()
+{
+ m_nChangingControlCalls++;
+
+ if(m_pTemplateProvider)
+ {
+ m_xCurrentChartTypeTemplate = m_pTemplateProvider->getCurrentTemplate();
+ }
+
+ bool bUseColumns = ! m_aRB_Rows.IsChecked();
+ bool bFirstCellAsLabel = bUseColumns ? m_aCB_FirstRowAsLabel.IsChecked() : m_aCB_FirstColumnAsLabel.IsChecked();
+ bool bHasCategories = bUseColumns ? m_aCB_FirstColumnAsLabel.IsChecked() : m_aCB_FirstRowAsLabel.IsChecked();
+
+ bool bIsValid = m_rDialogModel.allArgumentsForRectRangeDetected();
+ if( bIsValid )
+ m_rDialogModel.detectArguments(
+ m_aLastValidRangeString, bUseColumns, bFirstCellAsLabel, bHasCategories );
+ else
+ m_aLastValidRangeString = String::EmptyString();
+
+ m_aED_Range.SetText( m_aLastValidRangeString );
+
+ m_aRB_Rows.Check( !bUseColumns );
+ m_aRB_Columns.Check( bUseColumns );
+
+ m_aCB_FirstRowAsLabel.Check( m_aRB_Rows.IsChecked()?bHasCategories:bFirstCellAsLabel );
+ m_aCB_FirstColumnAsLabel.Check( m_aRB_Columns.IsChecked()?bHasCategories:bFirstCellAsLabel );
+
+ isValid();
+
+ m_nChangingControlCalls--;
+}
+
+void RangeChooserTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void RangeChooserTabPage::commitPage()
+{
+ commitPage(::svt::WizardTypes::eFinish);
+}
+
+sal_Bool RangeChooserTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ changeDialogModelAccordingToControls();
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
+void RangeChooserTabPage::changeDialogModelAccordingToControls()
+{
+ if(m_nChangingControlCalls>0)
+ return;
+
+ if( !m_xCurrentChartTypeTemplate.is() )
+ {
+ if(m_pTemplateProvider)
+ m_xCurrentChartTypeTemplate.set( m_pTemplateProvider->getCurrentTemplate());
+ if( !m_xCurrentChartTypeTemplate.is())
+ {
+ OSL_ENSURE( false, "Need a template to change data source" );
+ return;
+ }
+ }
+
+ if( m_bIsDirty )
+ {
+ sal_Bool bFirstCellAsLabel = ( m_aCB_FirstColumnAsLabel.IsChecked() && !m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && !m_aRB_Rows.IsChecked() );
+ sal_Bool bHasCategories = ( m_aCB_FirstColumnAsLabel.IsChecked() && m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && m_aRB_Rows.IsChecked() );
+
+ Sequence< beans::PropertyValue > aArguments(
+ DataSourceHelper::createArguments(
+ m_aRB_Columns.IsChecked(), bFirstCellAsLabel, bHasCategories ) );
+
+ // only if range is valid
+ if( m_aLastValidRangeString.equals( m_aED_Range.GetText()))
+ {
+ m_rDialogModel.setTemplate( m_xCurrentChartTypeTemplate );
+ aArguments.realloc( aArguments.getLength() + 1 );
+ aArguments[aArguments.getLength() - 1] =
+ beans::PropertyValue( C2U("CellRangeRepresentation"), -1,
+ uno::makeAny( m_aLastValidRangeString ),
+ beans::PropertyState_DIRECT_VALUE );
+ m_rDialogModel.setData( aArguments );
+ m_bIsDirty = false;
+ }
+
+ //@todo warn user that the selected range is not valid
+ //@todo better: disable OK-Button if range is invalid
+ }
+}
+
+bool RangeChooserTabPage::isValid()
+{
+ ::rtl::OUString aRange( m_aED_Range.GetText());
+ sal_Bool bFirstCellAsLabel = ( m_aCB_FirstColumnAsLabel.IsChecked() && !m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && !m_aRB_Rows.IsChecked() );
+ sal_Bool bHasCategories = ( m_aCB_FirstColumnAsLabel.IsChecked() && m_aRB_Columns.IsChecked() )
+ || ( m_aCB_FirstRowAsLabel.IsChecked() && m_aRB_Rows.IsChecked() );
+ bool bIsValid = ( aRange.getLength() == 0 ) ||
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(), bFirstCellAsLabel, bHasCategories ));
+
+ if( bIsValid )
+ {
+ m_aED_Range.SetControlForeground();
+ m_aED_Range.SetControlBackground();
+ if( m_pTabPageNotifiable )
+ m_pTabPageNotifiable->setValidPage( this );
+ m_aLastValidRangeString = aRange;
+ }
+ else
+ {
+ m_aED_Range.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
+ m_aED_Range.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
+ if( m_pTabPageNotifiable )
+ m_pTabPageNotifiable->setInvalidPage( this );
+ }
+
+ // enable/disable controls
+ // #i79531# if the range is valid but an action of one of these buttons
+ // would render it invalid, the button should be disabled
+ if( bIsValid )
+ {
+ bool bDataInColumns = m_aRB_Columns.IsChecked();
+ bool bIsSwappedRangeValid = m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), ! bDataInColumns, bHasCategories, bFirstCellAsLabel ));
+ m_aRB_Rows.Enable( bIsSwappedRangeValid );
+ m_aRB_Columns.Enable( bIsSwappedRangeValid );
+
+ m_aCB_FirstRowAsLabel.Enable(
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(),
+ bDataInColumns ? ! bFirstCellAsLabel : bFirstCellAsLabel,
+ bDataInColumns ? bHasCategories : ! bHasCategories )));
+ m_aCB_FirstColumnAsLabel.Enable(
+ m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
+ DataSourceHelper::createArguments(
+ aRange, Sequence< sal_Int32 >(), m_aRB_Columns.IsChecked(),
+ bDataInColumns ? bFirstCellAsLabel : ! bFirstCellAsLabel,
+ bDataInColumns ? ! bHasCategories : bHasCategories )));
+ }
+ else
+ {
+ m_aRB_Rows.Enable( bIsValid );
+ m_aRB_Columns.Enable( bIsValid );
+ m_aCB_FirstRowAsLabel.Enable( bIsValid );
+ m_aCB_FirstColumnAsLabel.Enable( bIsValid );
+}
+ BOOL bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
+ lcl_ShowChooserButton( m_aIB_Range, m_aED_Range, bShowIB );
+
+ return bIsValid;
+}
+
+IMPL_LINK( RangeChooserTabPage, ControlEditedHdl, void*, EMPTYARG )
+{
+ setDirty();
+ isValid();
+ return 0;
+}
+
+IMPL_LINK( RangeChooserTabPage, ControlChangedHdl, void*, EMPTYARG )
+{
+ setDirty();
+ if( isValid())
+ changeDialogModelAccordingToControls();
+ return 0;
+}
+
+IMPL_LINK( RangeChooserTabPage, ChooseRangeHdl, void *, EMPTYARG )
+{
+ rtl::OUString aRange = m_aED_Range.GetText();
+ // using assignment for broken gcc 3.3
+ rtl::OUString aTitle = ::rtl::OUString( String( SchResId( STR_PAGE_DATA_RANGE ) ));
+
+ lcl_enableRangeChoosing( true, m_pParentDialog );
+ m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this );
+
+ return 0;
+}
+
+
+void RangeChooserTabPage::listeningFinished( const ::rtl::OUString & rNewRange )
+{
+ //user has selected a new range
+
+ rtl::OUString aRange( rNewRange );
+
+ m_rDialogModel.startControllerLockTimer();
+
+ // stop listening
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
+
+ //update dialog state
+ ToTop();
+ GrabFocus();
+ m_aED_Range.SetText( String( aRange ) );
+ m_aED_Range.GrabFocus();
+
+ setDirty();
+ if( isValid())
+ changeDialogModelAccordingToControls();
+
+ lcl_enableRangeChoosing( false, m_pParentDialog );
+}
+void RangeChooserTabPage::disposingRangeSelection()
+{
+ m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
+}
+
+void RangeChooserTabPage::setDirty()
+{
+ if( m_nChangingControlCalls == 0 )
+ m_bIsDirty = true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hrc b/chart2/source/controller/dialogs/tp_RangeChooser.hrc
new file mode 100644
index 000000000000..d7b593fc4f45
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FT_CAPTION_FOR_WIZARD 1
+#define FT_RANGE 2
+
+#define RB_DATAROWS 1
+#define RB_DATACOLS 2
+
+#define ED_RANGE 1
+#define IB_RANGE 1
+
+#define CB_FIRST_ROW_ASLABELS 1
+#define CB_FIRST_COLUMN_ASLABELS 2
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
new file mode 100644
index 000000000000..4d985669195c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_RANGECHOOSER_HXX
+#define _CHART2_TP_RANGECHOOSER_HXX
+
+#include "RangeSelectionListener.hxx"
+#include "RangeSelectionButton.hxx"
+#include "TabPageNotifiable.hxx"
+#include "RangeEdit.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <com/sun/star/sheet/XRangeSelection.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class RangeChooserTabPage : public svt::OWizardPage, public RangeSelectionListenerParent
+{
+public:
+
+ RangeChooserTabPage( Window* pParent
+ , DialogModel & rDialogModel
+ , ChartTypeTemplateProvider* pTemplateProvider
+ , Dialog * pParentDialog
+ , bool bHideDescription = false );
+virtual ~RangeChooserTabPage();
+
+ //RangeSelectionListenerParent
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange );
+ virtual void disposingRangeSelection();
+
+ void commitPage();
+
+protected: //methods
+
+ //OWizardPage
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
+
+ void initControlsFromModel();
+ void changeDialogModelAccordingToControls();
+ bool isValid();
+ void setDirty();
+
+ DECL_LINK( ChooseRangeHdl, void* );
+ DECL_LINK( ControlChangedHdl, void* );
+ DECL_LINK( ControlEditedHdl, void* );
+
+protected: //member
+
+ FixedText m_aFT_Caption;
+ FixedText m_aFT_Range;
+ RangeEdit m_aED_Range;
+ RangeSelectionButton m_aIB_Range;
+
+ RadioButton m_aRB_Rows;
+ RadioButton m_aRB_Columns;
+
+ CheckBox m_aCB_FirstRowAsLabel;
+ CheckBox m_aCB_FirstColumnAsLabel;
+
+ sal_Int32 m_nChangingControlCalls;
+ bool m_bIsDirty;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
+
+ rtl::OUString m_aLastValidRangeString;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate > m_xCurrentChartTypeTemplate;
+ ChartTypeTemplateProvider* m_pTemplateProvider;
+
+ DialogModel & m_rDialogModel;
+ Dialog * m_pParentDialog;
+ TabPageNotifiable * m_pTabPageNotifiable;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.src b/chart2/source/controller/dialogs/tp_RangeChooser.src
new file mode 100644
index 000000000000..962722b41c71
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.src
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_RangeChooser.hrc"
+#include "SchSlotIds.hxx"
+#include "dlg_CreationWizard.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+
+TabPage TP_RANGECHOOSER
+{
+ HelpID = "chart2:TabPage:TP_RANGECHOOSER";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 248, 140 ) ;
+
+ FixedText FT_CAPTION_FOR_WIZARD
+ {
+ Pos = MAP_APPFONT ( 5 , 8 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ Text [ en-US ] = "Choose a data range" ;
+ };
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 6 , 22 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ Text [ en-US ] = "~Data range" ;
+ };
+ Edit ED_RANGE
+ {
+ HelpID = "chart2:Edit:TP_RANGECHOOSER:ED_RANGE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 220 , 12 ) ;
+ };
+ ImageButton IB_RANGE
+ {
+ HelpID = "chart2:ImageButton:TP_RANGECHOOSER:IB_RANGE";
+ Pos = MAP_APPFONT ( 228 , 31 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = FALSE ;
+ };
+ RadioButton RB_DATAROWS
+ {
+ HelpID = "chart2:RadioButton:TP_RANGECHOOSER:RB_DATAROWS";
+ Pos = MAP_APPFONT ( 6 , 52 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Data series in ~rows" ;
+ };
+ RadioButton RB_DATACOLS
+ {
+ HelpID = "chart2:RadioButton:TP_RANGECHOOSER:RB_DATACOLS";
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Data series in ~columns" ;
+ };
+ CheckBox CB_FIRST_ROW_ASLABELS
+ {
+ HelpID = "chart2:CheckBox:TP_RANGECHOOSER:CB_FIRST_ROW_ASLABELS";
+ Pos = MAP_APPFONT ( 6 , 84 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~First row as label" ;
+ };
+ CheckBox CB_FIRST_COLUMN_ASLABELS
+ {
+ HelpID = "chart2:CheckBox:TP_RANGECHOOSER:CB_FIRST_COLUMN_ASLABELS";
+ Pos = MAP_APPFONT ( 6 , 98 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "F~irst column as label" ;
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
new file mode 100644
index 000000000000..34fc0702bafe
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -0,0 +1,518 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_Scale.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "Strings.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "AxisHelper.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <rtl/math.hxx>
+// header for class SvxDoubleItem
+#include <svx/chrtitem.hxx>
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+
+// header for class WarningBox
+#include <vcl/msgbox.hxx>
+
+// header for class SvNumberformat
+#ifndef _ZFORMAT_HXX
+#ifndef _ZFORLIST_DECLARE_TABLE
+#define _ZFORLIST_DECLARE_TABLE
+#endif
+#include <svl/zformat.hxx>
+#endif
+
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+
+void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
+{
+ Point aPos( rEdit.GetPosPixel() );
+ long nShift = nNewXPos - aPos.X();
+ aPos.X() = nNewXPos;
+ rEdit.SetPosPixel(aPos);
+
+ aPos = rAuto.GetPosPixel();
+ aPos.X() += nShift;
+ rAuto.SetPosPixel(aPos);
+}
+
+void lcl_placeControlsAtY( Control& rTop, Control& rBottom, long nNewYPos )
+{
+ Point aPos( rTop.GetPosPixel() );
+ long nShift = nNewYPos - aPos.Y();
+ aPos.Y() = nNewYPos;
+ rTop.SetPosPixel(aPos);
+
+ aPos = rBottom.GetPosPixel();
+ aPos.Y() += nShift;
+ rBottom.SetPosPixel(aPos);
+}
+
+}
+
+ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs),
+
+ aFlScale(this, SchResId(FL_SCALE)),
+ aTxtMin (this, SchResId (TXT_MIN)),
+ aFmtFldMin(this, SchResId(EDT_MIN)),
+ aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)),
+ aTxtMax(this, SchResId (TXT_MAX)),
+ aFmtFldMax(this, SchResId(EDT_MAX)),
+ aCbxAutoMax(this, SchResId(CBX_AUTO_MAX)),
+ aTxtMain (this, SchResId (TXT_STEP_MAIN)),
+ aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)),
+ aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)),
+ aTxtHelp (this, SchResId (TXT_STEP_HELP)),
+ aMtStepHelp (this, SchResId (MT_STEPHELP)),
+ aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)),
+
+ aTxtOrigin (this, SchResId (TXT_ORIGIN)),
+ aFmtFldOrigin(this, SchResId(EDT_ORIGIN)),
+ aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)),
+
+ aCbxLogarithm(this, SchResId(CBX_LOGARITHM)),
+ aCbxReverse(this, SchResId(CBX_REVERSE)),
+
+ fMin(0.0),
+ fMax(0.0),
+ fStepMain(0.0),
+ nStepHelp(0),
+ fOrigin(0.0),
+ nAxisType(chart2::AxisType::REALNUMBER),
+ pNumFormatter(NULL),
+ m_bShowAxisOrigin(false)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+}
+
+void ScaleTabPage::StateChanged( StateChangedType nType )
+{
+ TabPage::StateChanged( nType );
+
+ if( nType == STATE_CHANGE_INITSHOW )
+ AdjustControlPositions();
+}
+
+void ScaleTabPage::AdjustControlPositions()
+{
+ //optimize position of the controls
+ long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() );
+ nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth+=1;
+
+ long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
+ long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance;
+
+ //ensure that the auto checkboxes are wide enough and have correct size for calculation
+ aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() );
+ aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() );
+ aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() );
+ aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() );
+ aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() );
+
+ //ensure new pos is ok
+ long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
+ long nDialogWidth = GetSizePixel().Width();
+
+ long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls;
+ if(nLeftSpace>=0)
+ {
+ Size aSize( aTxtMin.GetSizePixel() );
+ aSize.Width() = nLabelWidth;
+ aTxtMin.SetSizePixel(aSize);
+ aTxtMax.SetSizePixel(aSize);
+ aTxtMain.SetSizePixel(aSize);
+ aTxtHelp.SetSizePixel(aSize);
+ aTxtOrigin.SetSizePixel(aSize);
+
+ lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos );
+ lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos );
+ lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos );
+ lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos );
+ lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos );
+ }
+}
+
+void ScaleTabPage::EnableControls()
+{
+ bool bEnableForValueOrPercentAxis = chart2::AxisType::REALNUMBER == nAxisType || chart2::AxisType::PERCENT == nAxisType;
+ aFlScale.Enable( bEnableForValueOrPercentAxis );
+ aTxtMin.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldMin.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoMin.Enable( bEnableForValueOrPercentAxis );
+ aTxtMax.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldMax.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoMax.Enable( bEnableForValueOrPercentAxis );
+ aTxtMain.Enable( bEnableForValueOrPercentAxis );
+ aFmtFldStepMain.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoStepMain.Enable( bEnableForValueOrPercentAxis );
+ aTxtHelp.Enable( bEnableForValueOrPercentAxis );
+ aMtStepHelp.Enable( bEnableForValueOrPercentAxis );
+ aCbxAutoStepHelp.Enable( bEnableForValueOrPercentAxis );
+ aCbxLogarithm.Enable( bEnableForValueOrPercentAxis );
+
+ aTxtOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+ aFmtFldOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+ aCbxAutoOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis );
+
+ long nNewYPos = aTxtOrigin.GetPosPixel().Y();
+ if( m_bShowAxisOrigin )
+ nNewYPos += ( aTxtOrigin.GetPosPixel().Y() - aTxtHelp.GetPosPixel().Y() );
+ lcl_placeControlsAtY( aCbxLogarithm, aCbxReverse, nNewYPos );
+}
+
+
+
+IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx )
+{
+ if (pCbx == &aCbxAutoMin)
+ {
+ aFmtFldMin.Enable(!aCbxAutoMin.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoMax)
+ {
+ aFmtFldMax.Enable(!aCbxAutoMax.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoStepMain)
+ {
+ aFmtFldStepMain.Enable(!aCbxAutoStepMain.IsChecked());
+ }
+ else if (pCbx == &aCbxAutoStepHelp)
+ {
+ aMtStepHelp.Show ();
+ aMtStepHelp.Enable( ! aCbxAutoStepHelp.IsChecked() );
+ }
+ else if (pCbx == &aCbxAutoOrigin)
+ {
+ aFmtFldOrigin.Enable(!aCbxAutoOrigin.IsChecked());
+ }
+ return 0;
+}
+
+SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new ScaleTabPage(pWindow, rOutAttrs);
+}
+
+BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
+
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,aCbxAutoMin.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,aCbxAutoMax.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,aCbxAutoStepHelp.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,aCbxAutoOrigin.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,aCbxLogarithm.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,aCbxReverse.IsChecked()));
+ rOutAttrs.Put(SvxDoubleItem(fMax , SCHATTR_AXIS_MAX));
+ rOutAttrs.Put(SvxDoubleItem(fMin , SCHATTR_AXIS_MIN));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp));
+ rOutAttrs.Put(SvxDoubleItem(fOrigin , SCHATTR_AXIS_ORIGIN));
+
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,aCbxAutoStepMain.IsChecked()));
+ rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
+
+ return TRUE;
+}
+
+void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
+ if(!pNumFormatter)
+ return;
+
+ const SfxPoolItem *pPoolItem = NULL;
+ nAxisType=chart2::AxisType::REALNUMBER;
+ if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
+ EnableControls();
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,TRUE,&pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldMin.SetValue( fMin );
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldMax.SetValue( fMax );
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldStepMain.SetValue( fStepMain );
+ }
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nStepHelp = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMtStepHelp.SetValue( nStepHelp );
+ }
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
+ aFmtFldOrigin.SetValue( fOrigin );
+ }
+
+ EnableValueHdl(&aCbxAutoMin);
+ EnableValueHdl(&aCbxAutoMax);
+ EnableValueHdl(&aCbxAutoStepMain);
+ EnableValueHdl(&aCbxAutoStepHelp);
+ EnableValueHdl(&aCbxAutoOrigin);
+}
+
+int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
+{
+ if( !pNumFormatter )
+ {
+ DBG_ERROR( "No NumberFormatter available" );
+ return LEAVE_PAGE;
+ }
+
+ sal_uInt32 nIndex = pNumFormatter->GetStandardIndex(LANGUAGE_SYSTEM);
+ const SfxPoolItem *pPoolItem = NULL;
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ nIndex = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
+ else
+ {
+ OSL_ENSURE( false, "Using Standard Language" );
+ }
+
+ Edit* pEdit = NULL;
+ USHORT nErrStrId = 0;
+ double fDummy;
+
+ fMax = aFmtFldMax.GetValue();
+ fMin = aFmtFldMin.GetValue();
+ fOrigin = aFmtFldOrigin.GetValue();
+ fStepMain = aFmtFldStepMain.GetValue();
+ nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue());
+
+ //do some reasonable automatic correction of user input if necessary
+ if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() &&
+ fMin >= fMax)
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_MIN_GREATER_MAX;
+ }
+ // check for entries in invalid ranges
+ if ( aCbxLogarithm.IsChecked() &&
+ ( ( !aCbxAutoMin.IsChecked() && fMin <= 0.0 )
+ || ( !aCbxAutoMax.IsChecked() && fMax <= 0.0 ) ) )
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_BAD_LOGARITHM;
+ }
+ if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0)
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+
+ //check wich entries need user action
+
+ // check for entries that cannot be parsed for the current number format
+ if ( aFmtFldMin.IsModified()
+ && !aCbxAutoMin.IsChecked()
+ && !pNumFormatter->IsNumberFormat(aFmtFldMin.GetText(), nIndex, fDummy))
+ {
+ pEdit = &aFmtFldMin;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (aFmtFldMax.IsModified() && !aCbxAutoMax.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldMax.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldMax;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldStepMain.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+ else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() &&
+ !pNumFormatter->IsNumberFormat(aFmtFldOrigin.GetText(),
+ nIndex, fDummy))
+ {
+ pEdit = &aFmtFldOrigin;
+ nErrStrId = STR_INVALID_NUMBER;
+ }
+ else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0)
+ {
+ pEdit = &aFmtFldStepMain;
+ nErrStrId = STR_STEP_GT_ZERO;
+ }
+
+ if( ShowWarning( nErrStrId, pEdit ) )
+ return KEEP_PAGE;
+
+ if( pItemSet )
+ FillItemSet( *pItemSet );
+
+ return LEAVE_PAGE;
+}
+
+void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
+{
+ pNumFormatter = pFormatter;
+ aFmtFldMax.SetFormatter( pNumFormatter );
+ aFmtFldMin.SetFormatter( pNumFormatter );
+ aFmtFldStepMain.SetFormatter( pNumFormatter );
+ aFmtFldOrigin.SetFormatter( pNumFormatter );
+
+ // #101318#, #i6278# allow more decimal places than the output format. As
+ // the numbers shown in the edit fields are used for input, it makes more
+ // sense to display the values in the input format rather than the output
+ // format.
+ aFmtFldMax.UseInputStringForFormatting();
+ aFmtFldMin.UseInputStringForFormatting();
+ aFmtFldStepMain.UseInputStringForFormatting();
+ aFmtFldOrigin.UseInputStringForFormatting();
+
+ SetNumFormat();
+}
+
+void ScaleTabPage::SetNumFormat()
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+
+ aFmtFldMax.SetFormatKey( nFmt );
+ aFmtFldMin.SetFormatKey( nFmt );
+ aFmtFldOrigin.SetFormatKey( nFmt );
+
+ if( pNumFormatter )
+ {
+ short eType = pNumFormatter->GetType( nFmt );
+ if( eType == NUMBERFORMAT_DATE )
+ {
+ // for intervals use standard format for dates (so you can enter a number of days)
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
+ if( pFormat )
+ nFmt = pNumFormatter->GetStandardIndex( pFormat->GetLanguage());
+ else
+ nFmt = pNumFormatter->GetStandardIndex();
+ }
+ else if( eType == NUMBERFORMAT_DATETIME )
+ {
+ // for intervals use time format for date times
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
+ if( pFormat )
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME, pFormat->GetLanguage() );
+ else
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME );
+ }
+ }
+
+ aFmtFldStepMain.SetFormatKey( nFmt );
+ }
+}
+
+void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
+{
+ m_bShowAxisOrigin = bShowOrigin;
+ if( !AxisHelper::isAxisPositioningEnabled() )
+ m_bShowAxisOrigin = true;
+}
+
+bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL */ )
+{
+ if( nResIdMessage == 0 )
+ return false;
+
+ WarningBox( this, WinBits( WB_OK ), String( SchResId( nResIdMessage ))).Execute();
+ if( pControl )
+ {
+ pControl->GrabFocus();
+ pControl->SetSelection( Selection( 0, SELECTION_MAX ));
+ }
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
new file mode 100644
index 000000000000..8d0e02186c38
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_SCALES_HXX
+#define _CHART2_TP_SCALES_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for class FormattedField
+#include <svtools/fmtfield.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+// header for CheckBox
+#include <vcl/button.hxx>
+// header for MetricField
+#include <vcl/field.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ScaleTabPage : public SfxTabPage
+{
+public:
+ ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
+
+ void SetNumFormatter( SvNumberFormatter* pFormatter );
+ void SetNumFormat();
+
+ void ShowAxisOrigin( bool bShowOrigin );
+
+ virtual void StateChanged( StateChangedType nType );
+
+private:
+ FixedLine aFlScale;
+
+ FixedText aTxtMin;
+ FormattedField aFmtFldMin;
+ CheckBox aCbxAutoMin;
+
+ FixedText aTxtMax;
+ FormattedField aFmtFldMax;
+ CheckBox aCbxAutoMax;
+
+ FixedText aTxtMain;
+ FormattedField aFmtFldStepMain;
+ CheckBox aCbxAutoStepMain;
+
+ FixedText aTxtHelp;
+ MetricField aMtStepHelp;
+ CheckBox aCbxAutoStepHelp;
+
+ FixedText aTxtOrigin;
+ FormattedField aFmtFldOrigin;
+ CheckBox aCbxAutoOrigin;
+
+ CheckBox aCbxLogarithm;
+ CheckBox aCbxReverse;
+
+ double fMin;
+ double fMax;
+ double fStepMain;
+ sal_Int32 nStepHelp;
+ double fOrigin;
+ int nAxisType;
+ SvNumberFormatter* pNumFormatter;
+
+ bool m_bShowAxisOrigin;
+
+ void AdjustControlPositions();
+ void EnableControls();
+
+ DECL_LINK( EnableValueHdl, CheckBox* );
+
+ /** shows a warning window due to an invalid input.
+
+ @param nResIdMessage
+ The resource identifier that represents the localized warning text.
+ If this is 0, no warning is shown and false is returned.
+
+ @param pControl
+ If non-NULL, contains a pointer to the control in which the
+ errornous value was in. This method gives this control the focus
+ and selects its content.
+
+ @return false, if nResIdMessage was 0, true otherwise
+ */
+ bool ShowWarning( USHORT nResIdMessage, Edit * pControl = NULL );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/dialogs/tp_Scale.src b/chart2/source/controller/dialogs/tp_Scale.src
new file mode 100644
index 000000000000..9e92e70f6f43
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.src
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+#define YLine1 3
+#define Y1 (YLine1+13)
+#define Y2 (Y1+16)
+#define Y3 (Y2+16)
+#define Y4 (Y3+16)
+#define Y5 (Y4+16)
+#define Y6 (Y5+17)
+#define Y7 (Y6+15)
+
+#define LABELWIDTH 88
+#define AUTOCHECKWIDTH 88
+#define EDITWIDTH 50
+#define X1 6
+#define X2 11
+#define X3 (X2+LABELWIDTH+4)
+#define X4 (X3+EDITWIDTH+5)
+
+TabPage TP_SCALE
+{
+ HelpID = "chart2:TabPage:TP_SCALE";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+
+ FixedLine FL_SCALE
+ {
+ Pos = MAP_APPFONT ( X1 , YLine1 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Scale" ;
+ };
+ FixedText TXT_MIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y1 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "~Minimum:" ;
+ };
+ SpinField EDT_MIN
+ {
+ HelpID = "chart2:SpinField:TP_SCALE:EDT_MIN";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y1-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_MIN
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_MIN";
+ Pos = MAP_APPFONT ( X4 , Y1-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Automatic" ;
+ };
+
+ FixedText TXT_MAX
+ {
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Ma~ximum:" ;
+ };
+ SpinField EDT_MAX
+ {
+ HelpID = "chart2:SpinField:TP_SCALE:EDT_MAX";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y2-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_MAX
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_MAX";
+ Pos = MAP_APPFONT ( X4 , Y2-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utomatic" ;
+ };
+ FixedText TXT_STEP_MAIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y3 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Ma~jor interval:" ;
+ };
+ SpinField EDT_STEP_MAIN
+ {
+ HelpID = "chart2:SpinField:TP_SCALE:EDT_STEP_MAIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y3-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_STEP_MAIN
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_MAIN";
+ Pos = MAP_APPFONT ( X4 , Y3-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Au~tomatic" ;
+ };
+ FixedText TXT_STEP_HELP
+ {
+ Pos = MAP_APPFONT ( X2 , Y4 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Minor interval ~count:" ;
+ };
+ MetricField MT_STEPHELP
+ {
+ HelpID = "chart2:MetricField:TP_SCALE:MT_STEPHELP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y4-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ CheckBox CBX_AUTO_STEP_HELP
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_HELP";
+ Pos = MAP_APPFONT ( X4 , Y4-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Aut~omatic" ;
+ };
+
+ FixedText TXT_ORIGIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Reference ~value:" ;
+ };
+ SpinField EDT_ORIGIN
+ {
+ HelpID = "chart2:SpinField:TP_SCALE:EDT_ORIGIN";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y5-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CBX_AUTO_ORIGIN
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_ORIGIN";
+ Pos = MAP_APPFONT ( X4 , Y5-1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automat~ic" ;
+ };
+
+ CheckBox CBX_LOGARITHM
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_LOGARITHM";
+ Pos = MAP_APPFONT ( X2 , Y6 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Logarithmic scale" ;
+ };
+
+ CheckBox CBX_REVERSE
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_REVERSE";
+ Pos = MAP_APPFONT ( X2 , Y7 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Reverse direction" ;
+ };
+
+};
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
new file mode 100644
index 000000000000..fbe2f4bf1907
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -0,0 +1,313 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_SeriesToAxis.hxx"
+#include "tp_SeriesToAxis.hrc"
+
+#include "ResId.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "NoWarningThisInCTOR.hxx"
+
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for SfxInt32Item
+#include <svl/intitem.hxx>
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#include <svtools/controldims.hrc>
+
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchOptionTabPage::SchOptionTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
+ SfxTabPage(pWindow, SchResId(TP_OPTIONS), rInAttrs),
+ aGrpAxis(this, SchResId(GRP_OPT_AXIS)),
+ aRbtAxis1(this,SchResId(RBT_OPT_AXIS_1)),
+ aRbtAxis2(this,SchResId(RBT_OPT_AXIS_2)),
+
+ aGrpBar(this, SchResId(GB_BAR)),
+ aFTGap(this,SchResId(FT_GAP)),
+ aMTGap(this,SchResId(MT_GAP)),
+ aFTOverlap(this,SchResId(FT_OVERLAP)),
+ aMTOverlap(this,SchResId(MT_OVERLAP)),
+ aCBConnect(this,SchResId(CB_CONNECTOR)),
+ aCBAxisSideBySide(this,SchResId(CB_BARS_SIDE_BY_SIDE)),
+ m_aFL_PlotOptions(this,SchResId(FL_PLOT_OPTIONS)),
+ m_aFT_MissingValues(this,SchResId(FT_MISSING_VALUES)),
+ m_aRB_DontPaint(this,SchResId(RB_DONT_PAINT)),
+ m_aRB_AssumeZero(this,SchResId(RB_ASSUME_ZERO)),
+ m_aRB_ContinueLine(this,SchResId(RB_CONTINUE_LINE)),
+ m_aCBIncludeHiddenCells(this,SchResId(CB_INCLUDE_HIDDEN_CELLS)),
+ m_bProvidesSecondaryYAxis(true),
+ m_bProvidesOverlapAndGapWidth(false)
+{
+ FreeResource();
+
+ aRbtAxis1.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
+ aRbtAxis2.SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
+}
+
+SchOptionTabPage::~SchOptionTabPage()
+{
+}
+
+IMPL_LINK( SchOptionTabPage, EnableHdl, RadioButton *, EMPTYARG )
+{
+ if( m_nAllSeriesAxisIndex == 0 )
+ aCBAxisSideBySide.Enable( aRbtAxis2.IsChecked());
+ else if( m_nAllSeriesAxisIndex == 1 )
+ aCBAxisSideBySide.Enable( aRbtAxis1.IsChecked());
+
+ return 0;
+}
+
+SfxTabPage* SchOptionTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
+{
+ return new SchOptionTabPage(pWindow, rOutAttrs);
+}
+
+BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ if(aRbtAxis2.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
+ else
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
+
+ if(aMTGap.IsVisible())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,static_cast< sal_Int32 >( aMTGap.GetValue())));
+
+ if(aMTOverlap.IsVisible())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,static_cast< sal_Int32 >( aMTOverlap.GetValue())));
+
+ if(aCBConnect.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_BAR_CONNECT,aCBConnect.IsChecked()));
+
+ // model property is "group bars per axis", UI feature is the other way
+ // round: "show bars side by side"
+ if(aCBAxisSideBySide.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, ! aCBAxisSideBySide.IsChecked()));
+
+ if(m_aRB_DontPaint.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP));
+ else if(m_aRB_AssumeZero.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::USE_ZERO));
+ else if(m_aRB_ContinueLine.IsChecked())
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,::com::sun::star::chart::MissingValueTreatment::CONTINUE));
+
+ if (m_aCBIncludeHiddenCells.IsVisible())
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked()));
+
+ return TRUE;
+}
+
+void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem *pPoolItem = NULL;
+
+ aRbtAxis1.Check(TRUE);
+ aRbtAxis2.Check(FALSE);
+ if (rInAttrs.GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(nVal==CHART_AXIS_SECONDARY_Y)
+ {
+ aRbtAxis2.Check(TRUE);
+ aRbtAxis1.Check(FALSE);
+ }
+ }
+
+ long nTmp;
+ if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMTGap.SetValue(nTmp);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
+ aMTOverlap.SetValue(nTmp);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ aCBConnect.Check(bCheck);
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ aCBAxisSideBySide.Disable();
+ }
+ if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ // 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();
+ aCBAxisSideBySide.Check( bCheck );
+ }
+ else
+ {
+ aCBAxisSideBySide.Show(FALSE);
+ }
+
+
+ //missing value treatment
+ {
+ ::com::sun::star::uno::Sequence < sal_Int32 > aMissingValueTreatments;
+ if( rInAttrs.GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ aMissingValueTreatments =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
+
+ if ( aMissingValueTreatments.getLength()>1 && rInAttrs.GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_aRB_DontPaint.Enable(FALSE);
+ m_aRB_AssumeZero.Enable(FALSE);
+ m_aRB_ContinueLine.Enable(FALSE);
+
+ for( sal_Int32 nN =0; nN<aMissingValueTreatments.getLength(); nN++ )
+ {
+ sal_Int32 nVal = aMissingValueTreatments[nN];
+ if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ m_aRB_DontPaint.Enable(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
+ m_aRB_AssumeZero.Enable(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
+ m_aRB_ContinueLine.Enable(TRUE);
+ }
+
+ long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ m_aRB_DontPaint.Check(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
+ m_aRB_AssumeZero.Check(TRUE);
+ else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
+ m_aRB_ContinueLine.Check(TRUE);
+ }
+ else
+ {
+ m_aFT_MissingValues.Show(FALSE);
+ m_aRB_DontPaint.Show(FALSE);
+ m_aRB_AssumeZero.Show(FALSE);
+ m_aRB_ContinueLine.Show(FALSE);
+ }
+ }
+
+ // Include hidden cells
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ {
+ bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ m_aCBIncludeHiddenCells.Check(bVal);
+ }
+ else
+ {
+ m_aCBIncludeHiddenCells.Show(FALSE);
+ if(!m_aFT_MissingValues.IsVisible())
+ m_aFL_PlotOptions.Show(FALSE);
+ }
+
+ AdaptControlPositionsAndVisibility();
+}
+
+void SchOptionTabPage::Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors )
+{
+ m_bProvidesSecondaryYAxis = bProvidesSecondaryYAxis;
+ m_bProvidesOverlapAndGapWidth = bProvidesOverlapAndGapWidth;
+ m_bProvidesBarConnectors = bProvidesBarConnectors;
+
+ AdaptControlPositionsAndVisibility();
+}
+
+void lcl_offsetControl(Control& rCtrl, long nXOffset, long nYOffset )
+{
+ Point aPos = rCtrl.GetPosPixel();
+ rCtrl.SetPosPixel( Point(aPos.getX() + nXOffset, aPos.getY() + nYOffset) );
+}
+
+void lcl_optimzeRadioButtonSize( RadioButton& rCtrl )
+{
+ rCtrl.SetSizePixel( rCtrl.CalcMinimumSize() );
+}
+
+void SchOptionTabPage::AdaptControlPositionsAndVisibility()
+{
+ aRbtAxis1.Show(m_bProvidesSecondaryYAxis);
+ aRbtAxis2.Show(m_bProvidesSecondaryYAxis);
+ aGrpAxis.Show(m_bProvidesSecondaryYAxis);
+
+ aMTGap.Show(m_bProvidesOverlapAndGapWidth);
+ aFTGap.Show(m_bProvidesOverlapAndGapWidth);
+
+ aMTOverlap.Show(m_bProvidesOverlapAndGapWidth);
+ aFTOverlap.Show(m_bProvidesOverlapAndGapWidth);
+
+ aCBConnect.Show(m_bProvidesBarConnectors);
+
+ if( !aMTGap.IsVisible() && !aMTOverlap.IsVisible() )
+ {
+ aGrpBar.Show(FALSE);
+ Point aPos;
+ if( !aRbtAxis1.IsVisible() && !aRbtAxis2.IsVisible() )
+ aPos = aGrpAxis.GetPosPixel();
+ else
+ aPos = aGrpBar.GetPosPixel();
+
+ long nYOffset = aPos.getY() - m_aFL_PlotOptions.GetPosPixel().getY();
+ lcl_offsetControl(m_aFL_PlotOptions, 0, nYOffset);
+ lcl_offsetControl(m_aFT_MissingValues, 0, nYOffset);
+ lcl_offsetControl(m_aRB_DontPaint, 0, nYOffset);
+ lcl_offsetControl(m_aRB_AssumeZero, 0, nYOffset);
+ lcl_offsetControl(m_aRB_ContinueLine, 0, nYOffset);
+ lcl_offsetControl(m_aCBIncludeHiddenCells, 0, nYOffset);
+ }
+
+ m_aFT_MissingValues.SetSizePixel( m_aFT_MissingValues.CalcMinimumSize() );
+ lcl_optimzeRadioButtonSize( m_aRB_DontPaint );
+ lcl_optimzeRadioButtonSize( m_aRB_AssumeZero );
+ lcl_optimzeRadioButtonSize( m_aRB_ContinueLine );
+
+ Size aControlDistance( m_aFT_MissingValues.LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
+ long nXOffset = m_aFT_MissingValues.GetPosPixel().getX() + m_aFT_MissingValues.GetSizePixel().getWidth() + aControlDistance.getWidth() - m_aRB_DontPaint.GetPosPixel().getX();
+ lcl_offsetControl(m_aRB_DontPaint, nXOffset, 0);
+ lcl_offsetControl(m_aRB_AssumeZero, nXOffset, 0);
+ lcl_offsetControl(m_aRB_ContinueLine, nXOffset, 0);
+
+ if( !m_aFT_MissingValues.IsVisible() )
+ {
+ //for example for stock charts
+ m_aCBIncludeHiddenCells.SetPosPixel( m_aFT_MissingValues.GetPosPixel() );
+ }
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
new file mode 100644
index 000000000000..814a148a2ef5
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hrc
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define GRP_OPT_AXIS 1
+#define RBT_OPT_AXIS_1 2
+#define RBT_OPT_AXIS_2 3
+#define MT_GAP 4
+#define MT_OVERLAP 5
+#define FT_GAP 6
+#define FT_OVERLAP 7
+#define GB_BAR 8
+#define CB_CONNECTOR 9
+#define CB_BARS_SIDE_BY_SIDE 10
+#define FL_PLOT_OPTIONS 11
+#define FT_MISSING_VALUES 12
+#define RB_DONT_PAINT 13
+#define RB_ASSUME_ZERO 14
+#define RB_CONTINUE_LINE 15
+#define CB_INCLUDE_HIDDEN_CELLS 16
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
new file mode 100644
index 000000000000..63caf2885910
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_SERIESTOAXIS_HXX
+#define _CHART2_TP_SERIESTOAXIS_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+// header for FixedText
+#include <vcl/fixed.hxx>
+// header for CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for MetricField
+#include <vcl/field.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class SchOptionTabPage : public SfxTabPage
+{
+public:
+ SchOptionTabPage(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual ~SchOptionTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+
+ void Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors );
+
+private: //methods
+ void AdaptControlPositionsAndVisibility();
+
+private: //member
+ FixedLine aGrpAxis;
+ RadioButton aRbtAxis1;
+ RadioButton aRbtAxis2;
+
+ FixedLine aGrpBar;
+ FixedText aFTGap;
+ MetricField aMTGap;
+ FixedText aFTOverlap;
+ MetricField aMTOverlap;
+ CheckBox aCBConnect;
+ CheckBox aCBAxisSideBySide;
+
+ FixedLine m_aFL_PlotOptions;
+ FixedText m_aFT_MissingValues;
+ RadioButton m_aRB_DontPaint;
+ RadioButton m_aRB_AssumeZero;
+ RadioButton m_aRB_ContinueLine;
+
+ CheckBox m_aCBIncludeHiddenCells;
+
+ DECL_LINK(EnableHdl, RadioButton * );
+
+ sal_Int32 m_nAllSeriesAxisIndex;
+
+ bool m_bProvidesSecondaryYAxis;
+ bool m_bProvidesOverlapAndGapWidth;
+ bool m_bProvidesBarConnectors;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.src b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
new file mode 100644
index 000000000000..844c81bd2e64
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.src
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "tp_SeriesToAxis.hrc"
+
+TabPage TP_OPTIONS
+{
+ HelpID = "chart2:TabPage:TP_OPTIONS";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine 1
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Align data series to";
+ };
+ RadioButton RBT_OPT_AXIS_1
+ {
+ HelpID = "chart2:RadioButton:TP_OPTIONS:RBT_OPT_AXIS_1";
+ Pos = MAP_APPFONT ( 12 , 20 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Primary Y axis";
+ };
+ RadioButton RBT_OPT_AXIS_2
+ {
+ HelpID = "chart2:RadioButton:TP_OPTIONS:RBT_OPT_AXIS_2";
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Secondary Y axis";
+ };
+
+ FixedLine GB_BAR
+ {
+ Pos = MAP_APPFONT ( 6 , 50 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ FixedText FT_OVERLAP
+ {
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "~Overlap";
+ };
+
+ MetricField MT_OVERLAP
+ {
+ HelpID = "chart2:MetricField:TP_OPTIONS:MT_OVERLAP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 63 , 78 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -100 ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ DecimalDigits = 0 ;
+ };
+
+ FixedText FT_GAP
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 47 , 8 ) ;
+ Text [ en-US ] = "~Spacing";
+ };
+
+ MetricField MT_GAP
+ {
+ HelpID = "chart2:MetricField:TP_OPTIONS:MT_GAP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 63 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 600 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ First = 1 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ DecimalDigits = 0 ;
+ };
+
+ CheckBox CB_CONNECTOR
+ {
+ HelpID = "chart2:CheckBox:TP_OPTIONS:CB_CONNECTOR";
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Connection lines";
+ };
+
+ CheckBox CB_BARS_SIDE_BY_SIDE
+ {
+ HelpID = "chart2:CheckBox:TP_OPTIONS:CB_BARS_SIDE_BY_SIDE";
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Show ~bars side by side";
+ };
+
+ FixedLine FL_PLOT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 113 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Plot options";
+ };
+
+ FixedText FT_MISSING_VALUES
+ {
+ Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Plot missing values";
+ };
+
+ RadioButton RB_DONT_PAINT
+ {
+ HelpID = "chart2:RadioButton:TP_OPTIONS:RB_DONT_PAINT";
+ Pos = MAP_APPFONT ( 82 , 127 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Leave gap";
+ };
+
+ RadioButton RB_ASSUME_ZERO
+ {
+ HelpID = "chart2:RadioButton:TP_OPTIONS:RB_ASSUME_ZERO";
+ Pos = MAP_APPFONT ( 82 , 141 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Assume zero";
+ };
+
+ RadioButton RB_CONTINUE_LINE
+ {
+ HelpID = "chart2:RadioButton:TP_OPTIONS:RB_CONTINUE_LINE";
+ Pos = MAP_APPFONT ( 82 , 155 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Continue line";
+ };
+
+ CheckBox CB_INCLUDE_HIDDEN_CELLS
+ {
+ HelpID = "chart2:CheckBox:TP_OPTIONS:CB_INCLUDE_HIDDEN_CELLS";
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Include ~values from hidden cells";
+ };
+};
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
new file mode 100644
index 000000000000..5b1d5647dc6c
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "tp_TitleRotation.hxx"
+
+#include "ResId.hxx"
+#include "TabPages.hrc"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "HelpIds.hrc"
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+// header for class SfxInt32Item
+#include <svl/intitem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
+ const SfxItemSet& rInAttrs, bool bWithRotation) :
+ SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
+ aFlAlign ( this, SchResId( FL_ALIGN ) ),
+ aCtrlDial ( this, SchResId( CTR_DIAL ) ),
+ aFtRotate ( this, SchResId( FT_DEGREES ) ),
+ aNfRotate ( this, SchResId( NF_ORIENT ) ),
+ aCbStacked ( this, SchResId( BTN_TXTSTACKED ) ),
+ aOrientHlp ( aCtrlDial, aNfRotate, aCbStacked ),
+ aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
+ aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
+{
+ FreeResource();
+
+ aCbStacked.EnableTriState( FALSE );
+ aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
+
+ if( !bWithRotation )
+ {
+ aOrientHlp.Hide();
+ Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
+ aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
+ aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
+
+ aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
+ }
+}
+
+SchAlignmentTabPage::~SchAlignmentTabPage()
+{
+}
+
+SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
+ const SfxItemSet& rInAttrs)
+{
+ return new SchAlignmentTabPage(pParent, rInAttrs);
+}
+
+SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
+ const SfxItemSet& rInAttrs)
+{
+ return new SchAlignmentTabPage(pParent, rInAttrs, false);
+}
+
+BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+{
+ //Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
+ bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
+
+ sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
+ rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
+
+ SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
+ rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
+
+ return TRUE;
+}
+
+void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
+
+ sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
+ aCtrlDial.SetRotation( nDegrees );
+
+ pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
+ bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
+ aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
+
+
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pItem) == SFX_ITEM_SET)
+ aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
new file mode 100644
index 000000000000..e02b0f29078d
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_TITLEROTATION_HXX
+#define _CHART2_TP_TITLEROTATION_HXX
+
+// header for SfxTabPage
+#include <sfx2/tabdlg.hxx>
+#include <svx/dialcontrol.hxx>
+#include <svx/wrapfield.hxx>
+#include <svx/orienthelper.hxx>
+#include <vcl/fixed.hxx>
+#include "TextDirectionListBox.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class SchAlignmentTabPage : public SfxTabPage
+{
+private:
+ FixedLine aFlAlign;
+ svx::DialControl aCtrlDial;
+ FixedText aFtRotate;
+ svx::WrapField aNfRotate;
+ TriStateBox aCbStacked;
+ svx::OrientationHelper aOrientHlp;
+ FixedText aFtTextDirection;
+ TextDirectionListBox aLbTextDirection;
+
+public:
+ SchAlignmentTabPage(Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
+ virtual ~SchAlignmentTabPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
+ static SfxTabPage* CreateWithoutRotation(Window* pParent, const SfxItemSet& rInAttrs);
+ virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual void Reset(const SfxItemSet& rInAttrs);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.src b/chart2/source/controller/dialogs/tp_TitleRotation.src
new file mode 100644
index 000000000000..2ac0355d39af
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.src
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+
+TabPage TP_ALIGNMENT
+{
+ Hide = TRUE ;
+ HelpID = HID_SCH_ALIGNMENT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Control CTR_DIAL
+ {
+ HelpId = HID_SCH_ALIGNMENT_CTR_DIAL ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 43 , 43 ) ;
+ Text = "ABCD" ;
+ };
+ TriStateBox BTN_TXTSTACKED
+ {
+ HelpId = HID_SCH_ALIGNMENT_STACKED ;
+ Pos = MAP_APPFONT ( 139 , 14 ) ;
+ Size = MAP_APPFONT ( 116 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ve~rtically stacked";
+ };
+ FixedText FT_DEGREES
+ {
+ Pos = MAP_APPFONT ( 93 , 32 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "~Degrees" ;
+ };
+ NumericField NF_ORIENT
+ {
+ HelpId = HID_SCH_ALIGNMENT_DEGREES ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 61 , 30 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ SpinSize = 5 ;
+ Minimum = 0 ;
+ Maximum = 359 ;
+ };
+ FixedLine FL_ALIGN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text orientation" ;
+ };
+ FixedText FT_TEXTDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Te~xt direction" ;
+ };
+ ListBox LB_TEXTDIR
+ {
+ HelpId = HID_SCH_TEXTDIRECTION_TITLE ;
+ Pos = MAP_APPFONT ( 78 , 63 ) ;
+ Size = MAP_APPFONT ( 170 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ DropDown = TRUE;
+ };
+};
+
diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx
new file mode 100644
index 000000000000..31b35b24a5b4
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Trendline.hxx"
+#include "ResId.hxx"
+#include "TabPages.hrc"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+TrendlineTabPage::TrendlineTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, SchResId( TP_TRENDLINE ), rInAttrs ),
+ m_aTrendlineResources( this, rInAttrs, false )
+{
+ FreeResource();
+}
+
+TrendlineTabPage::~TrendlineTabPage()
+{
+}
+
+SfxTabPage* TrendlineTabPage::Create(
+ Window* pParent, const SfxItemSet& rOutAttrs )
+{
+ return new TrendlineTabPage( pParent, rOutAttrs );
+}
+
+BOOL TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+{
+ return m_aTrendlineResources.FillItemSet( rOutAttrs );
+}
+
+void TrendlineTabPage::Reset( const SfxItemSet& rInAttrs )
+{
+ m_aTrendlineResources.Reset( rInAttrs );
+}
+
+void TrendlineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxTabPage::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ m_aTrendlineResources.FillValueSets();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
new file mode 100644
index 000000000000..f1c6eb5609fd
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TP_TRENDLINE_HXX
+#define _CHART2_TP_TRENDLINE_HXX
+
+#include "res_Trendline.hxx"
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TrendlineTabPage : public SfxTabPage
+{
+public:
+ TrendlineTabPage ( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual ~TrendlineTabPage ();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
+ virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void Reset( const SfxItemSet& rInAttrs );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ TrendlineResources m_aTrendlineResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Trendline.src b/chart2/source/controller/dialogs/tp_Trendline.src
new file mode 100644
index 000000000000..1a283844a8d1
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Trendline.src
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "TabPages.hrc"
+#include "res_Trendline.hrc"
+
+TabPage TP_TRENDLINE
+{
+ HelpID = "chart2:TabPage:TP_TRENDLINE";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ RESOURCE_TRENDLINE( 260 - 12, 0 )
+};
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
new file mode 100644
index 000000000000..03988116854e
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "tp_Wizard_TitlesAndObjects.hxx"
+#include "tp_Wizard_TitlesAndObjects.hrc"
+#include "Strings.hrc"
+#include "res_Titles.hxx"
+#include "res_LegendPosition.hxx"
+#include "ResId.hxx"
+#include "HelpIds.hrc"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "LegendHelper.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+
+TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
+ , const uno::Reference< XChartDocument >& xChartModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+ : OWizardPage( pParent, SchResId(TP_WIZARD_TITLEANDOBJECTS) )
+ , m_aFT_TitleDescription( this, SchResId( FT_TITLEDESCRIPTION ) )
+ , m_aFL_Vertical( this, SchResId( FL_VERTICAL ) )
+ , m_apTitleResources( new TitleResources(this,false) )
+ , m_apLegendPositionResources( new LegendPositionResources(this,xContext) )
+ , m_aFL_Grids( this, SchResId( FL_GRIDS ) )
+ , m_aCB_Grid_X( this, SchResId( CB_X_SECONDARY ) )
+ , m_aCB_Grid_Y( this, SchResId( CB_Y_SECONDARY ) )
+ , m_aCB_Grid_Z( this, SchResId( CB_Z_SECONDARY ) )
+ , m_xChartModel( xChartModel )
+ , m_xCC( xContext )
+ , m_bCommitToModel( true )
+ , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
+{
+ FreeResource();
+
+ this->SetText( String( SchResId( STR_PAGE_CHART_ELEMENTS ) ) );
+
+ Font aFont( m_aFT_TitleDescription.GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ m_aFT_TitleDescription.SetControlFont( aFont );
+
+ m_aCB_Grid_X.SetHelpId( HID_SCH_CB_XGRID );
+ m_aCB_Grid_Y.SetHelpId( HID_SCH_CB_YGRID );
+ m_aCB_Grid_Z.SetHelpId( HID_SCH_CB_ZGRID );
+
+ m_apTitleResources->SetUpdateDataHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_apLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+
+ m_aCB_Grid_X.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_aCB_Grid_Y.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+ m_aCB_Grid_Z.SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
+}
+
+TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
+{
+}
+
+void TitlesAndObjectsTabPage::initializePage()
+{
+ m_bCommitToModel = false;
+
+ //init titles
+ {
+ TitleDialogData aTitleInput;
+ aTitleInput.readFromModel( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+ m_apTitleResources->writeToResources( aTitleInput );
+ }
+
+ //init legend
+ {
+ m_apLegendPositionResources->writeToResources( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+ }
+
+ //init grid checkboxes
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel );
+ uno::Sequence< sal_Bool > aPossibilityList;
+ uno::Sequence< sal_Bool > aExistenceList;
+ AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, sal_False );
+ AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, sal_False );
+ m_aCB_Grid_X.Enable( aPossibilityList[0] );
+ m_aCB_Grid_Y.Enable( aPossibilityList[1] );
+ m_aCB_Grid_Z.Enable( aPossibilityList[2] );
+ m_aCB_Grid_X.Check( aExistenceList[0] );
+ m_aCB_Grid_Y.Check( aExistenceList[1] );
+ m_aCB_Grid_Z.Check( aExistenceList[2] );
+ }
+
+ m_bCommitToModel = true;
+}
+
+sal_Bool TitlesAndObjectsTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
+{
+ if( m_apTitleResources->IsModified() ) //titles may have changed in the meanwhile
+ commitToModel();
+ return sal_True;//return false if this page should not be left
+}
+
+void TitlesAndObjectsTabPage::commitToModel()
+{
+ bool bChanged = false;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
+
+ ControllerLockGuard aLockedControllers( xModel );
+
+ //commit title changes to model
+ {
+ TitleDialogData aTitleOutput;
+ m_apTitleResources->readFromResources( aTitleOutput );
+ bChanged = bChanged || aTitleOutput.writeDifferenceToModel( xModel, m_xCC );
+ m_apTitleResources->ClearModifyFlag();
+ }
+
+ //commit legend changes to model
+ {
+ bChanged = true;
+ m_apLegendPositionResources->writeToModel( xModel );
+ }
+
+ //commit grid changes to model
+ {
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ uno::Sequence< sal_Bool > aOldExistenceList;
+ AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, sal_False );
+ uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
+ aNewExistenceList[0]=m_aCB_Grid_X.IsChecked();
+ aNewExistenceList[1]=m_aCB_Grid_Y.IsChecked();
+ aNewExistenceList[2]=m_aCB_Grid_Z.IsChecked();
+ AxisHelper::changeVisibilityOfGrids( xDiagram
+ , aOldExistenceList, aNewExistenceList, m_xCC );
+ }
+}
+
+IMPL_LINK( TitlesAndObjectsTabPage, ChangeHdl, void *, EMPTYARG )
+{
+ if( m_bCommitToModel )
+ commitToModel();
+ return 0;
+}
+
+bool TitlesAndObjectsTabPage::canAdvance() const
+{
+ return false;
+}
+
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc
new file mode 100644
index 000000000000..44c340139782
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+/*
+#define ED_MAINTITLE 1
+#define ED_SUBTITLE 2
+#define ED_X_AXIS 3
+#define ED_Y_AXIS 4
+#define ED_Z_AXIS 5
+#define FT_MAINTITLE 1
+#define FT_SUBTITLE 2
+#define FT_TITLE_X_AXIS 3
+#define FT_TITLE_Y_AXIS 4
+#define FT_TITLE_Z_AXIS 5
+*/
+
+#define FT_TITLEDESCRIPTION 30
+
+#define FL_VERTICAL 3
+#define FL_GRIDS 4
+
+#define CB_X_SECONDARY 4
+#define CB_Y_SECONDARY 5
+#define CB_Z_SECONDARY 6
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
new file mode 100644
index 000000000000..1cd9c6162a46
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_TP_WIZARD_TITLESANDOBJECTS_HXX
+#define _CHART2_TP_WIZARD_TITLESANDOBJECTS_HXX
+
+#include "TimerTriggeredControllerLock.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/wizardmachine.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+//for auto_ptr
+#include <memory>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class TitleResources;
+class LegendPositionResources;
+class TitlesAndObjectsTabPage : public svt::OWizardPage
+{
+public:
+ TitlesAndObjectsTabPage( svt::OWizardMachine* pParent
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~TitlesAndObjectsTabPage();
+
+ virtual void initializePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason );
+ virtual bool canAdvance() const;
+
+protected:
+ void commitToModel();
+ DECL_LINK( ChangeHdl, void* );
+
+protected:
+ FixedText m_aFT_TitleDescription;
+ FixedLine m_aFL_Vertical;
+
+ ::std::auto_ptr< TitleResources > m_apTitleResources;
+ ::std::auto_ptr< LegendPositionResources > m_apLegendPositionResources;
+
+ FixedLine m_aFL_Grids;
+ CheckBox m_aCB_Grid_X;
+ CheckBox m_aCB_Grid_Y;
+ CheckBox m_aCB_Grid_Z;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ bool m_bCommitToModel;
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src
new file mode 100644
index 000000000000..473007f1c32b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "HelpIds.hrc"
+#include "SchSlotIds.hxx"
+#include "tp_Wizard_TitlesAndObjects.hrc"
+#include "res_Titlesx.hrc"
+#include "res_SecondaryAxisCheckBoxes.hrc"
+#include "dlg_CreationWizard.hrc"
+#include "res_LegendPosition.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define MASKCOLOR MaskColor = Color { Red = 0xC000 ; Green = 0xC000 ; Blue = 0xC000 ; }
+#define WIZ_TITLES_WIDTH 130
+
+#define WIZ_POSX1 6
+#define WIZ_POSX1_A (WIZ_POSX1)
+#define WIZ_POSX_VERTICAL (WIZ_POSX1+WIZ_TITLES_WIDTH+6)
+#define WIZ_POSX2 (WIZ_POSX_VERTICAL+RSC_CD_FIXEDLINE_WIDTH+2)
+#define WIZ_POSX2_A (WIZ_POSX2)
+#define WIZ_POSX2_B (WIZ_POSX2_A+9)
+
+#define WIZ_SECOND_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-10-(WIZ_POSX2))
+#define WIZ_COMPLETE_FIXEDLINE_WIDTH (CHART_WIZARD_PAGEWIDTH-10-(WIZ_POSX1))
+#define WIZ_VERTICAL_FIXEDLINE_HEIGHT ( 88 )
+
+#define WIZ_POSY1 8
+#define WIZ_POSY1_A (WIZ_POSY1 + RSC_CD_FIXEDTEXT_HEIGHT +5)
+#define WIZ_POSY1_B (WIZ_POSY1_A+ RSC_CD_FIXEDTEXT_HEIGHT +7)
+
+#define WIZ_POSY2 110
+#define WIZ_POSY_GRID (WIZ_POSY2+RSC_CD_FIXEDTEXT_HEIGHT+6)
+
+TabPage TP_WIZARD_TITLEANDOBJECTS
+{
+ HelpID = "chart2:TabPage:TP_WIZARD_TITLEANDOBJECTS";
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ;
+
+ FixedText FT_TITLEDESCRIPTION
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY1 ) ;
+ Size = MAP_APPFONT ( WIZ_COMPLETE_FIXEDLINE_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Choose titles, legend, and grid settings";
+ };
+ FixedLine FL_VERTICAL
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX_VERTICAL , WIZ_POSY1+3+RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH, WIZ_VERTICAL_FIXEDLINE_HEIGHT ) ;
+ Vert = TRUE ;
+ };
+
+ TITLES(WIZ_POSX1_A,WIZ_POSY1_A,WIZ_TITLES_WIDTH,0,0)
+ RESOURCE_LEGENDDISPLAY( WIZ_POSX2_A, WIZ_POSY1_A )
+ RESOURCE_LEGENDPOSITION( WIZ_POSX2_B, WIZ_POSY1_B )
+
+
+ FixedLine FL_GRIDS
+ {
+ Pos = MAP_APPFONT ( WIZ_POSX1 , WIZ_POSY2 ) ;
+ Size = MAP_APPFONT ( WIZ_COMPLETE_FIXEDLINE_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Display grids";
+ };
+
+ SECONDARYAXISCHECKBOXES( WIZ_POSX1_A, WIZ_POSY_GRID, 43, 0 )
+};
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
new file mode 100644
index 000000000000..48c96a715c5f
--- /dev/null
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -0,0 +1,445 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DrawViewWrapper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "ConfigurationAccess.hxx"
+#include "macros.hxx"
+
+#include <unotools/lingucfg.hxx>
+#include <editeng/langitem.hxx>
+// header for class SdrPage
+#include <svx/svdpage.hxx>
+//header for class SdrPageView
+#include <svx/svdpagv.hxx>
+// header for class SdrModel
+#include <svx/svdmodel.hxx>
+// header for class E3dScene
+#include <svx/scene3d.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdoutl.hxx>
+
+// header for class SvxForbiddenCharactersTable
+#include <editeng/forbiddencharacterstable.hxx>
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+// header for class SvxShape
+#include <svx/unoshape.hxx>
+#include <editeng/fhgtitem.hxx>
+
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <sfx2/objsh.hxx>
+#include <svx/helperhittest3d.hxx>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+ short lcl_getHitTolerance( OutputDevice* pOutDev )
+ {
+ const short HITPIX=2; //hit-tolerance in pixel
+ short nHitTolerance = 50;
+ if(pOutDev)
+ nHitTolerance = static_cast<short>(pOutDev->PixelToLogic(Size(HITPIX,0)).Width());
+ return nHitTolerance;
+ }
+
+// this code is copied from sfx2/source/doc/objembed.cxx
+SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel )
+{
+ SfxObjectShell* pResult = NULL;
+
+ 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( uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) );
+ }
+ }
+ }
+ catch( 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) fromthe parent document
+OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel )
+{
+ SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel );
+ if ( pParent )
+ return pParent->GetDocumentRefDev();
+ return NULL;
+}
+
+}
+
+ /*
+void lcl_initOutliner( SdrOutliner* pTargetOutliner, SdrOutliner* pSourceOutliner )
+{
+ //just an unsuccessful try to initialize the text edit outliner correctly
+ //if( bInit )
+ {
+ pTargetOutliner->EraseVirtualDevice();
+ pTargetOutliner->SetUpdateMode(FALSE);
+ pTargetOutliner->SetEditTextObjectPool( pSourceOutliner->GetEditTextObjectPool() );
+ pTargetOutliner->SetDefTab( pSourceOutliner->GetDefTab() );
+ }
+
+ pTargetOutliner->SetRefDevice( pSourceOutliner->GetRefDevice() );
+ pTargetOutliner->SetForbiddenCharsTable( pSourceOutliner->GetForbiddenCharsTable() );
+ pTargetOutliner->SetAsianCompressionMode( pSourceOutliner->GetAsianCompressionMode() );
+ pTargetOutliner->SetKernAsianPunctuation( pSourceOutliner->IsKernAsianPunctuation() );
+ pTargetOutliner->SetStyleSheetPool( pSourceOutliner->GetStyleSheetPool() );
+ pTargetOutliner->SetRefMapMode( pSourceOutliner->GetRefMapMode() );
+ pTargetOutliner->SetDefaultLanguage( pSourceOutliner->GetDefaultLanguage() );
+ pTargetOutliner->SetHyphenator( pSourceOutliner->GetHyphenator() );
+
+ USHORT nX, nY;
+ pSourceOutliner->GetGlobalCharStretching( nX, nY );
+ pTargetOutliner->SetGlobalCharStretching( nX, nY );
+
+ *//*
+ if ( !GetRefDevice() )
+ {
+ MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit);
+ pTargetOutliner->SetRefMapMode(aMapMode);
+ }
+ *//*
+}
+*/
+
+DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut, bool bPaintPageForEditMode)
+ : E3dView(pSdrModel, pOut)
+ , m_pMarkHandleProvider(NULL)
+ , m_apOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pSdrModel ) )
+ , m_bRestoreMapMode( false )
+{
+ // #114898#
+ SetBufferedOutputAllowed(true);
+ SetBufferedOverlayAllowed(true);
+
+ SetPagePaintingAllowed(bPaintPageForEditMode);
+
+ // #i12587# support for shapes in chart
+ SdrOutliner* pOutliner = getOutliner();
+ SfxItemPool* pOutlinerPool = ( pOutliner ? pOutliner->GetEditTextObjectPool() : NULL );
+ if ( pOutlinerPool )
+ {
+ SvtLinguConfig aLinguConfig;
+ SvtLinguOptions aLinguOptions;
+ if ( 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 ) );
+ }
+
+ // set font height without changing SdrEngineDefaults
+ pOutlinerPool->SetPoolDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt
+ }
+
+ ReInit();
+}
+
+void DrawViewWrapper::ReInit()
+{
+ OutputDevice* pOutDev = this->GetFirstOutputDevice();
+ Size aOutputSize(100,100);
+ if(pOutDev)
+ aOutputSize = pOutDev->GetOutputSize();
+
+ bPageVisible = false;
+ bPageBorderVisible = false;
+ bBordVisible = false;
+ bGridVisible = false;
+ bHlplVisible = false;
+
+ this->SetNoDragXorPolys(true);//for interactive 3D resize-dragging: paint only a single rectangle (not a simulated 3D object)
+ //this->SetResizeAtCenter(true);//for interactive resize-dragging: keep the object center fix
+
+ //a correct work area is at least necessary for correct values in the position and size dialog
+ Rectangle aRect(Point(0,0), aOutputSize);
+ this->SetWorkArea(aRect);
+
+ this->ShowSdrPage(this->GetModel()->GetPage(0));
+}
+
+DrawViewWrapper::~DrawViewWrapper()
+{
+ aComeBackTimer.Stop();//@todo this should be done in destructor of base class
+ UnmarkAllObj();//necessary to aavoid a paint call during the destructor hierarchy
+}
+
+SdrPageView* DrawViewWrapper::GetPageView() const
+{
+ SdrPageView* pSdrPageView = this->GetSdrPageView();
+ return pSdrPageView;
+};
+
+//virtual
+void DrawViewWrapper::SetMarkHandles()
+{
+ if( m_pMarkHandleProvider && m_pMarkHandleProvider->getMarkHandles( aHdl ) )
+ return;
+ else
+ SdrView::SetMarkHandles();
+}
+
+SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const
+{
+ SdrObject* pRet = NULL;
+ //ULONG nOptions =SDRSEARCH_DEEP|SDRSEARCH_PASS2BOUND|SDRSEARCH_PASS3NEAREST;
+ ULONG nOptions = SDRSEARCH_DEEP | SDRSEARCH_TESTMARKABLE;
+
+ SdrPageView* pSdrPageView = this->GetPageView();
+ this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pRet, pSdrPageView, nOptions);
+
+ if( pRet )
+ {
+ //ignore some special shapes
+ rtl::OUString aShapeName = pRet->GetName();
+ if( aShapeName.match(C2U("PlotAreaIncludingAxes")) || aShapeName.match(C2U("PlotAreaExcludingAxes")) )
+ {
+ pRet->SetMarkProtect( true );
+ return getHitObject( rPnt );
+ }
+
+ //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);
+ if( pE3d )
+ {
+ E3dScene* pScene = pE3d->GetScene();
+ if( pScene )
+ {
+ // prepare result vector and call helper
+ ::std::vector< const E3dCompoundObject* > aHitList;
+ const basegfx::B2DPoint aHitPoint(rPnt.X(), rPnt.Y());
+ getAllHit3DObjectsSortedFrontToBack(aHitPoint, *pScene, aHitList);
+
+ if(aHitList.size())
+ {
+ // choose the frontmost hit 3D object of the scene
+ pRet = const_cast< E3dCompoundObject* >(aHitList[0]);
+ }
+ }
+ }
+ }
+ return pRet;
+}
+
+void DrawViewWrapper::MarkObject( SdrObject* pObj )
+{
+ bool bFrameDragSingles = true;//true == green == surrounding handles
+ if(pObj)
+ pObj->SetMarkProtect(false);
+ if( m_pMarkHandleProvider )
+ bFrameDragSingles = m_pMarkHandleProvider->getFrameDragSingles();
+
+ this->SetFrameDragSingles(bFrameDragSingles);//decide wether each single object should get handles
+ this->SdrView::MarkObj( pObj, this->GetPageView() );
+ this->showMarkHandles();
+}
+
+
+void DrawViewWrapper::setMarkHandleProvider( MarkHandleProvider* pMarkHandleProvider )
+{
+ m_pMarkHandleProvider = pMarkHandleProvider;
+}
+
+void DrawViewWrapper::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* /* pRedirector */)
+{
+ svtools::ColorConfig aColorConfig;
+ Color aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor );
+ this->SetApplicationBackgroundColor(aFillColor);
+ this->E3dView::CompleteRedraw( pOut, rReg );
+}
+
+SdrObject* DrawViewWrapper::getSelectedObject() const
+{
+ SdrObject* pObj(NULL);
+ const SdrMarkList& rMarkList = this->GetMarkedObjectList();
+ if(rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ pObj = pMark->GetMarkedSdrObj();
+ }
+ return pObj;
+}
+
+SdrObject* DrawViewWrapper::getTextEditObject() const
+{
+ SdrObject* pObj = this->getSelectedObject();
+ SdrObject* pTextObj = NULL;
+ if( pObj && pObj->HasTextEdit())
+ pTextObj = (SdrTextObj*)pObj;
+ return pTextObj;
+}
+
+void DrawViewWrapper::attachParentReferenceDevice( const uno::Reference< frame::XModel > & xChartModel )
+{
+ OutputDevice * pParentRefDev( lcl_GetParentRefDevice( xChartModel ));
+ SdrOutliner * pOutliner( getOutliner());
+ if( pParentRefDev && pOutliner )
+ {
+ pOutliner->SetRefDevice( pParentRefDev );
+ }
+}
+
+SdrOutliner* DrawViewWrapper::getOutliner() const
+{
+// lcl_initOutliner( m_apOutliner.get(), &GetModel()->GetDrawOutliner() );
+ return m_apOutliner.get();
+}
+
+SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const
+{
+ SfxItemSet aFullSet( GetModel()->GetItemPool(),
+ SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE,
+ SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT,
+ SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS,
+ SID_ATTR_METRIC,SID_ATTR_METRIC,
+ 0);
+ SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() );
+ aFullSet.Put( aGeoSet );
+ aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getFieldUnit())));
+ return aFullSet;
+}
+
+SdrObject* DrawViewWrapper::getNamedSdrObject( const rtl::OUString& rName ) const
+{
+ if(rName.getLength()==0)
+ return 0;
+ SdrPageView* pSdrPageView = this->GetPageView();
+ if( pSdrPageView )
+ {
+ return DrawModelWrapper::getNamedSdrObject( rName, pSdrPageView->GetObjList() );
+ }
+ return 0;
+}
+
+bool DrawViewWrapper::IsObjectHit( SdrObject* pObj, const Point& rPnt ) const
+{
+ if(pObj)
+ {
+ Rectangle aRect(pObj->GetCurrentBoundRect());
+ return aRect.IsInside(rPnt);
+ }
+ return false;
+}
+
+void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ //prevent wrong reselection of objects
+ SdrModel* pSdrModel( this->GetModel() );
+ if( pSdrModel && pSdrModel->isLocked() )
+ return;
+
+ const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
+
+ //#i76053# do nothing when only changes on the hidden draw page were made ( e.g. when the symbols for the dialogs are created )
+ SdrPageView* pSdrPageView = this->GetPageView();
+ if( pSdrHint && pSdrPageView )
+ {
+ if( pSdrPageView->GetPage() != pSdrHint->GetPage() )
+ return;
+ }
+
+ E3dView::Notify(rBC, rHint);
+
+ if( pSdrHint != 0 )
+ {
+ SdrHintKind eKind = pSdrHint->GetKind();
+ if( eKind == HINT_BEGEDIT )
+ {
+ // #i79965# remember map mode
+ OSL_ASSERT( ! m_bRestoreMapMode );
+ OutputDevice* pOutDev = this->GetFirstOutputDevice();
+ if( pOutDev )
+ {
+ m_aMapModeToRestore = pOutDev->GetMapMode();
+ m_bRestoreMapMode = true;
+ }
+ }
+ else if( eKind == HINT_ENDEDIT )
+ {
+ // #i79965# scroll back view when ending text edit
+ OSL_ASSERT( m_bRestoreMapMode );
+ if( m_bRestoreMapMode )
+ {
+ OutputDevice* pOutDev = this->GetFirstOutputDevice();
+ if( pOutDev )
+ {
+ pOutDev->SetMapMode( m_aMapModeToRestore );
+ m_bRestoreMapMode = false;
+ }
+ }
+ }
+ }
+}
+
+//static
+SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference<
+ drawing::XShape >& xShape )
+{
+ SdrObject* pRet = 0;
+ uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
+ uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
+ if(xUnoTunnel.is()&&xTypeProvider.is())
+ {
+ SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ if(pSvxShape)
+ pRet = pSvxShape->GetSdrObject();
+ }
+ return pRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
new file mode 100644
index 000000000000..755058050a2d
--- /dev/null
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ViewElementListProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "chartview/DataPointSymbolSupplier.hxx"
+#include "macros.hxx"
+#include "DrawViewWrapper.hxx"
+#include <svx/xtable.hxx>
+#include <svx/XPropertyTable.hxx>
+#include <svx/unofill.hxx>
+#include <svx/unoapi.hxx>
+
+// header for class NameOrIndex
+#include <svx/xit.hxx>
+// header for class XFillBitmapItem
+#include <svx/xbtmpit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflgrit.hxx>
+// header for class XLineStartItem
+#include <svx/xlnstit.hxx>
+// header for class XLineEndItem
+#include <svx/xlnedit.hxx>
+
+//------------
+//oldChartModelWrapper
+
+// header for class SfxItemPool
+#include <svl/itempool.hxx>
+// header for class FontList
+#include <svtools/ctrltool.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+//------------
+// header for class SdrObject
+#include <svx/svdobj.hxx>
+
+
+//---------------
+//for creation of a symbol Graphic
+// header for class VirtualDevice
+#include <vcl/virdev.hxx>
+// header for class SdrView
+#include <svx/svdview.hxx>
+//---------------
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+ViewElementListProvider::ViewElementListProvider( DrawModelWrapper* pDrawModelWrapper )
+ : m_pDrawModelWrapper( pDrawModelWrapper )
+ , m_pFontList(NULL)
+{
+}
+
+ViewElementListProvider::~ViewElementListProvider()
+{
+ if(m_pFontList)
+ delete m_pFontList;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+XColorTable* ViewElementListProvider::GetColorTable() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetColorTable();
+ return NULL;
+}
+XDashList* ViewElementListProvider::GetDashList() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetDashList();
+ return NULL;
+}
+XLineEndList* ViewElementListProvider::GetLineEndList() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetLineEndList();
+ return NULL;
+}
+XGradientList* ViewElementListProvider::GetGradientList() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetGradientList();
+ return NULL;
+}
+XHatchList* ViewElementListProvider::GetHatchList() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetHatchList();
+ return NULL;
+}
+XBitmapList* ViewElementListProvider::GetBitmapList() const
+{
+ if(m_pDrawModelWrapper)
+ return m_pDrawModelWrapper->GetBitmapList();
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//create chartspecific symbols for linecharts
+SdrObjList* ViewElementListProvider::GetSymbolList() const
+{
+ SdrObjList* m_pSymbolList = NULL;
+ uno::Reference< drawing::XShapes > m_xSymbols(NULL);//@todo this keeps the first drawinglayer alive ...
+ try
+ {
+ if(!m_pSymbolList || !m_pSymbolList->GetObjCount())
+ {
+ //@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(), uno::UNO_QUERY );
+
+ //create symbols via uno and convert to native sdr objects
+ drawing::Direction3D aSymbolSize(220,220,0); // should be 250, but 250 -> 280 ??
+ m_xSymbols = DataPointSymbolSupplier::create2DSymbolList( xShapeFactory, xTarget, aSymbolSize );
+
+ SdrObject* pSdrObject = DrawViewWrapper::getSdrObject( uno::Reference< drawing::XShape >( m_xSymbols, uno::UNO_QUERY ) );
+ if(pSdrObject)
+ m_pSymbolList = pSdrObject->GetSubList();
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return m_pSymbolList;
+}
+
+Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, const SfxItemSet* pSymbolShapeProperties ) const
+{
+ SdrObjList* pSymbolList = this->GetSymbolList();
+ if( !pSymbolList->GetObjCount() )
+ return Graphic();
+ if(nStandardSymbol<0)
+ nStandardSymbol*=-1;
+ if( nStandardSymbol >= static_cast<sal_Int32>(pSymbolList->GetObjCount()) )
+ nStandardSymbol %= pSymbolList->GetObjCount();
+ SdrObject* pObj = pSymbolList->GetObj(nStandardSymbol);
+
+ VirtualDevice aVDev;
+ aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+ SdrModel* pModel = new SdrModel();
+ pModel->GetItemPool().FreezeIdRanges();
+ SdrPage* pPage = new SdrPage( *pModel, FALSE );
+ pPage->SetSize(Size(1000,1000));
+ pModel->InsertPage( pPage, 0 );
+ SdrView* pView = new SdrView( pModel, &aVDev );
+ pView->hideMarkHandles();
+ SdrPageView* pPageView = pView->ShowSdrPage(pPage);
+
+ pObj=pObj->Clone();
+ pPage->NbcInsertObject(pObj);
+ pView->MarkObj(pObj,pPageView);
+ if( pSymbolShapeProperties )
+ pObj->SetMergedItemSet(*pSymbolShapeProperties);
+
+ GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
+
+ Graphic aGraph(aMeta);
+ Size aSize = pObj->GetSnapRect().GetSize();
+ aGraph.SetPrefSize(aSize);
+ aGraph.SetPrefMapMode(MAP_100TH_MM);
+
+ pView->UnmarkAll();
+ pObj=pPage->RemoveObject(0);
+ SdrObject::Free( pObj );
+ delete pView;
+ delete pModel;
+
+ return aGraph;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+FontList* ViewElementListProvider::getFontList() const
+{
+ //was old chart:
+ //SvxFontListItem* SfxObjectShell::.GetItem(SID_ATTR_CHAR_FONTLIST)
+
+ if(!m_pFontList)
+ {
+ OutputDevice* pRefDev = m_pDrawModelWrapper ? m_pDrawModelWrapper->getReferenceDevice() : NULL;
+ OutputDevice* pDefaultOut = Application::GetDefaultDevice(); // #67730#
+ m_pFontList = new FontList( pRefDev ? pRefDev : pDefaultOut
+ , pRefDev ? pDefaultOut : NULL
+ , FALSE );
+ }
+ return m_pFontList;
+}
+
+/*
+SfxPrinter* ObjectPropertiesDialogParameter::getPrinter()
+{
+ //was old chart:
+ //SfxPrinter* SchChartDocShell::GetPrinter()
+
+ // OLE-Objekt: kein Printer anlegen ??? see old chart: :UpdateTablePointers
+ //@todo get printer from calc or other container
+ //return NULL;
+
+ SfxPrinter* pPrinter = NULL;
+ bool bOwnPrinter = true;
+ if (!pPrinter)
+ {
+ SfxBoolItem aItem(SID_PRINTER_NOTFOUND_WARN, TRUE);
+ // ItemSet mit speziellem Poolbereich anlegen
+ SfxItemSet* pSet = new SfxItemSet(GetPool(),
+ SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_NOTFOUND_WARN, 0);
+ pSet->Put(aItem);
+ pPrinter = new SfxPrinter(pSet); //@todo ->need to remember and delete
+ bOwnPrinter = TRUE;
+
+ MapMode aMapMode = pPrinter->GetMapMode();
+ aMapMode.SetMapUnit(MAP_100TH_MM);
+ pPrinter->SetMapMode(aMapMode);
+
+ if (pChDoc)
+ {
+ if (pPrinter != pChDoc->GetRefDevice())
+ pChDoc->SetRefDevice(pPrinter);
+
+ if (pPrinter != pChDoc->GetOutliner()->GetRefDevice())
+ pChDoc->GetOutliner()->SetRefDevice(pPrinter);
+ }
+ }
+ return pPrinter;
+}
+*/
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/drawinglayer/makefile.mk b/chart2/source/controller/drawinglayer/makefile.mk
new file mode 100644
index 000000000000..ab0645e61b10
--- /dev/null
+++ b/chart2/source/controller/drawinglayer/makefile.mk
@@ -0,0 +1,49 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcdrawinglayer
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= $(SLO)$/DrawViewWrapper.obj \
+ $(SLO)$/ViewElementListProvider.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx
new file mode 100644
index 000000000000..ea52a29c614b
--- /dev/null
+++ b/chart2/source/controller/inc/AccessibleBase.hxx
@@ -0,0 +1,379 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLEBASE_HXX_
+#define _CHART2_ACCESSIBLEBASE_HXX_
+
+#include "ObjectIdentifier.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/compbase6.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+#include "MutexContainer.hxx"
+
+class SfxItemSet;
+class SdrObject;
+class SdrView;
+
+namespace accessibility
+{
+class IAccessibleViewForwarder;
+}
+
+namespace chart
+{
+
+class AccessibleBase;
+class ObjectHierarchy;
+
+typedef ObjectIdentifier AccessibleUniqueId;
+
+struct AccessibleElementInfo
+{
+ AccessibleUniqueId m_aOID;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface > m_xView;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::awt::XWindow > m_xWindow;
+
+ ::boost::shared_ptr< ObjectHierarchy > m_spObjectHierarchy;
+
+ AccessibleBase * m_pParent;
+ SdrView* m_pSdrView;
+ ::accessibility::IAccessibleViewForwarder* m_pViewForwarder;
+};
+
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper6<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XEventListener
+ > AccessibleBase_Base;
+}
+
+/** Base class for all Chart Accessibility objects
+ */
+class AccessibleBase :
+ public MutexContainer,
+ public impl::AccessibleBase_Base
+{
+public:
+ enum EventType
+ {
+ OBJECT_CHANGE,
+ GOT_SELECTION,
+ LOST_SELECTION,
+ PROPERTY_CHANGE
+ };
+
+ AccessibleBase( const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent = false );
+ virtual ~AccessibleBase();
+
+protected:
+ // for all calls to protected methods it is assumed that the mutex is locked
+ // unless calls outside via UNO, e.g. event notification, are done
+
+ /** @param bThrowException if true, a DisposedException is thrown if the
+ object is already disposed
+ @return true, if the component is already disposed and bThrowException is false,
+ false otherwise
+ */
+ bool CheckDisposeState( bool bThrowException = true ) const throw (::com::sun::star::lang::DisposedException);
+
+ /** Events coming from the core have to be processed in this methods. The
+ default implementation returns false, which indicates that the object is
+ not interested in the event. To react on events you have to implement
+ this method in derived classes.
+
+ The default implementation iterates over all children and forwards the
+ event until the first child returns true.
+
+ @param nObjId contains the object id of chart objects. If the object is
+ no chart object, the event is not broadcast.
+ @return If an object is the addressee of the event it should return
+ true, false otherwise.
+ */
+ virtual bool NotifyEvent( EventType eType, const AccessibleUniqueId & rId );
+
+ /** Adds a state to the set.
+ */
+ void AddState( sal_Int16 aState ) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Removes a state from the set if the set contains the state, otherwise
+ nothing is done.
+ */
+ void RemoveState( sal_Int16 aState ) throw (::com::sun::star::uno::RuntimeException);
+
+ /** has to be overloaded by derived classes that support child elements.
+ With this method a rescan is initiated that should result in a correct
+ list of children.
+
+ This method is called when access to any methods concerning children is
+ invoked for the first time.
+ */
+ bool UpdateChildren();
+
+ /** Is called by UpdateChildren. This method is only called if an update is
+ really necessary.
+ */
+ virtual bool ImplUpdateChildren();
+
+ /** adds a child to the end of the internal vector of children. As a
+ result, the child-count increases by one, but all existing children keep
+ their indices.
+
+ Important: as the implementation is needed, this should remain the only
+ method for adding children (i.e. there mustn't be an AddChild( Reference<
+ XAccessible > ) or the like).
+ */
+ void AddChild( AccessibleBase* pChild );
+
+ /** removes a child from the internal vector. All children with index
+ greater than the index of the removed element get an index one less than
+ before.
+ */
+ void RemoveChildByOId( const ObjectIdentifier& rOId );
+
+ /** Retrieve the pixel coordinates of logical coordinates (0,0) of the
+ current logic coordinate system. This can be used for
+ getLocationOnScreen, if the coordinates of an object are not relative to
+ its direct parent, but a parent higher up in hierarchy.
+
+ @return the (x,y) pixel coordinates of the upper left corner
+ */
+ virtual ::com::sun::star::awt::Point GetUpperLeftOnScreen() const;
+
+ /** 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 ::com::sun::star::uno::Any & rNew,
+ const ::com::sun::star::uno::Any & rOld,
+ bool bSendGlobally = false ) const;
+
+ /** Removes all children from the internal lists and broadcasts child remove
+ events.
+
+ This method cares about mutex locking, and thus should be called without
+ the mutex locked.
+ */
+ virtual void KillAllChildren();
+
+ /** Is called from getAccessibleChild(). Before this method is called, an
+ update of children is done if necessary.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ /** Is called from getAccessibleChildCount(). Before this method is called,
+ an update of children is done if necessary.
+ */
+ virtual sal_Int32 ImplGetAccessibleChildCount() const
+ throw (::com::sun::star::uno::RuntimeException);
+
+ AccessibleElementInfo GetInfo() const;
+ void SetInfo( const AccessibleElementInfo & rNewInfo );
+ AccessibleUniqueId GetId() const;
+
+ // ________ WeakComponentImplHelper (XComponent::dispose) ________
+ virtual void SAL_CALL disposing();
+
+ // ________ XAccessible ________
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @return AccessibleRole.SHAPE
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::com::sun::star::uno::RuntimeException);
+ // has to be implemented by derived classes
+// virtual ::rtl::OUString SAL_CALL getAccessibleName()
+// throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException,
+ ::com::sun::star::uno::RuntimeException);
+ // has to be implemented by derived classes
+// virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleComponent ________
+ virtual sal_Bool SAL_CALL containsPoint(
+ const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+ // has to be defined in derived classes
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(
+ const ::rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XEventListener ________
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ using ::cppu::WeakComponentImplHelperBase::addEventListener;
+ using ::cppu::WeakComponentImplHelperBase::removeEventListener;
+
+ // ________ XAccessibleEventBroadcaster ________
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ enum eColorType
+ {
+ ACC_BASE_FOREGROUND,
+ ACC_BASE_BACKGROUND
+ };
+ sal_Int32 getColor( eColorType eColType );
+
+private:
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > tAccessible;
+ /** type of the vector containing the accessible children
+ */
+ typedef ::std::vector< tAccessible > ChildListVectorType;
+ /** type of the hash containing a vector index for every AccessibleUniqueId
+ of the object in the child list
+ */
+ typedef ::std::map< ObjectIdentifier, tAccessible > ChildOIDMap;
+
+ bool m_bIsDisposed;
+ const bool m_bMayHaveChildren;
+ bool m_bChildrenInitialized;
+ ChildListVectorType m_aChildList;
+
+ ChildOIDMap m_aChildOIDMap;
+
+ ::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId;
+
+ /** Implementation helper for getAccessibleStateSet()
+
+ Note: This member must come before m_aStateSet!
+ */
+ ::utl::AccessibleStateSetHelper * m_pStateSetHelper;
+ /** this is returned in getAccessibleStateSet().
+
+ The implementation is an ::utl::AccessibleStateSetHelper. To access
+ implementation methods use m_pStateSetHelper.
+
+ Note: Keeping this reference ensures, that the helper object is only
+ destroyed after this object has been disposed().
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet >
+ m_aStateSet;
+
+ AccessibleElementInfo m_aAccInfo;
+ const bool m_bAlwaysTransparent;
+ /** denotes if the state-set is initialized. On initialization the selected
+ state is checked.
+
+ This variable is monitored by the solar mutex!
+
+ Note: declared volatile to enable double-check-locking
+ */
+ volatile bool m_bStateSetInitialized;
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/inc/AccessibleChartView.hxx b/chart2/source/controller/inc/AccessibleChartView.hxx
new file mode 100644
index 000000000000..2cc46825a5aa
--- /dev/null
+++ b/chart2/source/controller/inc/AccessibleChartView.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLE_CHART_VIEW_HXX
+#define _CHART2_ACCESSIBLE_CHART_VIEW_HXX
+
+#include "AccessibleBase.hxx"
+#include "MutexContainer.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+// header for class WeakReference
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace accessibility
+{
+class IAccessibleViewForwarder;
+}
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ExplicitValueProvider;
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper2<
+ ::chart::AccessibleBase,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::view::XSelectionChangeListener >
+ AccessibleChartView_Base;
+}
+
+class AccessibleChartView :
+ public impl::AccessibleChartView_Base
+{
+public:
+ AccessibleChartView(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext, SdrView* pView );
+ virtual ~AccessibleChartView();
+
+ // ____ WeakComponentHelper (called from XComponent::dispose()) ____
+ virtual void SAL_CALL 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 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ view::XSelectionChangeListener ____
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XEventListener ________
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleComponent ________
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ________ AccessibleChartElement ________
+ virtual ::com::sun::star::awt::Point GetUpperLeftOnScreen() const;
+
+private: // methods
+ /** @return the result that m_xWindow->getPosSize() _should_ return. It
+ returns (0,0) as upper left corner. When calling
+ getAccessibleParent, you get the parent's parent, which contains
+ a decoration. Thus you have an offset of (currently) (2,2)
+ which isn't taken into account.
+ */
+ virtual ::com::sun::star::awt::Rectangle GetWindowPosSize() const;
+
+ ExplicitValueProvider* getExplicitValueProvider();
+
+private: // members
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xContext;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::uno::XInterface > m_xChartView;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::awt::XWindow > m_xWindow;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+ ::boost::shared_ptr< ObjectHierarchy > m_spObjectHierarchy;
+ AccessibleUniqueId m_aCurrentSelectionOID;
+ SdrView* m_pSdrView;
+ ::accessibility::IAccessibleViewForwarder* m_pViewForwarder;
+
+ //no default constructor
+ AccessibleChartView();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/AccessibleTextHelper.hxx b/chart2/source/controller/inc/AccessibleTextHelper.hxx
new file mode 100644
index 000000000000..66ef9338dc09
--- /dev/null
+++ b/chart2/source/controller/inc/AccessibleTextHelper.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_ACCESSIBLETEXTHELPER_HXX
+#define CHART2_ACCESSIBLETEXTHELPER_HXX
+
+#include "MutexContainer.hxx"
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+// forward declaration of helper class from svx
+namespace accessibility
+{
+class AccessibleTextHelper;
+}
+
+namespace chart
+{
+
+class DrawViewWrapper;
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::accessibility::XAccessibleContext >
+ AccessibleTextHelper_Base;
+}
+
+class AccessibleTextHelper :
+ public MutexContainer,
+ public impl::AccessibleTextHelper_Base
+{
+public:
+ explicit AccessibleTextHelper( DrawViewWrapper * pDrawViewWrapper );
+ virtual ~AccessibleTextHelper();
+
+ // ____ 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
+ the corresponding drawing object that contains the text that should
+ be handled by this helper class.
+1
+ mandatory parameter 1: type XAccessible. Is used as EventSource for the
+ ::accessibility::AccessibleTextHelper (svx)
+
+ mandatory parameter 2: type awt::XWindow. The Window that shows the
+ text currently.
+ */
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XAccessibleContext ____
+ virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild(
+ ::sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException,
+ ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::accessibility::AccessibleTextHelper * m_pTextHelper;
+ DrawViewWrapper * m_pDrawViewWrapper;
+};
+
+} // namespace chart
+
+// CHART2_ACCESSIBLETEXTHELPER_HXX
+#endif
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx
new file mode 100644
index 000000000000..7c8f83452963
--- /dev/null
+++ b/chart2/source/controller/inc/AxisItemConverter.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AXISITEMCONVERTER_HXX
+#define CHART_AXISITEMCONVERTER_HXX
+
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include "ItemConverter.hxx"
+
+#include <vector>
+#include <memory>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class AxisItemConverter : public ::comphelper::ItemConverter
+{
+public:
+ AxisItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ ::com::sun::star::chart2::ExplicitScaleData * pScale = NULL,
+ ::com::sun::star::chart2::ExplicitIncrementData * pIncrement = NULL,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~AxisItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::std::vector< ItemConverter * > m_aConverters;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > m_xAxis;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
+
+ ::com::sun::star::chart2::ExplicitScaleData * m_pExplicitScale;
+ ::com::sun::star::chart2::ExplicitIncrementData * m_pExplicitIncrement;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_AXISITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
new file mode 100644
index 000000000000..d2590c37759c
--- /dev/null
+++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARACTERPROPERTYITEMCONVERTER_HXX
+#define CHART_CHARACTERPROPERTYITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <memory>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class CharacterPropertyItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ CharacterPropertyItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool );
+ CharacterPropertyItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize,
+ const ::rtl::OUString & rRefSizePropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rRefSizePropSet =
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >() );
+ virtual ~CharacterPropertyItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetRefSizePropertySet() const;
+
+private:
+ ::std::auto_ptr< ::com::sun::star::awt::Size > m_pRefSize;
+ ::rtl::OUString m_aRefSizePropertyName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xRefSizePropSet;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHARACTERPROPERTYITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
new file mode 100644
index 000000000000..f06c502dfd6c
--- /dev/null
+++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTDOCUMENTWRAPPER_HXX
+#define CHART_CHARTDOCUMENTWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+//#include "OPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <cppuhelper/implbase5.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/eventlisteneradapter.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper5
+ < WrappedPropertySet
+ , ::com::sun::star::chart::XChartDocument
+ , ::com::sun::star::drawing::XDrawPageSupplier
+ , ::com::sun::star::lang::XMultiServiceFactory
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::uno::XAggregation
+ >
+{
+};
+
+class ChartDocumentWrapper : public ChartDocumentWrapper_Base
+ , public ::utl::OEventListenerAdapter
+{
+public:
+ explicit ChartDocumentWrapper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~ChartDocumentWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ChartDocumentWrapper)
+
+ void setAddIn( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable >& xAddIn );
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > getAddIn() const;
+
+ void setUpdateAddIn( sal_Bool bUpdateAddIn );
+ sal_Bool getUpdateAddIn() const;
+
+ void setBaseDiagram( const rtl::OUString& rBaseDiagram );
+ rtl::OUString getBaseDiagram() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > getAdditionalShapes() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage > impl_getDrawPage() const
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ // ____ chart::XChartDocument ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getSubTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getLegend()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getArea()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XDiagram > SAL_CALL getDiagram()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartData > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL attachData( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartData >& xData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModel ____
+ virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& URL, const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getURL()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& Controller )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& Controller )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL lockControllers()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlockControllers()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasControllersLocked()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController > SAL_CALL getCurrentController()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& Controller )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XInterface (for new interfaces) ____
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ::utl::OEventListenerAdapter ____
+ virtual void _disposing( const ::com::sun::star::lang::EventObject& rSource );
+
+ // ____ XDrawPageSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage > SAL_CALL getDrawPage()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XMultiServiceFactory ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
+ const ::rtl::OUString& ServiceSpecifier,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAggregation ____
+ virtual void SAL_CALL setDelegator(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& rDelegator )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private: //methods
+ void impl_resetAddIn();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDelegator;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xTitle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xSubTitle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xLegend;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData > m_xChartData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > m_xDiagram;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xArea;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > m_xAddIn;
+ rtl::OUString m_aBaseDiagram;
+ sal_Bool m_bUpdateAddIn;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xChartView;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
+ m_xShapeFactory;
+
+ bool m_bIsDisposed;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHARTDOCUMENT_HXX
+#endif
diff --git a/chart2/source/controller/inc/ChartRenderer.hxx b/chart2/source/controller/inc/ChartRenderer.hxx
new file mode 100644
index 000000000000..c602a6ec6630
--- /dev/null
+++ b/chart2/source/controller/inc/ChartRenderer.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_RENDERER_HXX
+#define CHART_RENDERER_HXX
+
+#include <svtools/chartprettypainter.hxx>
+#include "ServiceMacros.hxx"
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/weakref.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//#i82893#, #i75867#: charts must be painted resolution dependent!!
+class ChartRenderer : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ >, public ChartPrettyPainter
+{
+public:
+ ChartRenderer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ virtual ~ChartRenderer();
+
+ // ___lang::XServiceInfo___
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XUnoTunnel ___
+ virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartPrettyPainter ___
+ virtual bool DoPaint(OutputDevice* pOutDev, const Rectangle& rLogicObjectRect) const;
+
+private:
+ ChartRenderer();
+ ChartRenderer( const ChartRenderer& );
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xChartModel;
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx
new file mode 100644
index 000000000000..0cc8180b3dd2
--- /dev/null
+++ b/chart2/source/controller/inc/ConfigurationAccess.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CONFIGURATIONACCESS_HXX
+#define _CHART2_CONFIGURATIONACCESS_HXX
+
+// header for enum FieldUnit
+#include <vcl/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
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
new file mode 100644
index 000000000000..d738cf8f6245
--- /dev/null
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATAPOINTITEMCONVERTER_HXX
+#define CHART_DATAPOINTITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+#include <vector>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class DataPointItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ DataPointItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ NumberFormatterWrapper * pNumFormatter,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::eGraphicObjectType eMapTo =
+ GraphicPropertyItemConverter::FILLED_DATA_POINT,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >(),
+ bool bDataSeries = false,
+ bool bUseSpecialFillColor = false,
+ sal_Int32 nSpecialFillColor = 0,
+ bool bOverwriteLabelsForAttributedDataPointsAlso=false,
+ sal_Int32 nNumberFormat=0,
+ sal_Int32 nPercentNumberFormat=0);
+
+ virtual ~DataPointItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::std::vector< ItemConverter * > m_aConverters;
+ NumberFormatterWrapper * m_pNumberFormatterWrapper;
+ bool m_bDataSeries;
+ bool m_bOverwriteLabelsForAttributedDataPointsAlso;
+ bool m_bColorPerPoint;
+ bool m_bUseSpecialFillColor;
+ sal_Int32 m_nSpecialFillColor;
+ sal_Int32 m_nNumberFormat;
+ sal_Int32 m_nPercentNumberFormat;
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aAvailableLabelPlacements;
+ bool m_bForbidPercentValue;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_DATAPOINTITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
new file mode 100644
index 000000000000..1dbdf6a85a53
--- /dev/null
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DRAW_VIEW_WRAPPER_HXX
+#define _CHART2_DRAW_VIEW_WRAPPER_HXX
+
+#include <svx/view3d.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+class SdrModel;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/** The DrawViewWrapper should help us to reduce effort if the underlying DrawingLayer changes.
+Another task is to hide functionality we do not need, for example more than one page.
+*/
+
+class MarkHandleProvider
+{
+public:
+ virtual bool getMarkHandles( SdrHdlList& rHdlList ) =0;
+ virtual bool getFrameDragSingles() =0;
+};
+
+class DrawViewWrapper : public E3dView
+{
+public:
+ DrawViewWrapper(SdrModel* pModel, OutputDevice* pOut, bool bPaintPageForEditMode);
+ virtual ~DrawViewWrapper();
+
+ //triggers the use of an updated first page
+ void ReInit();
+
+ /// tries to get an OutputDevice from the XParent of the model to use as reference device
+ void attachParentReferenceDevice(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
+
+ //fill list of selection handles 'aHdl'
+ virtual void SetMarkHandles();
+
+ SdrPageView* GetPageView() const;
+
+ SdrObject* getHitObject( const Point& rPnt ) const;
+ //BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const;
+ //BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const;
+ //BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
+
+ //void MarkObj(SdrObject* pObj, SdrPageView* pPV, BOOL bUnmark=FALSE, BOOL bImpNoSetMarkHdl=FALSE);
+ void MarkObject( SdrObject* pObj );
+
+ //----------------------
+ //pMarkHandleProvider can be NULL; ownership is not taken
+ void setMarkHandleProvider( MarkHandleProvider* pMarkHandleProvider );
+ void CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0);
+
+ SdrObject* getSelectedObject() const;
+ SdrObject* getTextEditObject() const;
+ SdrOutliner* getOutliner() const;
+
+ SfxItemSet getPositionAndSizeItemSetFromMarkedObject() const;
+
+ SdrObject* getNamedSdrObject( const rtl::OUString& rName ) const;
+ bool IsObjectHit( SdrObject* pObj, const Point& rPnt ) const;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ static SdrObject* getSdrObject( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+private:
+ mutable MarkHandleProvider* m_pMarkHandleProvider;
+
+ ::std::auto_ptr< SdrOutliner > m_apOutliner;
+
+ // #i79965# scroll back view when ending text edit
+ bool m_bRestoreMapMode;
+ MapMode m_aMapModeToRestore;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
new file mode 100755
index 000000000000..9dffde68cd5b
--- /dev/null
+++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STATISTICSITEMCONVERTER_HXX
+#define CHART_STATISTICSITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class ErrorBarItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ ErrorBarItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory );
+ virtual ~ErrorBarItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::boost::shared_ptr< ItemConverter > m_spGraphicConverter;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_STATISTICSITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
new file mode 100644
index 000000000000..c10e1d4e5b86
--- /dev/null
+++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_GRAPHICPROPERTYITEMCONVERTER_HXX
+#define CHART_GRAPHICPROPERTYITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class GraphicPropertyItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ enum eGraphicObjectType
+ {
+ FILLED_DATA_POINT,
+ LINE_DATA_POINT,
+ LINE_PROPERTIES,
+ FILL_PROPERTIES,
+ LINE_AND_FILL_PROPERTIES
+ };
+
+ GraphicPropertyItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ eGraphicObjectType eObjectType = FILLED_DATA_POINT );
+ virtual ~GraphicPropertyItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ eGraphicObjectType m_eGraphicObjectType;
+ SdrModel & m_rDrawModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_GRAPHICPROPERTYITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc
new file mode 100644
index 000000000000..5e20b7980c8b
--- /dev/null
+++ b/chart2/source/controller/inc/HelpIds.hrc
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_HELPIDS_HRC
+#define CHART_HELPIDS_HRC
+
+#define HID_SCH_ALIGNMENT "CHART2_HID_SCH_ALIGNMENT"
+#define HID_SCH_LEGEND_POS "CHART2_HID_SCH_LEGEND_POS"
+#define HID_SCH_DATA_DESCR "CHART2_HID_SCH_DATA_DESCR"
+
+#define HID_SCH_STAT "CHART2_HID_SCH_STAT"
+#define HID_SCH_WIN_DOCUMENT "CHART2_HID_SCH_WIN_DOCUMENT"
+#define HID_SCH_CTL_DATA "CHART2_HID_SCH_CTL_DATA"
+
+#define HID_SCH_CT_INDICATE "CHART2_HID_SCH_CT_INDICATE"
+
+//for chart type dialog:
+#define HID_SCH_CTL_TYPE "CHART2_HID_SCH_CTL_TYPE"
+#define HID_SCH_CTL_VARIANT "CHART2_HID_SCH_CTL_VARIANT"
+#define HID_SCH_NUM_OF_LINES "CHART2_HID_SCH_NUM_OF_LINES"
+#define HID_SCH_SERIES_LIST "CHART2_HID_SCH_SERIES_LIST"
+#define HID_SCH_DATA_RANGES_LIST "CHART2_HID_SCH_DATA_RANGES_LIST"
+//
+
+#define HID_SCH_TBI_DATA_INSERT_ROW "CHART2_HID_SCH_TBI_DATA_INSERT_ROW"
+#define HID_SCH_TBI_DATA_INSERT_COL "CHART2_HID_SCH_TBI_DATA_INSERT_COL"
+#define HID_SCH_TBI_DATA_DELETE_ROW "CHART2_HID_SCH_TBI_DATA_DELETE_ROW"
+#define HID_SCH_TBI_DATA_DELETE_COL "CHART2_HID_SCH_TBI_DATA_DELETE_COL"
+#define HID_SCH_TBI_DATA_SWAP_COL "CHART2_HID_SCH_TBI_DATA_SWAP_COL"
+#define HID_SCH_TBI_DATA_SWAP_ROW "CHART2_HID_SCH_TBI_DATA_SWAP_ROW"
+#define HID_SCH_TBI_DATA_INSERT_TEXT_COL "CHART2_HID_SCH_TBI_DATA_INSERT_TEXT_COL"
+#define HID_SCH_TBX_DATA "CHART2_HID_SCH_TBX_DATA"
+
+#define HID_SCH_ALIGNMENT_CTR_DIAL "CHART2_HID_SCH_ALIGNMENT_CTR_DIAL"
+#define HID_SCH_ALIGNMENT_STACKED "CHART2_HID_SCH_ALIGNMENT_STACKED"
+#define HID_SCH_ALIGNMENT_DEGREES "CHART2_HID_SCH_ALIGNMENT_DEGREES"
+
+#define HID_SCH_TP_AXIS_LABEL "CHART2_HID_SCH_TP_AXIS_LABEL"
+
+#define HID_SCH_CHART_AUTO_FORMAT "CHART2_HID_SCH_CHART_AUTO_FORMAT"
+#define HID_SCH_LB_BAR_GEOMETRY "CHART2_HID_SCH_LB_BAR_GEOMETRY"
+#define HID_SCH_DLG_SPLINE_PROPERTIES "CHART2_HID_SCH_DLG_SPLINE_PROPERTIES"
+#define HID_SCH_DLG_RANGES "CHART2_HID_SCH_DLG_RANGES"
+
+#define HID_SCH_CB_XAXIS "CHART2_HID_SCH_CB_XAXIS"
+#define HID_SCH_CB_YAXIS "CHART2_HID_SCH_CB_YAXIS"
+#define HID_SCH_CB_ZAXIS "CHART2_HID_SCH_CB_ZAXIS"
+#define HID_SCH_CB_SECONDARY_XAXIS "CHART2_HID_SCH_CB_SECONDARY_XAXIS"
+#define HID_SCH_CB_SECONDARY_YAXIS "CHART2_HID_SCH_CB_SECONDARY_YAXIS"
+#define HID_SCH_CB_SECONDARY_ZAXIS "CHART2_HID_SCH_CB_SECONDARY_ZAXIS"
+
+#define HID_SCH_CB_XGRID "CHART2_HID_SCH_CB_XGRID"
+#define HID_SCH_CB_YGRID "CHART2_HID_SCH_CB_YGRID"
+#define HID_SCH_CB_ZGRID "CHART2_HID_SCH_CB_ZGRID"
+#define HID_SCH_CB_SECONDARY_XGRID "CHART2_HID_SCH_CB_SECONDARY_XGRID"
+#define HID_SCH_CB_SECONDARY_YGRID "CHART2_HID_SCH_CB_SECONDARY_YGRID"
+#define HID_SCH_CB_SECONDARY_ZGRID "CHART2_HID_SCH_CB_SECONDARY_ZGRID"
+
+#define HID_SCH_LEGEND_POS_LEFT "CHART2_HID_SCH_LEGEND_POS_LEFT"
+#define HID_SCH_LEGEND_POS_TOP "CHART2_HID_SCH_LEGEND_POS_TOP"
+#define HID_SCH_LEGEND_POS_RIGHT "CHART2_HID_SCH_LEGEND_POS_RIGHT"
+#define HID_SCH_LEGEND_POS_BOTTOM "CHART2_HID_SCH_LEGEND_POS_BOTTOM"
+
+#define HID_SCH_STATISTIK_MEANVALUE "CHART2_HID_SCH_STATISTIK_MEANVALUE"
+#define HID_SCH_STATISTIK_NO_ERROR "CHART2_HID_SCH_STATISTIK_NO_ERROR"
+#define HID_SCH_STATISTIK_VARIANT "CHART2_HID_SCH_STATISTIK_VARIANT"
+#define HID_SCH_STATISTIK_SIGMA "CHART2_HID_SCH_STATISTIK_SIGMA"
+#define HID_SCH_STATISTIK_PERCENT "CHART2_HID_SCH_STATISTIK_PERCENT"
+#define HID_SCH_STATISTIK_BIGERROR "CHART2_HID_SCH_STATISTIK_BIGERROR"
+#define HID_SCH_STATISTIK_CONSTERROR "CHART2_HID_SCH_STATISTIK_CONSTERROR"
+#define HID_SCH_STATISTIK_PERCENT_VALUE "CHART2_HID_SCH_STATISTIK_PERCENT_VALUE"
+#define HID_SCH_STATISTIK_BIGERROR_VALUE "CHART2_HID_SCH_STATISTIK_BIGERROR_VALUE"
+#define HID_SCH_STATISTIK_PLUS_VALUE "CHART2_HID_SCH_STATISTIK_PLUS_VALUE"
+#define HID_SCH_STATISTIK_MINUS_VALUE "CHART2_HID_SCH_STATISTIK_MINUS_VALUE"
+
+#define HID_SCH_DATALABEL_VALUE "CHART2_HID_SCH_DATALABEL_VALUE"
+#define HID_SCH_DATALABEL_NUMBER "CHART2_HID_SCH_DATALABEL_NUMBER"
+#define HID_SCH_DATALABEL_PERCENT "CHART2_HID_SCH_DATALABEL_PERCENT"
+#define HID_SCH_DATALABEL_TEXT "CHART2_HID_SCH_DATALABEL_TEXT"
+#define HID_SCH_DATALABEL_SYMBOL "CHART2_HID_SCH_DATALABEL_SYMBOL"
+#define HID_SCH_PB_NUMBERFORMAT "CHART2_HID_SCH_PB_NUMBERFORMAT"
+#define HID_SCH_PB_PERCENT_NUMBERFORMAT "CHART2_HID_SCH_PB_PERCENT_NUMBERFORMAT"
+#define HID_SCH_DATALABEL_SEPARATOR "CHART2_HID_SCH_DATALABEL_SEPARATOR"
+#define HID_SCH_DATALABEL_PLACEMENT "CHART2_HID_SCH_DATALABEL_PLACEMENT"
+#define HID_SCH_TEXTDIRECTION "CHART2_HID_SCH_TEXTDIRECTION"
+#define HID_SCH_TEXTDIRECTION_TITLE "CHART2_HID_SCH_TEXTDIRECTION_TITLE"
+#define HID_SCH_TEXTDIRECTION_EQUATION "CHART2_HID_SCH_TEXTDIRECTION_EQUATION"
+#define HID_SCH_DATALABEL_ROTATION_KNOB "CHART2_HID_SCH_DATALABEL_ROTATION_KNOB"
+#define HID_SCH_DATALABEL_ROTATION_EDIT "CHART2_HID_SCH_DATALABEL_ROTATION_EDIT"
+
+#define HID_SCH_TITLE_MAIN "CHART2_HID_SCH_TITLE_MAIN"
+#define HID_SCH_TITLE_SUB "CHART2_HID_SCH_TITLE_SUB"
+#define HID_SCH_TITLE_X "CHART2_HID_SCH_TITLE_X"
+#define HID_SCH_TITLE_Y "CHART2_HID_SCH_TITLE_Y"
+#define HID_SCH_TITLE_Z "CHART2_HID_SCH_TITLE_Z"
+#define HID_SCH_TITLE_SECONDARY_X "CHART2_HID_SCH_TITLE_SECONDARY_X"
+#define HID_SCH_TITLE_SECONDARY_Y "CHART2_HID_SCH_TITLE_SECONDARY_Y"
+
+#define HID_SCH_WIZARD_ROADMAP "CHART2_HID_SCH_WIZARD_ROADMAP"
+#define HID_SCH_LEGEND_SHOW "CHART2_HID_SCH_LEGEND_SHOW"
+#define HID_SCH_DATA_SERIES_LABEL "CHART2_HID_SCH_DATA_SERIES_LABEL"
+
+#define HID_SCH_STARTING_ANGLE_DIAL "CHART2_HID_SCH_STARTING_ANGLE_DIAL"
+
+#define HID_SCH_TRENDLINE_RB_NONE "CHART2_HID_SCH_TRENDLINE_RB_NONE"
+#define HID_SCH_TRENDLINE_RB_LINEAR "CHART2_HID_SCH_TRENDLINE_RB_LINEAR"
+#define HID_SCH_TRENDLINE_RB_LOGARITHMIC "CHART2_HID_SCH_TRENDLINE_RB_LOGARITHMIC"
+#define HID_SCH_TRENDLINE_RB_EXPONENTIAL "CHART2_HID_SCH_TRENDLINE_RB_EXPONENTIAL"
+#define HID_SCH_TRENDLINE_RB_POWER "CHART2_HID_SCH_TRENDLINE_RB_POWER"
+#define HID_SCH_TRENDLINE_SHOW_EQUATION "CHART2_HID_SCH_TRENDLINE_SHOW_EQUATION"
+#define HID_SCH_TRENDLINE_SHOW_R_SQUARED "CHART2_HID_SCH_TRENDLINE_SHOW_R_SQUARED"
+
+#define HID_SCH_STATISTIK_FUNCTION "CHART2_HID_SCH_STATISTIK_FUNCTION"
+#define HID_SCH_STATISTIK_RANGE "CHART2_HID_SCH_STATISTIK_RANGE"
+#define HID_SCH_STATISTIK_FUNCTION_LB "CHART2_HID_SCH_STATISTIK_FUNCTION_LB"
+#define HID_SCH_STATISTIK_POSITIVE_VALUE "CHART2_HID_SCH_STATISTIK_POSITIVE_VALUE"
+#define HID_SCH_STATISTIK_POSITIVE_RANGE "CHART2_HID_SCH_STATISTIK_POSITIVE_RANGE"
+#define HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER "CHART2_HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER"
+#define HID_SCH_STATISTIK_NEGATIVE_VALUE "CHART2_HID_SCH_STATISTIK_NEGATIVE_VALUE"
+#define HID_SCH_STATISTIK_NEGATIVE_RANGE "CHART2_HID_SCH_STATISTIK_NEGATIVE_RANGE"
+#define HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER "CHART2_HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER"
+#define HID_SCH_STATISTIK_SAME_FOR_BOTH "CHART2_HID_SCH_STATISTIK_SAME_FOR_BOTH"
+#define HID_SCH_STATISTIK_SHOW_BOTH "CHART2_HID_SCH_STATISTIK_SHOW_BOTH"
+#define HID_SCH_STATISTIK_SHOW_POSITIVE "CHART2_HID_SCH_STATISTIK_SHOW_POSITIVE"
+#define HID_SCH_STATISTIK_SHOW_NEGATIVE "CHART2_HID_SCH_STATISTIK_SHOW_NEGATIVE"
+
+#define HID_INSERT_GRIDS "CHART2_HID_INSERT_GRIDS"
+
+#define HID_DIAGRAM_TYPE "CHART2_HID_DIAGRAM_TYPE"
+#define HID_3D_VIEW "CHART2_HID_3D_VIEW"
+#define HID_DIAGRAM_DATA "CHART2_HID_DIAGRAM_DATA"
+#define HID_INSERT_AXIS "CHART2_HID_INSERT_AXIS"
+#define HID_INSERT_STATISTICS "CHART2_HID_INSERT_STATISTICS"
+#define HID_INSERT_TITLE "CHART2_HID_INSERT_TITLE"
+#define HID_INSERT_CHART_LEGEND "CHART2_HID_INSERT_CHART_LEGEND"
+#define HID_INSERT_DESCRIPTION "CHART2_HID_INSERT_DESCRIPTION"
+
+
+#endif
diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx
new file mode 100644
index 000000000000..2f52e45f070c
--- /dev/null
+++ b/chart2/source/controller/inc/ItemConverter.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_ITEMCONVERTER_HXX
+#define CHART_ITEMCONVERTER_HXX
+
+#include <unotools/eventlisteneradapter.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+// for pair
+#include <utility>
+
+namespace comphelper
+{
+
+/** This class serves for conversion between properties of an XPropertySet and
+ SfxItems in SfxItemSets.
+
+ With this helper classes, you can feed dialogs with XPropertySets and let
+ those modify by the dialogs.
+
+ You must implement GetWhichPairs() such that an SfxItemSet created with
+ CreateEmptyItemSet() is able to hold all items that may be mapped.
+
+ You also have to implement GetItemProperty(), in order to return the
+ property name for a given which-id together with the corresponding member-id
+ that has to be used for conversion in QueryValue/PutValue.
+
+ FillSpecialItem and ApplySpecialItem may be used for special handling of
+ individual item, e.g. if you need member-ids in QueryValue/PutValue
+
+ A typical use could be the following:
+
+ ::comphelper::ChartTypeItemConverter aItemConverter( xPropertySet, GetItemPool() );
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+ bool bChanged = false;
+
+ MyDialog aDlg( aItemSet );
+ if( aDlg.Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ if( pOutItemSet )
+ bChanged = aItemConverter.ApplyItemSet( *pOutItemSet );
+ }
+
+ if( bChanged )
+ {
+ [ apply model changes to view ]
+ }
+ */
+class ItemConverter :
+ public ::utl::OEventListenerAdapter
+{
+public:
+ /** Construct an item converter that uses the given property set for
+ reading/writing converted items
+ */
+ ItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet ,
+ SfxItemPool& rItemPool );
+ virtual ~ItemConverter();
+
+ // typedefs -------------------------------
+
+ typedef USHORT tWhichIdType;
+ typedef ::rtl::OUString tPropertyNameType;
+ typedef BYTE tMemberIdType;
+
+ typedef ::std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId;
+
+ // ----------------------------------------
+
+ /** applies all properties that can be mapped to items into the given item
+ set.
+
+ Call this method before opening a dialog.
+
+ @param rOutItemSet
+ the SfxItemSet is filled with all items that are a result of a
+ conversion from a property of the internal XPropertySet.
+ */
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+
+ /** applies all properties that are results of a conversion from all items
+ in rItemSet to the internal XPropertySet.
+
+ Call this method after a dialog was closed with OK
+
+ @return true, if any properties have been changed, false otherwise.
+ */
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+ /** creates an empty item set using the given pool or a common pool if empty
+ (see GetItemPool) and allowing all items given in the ranges returned by
+ GetWhichPairs.
+ */
+ SfxItemSet CreateEmptyItemSet() const;
+
+ /** Invalidates all items in rDestSet, that are set (state SFX_ITEM_SET) in
+ both item sets (rDestSet and rSourceSet) and have differing content.
+ */
+ static void InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet );
+
+protected:
+ // ________
+
+ /** implement this method to provide an array of which-ranges of the form:
+
+ const USHORT aMyPairs[] =
+ {
+ from_1, to_1,
+ from_2, to_2,
+ ...
+ from_n, to_n,
+ 0
+ };
+ */
+ virtual const USHORT * GetWhichPairs() const = 0;
+
+ /** implement this method to return a Property object for a given which id.
+
+ @param rOutProperty
+ If true is returned, this contains the property name and the
+ corresponding Member-Id.
+
+ @return true, if the item can be mapped to a property.
+ */
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const = 0;
+
+ /** for items that can not be mapped directly to a property.
+
+ This method is called from FillItemSet(), if GetItemProperty() returns
+ false.
+
+ The default implementation does nothing except showing an assertion
+ */
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+
+ /** for items that can not be mapped directly to a property.
+
+ This method is called from ApplyItemSet(), if GetItemProperty() returns
+ false.
+
+ The default implementation returns just false and shows an assertion
+
+ @return true if the item changed a property, false otherwise.
+ */
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+ // ________
+
+ /// Returns the pool
+ SfxItemPool & GetItemPool() const;
+
+ /** Returns the XPropertySet that was given in the CTOR and is used to apply
+ items in ApplyItemSet().
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetPropertySet() const;
+
+ // ____ ::utl::OEventListenerAdapter ____
+ virtual void _disposing( const ::com::sun::star::lang::EventObject& rSource );
+
+protected:
+ /** sets a new property set, that you get with GetPropertySet(). It should
+ not be necessary to use this method. It is introduced to allow changing
+ the regression type of a regression curve which changes the object
+ identity.
+ */
+ void resetPropertySet( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xPropSet );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xPropertySet;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > m_xPropertySetInfo;
+
+ SfxItemPool& m_rItemPool;
+ bool m_bIsValid;
+};
+
+} // namespace comphelper
+
+// CHART_ITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/ItemPropertyMap.hxx b/chart2/source/controller/inc/ItemPropertyMap.hxx
new file mode 100644
index 000000000000..809df66156e2
--- /dev/null
+++ b/chart2/source/controller/inc/ItemPropertyMap.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_ITEMPROPERTYMAP_HXX
+#define CHART_ITEMPROPERTYMAP_HXX
+
+
+#include <comphelper/InlineContainer.hxx>
+#include "ItemConverter.hxx"
+
+
+#define IPM_MAP_ENTRY(wid,uno,mid) (wid, ::std::make_pair< ::comphelper::ItemConverter::tPropertyNameType, ::comphelper::ItemConverter::tMemberIdType >(\
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(uno)), mid))
+
+namespace comphelper
+{
+
+typedef ::std::map< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > >
+ ItemPropertyMapType;
+typedef ::comphelper::MakeMap< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > >
+ MakeItemPropertyMap;
+
+class FillItemSetFunc : public ::std::unary_function< ItemConverter *, void >
+{
+public:
+ explicit FillItemSetFunc( SfxItemSet & rOutItemSet ) :
+ m_rOutItemSet( rOutItemSet )
+ {}
+
+ void operator() ( ItemConverter * pConv )
+ {
+ pConv->FillItemSet( m_rOutItemSet );
+ }
+
+private:
+ SfxItemSet & m_rOutItemSet;
+};
+
+class ApplyItemSetFunc : public ::std::unary_function< ItemConverter *, void >
+{
+public:
+ explicit ApplyItemSetFunc( const SfxItemSet & rItemSet,
+ bool & rOutResult ) :
+ m_rItemSet( rItemSet ),
+ m_rOutResult( rOutResult )
+ {}
+
+ void operator() ( ItemConverter * pConv )
+ {
+ m_rOutResult = pConv->ApplyItemSet( m_rItemSet ) || m_rOutResult;
+ }
+
+private:
+ const SfxItemSet & m_rItemSet;
+ bool & m_rOutResult;
+};
+
+struct DeleteItemConverterPtr : public ::std::unary_function< ItemConverter *, void >
+{
+ void operator() ( ItemConverter * pConv )
+ { delete pConv; }
+};
+
+} // namespace comphelper
+
+// CHART_ITEMPROPERTYMAP_HXX
+#endif
diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx
new file mode 100644
index 000000000000..b1b0bcdeea75
--- /dev/null
+++ b/chart2/source/controller/inc/LegendItemConverter.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LEGENDITEMCONVERTER_HXX
+#define CHART_LEGENDITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vector>
+#include <memory>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class LegendItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ LegendItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~LegendItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::std::vector< ItemConverter * > m_aConverters;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_LEGENDITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/MenuResIds.hrc b/chart2/source/controller/inc/MenuResIds.hrc
new file mode 100644
index 000000000000..38a09ad35ded
--- /dev/null
+++ b/chart2/source/controller/inc/MenuResIds.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_MENURESIDS_HRC
+#define CHART_MENURESIDS_HRC
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+//-----------------------------------------------------------------------------
+// context menus
+
+#define RID_CONTEXTMENU_SHAPE (RID_APP_START + 1)
+#define RID_CONTEXTMENU_SHAPEEDIT (RID_APP_START + 2)
+
+// CHART_MENURESIDS_HRC
+#endif
diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx
new file mode 100644
index 000000000000..9b0555ec82e1
--- /dev/null
+++ b/chart2/source/controller/inc/MultipleChartConverters.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_MULTIPLECHARTCONVERTERS_HXX
+#define CHART2_MULTIPLECHARTCONVERTERS_HXX
+
+#include "MultipleItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <memory>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class AllAxisItemConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ AllAxisItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~AllAxisItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+class AllGridItemConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ AllGridItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory );
+ virtual ~AllGridItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+class AllDataLabelItemConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ AllDataLabelItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~AllDataLabelItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+class AllTitleItemConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ AllTitleItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~AllTitleItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+class AllSeriesStatisticsConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ AllSeriesStatisticsConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool );
+ virtual ~AllSeriesStatisticsConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART2_MULTIPLECHARTCONVERTERS_HXX
+#endif
diff --git a/chart2/source/controller/inc/MultipleItemConverter.hxx b/chart2/source/controller/inc/MultipleItemConverter.hxx
new file mode 100644
index 000000000000..32c48ca8e7db
--- /dev/null
+++ b/chart2/source/controller/inc/MultipleItemConverter.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_ALLAXISITEMCONVERTER_HXX
+#define CHART_ALLAXISITEMCONVERTER_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include "ItemConverter.hxx"
+
+#include <vector>
+
+namespace comphelper
+{
+
+/** Note: virtual const USHORT * GetWhichPairs() const; is still pure virtual
+ */
+class MultipleItemConverter : public ItemConverter
+{
+public:
+ virtual ~MultipleItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+ /// implemented empty (returns always false)
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+protected:
+ MultipleItemConverter( SfxItemPool& rItemPool );
+
+ ::std::vector< ItemConverter * > m_aConverters;
+};
+
+} // namespace comphelper
+
+#endif
diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx
new file mode 100644
index 000000000000..857b576fe6ef
--- /dev/null
+++ b/chart2/source/controller/inc/ObjectHierarchy.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_OBJECTHIERARCHY_HXX
+#define CHART2_OBJECTHIERARCHY_HXX
+
+#include "ObjectIdentifier.hxx"
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+
+#include <memory>
+#include <vector>
+
+namespace chart
+{
+
+class ExplicitValueProvider;
+
+namespace impl
+{
+class ImplObjectHierarchy;
+}
+
+class ObjectHierarchy
+{
+public:
+ typedef ObjectIdentifier tOID;
+ typedef ::std::vector< tOID > tChildContainer;
+
+ /** @param bFlattenDiagram
+ If <TRUE/>, the content of the diaram (data series, wall, floor,
+ etc.) is treated as being at the same level as the diagram. (This is
+ used for keyboard navigation).
+ */
+ explicit ObjectHierarchy(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ ExplicitValueProvider * pExplicitValueProvider = 0,
+ bool bFlattenDiagram = false,
+ bool bOrderingForElementSelector = false );
+ ~ObjectHierarchy();
+
+ static tOID getRootNodeOID();
+ static bool isRootNode( const tOID& rOID );
+
+ /// equal to getChildren( getRootNodeOID())
+ tChildContainer getTopLevelChildren() const;
+ bool hasChildren( const tOID& rParent ) const;
+ tChildContainer getChildren( const tOID& rParent ) const;
+
+ tChildContainer getSiblings( const tOID& rNode ) const;
+
+ /// The result is empty, if the node cannot be found in the tree
+ tOID getParent( const tOID& rNode ) const;
+ /// @returns -1, if no parent can be determined
+ sal_Int32 getIndexInParent( const tOID& rNode ) const;
+
+private:
+
+ ::std::auto_ptr< impl::ImplObjectHierarchy > m_apImpl;
+};
+
+class ObjectKeyNavigation
+{
+public:
+ explicit ObjectKeyNavigation( const ObjectHierarchy::tOID & rCurrentOID,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ ExplicitValueProvider * pExplicitValueProvider = 0 );
+
+ bool handleKeyEvent( const ::com::sun::star::awt::KeyEvent & rEvent );
+ ObjectHierarchy::tOID getCurrentSelection() const;
+
+private:
+ void setCurrentSelection( const ObjectHierarchy::tOID& rOID );
+ bool first();
+ bool last();
+ bool next();
+ bool previous();
+ bool up();
+ bool down();
+ bool veryFirst();
+ bool veryLast();
+
+ ObjectHierarchy::tOID m_aCurrentOID;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+ ExplicitValueProvider * m_pExplicitValueProvider;
+ bool m_bStepDownInDiagram;
+};
+
+} // namespace chart
+
+// CHART2_OBJECTHIERARCHY_HXX
+#endif
diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx
new file mode 100644
index 000000000000..02ecc8f229c8
--- /dev/null
+++ b/chart2/source/controller/inc/ObjectNameProvider.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_OBJECTNAME_PROVIDER_HXX
+#define _CHART2_OBJECTNAME_PROVIDER_HXX
+
+#include "ObjectIdentifier.hxx"
+#include "TitleHelper.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/** Provides localized ui strings for the userinterface.
+*/
+
+class ObjectNameProvider
+{
+public:
+ static rtl::OUString getName( ObjectType eObjectType, bool bPlural=false );
+ static rtl::OUString getAxisName( const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ static rtl::OUString getGridName( const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ static rtl::OUString getTitleName( const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ static rtl::OUString getTitleNameByType( TitleHelper::eTitleType eType );
+
+ static rtl::OUString getNameForCID(
+ const rtl::OUString& rObjectCID,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+
+ static rtl::OUString getName_ObjectForSeries(
+ ObjectType eObjectType,
+ const rtl::OUString& rSeriesCID,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+ static rtl::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 rtl::OUString getHelpText( const rtl::OUString& rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, bool bVerbose=false );
+ static rtl::OUString getHelpText( const rtl::OUString& rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument, bool bVerbose=false );
+
+ /** This is used for showing the currently selected object in the status bar
+ (command "Context")
+ */
+ static rtl::OUString getSelectedObjectText( const rtl::OUString & rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/PositionAndSizeHelper.hxx b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
new file mode 100644
index 000000000000..312c92997055
--- /dev/null
+++ b/chart2/source/controller/inc/PositionAndSizeHelper.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_POSITIONANDSIZEHELPER_HXX
+#define _CHART2_POSITIONANDSIZEHELPER_HXX
+
+#include "ObjectIdentifier.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class PositionAndSizeHelper
+{
+public:
+ static bool moveObject( ObjectType eObjectType
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xObjectProp
+ , const ::com::sun::star::awt::Rectangle& rNewPositionAndSize
+ , const ::com::sun::star::awt::Rectangle& rPageRectangle );
+
+ static bool moveObject( const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::awt::Rectangle& rNewPositionAndSize
+ , const ::com::sun::star::awt::Rectangle& rPageRectangle );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/RangeEdit.hxx b/chart2/source/controller/inc/RangeEdit.hxx
new file mode 100755
index 000000000000..cacba52decb5
--- /dev/null
+++ b/chart2/source/controller/inc/RangeEdit.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+#ifndef CHART2RANGEEDIT_HXX
+#define CHART2RANGEEDIT_HXX
+
+#include <vcl/edit.hxx>
+#include <vcl/accel.hxx>
+#include <tools/link.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class RangeEdit : public Edit
+{
+public:
+ explicit RangeEdit( Window* pParent, const ResId& rResId);
+ virtual ~RangeEdit();
+
+ // KeyInput method
+ void SetKeyInputHdl( const Link& rKeyInputLink );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+private:
+ Link m_aKeyInputLink;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/RangeSelectionButton.hxx b/chart2/source/controller/inc/RangeSelectionButton.hxx
new file mode 100644
index 000000000000..4aedf9012489
--- /dev/null
+++ b/chart2/source/controller/inc/RangeSelectionButton.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_RANGESELECTIONBUTTON_HXX
+#define _CHART2_RANGESELECTIONBUTTON_HXX
+
+// header for Class ImageButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class RangeSelectionButton : public ImageButton
+{
+public:
+ RangeSelectionButton( Window* pParent, const ResId& rResId );
+ virtual ~RangeSelectionButton();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/controller/inc/RangeSelectionHelper.hxx
new file mode 100755
index 000000000000..cb9e067bd8e2
--- /dev/null
+++ b/chart2/source/controller/inc/RangeSelectionHelper.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RANGESELECTIONHELPER_HXX
+#define CHART2_RANGESELECTIONHELPER_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace sheet{
+ class XRangeSelection;
+ class XRangeSelectionListener;
+ class XCellRangesAccess;
+ }
+}}}
+
+namespace chart
+{
+
+class RangeSelectionListenerParent;
+
+class RangeSelectionHelper
+{
+public:
+ explicit RangeSelectionHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument );
+ ~RangeSelectionHelper();
+
+ bool hasRangeSelection();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::sheet::XRangeSelection > getRangeSelection();
+ void raiseRangeSelectionDocument();
+ bool chooseRange(
+ const ::rtl::OUString & aCurrentRange,
+ const ::rtl::OUString & aUIString,
+ RangeSelectionListenerParent & rListenerParent );
+ void stopRangeListening( bool bRemoveListener = true );
+ bool verifyCellRange( const ::rtl::OUString & rRangeStr );
+ bool verifyArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::sheet::XRangeSelection >
+ m_xRangeSelection;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >
+ m_xChartDocument;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::sheet::XCellRangesAccess >
+ m_xCellRangesAccess;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::sheet::XRangeSelectionListener >
+ m_xRangeSelectionListener;
+};
+
+} // namespace chart
+
+// CHART2_RANGESELECTIONHELPER_HXX
+#endif
diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx
new file mode 100644
index 000000000000..3e470c0116f0
--- /dev/null
+++ b/chart2/source/controller/inc/RangeSelectionListener.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RANGESELECTIONLISTENER_HXX
+#define CHART2_RANGESELECTIONLISTENER_HXX
+
+#include "ControllerLockGuard.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sheet/XRangeSelectionListener.hpp>
+
+namespace chart
+{
+
+class RangeSelectionListenerParent
+{
+public:
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange ) = 0;
+ virtual void disposingRangeSelection() = 0;
+};
+
+// ----------------------------------------
+
+class RangeSelectionListener : public
+ ::cppu::WeakImplHelper1<
+ ::com::sun::star::sheet::XRangeSelectionListener >
+{
+public:
+ explicit RangeSelectionListener(
+ RangeSelectionListenerParent & rParent,
+ const ::rtl::OUString & rInitialRange,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModelToLockController );
+ virtual ~RangeSelectionListener();
+
+protected:
+ // ____ XRangeSelectionListener ____
+ virtual void SAL_CALL done( const ::com::sun::star::sheet::RangeSelectionEvent& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL aborted( const ::com::sun::star::sheet::RangeSelectionEvent& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener ____
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ RangeSelectionListenerParent & m_rParent;
+ ::rtl::OUString m_aRange;
+ ControllerLockGuard m_aControllerLockGuard;
+};
+
+} // namespace chart
+
+// CHART2_RANGESELECTIONLISTENER_HXX
+#endif
diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
new file mode 100644
index 000000000000..ab2d29cb5e0d
--- /dev/null
+++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_REGRESSIONCURVE_ITEMCONVERTER_HXX
+#define CHART_REGRESSIONCURVE_ITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class RegressionCurveItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ RegressionCurveItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCurveCnt,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory );
+ virtual ~RegressionCurveItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::boost::shared_ptr< ItemConverter > m_spGraphicConverter;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > m_xCurveContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_REGRESSIONCURVE_ITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
new file mode 100644
index 000000000000..5fe5313c8d4a
--- /dev/null
+++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_REGRESSIONEQUATION_ITEMCONVERTER_HXX
+#define CHART_REGRESSIONEQUATION_ITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class RegressionEquationItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ RegressionEquationItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+ virtual ~RegressionEquationItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::std::vector< ItemConverter * > m_aConverters;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_REGRESSIONEQUATION_ITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/SchSlotIds.hxx b/chart2/source/controller/inc/SchSlotIds.hxx
new file mode 100644
index 000000000000..601e64100bbf
--- /dev/null
+++ b/chart2/source/controller/inc/SchSlotIds.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SCH_SLOTIDS_HXX
+#define SCH_SLOTIDS_HXX
+
+// header for SID_OBJ1_START
+#include <sfx2/sfxsids.hrc>
+
+// SID_OBJ1_START == 30000 + 512
+//not used as slot in old chart
+//#define SID_COPYFORMAT SID_OBJ1_START
+//not used as slot in old chart
+//#define SID_PASTEFORMAT (SID_OBJ1_START + 1)
+
+//still used as help id
+#define SID_DIAGRAM_DATA (SID_OBJ1_START + 2)
+//only used as help id
+#define SID_INSERT_TITLE (SID_OBJ1_START + 3)
+//only used as help id
+#define SID_INSERT_CHART_LEGEND (SID_OBJ1_START + 4)
+//only used as help id
+#define SID_INSERT_DESCRIPTION (SID_OBJ1_START + 5)
+//only used as help id
+#define SID_INSERT_AXIS (SID_OBJ1_START + 6)
+//some how used as slot in old chart
+//#define SID_DATA_ROW_POINT (SID_OBJ1_START + 7)
+//menu parent id and helpid
+//MENUCHANGE FORMATMENU #define SID_CHART_TITLE (SID_OBJ1_START + 8)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_LEGEND (SID_OBJ1_START + 9)
+//menu parent id and helpid
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS (SID_OBJ1_START + 10)
+//menu parent id and helpid
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID (SID_OBJ1_START + 11)
+
+/*
+//MENUCHANGE
+//still used as slot id
+#define SID_DIAGRAM_WALL (SID_OBJ1_START + 12)
+//still used as slot id
+#define SID_DIAGRAM_FLOOR (SID_OBJ1_START + 13)
+//still used as slot id
+#define SID_DIAGRAM_AREA (SID_OBJ1_START + 14)
+*/
+
+//only used as help id
+#define SID_3D_VIEW (SID_OBJ1_START + 15)
+//still used as slot id
+#define SID_DIAGRAM_TYPE (SID_OBJ1_START + 16)
+//used as slot in old chart
+//#define SID_TOGGLE_TITLE (SID_OBJ1_START + 17)
+//used as slot in old chart
+//#define SID_TOGGLE_LEGEND (SID_OBJ1_START + 18)
+//used as slot in old chart
+//#define SID_TOGGLE_AXIS_TITLE (SID_OBJ1_START + 19)
+//used as slot in old chart
+//#define SID_TOGGLE_AXIS_DESCR (SID_OBJ1_START + 20) // 30532
+//used as slot in old chart
+//#define SID_TOGGLE_GRID_HORZ (SID_OBJ1_START + 21)
+//used as slot in old chart
+//#define SID_TOGGLE_GRID_VERT (SID_OBJ1_START + 22)
+//used as slot in old chart
+//#define SID_DATA_IN_ROWS (SID_OBJ1_START + 23)
+//used as slot in old chart
+//#define SID_DATA_IN_COLUMNS (SID_OBJ1_START + 24)
+//used as slot in old chart
+//#define SID_TOOL_SELECT (SID_OBJ1_START + 25)
+//some how used as slot in old chart
+//#define SID_CONTEXT_TYPE (SID_OBJ1_START + 26)
+//used as slot in old chart
+//#define SID_NEW_ARRANGEMENT (SID_OBJ1_START + 27) // 30539
+//only used as help id
+#define SID_INSERT_GRIDS (SID_OBJ1_START + 28)
+
+//not used as slot in old chart
+//#define SID_MAINTITLE (SID_OBJ1_START + 29)
+//not used as slot in old chart
+//#define SID_SUBTITLE (SID_OBJ1_START + 30)
+//not used as slot in old chart
+//#define SID_XAXIS_TITLE (SID_OBJ1_START + 31)
+//not used as slot in old chart
+//#define SID_YAXIS_TITLE (SID_OBJ1_START + 32)
+//not used as slot in old chart
+//#define SID_ZAXIS_TITLE (SID_OBJ1_START + 33)
+
+/*
+//used as slot in old chart
+#ifdef SID_UPDATE
+#undef SID_UPDATE
+#endif
+#define SID_UPDATE (SID_OBJ1_START + 34)
+*/
+
+//not used as slot in old chart
+//#define SID_DATA (SID_OBJ1_START + 35)
+//not used as slot in old chart
+//#define SID_ADD_COLUMN (SID_OBJ1_START + 36)
+//not used as slot in old chart
+//#define SID_ADD_ROW (SID_OBJ1_START + 37)
+
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_X (SID_OBJ1_START + 40)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_Y (SID_OBJ1_START + 41)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_Z (SID_OBJ1_START + 42)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_ALL (SID_OBJ1_START + 43)
+//only used as help id
+#define SID_INSERT_STATISTICS (SID_OBJ1_START + 44)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_MAIN (SID_OBJ1_START + 45)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_SUB (SID_OBJ1_START + 46)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_X (SID_OBJ1_START + 47)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_Y (SID_OBJ1_START + 48)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_Z (SID_OBJ1_START + 49)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_TITLE_ALL (SID_OBJ1_START + 50)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_Y_MAIN (SID_OBJ1_START + 51)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_X_MAIN (SID_OBJ1_START + 52)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_Z_MAIN (SID_OBJ1_START + 53)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_ALL (SID_OBJ1_START + 54)
+
+//used as slot in old chart
+//#define SID_HAS_X_DESCR (SID_OBJ1_START + 55)
+//used as slot in old chart
+//#define SID_HAS_Y_DESCR (SID_OBJ1_START + 56)
+//used as slot in old chart
+//#define SID_HAS_Z_DESCR (SID_OBJ1_START + 57)
+
+//#define SID_DIAGRAM_OBJECTS (SID_OBJ1_START + 60)
+
+//not used as slot in old chart
+//#define SID_HAS_X_TITLE (SID_OBJ1_START + 61)
+//not used as slot in old chart
+//#define SID_HAS_Y_TITLE (SID_OBJ1_START + 62)
+//not used as slot in old chart
+//#define SID_HAS_Z_TITLE (SID_OBJ1_START + 63)
+//not used as slot in old chart
+//#define SID_HAS_MAIN_TITLE (SID_OBJ1_START + 64)
+//not used as slot in old chart
+//#define SID_HAS_SUB_TITLE (SID_OBJ1_START + 65)
+
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_Y_HELP (SID_OBJ1_START + 66)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_X_HELP (SID_OBJ1_START + 67)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_GRID_Z_HELP (SID_OBJ1_START + 68)
+
+//not used as slot in old chart
+//#define SID_DIAGRAM_DATA_WIN (SID_OBJ1_START + 70)
+
+//used as slot in old chart
+//#define SID_DIAGRAM_ERROR (SID_OBJ1_START + 71)
+//used as slot in old chart
+//#define SID_DIAGRAM_AVERAGEVALUE (SID_OBJ1_START + 72)
+//used as slot in old chart
+//#define SID_DIAGRAM_REGRESSION (SID_OBJ1_START + 73)
+//used as slot in old chart
+//#define SID_SCALE_TEXT (SID_OBJ1_START + 74)
+//not used as slot in old chart
+//#define SID_TEXTBREAK (SID_OBJ1_START + 75)
+
+//not used as slot in old chart
+//#define SID_DIAGRAM_DATADESCRIPTION (SID_OBJ1_START + 76)
+//not used as slot in old chart
+//#define SID_DIAGRAM_POSLEGEND (SID_OBJ1_START + 77)
+//not used as slot in old chart
+//#define SID_DIAGRAM_DEFAULTCOLORS (SID_OBJ1_START + 78)
+//not used as slot in old chart
+//#define SID_DIAGRAM_BARWIDTH (SID_OBJ1_START + 79)
+//not used as slot in old chart
+//#define SID_DIAGRAM_NUMLINES (SID_OBJ1_START + 80)
+
+//menu parent id and helpid
+//#define SID_ROW_POSITION (SID_OBJ1_START + 81)
+//still used as slot id
+//#define SID_ROW_MOREFRONT (SID_OBJ1_START + 82)
+//still used as slot id
+//#define SID_ROW_MOREBACK (SID_OBJ1_START + 83)
+
+//not used as slot in old chart
+//#define SID_TITLE_TEXT (SID_OBJ1_START + 100)
+//somehow used as slot in old chart
+//#define SID_DIAGRAM_STOCK_LINE (SID_OBJ1_START + 101)
+//used as slot in old chart
+//#define SID_DIAGRAM_STOCK_LOSS (SID_OBJ1_START + 102)
+//used as slot in old chart
+//#define SID_DIAGRAM_STOCK_PLUS (SID_OBJ1_START + 103)
+
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_A (SID_OBJ1_START + 104)
+//still used as slot id
+//MENUCHANGE FORMATMENU #define SID_DIAGRAM_AXIS_B (SID_OBJ1_START + 105)
+//used as slot in old chart
+//#define SID_DIAGRAM_AXIS_C (SID_OBJ1_START + 106)
+
+// Reserved till (SID_OBJ1_START + 110)
+
+#endif
+// SCH_SLOTIDS_HXX
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
new file mode 100644
index 000000000000..207a6ab7f0ee
--- /dev/null
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SERIESOPTIONSITEMCONVERTER_HXX
+#define CHART_SERIESOPTIONSITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class SeriesOptionsItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ SeriesOptionsItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool );
+ virtual ~SeriesOptionsItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ bool m_bAttachToMainAxis;
+ bool m_bSupportingOverlapAndGapWidthProperties;
+ bool m_bSupportingBarConnectors;
+
+ sal_Int32 m_nBarOverlap;
+ sal_Int32 m_nGapWidth;
+ sal_Bool m_bConnectBars;
+
+ bool m_bSupportingAxisSideBySide;
+ bool m_bGroupBarsPerAxis;
+ bool m_bAllSeriesAttachedToSameAxis;
+ sal_Int32 m_nAllSeriesAxisIndex;
+
+ bool m_bSupportingStartingAngle;
+ sal_Int32 m_nStartingAngle;
+
+ bool m_bClockwise;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > m_xCooSys;
+
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aSupportedMissingValueTreatments;
+ sal_Int32 m_nMissingValueTreatment;
+
+ bool m_bSupportingPlottingOfHiddenCells;
+ bool m_bIncludeHiddenCells;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_SERIESOPTIONSITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/ShapeController.hrc b/chart2/source/controller/inc/ShapeController.hrc
new file mode 100644
index 000000000000..6c7b43526d22
--- /dev/null
+++ b/chart2/source/controller/inc/ShapeController.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SHAPECONTROLLER_HRC
+#define CHART_SHAPECONTROLLER_HRC
+
+//-----------------------------------------------------------------------------
+//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_ARRANGE_ROW 7
+#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_CUT 12
+#define COMMAND_ID_COPY 13
+#define COMMAND_ID_PASTE 14
+#define COMMAND_ID_FONT_DIALOG 15
+#define COMMAND_ID_PARAGRAPH_DIALOG 16
+
+// CHART_SHAPECONTROLLER_HRC
+#endif
diff --git a/chart2/source/controller/inc/StatisticsItemConverter.hxx b/chart2/source/controller/inc/StatisticsItemConverter.hxx
new file mode 100644
index 000000000000..cb4227185093
--- /dev/null
+++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STATISTICSITEMCONVERTER_HXX
+#define CHART_STATISTICSITEMCONVERTER_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include "ItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+
+#include <vector>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class StatisticsItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ StatisticsItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool );
+ virtual ~StatisticsItemConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_STATISTICSITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx
new file mode 100644
index 000000000000..41e41dbde308
--- /dev/null
+++ b/chart2/source/controller/inc/TabPageNotifiable.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_TABPAGENOTIFIABLE_HXX
+#define CHART2_TABPAGENOTIFIABLE_HXX
+
+#include <vcl/tabpage.hxx>
+#include <tools/color.hxx>
+
+// color to use as foreground for an invalid range
+#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE
+// color to use as background for an invalid range
+#define RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR 0xff6563
+
+namespace chart
+{
+
+class TabPageNotifiable
+{
+public:
+ virtual void setInvalidPage( TabPage * pTabPage ) = 0;
+ virtual void setValidPage( TabPage * pTabPage ) = 0;
+};
+
+} // namespace chart
+
+// CHART2_TABPAGENOTIFIABLE_HXX
+#endif
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx
new file mode 100644
index 000000000000..626724289187
--- /dev/null
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef CHART2_TEXTDIRECTIONLISTBOX_HXX
+#define CHART2_TEXTDIRECTIONLISTBOX_HXX
+
+#include <svx/frmdirlbox.hxx>
+
+class Window;
+
+namespace chart
+{
+
+class TextDirectionListBox : public svx::FrameDirectionListBox
+{
+public:
+ explicit TextDirectionListBox( Window* pParent, const ResId& rResId,
+ Window* pWindow1 = 0, Window* pWindow2 = 0 );
+ virtual ~TextDirectionListBox();
+};
+
+} //namespace chart
+
+#endif
+
diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
new file mode 100644
index 000000000000..768cca0fe8c6
--- /dev/null
+++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TIMERTRIGGEREDCONTROLLERLOCK_HXX
+#define _CHART2_TIMERTRIGGEREDCONTROLLERLOCK_HXX
+
+#include "ControllerLockGuard.hxx"
+#include <vcl/timer.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TimerTriggeredControllerLock
+{
+public:
+ TimerTriggeredControllerLock( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+ virtual ~TimerTriggeredControllerLock();
+
+ void startTimer();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+ std::auto_ptr< ControllerLockGuard > m_apControllerLockGuard;
+ AutoTimer m_aTimer;
+
+ DECL_LINK( TimerTimeout, void* );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/TitleDialogData.hxx b/chart2/source/controller/inc/TitleDialogData.hxx
new file mode 100644
index 000000000000..fadcdad4aab3
--- /dev/null
+++ b/chart2/source/controller/inc/TitleDialogData.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TITLEDIALOGDATA_HXX
+#define _CHART2_TITLEDIALOGDATA_HXX
+
+#include "ReferenceSizeProvider.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct TitleDialogData
+{
+ ::com::sun::star::uno::Sequence< sal_Bool > aPossibilityList;
+ ::com::sun::star::uno::Sequence< sal_Bool > aExistenceList;
+ ::com::sun::star::uno::Sequence< rtl::OUString > aTextList;
+ ::std::auto_ptr< ReferenceSizeProvider > apReferenceSizeProvider;
+
+ TitleDialogData( ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider =
+ ::std::auto_ptr< ReferenceSizeProvider >( 0 ));
+
+ void readFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ /* return true if anything has changed;
+ when pOldState is NULL then all data are written to the model
+ */
+ bool writeDifferenceToModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
+ , TitleDialogData* pOldState=NULL );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx
new file mode 100644
index 000000000000..535e36226a12
--- /dev/null
+++ b/chart2/source/controller/inc/TitleItemConverter.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TITLEITEMCONVERTER_HXX
+#define CHART_TITLEITEMCONVERTER_HXX
+
+#include "ItemConverter.hxx"
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vector>
+#include <memory>
+
+class SdrModel;
+
+namespace chart
+{
+namespace wrapper
+{
+
+class TitleItemConverter :
+ public ::comphelper::ItemConverter
+{
+public:
+ TitleItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
+ ::std::auto_ptr< ::com::sun::star::awt::Size >() );
+
+ virtual ~TitleItemConverter();
+
+ virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
+ virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+ virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
+
+ virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( ::com::sun::star::uno::Exception );
+ virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( ::com::sun::star::uno::Exception );
+
+private:
+ ::std::vector< ItemConverter * > m_aConverters;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_TITLEITEMCONVERTER_HXX
+#endif
diff --git a/chart2/source/controller/inc/ViewElementListProvider.hxx b/chart2/source/controller/inc/ViewElementListProvider.hxx
new file mode 100644
index 000000000000..61a68d6f8b4c
--- /dev/null
+++ b/chart2/source/controller/inc/ViewElementListProvider.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VIEWELEMENTLISTPROVIDER_HXX
+#define _CHART2_VIEWELEMENTLISTPROVIDER_HXX
+
+#include <svx/xtable.hxx>
+#include <svx/svdpage.hxx>
+
+class FontList;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class DrawModelWrapper;
+
+class ViewElementListProvider
+{
+public:
+ ViewElementListProvider( DrawModelWrapper* pDrawModelWrapper );
+ virtual ~ViewElementListProvider();
+
+ XColorTable* GetColorTable() const;
+ XDashList* GetDashList() const;
+ XLineEndList* GetLineEndList() const;
+ XGradientList* GetGradientList() const;
+ XHatchList* GetHatchList() const;
+ XBitmapList* GetBitmapList() const;
+
+ //create chartspecific symbols for linecharts
+ SdrObjList* GetSymbolList() const;
+ Graphic GetSymbolGraphic( sal_Int32 nStandardSymbol, const SfxItemSet* pSymbolShapeProperties ) const;
+
+ FontList* getFontList() const;
+ //SfxPrinter* getPrinter();
+
+private:
+ DrawModelWrapper* m_pDrawModelWrapper;
+ mutable FontList* m_pFontList;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx
new file mode 100644
index 000000000000..4144531ed77e
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_ChartType.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_CHARTTYPE_HXX
+#define _CHART2_DLG_CHARTTYPE_HXX
+
+// header for class ModalDialog
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class OKButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ChartTypeTabPage;
+class ChartTypeDialog : public ModalDialog
+{
+public:
+ ChartTypeDialog( Window* pWindow
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ ~ChartTypeDialog();
+
+private:
+ FixedLine m_aFL;
+ OKButton m_aBtnOK;
+ CancelButton m_aBtnCancel;
+ HelpButton m_aBtnHelp;
+
+ ChartTypeTabPage* m_pChartTypeTabPage;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
new file mode 100644
index 000000000000..c8abda3cb19a
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CREATION_TYPE_UNO_HXX
+#define _CHART2_CREATION_TYPE_UNO_HXX
+
+#include "ServiceMacros.hxx"
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <vcl/vclevent.hxx>
+
+#include <svtools/genericunodialog.hxx>
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+typedef ::svt::OGenericUnoDialog ChartTypeUnoDlg_BASE;
+class ChartType;
+class ChartTypeUnoDlg : public ChartTypeUnoDlg_BASE
+ ,public ::comphelper::OPropertyArrayUsageHelper< ChartTypeUnoDlg >
+{
+public:
+ ChartTypeUnoDlg( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
+ // XServiceInfo - static methods
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void);
+ static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >&);
+private:
+ virtual ~ChartTypeUnoDlg();
+
+ // OGenericUnoDialog overridables
+ virtual void implInitialize(const com::sun::star::uno::Any& _rValue);
+ virtual Dialog* createDialog(Window* _pParent);
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException);
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ //no default constructor
+ ChartTypeUnoDlg();
+ ChartTypeUnoDlg(const ChartTypeUnoDlg&); // no defined
+ void operator =(const ChartTypeUnoDlg&); // no defined
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
new file mode 100644
index 000000000000..e70976ad1a4c
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CREATION_WIZARD_HXX
+#define _CHART2_CREATION_WIZARD_HXX
+
+#include "ServiceMacros.hxx"
+#include "TimerTriggeredControllerLock.hxx"
+#include "TabPageNotifiable.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <svtools/roadmapwizard.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+// for auto_ptr
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class RangeChooserTabPage;
+class DataSourceTabPage;
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class CreationWizard : public
+ svt::RoadmapWizard
+ , public TabPageNotifiable
+{
+public:
+ CreationWizard( Window* pParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ , sal_Int32 nOnePageOnlyIndex=-1 );//if nOnePageOnlyIndex is an index of an exsisting page starting with 0, then only this page is displayed without next/previous and roadmap
+ virtual ~CreationWizard();
+
+ bool isClosable();
+
+ // TabPageNotifiable
+ virtual void setInvalidPage( TabPage * pTabPage );
+ virtual void setValidPage( TabPage * pTabPage );
+
+protected:
+ virtual sal_Bool leaveState( WizardState _nState );
+ virtual WizardState determineNextState(WizardState nCurrentState) const;
+ virtual void enterState(WizardState nState);
+
+ virtual String getStateDisplayName( WizardState nState ) const;
+
+private:
+ //no default constructor
+ CreationWizard();
+
+ virtual svt::OWizardPage* createPage(WizardState nState);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+ bool m_bIsClosable;
+ sal_Int32 m_nOnePageOnlyIndex;//if nOnePageOnlyIndex is an index of an exsisting page starting with 0, then only this page is displayed without next/previous and roadmap
+ ChartTypeTemplateProvider* m_pTemplateProvider;
+ ::std::auto_ptr< DialogModel > m_apDialogModel;
+
+ WizardState m_nFirstState;
+ WizardState m_nLastState;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+
+// RangeChooserTabPage * m_pRangeChooserTabePage;
+// DataSourceTabPage * m_pDataSourceTabPage;
+ bool m_bCanTravel;
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
new file mode 100644
index 000000000000..9f546f1a72d6
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CREATION_WIZARD_UNO_HXX
+#define _CHART2_CREATION_WIZARD_UNO_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/component.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+// header for define DECL_LINK
+#include <tools/link.hxx>
+#include <vcl/vclevent.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class CreationWizard;
+class CreationWizardUnoDlg : public MutexContainer
+ , public ::cppu::OComponentHelper
+ , public ::com::sun::star::ui::dialogs::XExecutableDialog
+ , public ::com::sun::star::lang::XServiceInfo
+ , public ::com::sun::star::lang::XInitialization
+ , public ::com::sun::star::frame::XTerminateListener
+ , public ::com::sun::star::beans::XPropertySet
+{
+public:
+ CreationWizardUnoDlg( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~CreationWizardUnoDlg();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(CreationWizardUnoDlg)
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ DECL_LINK( DialogEventHdl, VclWindowEvent* );
+
+protected:
+ // ____ OComponentHelper ____
+ /// Called in dispose method after the listeners were notified.
+ virtual void SAL_CALL disposing();
+
+private:
+ //no default constructor
+ CreationWizardUnoDlg();
+ void createDialogOnDemand();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow > m_xParentWindow;
+
+ CreationWizard* m_pDialog;
+ sal_Bool m_bUnlockControllersOnExecute;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
new file mode 100644
index 000000000000..e5cd252df69d
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SCH_DGRDATA_HXX
+#define _SCH_DGRDATA_HXX
+
+#include <svl/lstner.hxx>
+#include <svtools/stdctrl.hxx>
+#include <vcl/toolbox.hxx>
+#include <comphelper/stl_types.hxx>
+#include <vcl/dialog.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 {
+ class XChartDocument;
+ }
+}}}
+
+namespace chart
+{
+
+class DataBrowser;
+
+class DataEditor : public ModalDialog
+{
+public:
+ DataEditor( Window* pParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataEditor();
+
+ // Window
+ virtual void Resize();
+
+ // Dialog
+ virtual BOOL Close();
+
+ void SetReadOnly( bool bReadOnly );
+ bool ApplyChangesToModel();
+
+private:
+ bool m_bReadOnly;
+ ::std::auto_ptr< DataBrowser > m_apBrwData;
+ ToolBox m_aTbxData;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ImageList m_aToolboxImageList;
+ ImageList m_aToolboxImageListHighContrast;
+
+ /// handles actions of the toolbox
+ DECL_LINK( ToolboxHdl, void* );
+ /// is called, if the cursor of the table has moved
+ DECL_LINK( BrowserCursorMovedHdl, void*);
+ /// this is called if MiscOptions change, esp. High-Contrast mode
+ DECL_LINK( MiscHdl, void* );
+ /// is called when the contents of the edit cell changes
+ DECL_LINK( CellModified, void* );
+ /// is called when the width of any column in the edit browsebox has changed
+ DECL_LINK( BrowserColumnResized, void* );
+ /// is called when the browser view was scrolled, @todo: only call on horizontal scroll
+ DECL_LINK( BrowserContentScrolled, void* );
+
+ void UpdateData();
+ void ApplyImageList();
+ /// moved and resizes the series name control etc. to fit the dimensions of the edit browsebox
+// void ImplAdjustHeaderControls( bool bRefreshFromModel );
+
+ /** notifySystemWindow adds or remove the given window pToRegister at the Systemwindow found when search pWindow.
+ @param pWindow
+ The window which is used to search for the SystemWindow.
+ @param pToRegister
+ The window which should be added or removed on the TaskPaneList.
+ @param rMemFunc
+ The member function which should be called at the SystemWindow when found.
+ Possible values are:
+ ::comphelper::mem_fun(&TaskPaneList::AddWindow)
+ ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
+
+ @note this code is taken from dbaccess/source/ui/inc/UITools.hxx
+ */
+ void notifySystemWindow( Window* pWindow,
+ Window* pToRegister,
+ ::comphelper::mem_fun1_t< TaskPaneList, Window* > rMemFunc );
+
+ void AdaptBrowseBoxSize();
+};
+
+} // namespace chart
+
+#endif // _SCH_DGRDATA_HXX
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
new file mode 100644
index 000000000000..f94c95b33370
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATASOURCEDIALOG_HXX
+#define CHART2_DATASOURCEDIALOG_HXX
+
+// header for class TabDialog
+#include <vcl/tabdlg.hxx>
+// header for class TabControl
+#include <vcl/tabctrl.hxx>
+// header for class OKButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+#include "TabPageNotifiable.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+// for auto_ptr
+#include <memory>
+
+namespace chart
+{
+
+class DataSourceTabControl;
+class RangeChooserTabPage;
+class DataSourceTabPage;
+class ChartTypeTemplateProvider;
+class DialogModel;
+
+class DataSourceDialog :
+ public TabDialog,
+ public TabPageNotifiable
+{
+public:
+ explicit DataSourceDialog(
+ Window * pParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataSourceDialog();
+
+ // from Dialog (base of TabDialog)
+ virtual short Execute();
+
+ // TabPageNotifiable
+ virtual void setInvalidPage( TabPage * pTabPage );
+ virtual void setValidPage( TabPage * pTabPage );
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
+ m_xChartDocument;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ::std::auto_ptr< ChartTypeTemplateProvider > m_apDocTemplateProvider;
+ ::std::auto_ptr< DialogModel > m_apDialogModel;
+
+private:
+ DataSourceTabControl* m_pTabControl;
+ OKButton m_aBtnOK;
+ CancelButton m_aBtnCancel;
+ HelpButton m_aBtnHelp;
+
+ RangeChooserTabPage * m_pRangeChooserTabePage;
+ DataSourceTabPage * m_pDataSourceTabPage;
+ bool m_bRangeChooserTabIsValid;
+ bool m_bDataSourceTabIsValid;
+
+ static USHORT m_nLastPageId;
+};
+
+} // namespace chart
+
+// CHART2_DATASOURCEDIALOG_HXX
+#endif
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
new file mode 100644
index 000000000000..5ed06d365fa2
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_INSERT_AXIS_GRID_HXX
+#define _CHART2_DLG_INSERT_AXIS_GRID_HXX
+
+// header for class ModalDialog
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/uno/Sequence.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+struct InsertAxisOrGridDialogData
+{
+ ::com::sun::star::uno::Sequence< sal_Bool > aPossibilityList;
+ ::com::sun::star::uno::Sequence< sal_Bool > aExistenceList;
+
+ InsertAxisOrGridDialogData();
+};
+
+/*************************************************************************
+|*
+|* insert Axis dialog (also base for grid dialog)
+|*
+\************************************************************************/
+class SchAxisDlg : public ModalDialog
+{
+protected:
+ FixedLine aFlPrimary;
+ FixedLine aFlPrimaryGrid;
+ CheckBox aCbPrimaryX;
+ CheckBox aCbPrimaryY;
+ CheckBox aCbPrimaryZ;
+
+ FixedLine aFlSecondary;
+ FixedLine aFlSecondaryGrid;
+ CheckBox aCbSecondaryX;
+ CheckBox aCbSecondaryY;
+ CheckBox aCbSecondaryZ;
+
+ OKButton aPbOK;
+ CancelButton aPbCancel;
+ HelpButton aPbHelp;
+
+public:
+ SchAxisDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg=true );
+ virtual ~SchAxisDlg();
+
+ void getResult( InsertAxisOrGridDialogData& rOutput );
+};
+
+
+/*************************************************************************
+|*
+|* Grid dialog
+|*
+\************************************************************************/
+class SchGridDlg : public SchAxisDlg
+{
+public:
+ SchGridDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput );
+ virtual ~SchGridDlg();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
new file mode 100644
index 000000000000..a22333b5bdc8
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DLG_INSERT_DATALABELS_GRID_HXX
+#define CHART2_DLG_INSERT_DATALABELS_GRID_HXX
+
+// header for class ModalDialog
+#include <vcl/dialog.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+//for auto_ptr
+#include <memory>
+
+class SvNumberFormatter;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class DataLabelResources;
+class DataLabelsDialog : public ModalDialog
+{
+private:
+ OKButton m_aBtnOK;
+ CancelButton m_aBtnCancel;
+ HelpButton m_aBtnHelp;
+ ::std::auto_ptr< DataLabelResources > m_apDataLabelResources;
+
+ const SfxItemSet& m_rInAttrs;
+
+ void Reset();
+
+public:
+ DataLabelsDialog(Window* pParent, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter);
+ virtual ~DataLabelsDialog();
+
+ void FillItemSet(SfxItemSet& rOutAttrs);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
new file mode 100644
index 000000000000..3554337d9deb
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_INSERT_ERRORBARS_HXX
+#define _CHART2_DLG_INSERT_ERRORBARS_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <svl/itemset.hxx>
+#include <memory>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include "res_ErrorBar.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class InsertErrorBarsDialog : public ModalDialog
+{
+public:
+ InsertErrorBarsDialog( Window* pParent, const SfxItemSet& rMyAttrs,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument,
+ ErrorBarResources::tErrorBarType eType = ErrorBarResources::ERROR_BAR_Y );
+ virtual ~InsertErrorBarsDialog();
+
+ void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
+
+ static double getAxisMinorStepWidthForErrorBarDecimals(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xChartView,
+ const ::rtl::OUString& rSelectedObjectCID );
+
+ void FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ const SfxItemSet & rInAttrs;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ ::std::auto_ptr< ErrorBarResources > m_apErrorBarResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx
new file mode 100644
index 000000000000..8ab7f285b5a9
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_INSERT_LEGEND_GRID_HXX
+#define _CHART2_DLG_INSERT_LEGEND_GRID_HXX
+
+// header for class ModalDialog
+#include <vcl/dialog.hxx>
+// header for class CheckBox
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+//for auto_ptr
+#include <memory>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendPositionResources;
+class SchLegendDlg : public ModalDialog
+{
+private:
+ ::std::auto_ptr< LegendPositionResources > m_apLegendPositionResources;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+public:
+ SchLegendDlg( Window* pParent, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext>& xCC );
+ virtual ~SchLegendDlg();
+
+ void init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ bool writeToModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel ) const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/inc/dlg_InsertTitle.hxx b/chart2/source/controller/inc/dlg_InsertTitle.hxx
new file mode 100644
index 000000000000..41eeac7a1055
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertTitle.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_INSERT_TITLE_GRID_HXX
+#define _CHART2_DLG_INSERT_TITLE_GRID_HXX
+
+#include "TitleDialogData.hxx"
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+//for auto_ptr
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class TitleResources;
+class SchTitleDlg : public ModalDialog
+{
+private:
+ ::std::auto_ptr< TitleResources > m_apTitleResources;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+public:
+ SchTitleDlg( Window* pParent, const TitleDialogData& rInput );
+ virtual ~SchTitleDlg();
+
+ void getResult( TitleDialogData& rOutput );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/inc/dlg_InsertTrendline.hxx b/chart2/source/controller/inc/dlg_InsertTrendline.hxx
new file mode 100644
index 000000000000..34819f6e0e16
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertTrendline.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_INSERT_TRENDLINE_HXX
+#define _CHART2_DLG_INSERT_TRENDLINE_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <svl/itemset.hxx>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class TrendlineResources;
+class InsertTrendlineDialog : public ModalDialog
+{
+public:
+ InsertTrendlineDialog( Window* pParent, const SfxItemSet& rMyAttrs );
+ virtual ~InsertTrendlineDialog();
+
+ void FillItemSet( SfxItemSet& rOutAttrs );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // sets the size so that all control texts fit. Has to be done after
+ // complete construction of the dialog
+ void adjustSize();
+
+private:
+ const SfxItemSet & rInAttrs;
+
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ ::std::auto_ptr< TrendlineResources > m_apTrendlineResources;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
new file mode 100644
index 000000000000..8ceabdbe33b7
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_OBJECTPROPERTIES_HXX
+#define _CHART2_DLG_OBJECTPROPERTIES_HXX
+
+#include "ObjectIdentifier.hxx"
+#include <sfx2/tabdlg.hxx>
+// header for typedef ChangeType
+#include <svx/tabarea.hxx>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ObjectPropertiesDialogParameter
+{
+public:
+ ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID );
+ virtual ~ObjectPropertiesDialogParameter();
+
+ void init( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+ ObjectType getObjectType() const;
+ rtl::OUString getLocalizedName() const;
+
+ bool HasGeometryProperties() const;
+ bool HasStatisticProperties() const;
+ bool ProvidesSecondaryYAxis() const;
+ bool ProvidesOverlapAndGapWidth() const;
+ bool ProvidesBarConnectors() const;
+ bool HasAreaProperties() const;
+ bool HasSymbolProperties() const;
+ bool HasNumberProperties() const;
+ bool ProvidesStartingAngle() const;
+ bool ProvidesMissingValueTreatments() const;
+
+ bool HasScaleProperties() const;
+ bool CanAxisLabelsBeStaggered() const;
+ bool IsSupportingAxisPositioning() const;
+ bool ShowAxisOrigin() const;
+ bool IsCrossingAxisIsCategoryAxis() const;
+ const ::com::sun::star::uno::Sequence< rtl::OUString >& GetCategories() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
+ getDocument() const;
+
+private:
+ rtl::OUString m_aObjectCID;
+ ObjectType m_eObjectType;
+ bool m_bAffectsMultipleObjects;//is true if more than one object of the given type will be changed (e.g. all axes or all titles)
+
+ rtl::OUString m_aLocalizedName;
+
+ bool m_bHasGeometryProperties;
+ bool m_bHasStatisticProperties;
+ bool m_bProvidesSecondaryYAxis;
+ bool m_bProvidesOverlapAndGapWidth;
+ bool m_bProvidesBarConnectors;
+ bool m_bHasAreaProperties;
+ bool m_bHasSymbolProperties;
+ bool m_bHasNumberProperties;
+ bool m_bProvidesStartingAngle;
+ bool m_bProvidesMissingValueTreatments;
+
+ bool m_bHasScaleProperties;
+ bool m_bCanAxisLabelsBeStaggered;
+
+ bool m_bSupportingAxisPositioning;
+ bool m_bShowAxisOrigin;
+ bool m_bIsCrossingAxisIsCategoryAxis;
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+};
+
+/*************************************************************************
+|*
+|* dialog for properties of different chart object
+|*
+\************************************************************************/
+
+class ViewElementListProvider;
+
+class SchAttribTabDlg : public SfxTabDialog
+{
+private:
+ ObjectType eObjectType;
+ bool bAffectsMultipleObjects;//is true if more than one object of the given type will be changed (e.g. all axes or all titles)
+ USHORT nDlgType;
+ USHORT nPageType;
+
+ const ObjectPropertiesDialogParameter * const m_pParameter;
+ const ViewElementListProvider* const m_pViewElementListProvider;
+ SvNumberFormatter* m_pNumberFormatter;
+
+ SfxItemSet* m_pSymbolShapeProperties;
+ Graphic* m_pAutoSymbolGraphic;
+
+ double m_fAxisMinorStepWidthForErrorBarDecimals;
+ bool m_bOKPressed;
+
+ virtual void PageCreated(USHORT nId, SfxTabPage& rPage);
+
+ Link m_aOriginalOKClickHdl;
+ DECL_LINK( OKPressed, void * );
+
+public:
+ SchAttribTabDlg(Window* pParent, const SfxItemSet* pAttr,
+ const ObjectPropertiesDialogParameter* pDialogParameter,
+ const ViewElementListProvider* pViewElementListProvider,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+ virtual ~SchAttribTabDlg();
+
+ //pSymbolShapeProperties: Properties to be set on the symbollist shapes
+ //pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected
+ //this class takes ownership over both parameter
+ void setSymbolInformation( SfxItemSet* pSymbolShapeProperties, Graphic* pAutoSymbolGraphic );
+
+ void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
+
+ bool DialogWasClosedWithOK() const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx
new file mode 100644
index 000000000000..ec1b6553bd64
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DLG_SHAPEFONT_HXX
+#define CHART2_DLG_SHAPEFONT_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ViewElementListProvider;
+
+/** dialog for font properties of shapes
+ */
+class ShapeFontDialog : public SfxTabDialog
+{
+public:
+ ShapeFontDialog( Window* pParent, const SfxItemSet* pAttr,
+ const ViewElementListProvider* pViewElementListProvider );
+ virtual ~ShapeFontDialog();
+
+private:
+ virtual void PageCreated( USHORT nId, SfxTabPage& rPage );
+
+ const ViewElementListProvider* m_pViewElementListProvider;
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+// CHART2_DLG_SHAPEFONT_HXX
+#endif
diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
new file mode 100644
index 000000000000..2bc57bfcffc2
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DLG_SHAPEPARAGRAPH_HXX
+#define CHART2_DLG_SHAPEPARAGRAPH_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+/** dialog for paragraph properties of shapes
+ */
+class ShapeParagraphDialog : public SfxTabDialog
+{
+public:
+ ShapeParagraphDialog( Window* pParent, const SfxItemSet* pAttr );
+ virtual ~ShapeParagraphDialog();
+
+private:
+ virtual void PageCreated( USHORT nId, SfxTabPage& rPage );
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+// CHART2_DLG_SHAPEPARAGRAPH_HXX
+#endif
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
new file mode 100644
index 000000000000..91b16d3512d8
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DLG_VIEW3D_DIAGRAM_HXX
+#define _CHART2_DLG_VIEW3D_DIAGRAM_HXX
+
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+// header for class TabDialog
+#include <vcl/tabdlg.hxx>
+// header for class TabControl
+#include <vcl/tabctrl.hxx>
+// header for class OKButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class XColorTable
+#include <svx/xtable.hxx>
+
+#include "ControllerLockGuard.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class ThreeD_SceneGeometry_TabPage;
+class ThreeD_SceneAppearance_TabPage;
+class ThreeD_SceneIllumination_TabPage;
+
+class View3DDialog : public TabDialog
+{
+public:
+ View3DDialog( Window* pWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
+ XColorTable* pColorTable=0 );
+ ~View3DDialog();
+
+ // from Dialog (base of TabDialog)
+ virtual short Execute();
+
+private:
+ TabControl m_aTabControl;
+ OKButton m_aBtnOK;
+ CancelButton m_aBtnCancel;
+ HelpButton m_aBtnHelp;
+
+ ThreeD_SceneGeometry_TabPage* m_pGeometry;
+ ThreeD_SceneAppearance_TabPage* m_pAppearance;
+ ThreeD_SceneIllumination_TabPage* m_pIllumination;
+
+ ControllerLockHelper m_aControllerLocker;
+
+ static USHORT m_nLastPageId;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
new file mode 100644
index 000000000000..0b5f33b5c128
--- /dev/null
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RES_ERRORBAR_HXX
+#define CHART2_RES_ERRORBAR_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/itemset.hxx>
+#include <svx/chrtitem.hxx>
+#include "chartview/ChartSfxItemIds.hxx"
+#include "RangeSelectionButton.hxx"
+#include "RangeSelectionListener.hxx"
+#include "RangeEdit.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+#include <memory>
+
+class Dialog;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class RangeSelectionHelper;
+
+class ErrorBarResources : public RangeSelectionListenerParent
+{
+public:
+ enum tErrorBarType
+ {
+ ERROR_BAR_X,
+ ERROR_BAR_Y
+ };
+
+ ErrorBarResources(
+ Window* pParent, Dialog * pParentDialog, const SfxItemSet& rInAttrst,
+ bool bNoneAvailable,
+ tErrorBarType eType = ERROR_BAR_Y );
+ virtual ~ErrorBarResources();
+
+ void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
+ void SetErrorBarType( tErrorBarType eNewType );
+ void SetChartDocumentForRangeChoosing(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDocument );
+ void Reset(const SfxItemSet& rInAttrs);
+ BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+
+ void FillValueSets();
+
+ // ____ RangeSelectionListenerParent ____
+ virtual void listeningFinished( const ::rtl::OUString & rNewRange );
+ virtual void disposingRangeSelection();
+
+private:
+ // category
+ FixedLine m_aFlErrorCategory;
+ RadioButton m_aRbNone;
+ RadioButton m_aRbConst;
+ RadioButton m_aRbPercent;
+ RadioButton m_aRbFunction;
+ RadioButton m_aRbRange;
+ ListBox m_aLbFunction;
+
+ // parameters
+ FixedLine m_aFlParameters;
+ FixedText m_aFtPositive;
+ MetricField m_aMfPositive;
+ RangeEdit m_aEdRangePositive;
+ RangeSelectionButton m_aIbRangePositive;
+ FixedText m_aFtNegative;
+ MetricField m_aMfNegative;
+ RangeEdit m_aEdRangeNegative;
+ RangeSelectionButton m_aIbRangeNegative;
+ CheckBox m_aCbSyncPosNeg;
+
+ // indicator
+ FixedLine m_aFlIndicate;
+ RadioButton m_aRbBoth;
+ RadioButton m_aRbPositive;
+ RadioButton m_aRbNegative;
+ FixedImage m_aFiBoth;
+ FixedImage m_aFiPositive;
+ FixedImage m_aFiNegative;
+
+ SvxChartKindError m_eErrorKind;
+ SvxChartIndicate m_eIndicate;
+ SvxChartRegress m_eTrendLineType;
+
+ bool m_bErrorKindUnique;
+ bool m_bIndicatorUnique;
+ bool m_bPlusUnique;
+ bool m_bMinusUnique;
+ bool m_bRangePosUnique;
+ bool m_bRangeNegUnique;
+
+ bool m_bNoneAvailable;
+
+ tErrorBarType m_eErrorBarType;
+ sal_uInt16 m_nConstDecimalDigits;
+ sal_Int64 m_nConstSpinSize;
+
+ Window * m_pParentWindow;
+ Dialog * m_pParentDialog;
+ ::std::auto_ptr< RangeSelectionHelper >
+ m_apRangeSelectionHelper;
+ Edit * m_pCurrentRangeChoosingField;
+ bool m_bHasInternalDataProvider;
+ bool m_bDisableDataTableDialog;
+
+ DECL_LINK( CategoryChosen, void * );
+ DECL_LINK( SynchronizePosAndNeg, void * );
+ DECL_LINK( PosValueChanged, void * );
+ DECL_LINK( IndicatorChanged, void * );
+ DECL_LINK( ChooseRange, RangeSelectionButton * );
+ DECL_LINK( RangeChanged, Edit * );
+
+ void UpdateControlStates();
+ bool isRangeFieldContentValid( Edit & rEdit );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
new file mode 100644
index 000000000000..8cf07aabad08
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -0,0 +1,835 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "AxisItemConverter.hxx"
+#include "ItemPropertyMap.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "chartview/ChartSfxItemIds.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "CommonConverters.hxx"
+
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/AxisOrientation.hpp>
+
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+// for SvxDoubleItem
+#include <svx/chrtitem.hxx>
+// for SfxInt32Item
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetAxisPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aAxisPropertyMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR, "DisplayLabels", 0 )
+ IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS, "MajorTickmarks", 0 )
+ IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS, "MinorTickmarks", 0 )
+ IPM_MAP_ENTRY( SCHATTR_TEXT_ORDER, "ArrangeOrder", 0 )
+ IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 )
+ IPM_MAP_ENTRY( SCHATTR_TEXTBREAK, "TextBreak", 0 )
+ IPM_MAP_ENTRY( SCHATTR_TEXT_OVERLAP, "TextOverlap", 0 )
+ );
+
+ return aAxisPropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+AxisItemConverter::AxisItemConverter(
+ const Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const Reference< chart2::XChartDocument > & xChartDoc,
+ chart2::ExplicitScaleData * pScale /* = NULL */,
+ chart2::ExplicitIncrementData * pIncrement /* = NULL */,
+ ::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_xChartDoc( xChartDoc ),
+ m_pExplicitScale( NULL ),
+ m_pExplicitIncrement( NULL )
+{
+ Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
+
+ if( pScale )
+ m_pExplicitScale = new chart2::ExplicitScaleData( *pScale );
+ if( pIncrement )
+ m_pExplicitIncrement = new chart2::ExplicitIncrementData( *pIncrement );
+
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_PROPERTIES ));
+ m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
+ C2U( "ReferencePageSize" ) ));
+
+ m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
+ OSL_ASSERT( m_xAxis.is());
+}
+
+AxisItemConverter::~AxisItemConverter()
+{
+ delete m_pExplicitScale;
+ delete m_pExplicitIncrement;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::DeleteItemConverterPtr() );
+}
+
+void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * AxisItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nAxisWhichPairs;
+}
+
+bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType & rMap( lcl_GetAxisPropertyMap());
+ ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutProperty =(*aIt).second;
+
+ return true;
+}
+
+void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ if( ! m_xAxis.is() )
+ return;
+
+ const chart2::ScaleData aScale( m_xAxis->getScaleData() );
+ const chart2::IncrementData aInc( aScale.IncrementData );
+ const uno::Sequence< chart2::SubIncrement > aSubIncs( aScale.IncrementData.SubIncrements );
+
+ switch( nWhichId )
+ {
+ case SCHATTR_AXIS_AUTO_MAX:
+ // if the any has no value => auto is on
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Maximum) ) );
+ break;
+
+ case SCHATTR_AXIS_MAX:
+ {
+ double fMax = 10.0;
+ if( aScale.Maximum >>= fMax )
+ {
+ rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ }
+ else
+ {
+ if( m_pExplicitScale )
+ fMax = m_pExplicitScale->Maximum;
+ rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_MIN:
+ // if the any has no value => auto is on
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Minimum) ) );
+ break;
+
+ case SCHATTR_AXIS_MIN:
+ {
+ double fMin = 0.0;
+ if( aScale.Minimum >>= fMin )
+ {
+ rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
+ }
+ else
+ {
+ if( m_pExplicitScale )
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_LOGARITHM:
+ {
+ BOOL bValue = AxisHelper::isLogarithmic( aScale.Scaling );
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
+ }
+ break;
+
+ case SCHATTR_AXIS_REVERSE:
+ rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == aScale.Orientation) ));
+ break;
+
+ // Increment
+ case SCHATTR_AXIS_AUTO_STEP_MAIN:
+ // if the any has no value => auto is on
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aInc.Distance) ) );
+ break;
+
+ case SCHATTR_AXIS_STEP_MAIN:
+ {
+ double fDistance = 1.0;
+ if( aInc.Distance >>= fDistance )
+ {
+ rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
+ }
+ else
+ {
+ if( m_pExplicitIncrement )
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
+ }
+ }
+ break;
+
+ // SubIncrement
+ case SCHATTR_AXIS_AUTO_STEP_HELP:
+ {
+ // if the any has no value => auto is on
+ rOutItemSet.Put(
+ SfxBoolItem(
+ nWhichId,
+ ! ( aSubIncs.getLength() > 0 &&
+ aSubIncs[0].IntervalCount.hasValue() )));
+ }
+ break;
+
+ case SCHATTR_AXIS_STEP_HELP:
+ {
+ if( aSubIncs.getLength() > 0 &&
+ aSubIncs[0].IntervalCount.hasValue())
+ {
+ OSL_ASSERT( aSubIncs[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
+ rOutItemSet.Put(
+ SfxInt32Item(
+ nWhichId,
+ *reinterpret_cast< const sal_Int32 * >(
+ aSubIncs[0].IntervalCount.getValue()) ));
+ }
+ else
+ {
+ if( m_pExplicitIncrement &&
+ m_pExplicitIncrement->SubIncrements.getLength() > 0 )
+ {
+ rOutItemSet.Put(
+ SfxInt32Item(
+ nWhichId,
+ m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_ORIGIN:
+ {
+ // if the any has no double value => auto is on
+ rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(aScale.Origin) )));
+ }
+ break;
+
+ case SCHATTR_AXIS_ORIGIN:
+ {
+ double fOrigin = 0.0;
+ if( !(aScale.Origin >>= fOrigin) )
+ {
+ if( m_pExplicitScale )
+ fOrigin = m_pExplicitScale->Origin;
+ }
+ rOutItemSet.Put( SvxDoubleItem( fOrigin, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_AXIS_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisPosition eAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eAxisPos;
+ rOutItemSet.Put( SfxInt32Item( nWhichId, eAxisPos ) );
+ }
+ break;
+
+ case SCHATTR_AXIS_POSITION_VALUE:
+ {
+ double fValue = 0.0;
+ if( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue )
+ rOutItemSet.Put( SvxDoubleItem( fValue, nWhichId ) );
+ }
+ break;
+
+ case SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT:
+ {
+ //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 ) ) );
+
+ Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
+
+ sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ xCrossingMainAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
+
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
+ }
+ break;
+
+ case SCHATTR_AXIS_LABEL_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisLabelPosition ePos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
+ GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= ePos;
+ rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
+ }
+ break;
+
+ case SCHATTR_AXIS_MARK_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisMarkPosition ePos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
+ GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= ePos;
+ rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
+ }
+ break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert double to int (times 100)
+ double fVal = 0;
+
+ if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 ) ) ));
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+// case SCHATTR_AXIS_NUMFMT:
+ {
+ if( m_pExplicitScale )
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+
+ sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
+
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_SOURCE:
+ {
+ bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
+ rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
+ }
+ break;
+
+ case SCHATTR_AXISTYPE:
+ rOutItemSet.Put( SfxInt32Item( nWhichId, aScale.AxisType ));
+ break;
+ }
+}
+
+bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ if( !m_xAxis.is() )
+ return false;
+
+ chart2::ScaleData aScale( m_xAxis->getScaleData() );
+
+ bool bSetScale = false;
+ bool bChangedOtherwise = false;
+
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_AXIS_AUTO_MAX:
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aScale.Maximum.clear();
+ bSetScale = true;
+ }
+ // else SCHATTR_AXIS_MAX must have some value
+ break;
+
+ case SCHATTR_AXIS_MAX:
+ // only if auto if false
+ if( ! (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_MAX )).GetValue() ))
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( aScale.Maximum != aValue )
+ {
+ aScale.Maximum = aValue;
+ bSetScale = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_MIN:
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aScale.Minimum.clear();
+ bSetScale = true;
+ }
+ // else SCHATTR_AXIS_MIN must have some value
+ break;
+
+ case SCHATTR_AXIS_MIN:
+ // only if auto if false
+ if( ! (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_MIN )).GetValue() ))
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( aScale.Minimum != aValue )
+ {
+ aScale.Minimum = aValue;
+ bSetScale = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_LOGARITHM:
+ {
+ bool bWasLogarithm = AxisHelper::isLogarithmic( aScale.Scaling );
+
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ // logarithm is true
+ if( ! bWasLogarithm )
+ {
+ aScale.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
+ bSetScale = true;
+ }
+ }
+ else
+ {
+ // logarithm is false => linear scaling
+ if( bWasLogarithm )
+ {
+ aScale.Scaling = AxisHelper::createLinearScaling();
+ bSetScale = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_REVERSE:
+ {
+ bool bWasReverse = ( AxisOrientation_REVERSE == aScale.Orientation );
+ bool bNewReverse = (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() );
+ if( bWasReverse != bNewReverse )
+ {
+ aScale.Orientation = bNewReverse ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
+ bSetScale = true;
+ }
+ }
+ break;
+
+ // Increment
+ case SCHATTR_AXIS_AUTO_STEP_MAIN:
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aScale.IncrementData.Distance.clear();
+ bSetScale = true;
+ }
+ // else SCHATTR_AXIS_STEP_MAIN must have some value
+ break;
+
+ case SCHATTR_AXIS_STEP_MAIN:
+ // only if auto if false
+ if( ! (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue() ))
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( aScale.IncrementData.Distance != aValue )
+ {
+ aScale.IncrementData.Distance = aValue;
+ bSetScale = true;
+ }
+ }
+ break;
+
+ // SubIncrement
+ case SCHATTR_AXIS_AUTO_STEP_HELP:
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ) &&
+ aScale.IncrementData.SubIncrements.getLength() > 0 &&
+ aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
+ {
+ aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
+ bSetScale = true;
+ }
+ // else SCHATTR_AXIS_STEP_MAIN must have some value
+ break;
+
+ case SCHATTR_AXIS_STEP_HELP:
+ // only if auto if false
+ if( ! (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue() ) &&
+ aScale.IncrementData.SubIncrements.getLength() > 0 )
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ||
+ aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
+ {
+ OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
+ aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
+ bSetScale = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_ORIGIN:
+ {
+ if( (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aScale.Origin.clear();
+ bSetScale = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_ORIGIN:
+ {
+ // only if auto is false
+ if( ! (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_ORIGIN )).GetValue() ))
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( aScale.Origin != aValue )
+ {
+ aScale.Origin = aValue;
+ bSetScale = true;
+
+ 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 ) ) );
+
+ 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 );
+ if( xCrossingMainAxis.is() )
+ {
+ double fValue = 0.0;
+ if( aValue >>= fValue )
+ {
+ xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE ));
+ xCrossingMainAxis->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
+ }
+ else
+ xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START ));
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisPosition eAxisPos =
+ (::com::sun::star::chart::ChartAxisPosition)
+ static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+
+ ::com::sun::star::chart::ChartAxisPosition eOldAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eOldAxisPos );
+
+ if( !bPropExisted || ( eOldAxisPos != eAxisPos ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eAxisPos ));
+ bChangedOtherwise = true;
+
+ //move the parallel axes to the other side if necessary
+ if( eAxisPos==::com::sun::star::chart::ChartAxisPosition_START || eAxisPos==::com::sun::star::chart::ChartAxisPosition_END )
+ {
+ Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
+ if( xParallelAxis.is() )
+ {
+ ::com::sun::star::chart::ChartAxisPosition eOtherPos;
+ if( xParallelAxis->getPropertyValue( C2U( "CrossoverPosition" ) ) >>= eOtherPos )
+ {
+ if( eOtherPos == eAxisPos )
+ {
+ ::com::sun::star::chart::ChartAxisPosition eOppositePos =
+ (eAxisPos==::com::sun::star::chart::ChartAxisPosition_START)
+ ? ::com::sun::star::chart::ChartAxisPosition_END
+ : ::com::sun::star::chart::ChartAxisPosition_START;
+ xParallelAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eOppositePos ));
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_POSITION_VALUE:
+ {
+ double fValue = static_cast< const SvxDoubleItem & >( rItemSet.Get( nWhichId )).GetValue();
+
+ double fOldValue = 0.0;
+ bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fOldValue );
+
+ if( !bPropExisted || ( fOldValue != fValue ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
+ bChangedOtherwise = true;
+
+ //keep old and new settings for axis positioning in sync somehow
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+
+ sal_Int32 nDimensionIndex=0;
+ sal_Int32 nAxisIndex=0;
+ if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 && nDimensionIndex==0 )
+ {
+ Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
+ if( xCrossingMainAxis.is() )
+ {
+ ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
+ aCrossingScale.Origin = uno::makeAny(fValue);
+ xCrossingMainAxis->setScaleData(aCrossingScale);
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_LABEL_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisLabelPosition ePos =
+ (::com::sun::star::chart::ChartAxisLabelPosition)
+ static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+
+ ::com::sun::star::chart::ChartAxisLabelPosition eOldPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
+ bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= eOldPos );
+
+ if( !bPropExisted || ( eOldPos != ePos ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( ePos ));
+ bChangedOtherwise = true;
+
+ //move the parallel axes to the other side if necessary
+ if( ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START || ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END )
+ {
+ Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
+ if( xParallelAxis.is() )
+ {
+ ::com::sun::star::chart::ChartAxisLabelPosition eOtherPos;
+ if( xParallelAxis->getPropertyValue( C2U( "LabelPosition" ) ) >>= eOtherPos )
+ {
+ if( eOtherPos == ePos )
+ {
+ ::com::sun::star::chart::ChartAxisLabelPosition eOppositePos =
+ (ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START)
+ ? ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END
+ : ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START;
+ xParallelAxis->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( eOppositePos ));
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_MARK_POSITION:
+ {
+ ::com::sun::star::chart::ChartAxisMarkPosition ePos =
+ (::com::sun::star::chart::ChartAxisMarkPosition)
+ static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+
+ ::com::sun::star::chart::ChartAxisMarkPosition eOldPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
+ bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= eOldPos );
+
+ if( !bPropExisted || ( eOldPos != ePos ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "MarkPosition" ), uno::makeAny( ePos ));
+ bChangedOtherwise = true;
+ }
+ }
+ break;
+
+ 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 fOldVal = 0.0;
+ bool bPropExisted =
+ ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldVal );
+
+ if( ! bPropExisted ||
+ ( bPropExisted && fOldVal != fVal ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fVal ));
+ bChangedOtherwise = true;
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+// case SCHATTR_AXIS_NUMFMT:
+ {
+ if( m_pExplicitScale )
+ {
+ bool bUseSourceFormat =
+ (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue() );
+
+ if( ! bUseSourceFormat )
+ {
+ sal_Int32 nFmt = static_cast< sal_Int32 >(
+ static_cast< const SfxUInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ aValue = uno::makeAny(nFmt);
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
+ bChangedOtherwise = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_SOURCE:
+ {
+ bool bUseSourceFormat =
+ (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() );
+ bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
+
+ bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
+ if( bChangedOtherwise )
+ {
+ if( ! bUseSourceFormat )
+ {
+ SfxItemState aState = rItemSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE );
+ if( aState == SFX_ITEM_SET )
+ {
+ sal_Int32 nFormatKey = static_cast< sal_Int32 >(
+ static_cast< const SfxUInt32Item & >(
+ rItemSet.Get( SID_ATTR_NUMBERFORMAT_VALUE )).GetValue());
+ aValue <<= nFormatKey;
+ }
+ else
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis(
+ m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+
+ sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
+
+ aValue <<= nFormatKey;
+ }
+ }
+ // else set a void Any
+ GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
+ }
+ }
+ break;
+
+ case SCHATTR_AXISTYPE:
+ //don't allow to change the axis type so far
+ break;
+ }
+
+ if( bSetScale )
+ m_xAxis->setScaleData( aScale );
+
+ return (bSetScale || bChangedOtherwise);
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
new file mode 100644
index 000000000000..3382ae1ff085
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -0,0 +1,518 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "RelativeSizeHelper.hxx"
+#include <editeng/memberids.hrc>
+#include <editeng/eeitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svl/stritem.hxx>
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/chart2/XFormattedString.hpp>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetCharacterPropertyPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aCharacterPropertyMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( EE_CHAR_COLOR, "CharColor", 0 )
+ IPM_MAP_ENTRY( EE_CHAR_LANGUAGE, "CharLocale", MID_LANG_LOCALE )
+ IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CJK, "CharLocaleAsian", MID_LANG_LOCALE )
+ IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CTL, "CharLocaleComplex", MID_LANG_LOCALE )
+// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT, "CharHeight", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_ITALIC, "CharPosture", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_WEIGHT, "CharWeight", 0 )
+
+ IPM_MAP_ENTRY( EE_CHAR_STRIKEOUT, "CharStrikeout", MID_CROSS_OUT )
+ IPM_MAP_ENTRY( EE_CHAR_WLM, "CharWordMode", 0 )
+ IPM_MAP_ENTRY( EE_CHAR_SHADOW, "CharShadowed", 0 )
+ IPM_MAP_ENTRY( EE_CHAR_RELIEF, "CharRelief", 0 )
+ IPM_MAP_ENTRY( EE_CHAR_OUTLINE, "CharContoured", 0 )
+ IPM_MAP_ENTRY( EE_CHAR_EMPHASISMARK, "CharEmphasis", 0 )
+
+ IPM_MAP_ENTRY( EE_PARA_WRITINGDIR, "WritingMode", 0 )
+
+// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT_CJK, "CharHeightAsian", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_FONTHEIGHT_CTL, "CharHeightComplex", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_WEIGHT_CJK, "CharWeightAsian", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_WEIGHT_CTL, "CharWeightComplex", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CJK, "CharPostureAsian", 0 )
+// IPM_MAP_ENTRY( EE_CHAR_ITALIC_CTL, "CharPostureComplex", 0 )
+ IPM_MAP_ENTRY( EE_PARA_ASIANCJKSPACING, "ParaIsCharacterDistance", 0 )
+ );
+
+ return aCharacterPropertyMap;
+}
+} // anonymous namespace
+
+// ========================================
+
+namespace chart
+{
+namespace wrapper
+{
+
+CharacterPropertyItemConverter::CharacterPropertyItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool ) :
+ ItemConverter( rPropertySet, rItemPool )
+{}
+
+CharacterPropertyItemConverter::CharacterPropertyItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ ::std::auto_ptr< awt::Size > pRefSize,
+ const ::rtl::OUString & rRefSizePropertyName,
+ const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_pRefSize( pRefSize ),
+ m_aRefSizePropertyName( rRefSizePropertyName ),
+ m_xRefSizePropSet( rRefSizePropSet.is() ? rRefSizePropSet : rPropertySet )
+{}
+
+CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
+{}
+
+const USHORT * CharacterPropertyItemConverter::GetWhichPairs() const
+{
+ return nCharacterPropertyWhichPairs;
+}
+
+bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType & rMap( lcl_GetCharacterPropertyPropertyMap());
+ ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutProperty =(*aIt).second;
+ return true;
+}
+
+void CharacterPropertyItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case EE_CHAR_FONTINFO:
+ case EE_CHAR_FONTINFO_CJK:
+ case EE_CHAR_FONTINFO_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_FONTINFO_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_FONTINFO_CTL )
+ aPostfix = C2U( "Complex" );
+
+ SvxFontItem aItem( nWhichId );
+
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix),
+ MID_FONT_FAMILY_NAME );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix),
+ MID_FONT_FAMILY );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix),
+ MID_FONT_STYLE_NAME );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix),
+ MID_FONT_CHAR_SET );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix),
+ MID_FONT_PITCH );
+
+ rOutItemSet.Put( aItem );
+ }
+ break;
+
+ case EE_CHAR_UNDERLINE:
+ {
+ SvxUnderlineItem aItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE);
+ bool bModified = false;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharUnderline" )));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_TL_STYLE );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ));
+ if( aValue.hasValue() &&
+ ( *reinterpret_cast< const sal_Bool * >( aValue.getValue()) != sal_False ))
+ {
+ aItem.PutValue( aValue, MID_TL_HASCOLOR );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_TL_COLOR );
+ bModified = true;
+ }
+
+ if( bModified )
+ rOutItemSet.Put( aItem );
+ }
+ break;
+
+ case EE_CHAR_ITALIC:
+ case EE_CHAR_ITALIC_CJK:
+ case EE_CHAR_ITALIC_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_ITALIC_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_ITALIC_CTL )
+ aPostfix = C2U( "Complex" );
+
+ SvxPostureItem aItem( ITALIC_NONE, nWhichId );
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_POSTURE );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+
+ case EE_CHAR_WEIGHT:
+ case EE_CHAR_WEIGHT_CJK:
+ case EE_CHAR_WEIGHT_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_WEIGHT_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_WEIGHT_CTL )
+ aPostfix = C2U( "Complex" );
+
+ SvxWeightItem aItem( WEIGHT_NORMAL, nWhichId );
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_WEIGHT );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+
+ case EE_CHAR_FONTHEIGHT:
+ case EE_CHAR_FONTHEIGHT_CJK:
+ case EE_CHAR_FONTHEIGHT_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
+ aPostfix = C2U( "Complex" );
+
+ SvxFontHeightItem aItem( 240, 100, nWhichId );
+
+ try
+ {
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ));
+ float fHeight;
+ if( aValue >>= fHeight )
+ {
+ if( m_pRefSize.get())
+ {
+ awt::Size aOldRefSize;
+ if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
+ {
+ // calculate font height in view
+ fHeight = static_cast< float >(
+ RelativeSizeHelper::calculate( fHeight, aOldRefSize, *m_pRefSize ));
+ aValue <<= fHeight;
+ }
+ }
+
+ aItem.PutValue( aValue, MID_FONTHEIGHT );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+
+ case SID_CHAR_DLG_PREVIEW_STRING:
+ {
+ uno::Reference< chart2::XFormattedString > xFormattedString( GetPropertySet(), uno::UNO_QUERY );
+ if( xFormattedString.is() )
+ {
+ ::rtl::OUString aString = xFormattedString->getString();
+ rOutItemSet.Put( SfxStringItem( nWhichId, aString ) );
+ }
+ else
+ rOutItemSet.Put( SfxStringItem( nWhichId, C2U( "" ) ) );
+ }
+ break;
+
+ case EE_PARA_FORBIDDENRULES:
+ case EE_PARA_HANGINGPUNCTUATION:
+ rOutItemSet.DisableItem( nWhichId );
+ break;
+ }
+}
+
+bool CharacterPropertyItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case EE_CHAR_FONTINFO:
+ case EE_CHAR_FONTINFO_CJK:
+ case EE_CHAR_FONTINFO_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_FONTINFO_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_FONTINFO_CTL )
+ aPostfix = C2U( "Complex" );
+
+ const SvxFontItem & rItem =
+ static_cast< const SvxFontItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_FONT_FAMILY_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontName" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_FAMILY ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontFamily" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_STYLE_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontStyleName" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_CHAR_SET ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontCharSet" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_PITCH ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontPitch" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_UNDERLINE:
+ {
+ const SvxUnderlineItem & rItem =
+ static_cast< const SvxUnderlineItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_TL_STYLE ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderline" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderline" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if( rItem.QueryValue( aValue, MID_TL_COLOR ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderlineColor" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if( rItem.QueryValue( aValue, MID_TL_HASCOLOR ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderlineHasColor" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_ITALIC:
+ case EE_CHAR_ITALIC_CJK:
+ case EE_CHAR_ITALIC_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_ITALIC_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_ITALIC_CTL )
+ aPostfix = C2U( "Complex" );
+
+ const SvxPostureItem & rItem =
+ static_cast< const SvxPostureItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_POSTURE ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharPosture" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_WEIGHT:
+ case EE_CHAR_WEIGHT_CJK:
+ case EE_CHAR_WEIGHT_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_WEIGHT_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_WEIGHT_CTL )
+ aPostfix = C2U( "Complex" );
+
+ const SvxWeightItem & rItem =
+ static_cast< const SvxWeightItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_WEIGHT ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharWeight" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_FONTHEIGHT:
+ case EE_CHAR_FONTHEIGHT_CJK:
+ case EE_CHAR_FONTHEIGHT_CTL:
+ {
+ ::rtl::OUString aPostfix;
+ if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
+ aPostfix = C2U( "Asian" );
+ else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
+ aPostfix = C2U( "Complex" );
+
+ const SvxFontHeightItem & rItem =
+ static_cast< const SvxFontHeightItem & >(
+ rItemSet.Get( nWhichId ));
+
+ try
+ {
+ if( rItem.QueryValue( aValue, MID_FONTHEIGHT ) )
+ {
+ bool bSetValue = false;
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ))
+ bSetValue = true;
+ else
+ {
+ if( m_pRefSize.get() )
+ {
+ awt::Size aNewRefSize = *m_pRefSize;
+ awt::Size aOldRefSize;
+ if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
+ {
+ if( aNewRefSize.Width != aOldRefSize.Width
+ || aNewRefSize.Height != aOldRefSize.Height )
+ bSetValue = true;
+ }
+ }
+ }
+ if( bSetValue )
+ {
+ // set new reference size only if there was a reference size before (auto-scaling on)
+ if( m_pRefSize.get() &&
+ GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ).hasValue())
+ {
+ GetRefSizePropertySet()->setPropertyValue( m_aRefSizePropertyName,
+ uno::makeAny( *m_pRefSize ));
+ }
+
+ GetPropertySet()->setPropertyValue( C2U( "CharHeight" ) + aPostfix, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+uno::Reference< beans::XPropertySet >
+ CharacterPropertyItemConverter::GetRefSizePropertySet() const
+{
+ return m_xRefSizePropSet;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
new file mode 100644
index 000000000000..14590b6f6f9c
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -0,0 +1,700 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataPointItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "StatisticsItemConverter.hxx"
+#include "SeriesOptionsItemConverter.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include <svx/chrtitem.hxx>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+
+// header for class XFillColorItem
+#include <svx/xflclit.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/sizeitem.hxx>
+// header for class SfxStringItem
+#include <svl/stritem.hxx>
+#include <editeng/brshitem.hxx>
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+#include <vcl/graph.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+// for SVX_SYMBOLTYPE_...
+#include <svx/tabline.hxx>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetDataPointPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aDataPointPropertyMap(
+ ::comphelper::MakeItemPropertyMap
+// IPM_MAP_ENTRY( CHATTR_PIE_SEGMENT_OFFSET, "Offset", 0 )
+ IPM_MAP_ENTRY( SCHATTR_STYLE_SHAPE, "Geometry3D", 0 )
+ );
+
+ return aDataPointPropertyMap;
+};
+
+sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
+{
+ sal_Int32 nStyle = SVX_SYMBOLTYPE_UNKNOWN;
+ switch( rSymbol.Style )
+ {
+ case chart2::SymbolStyle_NONE:
+ nStyle = SVX_SYMBOLTYPE_NONE;
+ break;
+ case chart2::SymbolStyle_AUTO:
+ nStyle = SVX_SYMBOLTYPE_AUTO;
+ break;
+ case chart2::SymbolStyle_GRAPHIC:
+ nStyle = SVX_SYMBOLTYPE_BRUSHITEM;
+ break;
+ case chart2::SymbolStyle_STANDARD:
+ nStyle = rSymbol.StandardSymbol;
+ break;
+
+ case chart2::SymbolStyle_POLYGON:
+ // to avoid warning
+ case chart2::SymbolStyle_MAKE_FIXED_SIZE:
+ // nothing
+ break;
+ }
+ return nStyle;
+}
+
+bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
+{
+ bool bChanged = false;
+ if( !xPropertySet.is() )
+ return bChanged;
+ rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
+ USHORT nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
+
+ if( SFX_ITEM_SET != rItemSet.GetItemState( nSourceWhich ) )
+ return bChanged;
+
+ uno::Any aValue;
+ bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nSourceWhich )).GetValue() );
+ if( !bUseSourceFormat )
+ {
+ SfxItemState aState = rItemSet.GetItemState( nWhichId );
+ if( aState == SFX_ITEM_SET )
+ {
+ sal_Int32 nFmt = static_cast< sal_Int32 >(
+ static_cast< const SfxUInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue());
+ aValue = uno::makeAny(nFmt);
+ }
+ else
+ return bChanged;
+ }
+
+ uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
+ if( bOverwriteAttributedDataPointsAlso )
+ {
+ Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
+ if( aValue != aOldValue ||
+ ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
+ {
+ ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aValue );
+ bChanged = true;
+ }
+ }
+ else if( aOldValue != aValue )
+ {
+ xPropertySet->setPropertyValue(aPropertyName, aValue );
+ bChanged = true;
+ }
+ return bChanged;
+}
+
+bool lcl_UseSourceFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
+{
+ bool bChanged = false;
+ if( !xPropertySet.is() )
+ return bChanged;
+ rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" );
+ USHORT nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
+
+ if( SFX_ITEM_SET != rItemSet.GetItemState( nWhichId ) )
+ return bChanged;
+
+ uno::Any aNewValue;
+ bool bUseSourceFormat = (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() );
+ if( !bUseSourceFormat )
+ {
+ SfxItemState aState = rItemSet.GetItemState( nFormatWhich );
+ if( aState == SFX_ITEM_SET )
+ {
+ sal_Int32 nFormatKey = static_cast< sal_Int32 >(
+ static_cast< const SfxUInt32Item & >(
+ rItemSet.Get( nFormatWhich )).GetValue());
+ aNewValue <<= nFormatKey;
+ }
+ else
+ return bChanged;
+ }
+
+ uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) );
+ if( bOverwriteAttributedDataPointsAlso )
+ {
+ Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY);
+ if( aNewValue != aOldValue ||
+ ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) )
+ {
+ ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, aPropertyName, aNewValue );
+ bChanged = true;
+ }
+ }
+ else if( aOldValue != aNewValue )
+ {
+ xPropertySet->setPropertyValue( aPropertyName, aNewValue );
+ bChanged = true;
+ }
+
+ return bChanged;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+DataPointItemConverter::DataPointItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ const uno::Reference< uno::XComponentContext > & xContext,
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ const uno::Reference< XDataSeries > & xSeries,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ NumberFormatterWrapper * pNumFormatter,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::eGraphicObjectType eMapTo /* = FILL_PROPERTIES */,
+ ::std::auto_ptr< awt::Size > pRefSize /* = NULL */,
+ bool bDataSeries /* = false */,
+ bool bUseSpecialFillColor /* = false */,
+ sal_Int32 nSpecialFillColor /* =0 */,
+ bool bOverwriteLabelsForAttributedDataPointsAlso /*false*/,
+ sal_Int32 nNumberFormat,
+ sal_Int32 nPercentNumberFormat
+ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_pNumberFormatterWrapper( pNumFormatter ),
+ m_bDataSeries( bDataSeries ),
+ m_bOverwriteLabelsForAttributedDataPointsAlso(m_bDataSeries && bOverwriteLabelsForAttributedDataPointsAlso),
+ m_bUseSpecialFillColor(bUseSpecialFillColor),
+ m_nSpecialFillColor(nSpecialFillColor),
+ m_nNumberFormat(nNumberFormat),
+ m_nPercentNumberFormat(nPercentNumberFormat),
+ m_aAvailableLabelPlacements(),
+ m_bForbidPercentValue(true)
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
+ m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
+ C2U( "ReferencePageSize" )));
+ if( bDataSeries )
+ {
+ m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
+ m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
+ }
+
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
+ uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xSeries ) );
+ bool bFound = false;
+ bool bAmbiguous = false;
+ sal_Bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, DiagramHelper::getDimension( xDiagram ), bSwapXAndY, xSeries );
+
+ m_bForbidPercentValue = AxisType::CATEGORY != ChartTypeHelper::getAxisType( xChartType, 0 );
+}
+
+DataPointItemConverter::~DataPointItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::DeleteItemConverterPtr() );
+}
+
+void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+
+ if( m_bUseSpecialFillColor )
+ {
+ Color aColor(m_nSpecialFillColor);
+ rOutItemSet.Put( XFillColorItem( String(), aColor ) );
+ }
+}
+
+bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * DataPointItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ if( m_bDataSeries )
+ return nRowWhichPairs;
+ return nDataPointWhichPairs;
+}
+
+bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType & rMap( lcl_GetDataPointPropertyMap());
+ ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutProperty =(*aIt).second;
+ return true;
+}
+
+
+bool DataPointItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_DATADESCR_SHOW_NUMBER:
+ case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
+ case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_SYMBOL:
+ {
+ const SfxBoolItem & rItem = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId ));
+
+ uno::Any aOldValue( GetPropertySet()->getPropertyValue( C2U( "Label" ) ));
+ chart2::DataPointLabel aLabel;
+ if( aOldValue >>= aLabel )
+ {
+ sal_Bool& rValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
+ (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
+ (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
+ sal_Bool bOldValue = rValue;
+ rValue = static_cast< sal_Bool >( rItem.GetValue() );
+ if( m_bOverwriteLabelsForAttributedDataPointsAlso )
+ {
+ Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ if( bOldValue != rValue ||
+ DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "Label" ), aOldValue ) )
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "Label" ), uno::makeAny( aLabel ) );
+ bChanged = true;
+ }
+ }
+ else if( bOldValue != rValue )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ));
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+ case SCHATTR_PERCENT_NUMBERFORMAT_VALUE: //fall through intended
+ {
+ bChanged = lcl_NumberFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_SOURCE:
+ case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE: //fall through intended
+ {
+ bChanged = lcl_UseSourceFormatFromItemToPropertySet( nWhichId, rItemSet, GetPropertySet(), m_bOverwriteLabelsForAttributedDataPointsAlso );
+ }
+ break;
+
+ case SCHATTR_DATADESCR_SEPARATOR:
+ {
+ rtl::OUString aNewValue = static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue();
+ rtl::OUString aOldValue;
+ try
+ {
+ GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aOldValue;
+ if( m_bOverwriteLabelsForAttributedDataPointsAlso )
+ {
+ Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ if( !aOldValue.equals(aNewValue) ||
+ DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "LabelSeparator" ), uno::makeAny( aOldValue ) ) )
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "LabelSeparator" ), uno::makeAny( aNewValue ) );
+ bChanged = true;
+ }
+ }
+ else if( !aOldValue.equals(aNewValue) )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "LabelSeparator" ), uno::makeAny( aNewValue ));
+ bChanged = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ break;
+
+ case SCHATTR_DATADESCR_PLACEMENT:
+ {
+
+ try
+ {
+ sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+ sal_Int32 nOld =0;
+ if( !(GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nOld) )
+ {
+ if( m_aAvailableLabelPlacements.getLength() )
+ nOld = m_aAvailableLabelPlacements[0];
+ }
+ if( m_bOverwriteLabelsForAttributedDataPointsAlso )
+ {
+ Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY);
+ if( nOld!=nNew ||
+ DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nOld ) ) )
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "LabelPlacement" ), uno::makeAny( nNew ) );
+ bChanged = true;
+ }
+ }
+ else if( nOld!=nNew )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "LabelPlacement" ), uno::makeAny( nNew ));
+ bChanged = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ break;
+
+ case SCHATTR_STYLE_SYMBOL:
+ {
+ sal_Int32 nStyle =
+ static_cast< const SfxInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ chart2::Symbol aSymbol;
+
+ GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
+ sal_Int32 nOldStyle = lcl_getSymbolStyleForSymbol( aSymbol );
+
+ if( nStyle != nOldStyle )
+ {
+ bool bDeleteSymbol = false;
+ switch( nStyle )
+ {
+ case SVX_SYMBOLTYPE_NONE:
+ aSymbol.Style = chart2::SymbolStyle_NONE;
+ break;
+ case SVX_SYMBOLTYPE_AUTO:
+ aSymbol.Style = chart2::SymbolStyle_AUTO;
+ break;
+ case SVX_SYMBOLTYPE_BRUSHITEM:
+ aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
+ break;
+ case SVX_SYMBOLTYPE_UNKNOWN:
+ bDeleteSymbol = true;
+ break;
+
+ default:
+ aSymbol.Style = chart2::SymbolStyle_STANDARD;
+ aSymbol.StandardSymbol = nStyle;
+ }
+
+ if( bDeleteSymbol )
+ GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::Any());
+ else
+ GetPropertySet()->setPropertyValue( C2U( "Symbol" ),
+ uno::makeAny( aSymbol ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_SYMBOL_SIZE:
+ {
+ Size aSize = static_cast< const SvxSizeItem & >(
+ rItemSet.Get( nWhichId )).GetSize();
+ chart2::Symbol aSymbol;
+
+ GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
+ if( aSize.getWidth() != aSymbol.Size.Width ||
+ aSize.getHeight() != aSymbol.Size.Height )
+ {
+ aSymbol.Size.Width = aSize.getWidth();
+ aSymbol.Size.Height = aSize.getHeight();
+
+ GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_SYMBOL_BRUSH:
+ {
+ const SvxBrushItem & rBrshItem( static_cast< const SvxBrushItem & >(
+ rItemSet.Get( nWhichId )));
+ uno::Any aXGraphicAny;
+ const Graphic *pGraphic( rBrshItem.GetGraphic());
+ if( pGraphic )
+ {
+ uno::Reference< graphic::XGraphic > xGraphic( pGraphic->GetXGraphic());
+ if( xGraphic.is())
+ {
+ aXGraphicAny <<= xGraphic;
+ chart2::Symbol aSymbol;
+ GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
+ if( aSymbol.Graphic != xGraphic )
+ {
+ aSymbol.Graphic = xGraphic;
+ GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ double fValue = static_cast< double >(
+ static_cast< const SfxInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ double fOldValue = 0.0;
+ bool bPropExisted =
+ ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldValue );
+
+ if( ! bPropExisted ||
+ ( bPropExisted && fOldValue != fValue ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void DataPointItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_DATADESCR_SHOW_NUMBER:
+ case SCHATTR_DATADESCR_SHOW_PERCENTAGE:
+ case SCHATTR_DATADESCR_SHOW_CATEGORY:
+ case SCHATTR_DATADESCR_SHOW_SYMBOL:
+ {
+ chart2::DataPointLabel aLabel;
+ if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel )
+ {
+ sal_Bool bValue = (SCHATTR_DATADESCR_SHOW_NUMBER==nWhichId) ? aLabel.ShowNumber : (
+ (SCHATTR_DATADESCR_SHOW_PERCENTAGE==nWhichId) ? aLabel.ShowNumberInPercent : (
+ (SCHATTR_DATADESCR_SHOW_CATEGORY==nWhichId) ? aLabel.ShowCategoryName : aLabel.ShowLegendSymbol ));
+
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
+
+ if( m_bOverwriteLabelsForAttributedDataPointsAlso )
+ {
+ if( DataSeriesHelper::hasAttributedDataPointDifferentValue(
+ Reference< chart2::XDataSeries >( GetPropertySet(), uno::UNO_QUERY), C2U( "Label" ), uno::makeAny(aLabel) ) )
+ {
+ rOutItemSet.InvalidateItem(nWhichId);
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+ {
+ sal_Int32 nKey = 0;
+ if( !(GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nKey) )
+ nKey = m_nNumberFormat;
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
+ }
+ break;
+
+ case SCHATTR_PERCENT_NUMBERFORMAT_VALUE:
+ {
+ sal_Int32 nKey = 0;
+ if( !(GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )) >>= nKey) )
+ nKey = m_nPercentNumberFormat;
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_SOURCE:
+ {
+ bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
+ rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
+ }
+ break;
+ case SCHATTR_PERCENT_NUMBERFORMAT_SOURCE:
+ {
+ bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "PercentageNumberFormat" )).hasValue());
+ rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
+ }
+ break;
+
+ case SCHATTR_DATADESCR_SEPARATOR:
+ {
+ rtl::OUString aValue;
+ try
+ {
+ GetPropertySet()->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aValue;
+ rOutItemSet.Put( SfxStringItem( nWhichId, aValue ));
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ break;
+
+ case SCHATTR_DATADESCR_PLACEMENT:
+ {
+ try
+ {
+ sal_Int32 nPlacement=0;
+ if( GetPropertySet()->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nPlacement )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, nPlacement ));
+ else if( m_aAvailableLabelPlacements.getLength() )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_aAvailableLabelPlacements[0] ));
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ break;
+
+ case SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS:
+ {
+ SvULongs aList;
+ for ( sal_Int32 nN=0; nN<m_aAvailableLabelPlacements.getLength(); nN++ )
+ aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< USHORT >(nN) );
+ rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
+ }
+ break;
+
+ case SCHATTR_DATADESCR_NO_PERCENTVALUE:
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
+ }
+ break;
+
+ case SCHATTR_STYLE_SYMBOL:
+ {
+ chart2::Symbol aSymbol;
+ if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, lcl_getSymbolStyleForSymbol( aSymbol ) ));
+ }
+ break;
+
+ case SCHATTR_SYMBOL_SIZE:
+ {
+ chart2::Symbol aSymbol;
+ if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
+ rOutItemSet.Put(
+ SvxSizeItem( nWhichId, Size( aSymbol.Size.Width, aSymbol.Size.Height ) ));
+ }
+ break;
+
+ case SCHATTR_SYMBOL_BRUSH:
+ {
+ chart2::Symbol aSymbol;
+ if(( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
+ && aSymbol.Graphic.is() )
+ {
+ rOutItemSet.Put( SvxBrushItem( Graphic( aSymbol.Graphic ), GPOS_MM, SCHATTR_SYMBOL_BRUSH ));
+ }
+ }
+ break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ double fValue = 0;
+
+ if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fValue )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
+ ::rtl::math::round( fValue * 100.0 ) ) ));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
new file mode 100755
index 000000000000..0e2e6cdd4644
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
@@ -0,0 +1,456 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ErrorBarItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "ErrorBar.hxx"
+#include "PropertyHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "StatisticsHelper.hxx"
+
+#include "GraphicPropertyItemConverter.hxx"
+
+#include <svl/stritem.hxx>
+#include <svx/chrtitem.hxx>
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+#include <functional>
+#include <algorithm>
+#include <vector>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+void lcl_getErrorValues( const uno::Reference< beans::XPropertySet > & xErrorBarProp,
+ double & rOutPosError, double & rOutNegError )
+{
+ if( ! xErrorBarProp.is())
+ return;
+
+ try
+ {
+ xErrorBarProp->getPropertyValue( C2U( "PositiveError" )) >>= rOutPosError;
+ xErrorBarProp->getPropertyValue( C2U( "NegativeError" )) >>= rOutNegError;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void lcl_getErrorIndicatorValues(
+ const uno::Reference< beans::XPropertySet > & xErrorBarProp,
+ bool & rOutShowPosError, bool & rOutShowNegError )
+{
+ if( ! xErrorBarProp.is())
+ return;
+
+ try
+ {
+ xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= rOutShowPosError;
+ xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= rOutShowNegError;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+ErrorBarItemConverter::ErrorBarItemConverter(
+ const uno::Reference< frame::XModel > & xModel,
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_spGraphicConverter( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_PROPERTIES )),
+ m_xModel( xModel )
+{}
+
+ErrorBarItemConverter::~ErrorBarItemConverter()
+{}
+
+void ErrorBarItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ m_spGraphicConverter->FillItemSet( rOutItemSet );
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool ErrorBarItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = m_spGraphicConverter->ApplyItemSet( rItemSet );
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * ErrorBarItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nErrorBarWhichPairs;
+}
+
+bool ErrorBarItemConverter::GetItemProperty(
+ tWhichIdType /* nWhichId */,
+ tPropertyNameWithMemberId & /* rOutProperty */ ) const
+{
+ return false;
+}
+
+bool ErrorBarItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ // Attention !!! This case must be passed before SCHATTR_STAT_PERCENT,
+ // SCHATTR_STAT_BIGERROR, SCHATTR_STAT_CONSTPLUS,
+ // SCHATTR_STAT_CONSTMINUS and SCHATTR_STAT_INDICATE
+ case SCHATTR_STAT_KIND_ERROR:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet());
+
+ SvxChartKindError eErrorKind =
+ static_cast< const SvxChartKindErrorItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+
+ if( !xErrorBarProp.is() && eErrorKind == CHERROR_NONE)
+ {
+ //nothing to do
+ }
+ else
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+
+ switch( eErrorKind )
+ {
+ case CHERROR_NONE:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE; break;
+ case CHERROR_VARIANT:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE; break;
+ case CHERROR_SIGMA:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION; break;
+ case CHERROR_PERCENT:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE; break;
+ case CHERROR_BIGERROR:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN; break;
+ case CHERROR_CONST:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE; break;
+ case CHERROR_STDERROR:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR; break;
+ case CHERROR_RANGE:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::FROM_DATA; break;
+ }
+
+ xErrorBarProp->setPropertyValue( C2U( "ErrorBarStyle" ),
+ uno::makeAny( nStyle ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_PERCENT:
+ case SCHATTR_STAT_BIGERROR:
+ {
+ OSL_ENSURE( false, "Deprectaed item" );
+ uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet());
+
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+
+ if( ! ( ::rtl::math::approxEqual( fPos, fValue ) &&
+ ::rtl::math::approxEqual( fNeg, fValue )))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "PositiveError" ),
+ uno::makeAny( fValue ));
+ xErrorBarProp->setPropertyValue( C2U( "NegativeError" ),
+ uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTPLUS:
+ {
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
+
+ if( ! ::rtl::math::approxEqual( fPos, fValue ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "PositiveError" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTMINUS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet());
+
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+
+ if( ! ::rtl::math::approxEqual( fNeg, fValue ))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "NegativeError" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_INDICATE:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet());
+
+ SvxChartIndicate eIndicate =
+ static_cast< const SvxChartIndicateItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+
+ bool bNewIndPos = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_UP );
+ bool bNewIndNeg = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_DOWN );
+
+ bool bShowPos, bShowNeg;
+ lcl_getErrorIndicatorValues( xErrorBarProp, bShowPos, bShowNeg );
+
+ if( ( bShowPos != bNewIndPos ||
+ bShowNeg != bNewIndNeg ))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny( bNewIndPos ));
+ xErrorBarProp->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny( bNewIndNeg ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_RANGE_POS:
+ case SCHATTR_STAT_RANGE_NEG:
+ {
+ // @todo: also be able to deal with x-error bars
+ const bool bYError = true;
+ uno::Reference< chart2::data::XDataSource > xErrorBarSource( GetPropertySet(), 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( xErrorBarSource.is() && xDataProvider.is())
+ {
+ ::rtl::OUString aNewRange( static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue());
+ bool bApplyNewRange = false;
+
+ bool bIsPositiveValue( nWhichId == SCHATTR_STAT_RANGE_POS );
+ if( xChartDoc->hasInternalDataProvider())
+ {
+ if( aNewRange.getLength())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, bIsPositiveValue, bYError ));
+ if( ! xSeq.is())
+ {
+ // no data range for error bars yet => create
+ uno::Reference< chart2::XInternalDataProvider > xIntDataProvider( xDataProvider, uno::UNO_QUERY );
+ OSL_ASSERT( xIntDataProvider.is());
+ if( xIntDataProvider.is())
+ {
+ xIntDataProvider->appendSequence();
+ aNewRange = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("last"));
+ bApplyNewRange = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, bIsPositiveValue, bYError ));
+ bApplyNewRange =
+ ! ( xSeq.is() && aNewRange.equals( xSeq->getSourceRangeRepresentation()));
+ }
+
+ if( bApplyNewRange )
+ StatisticsHelper::setErrorDataSequence(
+ xErrorBarSource, xDataProvider, aNewRange, bIsPositiveValue, bYError );
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void ErrorBarItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_STAT_KIND_ERROR:
+ {
+ SvxChartKindError eErrorKind = CHERROR_NONE;
+ uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet());
+
+ sal_Int32 nStyle = 0;
+ if( xErrorBarProp->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle )
+ {
+ switch( nStyle )
+ {
+ case ::com::sun::star::chart::ErrorBarStyle::NONE:
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
+ eErrorKind = CHERROR_VARIANT; break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
+ eErrorKind = CHERROR_SIGMA; break;
+ case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
+ eErrorKind = CHERROR_CONST; break;
+ case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
+ eErrorKind = CHERROR_PERCENT; break;
+ case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ eErrorKind = CHERROR_BIGERROR; break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
+ eErrorKind = CHERROR_STDERROR; break;
+ case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
+ eErrorKind = CHERROR_RANGE; break;
+ }
+ }
+ rOutItemSet.Put( SvxChartKindErrorItem( eErrorKind, SCHATTR_STAT_KIND_ERROR ));
+ }
+ break;
+
+ case SCHATTR_STAT_PERCENT:
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_STAT_BIGERROR:
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTPLUS:
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTMINUS:
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( GetPropertySet(), fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_STAT_INDICATE:
+ {
+ SvxChartIndicate eIndicate = CHINDICATE_BOTH;
+ bool bShowPos, bShowNeg;
+ lcl_getErrorIndicatorValues( GetPropertySet(), bShowPos, bShowNeg );
+
+ if( bShowPos )
+ {
+ if( bShowNeg )
+ eIndicate = CHINDICATE_BOTH;
+ else
+ eIndicate = CHINDICATE_UP;
+ }
+ else
+ {
+ if( bShowNeg )
+ eIndicate = CHINDICATE_DOWN;
+ else
+ eIndicate = CHINDICATE_NONE;
+ }
+ rOutItemSet.Put( SvxChartIndicateItem( eIndicate, SCHATTR_STAT_INDICATE ));
+ }
+ break;
+
+ case SCHATTR_STAT_RANGE_POS:
+ case SCHATTR_STAT_RANGE_NEG:
+ {
+ uno::Reference< chart2::data::XDataSource > xErrorBarSource( GetPropertySet(), uno::UNO_QUERY );
+ if( xErrorBarSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, (nWhichId == SCHATTR_STAT_RANGE_POS) /*, true */ /* y */ ));
+ if( xSeq.is())
+ rOutItemSet.Put( SfxStringItem( nWhichId, String( xSeq->getSourceRangeRepresentation())));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
new file mode 100644
index 000000000000..c732dfe80ede
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -0,0 +1,809 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "PropertyHelper.hxx"
+#include "CommonConverters.hxx"
+#include <editeng/memberids.hrc>
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/xflbstit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xlntrit.hxx>
+#include <editeng/eeitem.hxx>
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+// for XFillGradientStepCountItem
+#include <svx/xgrscit.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/chart2/FillBitmap.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetDataPointFilledPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aDataPointPropertyFilledMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLCOLOR, "Color", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "Transparency", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "Gradient", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLHATCH, "Hatch", 0 )
+ IPM_MAP_ENTRY( XATTR_LINECOLOR, "BorderColor", 0 )
+ IPM_MAP_ENTRY( XATTR_LINESTYLE, "BorderStyle", 0 )
+ IPM_MAP_ENTRY( XATTR_LINEWIDTH, "BorderWidth", 0 )
+// IPM_MAP_ENTRY( XATTR_LINEDASH, "BorderDash", 0 )
+// IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "BorderTransparency", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 )
+ );
+
+ return aDataPointPropertyFilledMap;
+}
+::comphelper::ItemPropertyMapType & lcl_GetDataPointLinePropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aDataPointPropertyLineMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( XATTR_LINECOLOR, "Color", 0 )
+// IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "Transparency", 0 )
+ IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 )
+ IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 )
+// IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 )
+ );
+
+ return aDataPointPropertyLineMap;
+}
+::comphelper::ItemPropertyMapType & lcl_GetLinePropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aLinePropertyMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 )
+ IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 )
+// IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 )
+ IPM_MAP_ENTRY( XATTR_LINECOLOR, "LineColor", 0 )
+// IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "LineTransparence", 0 )
+ IPM_MAP_ENTRY( XATTR_LINEJOINT, "LineJoint", 0 )
+ );
+
+ return aLinePropertyMap;
+}
+::comphelper::ItemPropertyMapType & lcl_GetFillPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aFillPropertyMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLCOLOR, "FillColor", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "FillTransparence", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLBITMAP, "FillBitmapName", MID_NAME )
+// IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "FillGradient", 0 )
+// IPM_MAP_ENTRY( XATTR_FILLHATCH, "FillHatch", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 )
+ IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 )
+ );
+
+ return aFillPropertyMap;
+}
+
+bool lcl_supportsFillProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType )
+{
+ return ( eType == ::chart::wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT ||
+ eType == ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES ||
+ eType == ::chart::wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES );
+}
+
+bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType )
+{
+ return ( eType != ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES );
+}
+
+bool lcl_SetContentForNamedProperty(
+ const uno::Reference< lang::XMultiServiceFactory > & xFactory,
+ const ::rtl::OUString & rTableName,
+ NameOrIndex & rItem, BYTE nMemberId )
+{
+ bool bResult = false;
+ if( xFactory.is())
+ {
+ ::rtl::OUString aPropertyValue( rItem.GetName());
+ uno::Reference< container::XNameAccess > xNameAcc(
+ xFactory->createInstance( rTableName ),
+ uno::UNO_QUERY );
+ if( xNameAcc.is() &&
+ xNameAcc->hasByName( aPropertyValue ))
+ {
+ rItem.PutValue( xNameAcc->getByName( aPropertyValue ), nMemberId );
+ bResult = true;
+ }
+ }
+ return bResult;
+}
+
+} // anonymous namespace
+
+// ========================================
+
+namespace chart
+{
+namespace wrapper
+{
+
+GraphicPropertyItemConverter::GraphicPropertyItemConverter(
+ const uno::Reference<
+ beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ eGraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_eGraphicObjectType( eObjectType ),
+ m_rDrawModel( rDrawModel ),
+ m_xNamedPropertyTableFactory( xNamedPropertyContainerFactory )
+{}
+
+GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
+{}
+
+const USHORT * GraphicPropertyItemConverter::GetWhichPairs() const
+{
+ const USHORT * pResult = NULL;
+
+ switch( m_eGraphicObjectType )
+ {
+ case LINE_DATA_POINT:
+ case FILLED_DATA_POINT:
+ pResult = nRowWhichPairs; break;
+ case LINE_PROPERTIES:
+ pResult = nLinePropertyWhichPairs; break;
+ case FILL_PROPERTIES:
+ pResult = nFillPropertyWhichPairs; break;
+ case LINE_AND_FILL_PROPERTIES:
+ pResult = nLineAndFillPropertyWhichPairs; break;
+ }
+
+ return pResult;
+}
+
+bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType::const_iterator aEndIt;
+ ::comphelper::ItemPropertyMapType::const_iterator aIt;
+
+ switch( m_eGraphicObjectType )
+ {
+ case LINE_DATA_POINT:
+ aEndIt = lcl_GetDataPointLinePropertyMap().end();
+ aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId );
+ break;
+ case FILLED_DATA_POINT:
+ aEndIt = lcl_GetDataPointFilledPropertyMap().end();
+ aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId );
+ break;
+ case LINE_PROPERTIES:
+ aEndIt = lcl_GetLinePropertyMap().end();
+ aIt = lcl_GetLinePropertyMap().find( nWhichId );
+ break;
+
+ case FILL_PROPERTIES:
+ aEndIt = lcl_GetFillPropertyMap().end();
+ aIt = lcl_GetFillPropertyMap().find( nWhichId );
+ break;
+
+ case LINE_AND_FILL_PROPERTIES:
+ // line
+ aEndIt = lcl_GetLinePropertyMap().end();
+ aIt = lcl_GetLinePropertyMap().find( nWhichId );
+
+ // not found => try fill
+ if( aIt == aEndIt )
+ {
+ aEndIt = lcl_GetFillPropertyMap().end();
+ aIt = lcl_GetFillPropertyMap().find( nWhichId );
+ }
+ break;
+ }
+
+ if( aIt == aEndIt )
+ return false;
+
+ rOutProperty =(*aIt).second;
+ return true;
+}
+
+void GraphicPropertyItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+// if( m_eGraphicObjectType == LINE_DATA_POINT ||
+// m_eGraphicObjectType == LINE_PROPERTIES )
+// return;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBMP_TILE:
+ case XATTR_FILLBMP_STRETCH:
+ {
+ drawing::BitmapMode aMode = drawing::BitmapMode_REPEAT;
+ if( GetPropertySet()->getPropertyValue( C2U("FillBitmapMode")) >>= aMode )
+ {
+ rOutItemSet.Put( XFillBmpTileItem( aMode == drawing::BitmapMode_REPEAT ));
+ rOutItemSet.Put( XFillBmpStretchItem( aMode == drawing::BitmapMode_STRETCH ));
+ }
+ }
+ break;
+
+ case XATTR_FILLFLOATTRANSPARENCE:
+ try
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "TransparencyGradientName" )
+ : C2U( "FillTransparenceGradientName" );
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ));
+ if( aValue.hasValue())
+ {
+ XFillFloatTransparenceItem aItem;
+ aItem.PutValue( aValue, MID_NAME );
+
+ lcl_SetContentForNamedProperty(
+ m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.TransparencyGradientTable"),
+ aItem, MID_FILLGRADIENT );
+
+ // this is important to enable the item
+ ::rtl::OUString aName;
+ if( (aValue >>= aName) &&
+ aName.getLength())
+ {
+ aItem.SetEnabled( TRUE );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+
+ case XATTR_GRADIENTSTEPCOUNT:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "GradientStepCount" )
+ : C2U( "FillGradientStepCount" );
+
+ sal_Int16 nStepCount = 0;
+ uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ) );
+ if( hasLongOrShortValue(aValue) )
+ {
+ nStepCount = getShortForLongAlso(aValue);
+ rOutItemSet.Put( XGradientStepCountItem( nStepCount ));
+ }
+ }
+ break;
+
+ case XATTR_LINEDASH:
+ if( lcl_supportsLineProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderDashName" )
+ : C2U( "LineDashName" );
+
+ XLineDashItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
+
+ lcl_SetContentForNamedProperty(
+ m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.DashTable"),
+ aItem, MID_LINEDASH );
+
+ // translate model name to UI-name for predefined entries, so
+ // that the correct entry is chosen in the list of UI-names
+ XLineDashItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ case XATTR_FILLGRADIENT:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "GradientName" )
+ : C2U( "FillGradientName" );
+
+ XFillGradientItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
+
+ lcl_SetContentForNamedProperty(
+ m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.GradientTable"),
+ aItem, MID_FILLGRADIENT );
+
+ // translate model name to UI-name for predefined entries, so
+ // that the correct entry is chosen in the list of UI-names
+ XFillGradientItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ case XATTR_FILLHATCH:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "HatchName" )
+ : C2U( "FillHatchName" );
+
+ XFillHatchItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
+
+ lcl_SetContentForNamedProperty(
+ m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.HatchTable"),
+ aItem, MID_FILLHATCH );
+
+ // translate model name to UI-name for predefined entries, so
+ // that the correct entry is chosen in the list of UI-names
+ XFillHatchItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ case XATTR_FILLBITMAP:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ XFillBitmapItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" ) ), MID_NAME );
+
+ lcl_SetContentForNamedProperty(
+ m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.BitmapTable"),
+ aItem, MID_GRAFURL );
+
+ // translate model name to UI-name for predefined entries, so
+ // that the correct entry is chosen in the list of UI-names
+ XFillBitmapItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
+ // instead of sal_Int16
+ case XATTR_LINETRANSPARENCE:
+ if( lcl_supportsLineProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderTransparency" )
+ : (m_eGraphicObjectType == LINE_DATA_POINT)
+ ? C2U( "Transparency" )
+ : C2U( "LineTransparence" );
+
+ XLineTransparenceItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
+
+ rOutItemSet.Put( aItem );
+ }
+ break;
+
+ // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
+ // instead of sal_Int16
+ case XATTR_FILLTRANSPARENCE:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Transparency" )
+ : C2U( "FillTransparence" );
+
+ XFillTransparenceItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
+
+ rOutItemSet.Put( aItem );
+ }
+ break;
+ }
+}
+
+bool GraphicPropertyItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBMP_STRETCH:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ const ::rtl::OUString aModePropName = C2U("FillBitmapMode");
+ bool bStretched = static_cast< const XFillBmpStretchItem & >(
+ rItemSet.Get( XATTR_FILLBMP_STRETCH )).GetValue();
+ drawing::BitmapMode aMode =
+ (bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
+
+ aValue <<= aMode;
+ if( aValue != GetPropertySet()->getPropertyValue( aModePropName ))
+ {
+ GetPropertySet()->setPropertyValue( aModePropName, aValue );
+ bChanged = true;
+ }
+ }
+ break;
+
+ case XATTR_FILLBMP_TILE:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ const ::rtl::OUString aModePropName = C2U("FillBitmapMode");
+ bool bTiled = static_cast< const XFillBmpTileItem & >(
+ rItemSet.Get( XATTR_FILLBMP_TILE )).GetValue();
+ drawing::BitmapMode aMode =
+ (bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
+
+ aValue <<= aMode;
+ if( aValue != GetPropertySet()->getPropertyValue( aModePropName ))
+ {
+ GetPropertySet()->setPropertyValue( aModePropName, aValue );
+ bChanged = true;
+ }
+ }
+ break;
+
+ case XATTR_FILLFLOATTRANSPARENCE:
+ try
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "TransparencyGradientName" )
+ : C2U( "FillTransparenceGradientName" );
+
+ const XFillFloatTransparenceItem & rItem =
+ static_cast< const XFillFloatTransparenceItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.IsEnabled() &&
+ rItem.QueryValue( aValue, MID_NAME ))
+ {
+ uno::Any aGradient;
+ rItem.QueryValue( aGradient, MID_FILLGRADIENT );
+
+ // add TransparencyGradient to list if it does not already exist
+ ::rtl::OUString aPreferredName;
+ aValue >>= aPreferredName;
+ aValue <<= PropertyHelper::addTransparencyGradientUniqueNameToTable(
+ aGradient, m_xNamedPropertyTableFactory, aPreferredName );
+
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ else
+ {
+ ::rtl::OUString aName;
+ if( ( GetPropertySet()->getPropertyValue( aPropName ) >>= aName )
+ && aName.getLength() > 0 )
+ {
+ uno::Reference< beans::XPropertyState > xState( GetPropertySet(), uno::UNO_QUERY );
+ if( xState.is())
+ xState->setPropertyToDefault( aPropName );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+
+ case XATTR_GRADIENTSTEPCOUNT:
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "GradientStepCount" )
+ : C2U( "FillGradientStepCount" );
+
+ sal_Int16 nStepCount = ( static_cast< const XGradientStepCountItem & >(
+ rItemSet.Get( nWhichId ))).GetValue();
+
+ aValue <<= nStepCount;
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case XATTR_LINEDASH:
+ {
+ if( lcl_supportsLineProperties( m_eGraphicObjectType ))
+ {
+
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderDashName" )
+ : C2U( "LineDashName" );
+
+ const XLineDashItem & rItem =
+ static_cast< const XLineDashItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ // add LineDash to list
+ uno::Any aLineDash;
+ rItem.QueryValue( aLineDash, MID_LINEDASH );
+ ::rtl::OUString aPreferredName;
+ aValue >>= aPreferredName;
+ aValue <<= PropertyHelper::addLineDashUniqueNameToTable(
+ aLineDash, m_xNamedPropertyTableFactory, aPreferredName );
+
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case XATTR_FILLGRADIENT:
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "GradientName" )
+ : C2U( "FillGradientName" );
+
+ const XFillGradientItem & rItem =
+ static_cast< const XFillGradientItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ // add Gradient to list
+ uno::Any aGradient;
+ rItem.QueryValue( aGradient, MID_FILLGRADIENT );
+ ::rtl::OUString aPreferredName;
+ aValue >>= aPreferredName;
+ aValue <<= PropertyHelper::addGradientUniqueNameToTable(
+ aGradient, m_xNamedPropertyTableFactory, aPreferredName );
+
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case XATTR_FILLHATCH:
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "HatchName" )
+ : C2U( "FillHatchName" );
+
+ const XFillHatchItem & rItem =
+ static_cast< const XFillHatchItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ // add Hatch to list
+ uno::Any aHatch;
+ rItem.QueryValue( aHatch, MID_FILLHATCH );
+ ::rtl::OUString aPreferredName;
+ aValue >>= aPreferredName;
+ aValue <<= PropertyHelper::addHatchUniqueNameToTable(
+ aHatch, m_xNamedPropertyTableFactory, aPreferredName );
+
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case XATTR_FILLBITMAP:
+ {
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ const XFillBitmapItem & rItem =
+ static_cast< const XFillBitmapItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" )))
+ {
+ // add Bitmap to list
+ uno::Any aBitmap;
+ rItem.QueryValue( aBitmap, MID_GRAFURL );
+ ::rtl::OUString aPreferredName;
+ aValue >>= aPreferredName;
+ aValue <<= PropertyHelper::addBitmapUniqueNameToTable(
+ aBitmap, m_xNamedPropertyTableFactory, aPreferredName );
+
+ GetPropertySet()->setPropertyValue( C2U( "FillBitmapName" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
+ // instead of sal_Int16
+ case XATTR_LINETRANSPARENCE:
+ if( lcl_supportsLineProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderTransparency" )
+ : (m_eGraphicObjectType == LINE_DATA_POINT)
+ ? C2U( "Transparency" )
+ : C2U( "LineTransparence" );
+
+ const XLineTransparenceItem & rItem =
+ static_cast< const XLineTransparenceItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue ))
+ {
+ OSL_ENSURE( ! aValue.isExtractableTo(
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))),
+ "TransparenceItem QueryValue bug is fixed. Remove hack." );
+ sal_Int32 nValue = 0;
+ if( aValue >>= nValue )
+ {
+ OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
+ sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
+ aValue <<= nValueToSet;
+
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ else
+ {
+ OSL_ENSURE( false, "Wrong type in Transparency Any" );
+ }
+ }
+ }
+ break;
+
+ // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
+ // instead of sal_Int16
+ case XATTR_FILLTRANSPARENCE:
+ if( lcl_supportsFillProperties( m_eGraphicObjectType ))
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Transparency" )
+ : C2U( "FillTransparence" );
+
+ const XFillTransparenceItem & rItem =
+ static_cast< const XFillTransparenceItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue ))
+ {
+ OSL_ENSURE( ! aValue.isExtractableTo(
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))),
+ "TransparenceItem QueryValue bug is fixed. Remove hack." );
+ sal_Int32 nValue = 0;
+ if( aValue >>= nValue )
+ {
+ OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
+ sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
+ aValue <<= nValueToSet;
+
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ // if linear or no transparence is set, delete the gradient
+ ::rtl::OUString aTransGradPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "TransparencyGradientName" )
+ : C2U( "FillTransparenceGradientName" );
+ GetPropertySet()->setPropertyValue(
+ aTransGradPropName, uno::makeAny( ::rtl::OUString() ));
+
+ bChanged = true;
+ }
+ else
+ {
+ OSL_ENSURE( false, "Wrong type in Transparency Any" );
+ }
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
new file mode 100644
index 000000000000..5ee167260974
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ItemConverter.hxx"
+#include "macros.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+#include <svl/itemprop.hxx>
+#include <svl/itemiter.hxx>
+// header for class SfxWhichIter
+#include <svl/whiter.hxx>
+#include <svx/svxids.hrc>
+
+using namespace ::com::sun::star;
+
+namespace comphelper
+{
+
+ItemConverter::ItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool ) :
+ m_xPropertySet( rPropertySet ),
+ m_xPropertySetInfo( NULL ),
+ m_rItemPool( rItemPool ),
+ m_bIsValid( true )
+{
+ resetPropertySet( m_xPropertySet );
+}
+
+ItemConverter::~ItemConverter()
+{
+ stopAllComponentListening();
+}
+
+void ItemConverter::resetPropertySet(
+ const uno::Reference< beans::XPropertySet > & xPropSet )
+{
+ if( xPropSet.is())
+ {
+ stopAllComponentListening();
+ m_xPropertySet = xPropSet;
+ m_xPropertySetInfo = m_xPropertySet->getPropertySetInfo();
+
+ uno::Reference< lang::XComponent > xComp( m_xPropertySet, uno::UNO_QUERY );
+ if( xComp.is())
+ {
+ // method of base class ::utl::OEventListenerAdapter
+ startComponentListening( xComp );
+ }
+ }
+}
+
+SfxItemPool & ItemConverter::GetItemPool() const
+{
+ return m_rItemPool;
+}
+
+SfxItemSet ItemConverter::CreateEmptyItemSet() const
+{
+ return SfxItemSet( GetItemPool(), GetWhichPairs() );
+}
+
+uno::Reference< beans::XPropertySet > ItemConverter::GetPropertySet() const
+{
+ return m_xPropertySet;
+}
+
+void ItemConverter::_disposing( const lang::EventObject& rSource )
+{
+ if( rSource.Source == m_xPropertySet )
+ {
+ m_bIsValid = false;
+ }
+}
+
+void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ const USHORT * pRanges = rOutItemSet.GetRanges();
+ tPropertyNameWithMemberId aProperty;
+ SfxItemPool & rPool = GetItemPool();
+
+ OSL_ASSERT( pRanges != NULL );
+ OSL_ASSERT( m_xPropertySetInfo.is());
+ OSL_ASSERT( m_xPropertySet.is());
+
+ while( (*pRanges) != 0)
+ {
+ USHORT nBeg = (*pRanges);
+ ++pRanges;
+ USHORT nEnd = (*pRanges);
+ ++pRanges;
+
+ OSL_ASSERT( nBeg <= nEnd );
+ for( USHORT nWhich = nBeg; nWhich <= nEnd; ++nWhich )
+ {
+ if( GetItemProperty( nWhich, aProperty ))
+ {
+ // put the Property into the itemset
+ SfxPoolItem * pItem = rPool.GetDefaultItem( nWhich ).Clone();
+
+ if( pItem )
+ {
+ try
+ {
+ if( ! pItem->PutValue( m_xPropertySet->getPropertyValue( aProperty.first ),
+ aProperty.second // nMemberId
+ ))
+ {
+ delete pItem;
+ }
+ else
+ {
+ rOutItemSet.Put( *pItem, nWhich );
+ delete pItem;
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ delete pItem;
+ OSL_ENSURE( false,
+ ::rtl::OUStringToOString(
+ ex.Message +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ " - unknown Property: " )) + aProperty.first,
+ RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ catch( uno::Exception ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ FillSpecialItem( nWhich, rOutItemSet );
+ }
+ catch( uno::Exception ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+}
+
+void ItemConverter::FillSpecialItem(
+ USHORT /*nWhichId*/, SfxItemSet & /*rOutItemSet*/ ) const
+ throw( uno::Exception )
+{
+ OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
+}
+
+bool ItemConverter::ApplySpecialItem(
+ USHORT /*nWhichId*/, const SfxItemSet & /*rItemSet*/ )
+ throw( uno::Exception )
+{
+ OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
+ return false;
+}
+
+bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ OSL_ASSERT( m_xPropertySet.is());
+
+ bool bItemsChanged = false;
+ SfxItemIter aIter( rItemSet );
+ const SfxPoolItem * pItem = aIter.FirstItem();
+ tPropertyNameWithMemberId aProperty;
+ uno::Any aValue;
+
+ while( pItem )
+ {
+ if( rItemSet.GetItemState( pItem->Which(), FALSE ) == SFX_ITEM_SET )
+ {
+ if( GetItemProperty( pItem->Which(), aProperty ))
+ {
+ pItem->QueryValue( aValue, aProperty.second /* nMemberId */ );
+
+ try
+ {
+ if( aValue != m_xPropertySet->getPropertyValue( aProperty.first ))
+ {
+ m_xPropertySet->setPropertyValue( aProperty.first, aValue );
+ bItemsChanged = true;
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ OSL_ENSURE( false,
+ ::rtl::OUStringToOString(
+ ex.Message +
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ " - unknown Property: " )) + aProperty.first,
+ RTL_TEXTENCODING_ASCII_US).getStr());
+ }
+ catch( uno::Exception ex )
+ {
+ OSL_ENSURE( false, ::rtl::OUStringToOString(
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+ }
+ }
+ else
+ {
+ bItemsChanged = ApplySpecialItem( pItem->Which(), rItemSet ) || bItemsChanged;
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+
+ return bItemsChanged;
+}
+
+// --------------------------------------------------------------------------------
+
+//static
+void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet )
+{
+ SfxWhichIter aIter (rSourceSet);
+ USHORT nWhich = aIter.FirstWhich ();
+ const SfxPoolItem *pPoolItem = NULL;
+
+ while (nWhich)
+ {
+ if ((rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET) &&
+ (rDestSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET))
+ {
+ if (rSourceSet.Get(nWhich) != rDestSet.Get(nWhich))
+ {
+ if( SID_CHAR_DLG_PREVIEW_STRING != nWhich )
+ {
+ rDestSet.InvalidateItem(nWhich);
+ }
+ }
+ }
+ else if( rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_DONTCARE )
+ rDestSet.InvalidateItem(nWhich);
+
+ nWhich = aIter.NextWhich ();
+ }
+}
+
+} // namespace comphelper
diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
new file mode 100644
index 000000000000..3af6d9342f33
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LegendItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include <svx/chrtitem.hxx>
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+namespace wrapper
+{
+
+LegendItemConverter::LegendItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize ) :
+ ItemConverter( rPropertySet, rItemPool )
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ));
+ m_aConverters.push_back( new CharacterPropertyItemConverter(
+ rPropertySet, rItemPool, pRefSize,
+ C2U( "ReferencePageSize" ) ));
+}
+
+LegendItemConverter::~LegendItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::DeleteItemConverterPtr() );
+}
+
+void LegendItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool LegendItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * LegendItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nLegendWhichPairs;
+}
+
+bool LegendItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyNameWithMemberId & /*rOutProperty*/ ) const
+{
+ // No own (non-special) properties
+ return false;
+}
+
+
+bool LegendItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_LEGEND_POS:
+ {
+ chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END;
+ chart2::LegendPosition eOldPos;
+ bool bIsWide = false;
+ sal_Bool bShow = sal_True;
+
+ SvxChartLegendPos eItemPos =
+ static_cast< const SvxChartLegendPosItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ switch( eItemPos )
+ {
+ case CHLEGEND_LEFT:
+ eNewPos = chart2::LegendPosition_LINE_START;
+ break;
+ case CHLEGEND_RIGHT:
+ eNewPos = chart2::LegendPosition_LINE_END;
+ break;
+ case CHLEGEND_TOP:
+ eNewPos = chart2::LegendPosition_PAGE_START;
+ bIsWide = true;
+ break;
+ case CHLEGEND_BOTTOM:
+ eNewPos = chart2::LegendPosition_PAGE_END;
+ bIsWide = true;
+ break;
+
+ case CHLEGEND_NONE:
+ case CHLEGEND_NONE_LEFT:
+ case CHLEGEND_NONE_RIGHT:
+ case CHLEGEND_NONE_TOP:
+ case CHLEGEND_NONE_BOTTOM:
+ bShow = sal_False;
+ break;
+ }
+
+ try
+ {
+ sal_Bool bWasShown = sal_True;
+ if( ! (GetPropertySet()->getPropertyValue( C2U("Show")) >>= bWasShown) ||
+ ( bWasShown != bShow ))
+ {
+ GetPropertySet()->setPropertyValue( C2U("Show"), uno::makeAny( bShow ));
+ bChanged = true;
+ }
+
+ if( bShow )
+ {
+ if( ! ( GetPropertySet()->getPropertyValue( C2U( "AnchorPosition" )) >>= eOldPos ) ||
+ ( eOldPos != eNewPos ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos ));
+ chart2::LegendExpansion eExp = bIsWide
+ ? chart2::LegendExpansion_WIDE
+ : chart2::LegendExpansion_HIGH;
+ GetPropertySet()->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExp ));
+ GetPropertySet()->setPropertyValue( C2U( "RelativePosition" ), uno::Any());
+ bChanged = true;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void LegendItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_LEGEND_POS:
+ {
+ SvxChartLegendPos eItemPos( CHLEGEND_RIGHT );
+ chart2::LegendPosition ePos;
+
+ sal_Bool bShow = sal_True;
+ GetPropertySet()->getPropertyValue( C2U( "Show" )) >>= bShow;
+
+ if( ! bShow )
+ {
+ eItemPos = CHLEGEND_NONE;
+ }
+ else if( GetPropertySet()->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos )
+ {
+ switch( ePos )
+ {
+ case chart2::LegendPosition_LINE_START:
+ eItemPos = CHLEGEND_LEFT;
+ break;
+ case chart2::LegendPosition_LINE_END:
+ eItemPos = CHLEGEND_RIGHT;
+ break;
+ case chart2::LegendPosition_PAGE_START:
+ eItemPos = CHLEGEND_TOP;
+ break;
+ case chart2::LegendPosition_PAGE_END:
+ eItemPos = CHLEGEND_BOTTOM;
+ break;
+
+ case chart2::LegendPosition_CUSTOM:
+ default:
+ eItemPos = CHLEGEND_RIGHT;
+ break;
+ }
+ }
+
+ rOutItemSet.Put( SvxChartLegendPosItem( eItemPos, SCHATTR_LEGEND_POS ) );
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
new file mode 100644
index 000000000000..e111eb314360
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "MultipleChartConverters.hxx"
+
+#include "chartview/ChartSfxItemIds.hxx"
+#include "SchWhichPairs.hxx"
+#include "AxisItemConverter.hxx"
+#include "StatisticsItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "DataPointItemConverter.hxx"
+#include "ChartModelHelper.hxx"
+#include "TitleHelper.hxx"
+#include "TitleItemConverter.hxx"
+#include "AxisHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "DiagramHelper.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 chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------
+
+AllAxisItemConverter::AllAxisItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & /*xNamedPropertyContainerFactory*/,
+ ::std::auto_ptr< awt::Size > pRefSize )
+ : MultipleItemConverter( rItemPool )
+{
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
+ if( pRefSize.get())
+ m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
+ xObjectProperties, rItemPool, rDrawModel,
+ uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0,
+ ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize )) ));
+ else
+ m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
+ xObjectProperties, rItemPool, rDrawModel,
+ uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0 ) );
+ }
+}
+
+AllAxisItemConverter::~AllAxisItemConverter()
+{
+}
+
+const USHORT * AllAxisItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nAllAxisWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllGridItemConverter::AllGridItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
+ : MultipleItemConverter( rItemPool )
+{
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) );
+ for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
+ {
+ Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]);
+ m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
+ ::chart::wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ) );
+ }
+}
+
+AllGridItemConverter::~AllGridItemConverter()
+{
+}
+
+const USHORT * AllGridItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nGridWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllDataLabelItemConverter::AllDataLabelItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< awt::Size > pRefSize )
+ : MultipleItemConverter( rItemPool )
+{
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::ChartModelHelper::getDataSeries( xChartModel ));
+
+ ::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
+ for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
+ uno::Reference< uno::XComponentContext> xContext(0);//do not need Context for label properties
+
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, *aIt, -1/*nPointIndex*/, ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
+ xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
+
+ m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
+ xChartModel, xContext,
+ xObjectProperties, *aIt, rItemPool, rDrawModel, NULL,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::FILLED_DATA_POINT,
+ ::std::auto_ptr< awt::Size >( pRefSize.get() ? new awt::Size( *pRefSize ) : 0),
+ true, /*bDataSeries*/
+ false, /*bUseSpecialFillColor*/
+ 0, /*nSpecialFillColor*/
+ true /*bOverwriteLabelsForAttributedDataPointsAlso*/,
+ nNumberFormat, nPercentNumberFormat
+ ));
+ }
+}
+
+AllDataLabelItemConverter::~AllDataLabelItemConverter()
+{
+}
+
+const USHORT * AllDataLabelItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nDataLabelWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllTitleItemConverter::AllTitleItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< awt::Size > pRefSize )
+ : MultipleItemConverter( rItemPool )
+{
+ for(sal_Int32 nTitle = TitleHelper::TITLE_BEGIN; nTitle < TitleHelper::NORMAL_TITLE_END; nTitle++ )
+ {
+ uno::Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) );
+ if(!xTitle.is())
+ continue;
+ uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
+ ::std::auto_ptr< awt::Size > pSingleRefSize(0);
+ if( pRefSize.get())
+ pSingleRefSize = ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize ));
+ m_aConverters.push_back( new ::chart::wrapper::TitleItemConverter(
+ xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, pSingleRefSize ));
+ }
+}
+
+AllTitleItemConverter::~AllTitleItemConverter()
+{
+}
+
+const USHORT * AllTitleItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nTitleWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool )
+ : MultipleItemConverter( rItemPool )
+{
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::ChartModelHelper::getDataSeries( xChartModel ));
+
+ ::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
+ for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
+ m_aConverters.push_back( new ::chart::wrapper::StatisticsItemConverter(
+ xChartModel, xObjectProperties, rItemPool ));
+ }
+}
+
+AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter()
+{}
+
+const USHORT * AllSeriesStatisticsConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nStatWhichPairs;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx
new file mode 100644
index 000000000000..e24be80bb429
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "MultipleItemConverter.hxx"
+#include "ItemPropertyMap.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace comphelper
+{
+
+MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool )
+ : ItemConverter( NULL, rItemPool )
+{
+}
+MultipleItemConverter::~MultipleItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ DeleteItemConverterPtr() );
+}
+
+void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::vector< ItemConverter* >::const_iterator aIter = m_aConverters.begin();
+ const ::std::vector< ItemConverter* >::const_iterator aEnd = m_aConverters.end();
+ if( aIter != aEnd )
+ {
+ (*aIter)->FillItemSet( rOutItemSet );
+ aIter++;
+ }
+ for( ; aIter != aEnd; aIter++ )
+ {
+ SfxItemSet aSet = this->CreateEmptyItemSet();
+ (*aIter)->FillItemSet( aSet );
+ InvalidateUnequalItems( rOutItemSet, aSet );
+ }
+ // no own items
+}
+
+bool MultipleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ApplyItemSetFunc( rItemSet, bResult ));
+
+ // no own items
+ return bResult;
+}
+
+bool MultipleItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyNameWithMemberId & /*rOutProperty*/ ) const
+{
+ return false;
+}
+
+} // namespace comphelper
diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
new file mode 100644
index 000000000000..2fee8702e6d8
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "RegressionCurveItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+#include <svx/chrtitem.hxx>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+::chart::RegressionCurveHelper::tRegressionType lcl_convertRegressionType( SvxChartRegress eRegress )
+{
+ ::chart::RegressionCurveHelper::tRegressionType eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_NONE;
+ switch( eRegress )
+ {
+ case CHREGRESS_LINEAR:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
+ break;
+ case CHREGRESS_LOG:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LOG;
+ break;
+ case CHREGRESS_EXP:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_EXP;
+ break;
+ case CHREGRESS_POWER:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_POWER;
+ break;
+ case CHREGRESS_NONE:
+ break;
+ }
+ return eType;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+RegressionCurveItemConverter::RegressionCurveItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ const uno::Reference< chart2::XRegressionCurveContainer > & xRegCurveCnt,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_spGraphicConverter( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_PROPERTIES )),
+ m_xCurveContainer( xRegCurveCnt )
+{}
+
+RegressionCurveItemConverter::~RegressionCurveItemConverter()
+{}
+
+void RegressionCurveItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ m_spGraphicConverter->FillItemSet( rOutItemSet );
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool RegressionCurveItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = m_spGraphicConverter->ApplyItemSet( rItemSet );
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * RegressionCurveItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nRegressionCurveWhichPairs;
+}
+
+bool RegressionCurveItemConverter::GetItemProperty(
+ tWhichIdType /* nWhichId */, tPropertyNameWithMemberId & /* rOutProperty */ ) const
+{
+ // No own (non-special) properties
+ return false;
+}
+
+
+bool RegressionCurveItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY );
+ bool bChanged = false;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_REGRESSION_TYPE:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ SvxChartRegress eRegress = static_cast< SvxChartRegress >(
+ static_cast< sal_Int32 >( RegressionCurveHelper::getRegressionType( xCurve )));
+ SvxChartRegress eNewRegress = static_cast< const SvxChartRegressItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ if( eRegress != eNewRegress )
+ {
+ // note that changing the regression type changes the object
+ // for which this converter was created. Not optimal, but
+ // currently the only way to handle the type in the
+ // regression curve properties dialog
+ RegressionCurveHelper::replaceOrAddCurveAndReduceToOne(
+ lcl_convertRegressionType( eNewRegress ), m_xCurveContainer,
+ uno::Reference< uno::XComponentContext >());
+ uno::Reference< beans::XPropertySet > xNewPropSet(
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( m_xCurveContainer ),
+ uno::UNO_QUERY );
+ OSL_ASSERT( xNewPropSet.is());
+ if( xNewPropSet.is())
+ {
+ resetPropertySet( xNewPropSet );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_EQUATION:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ bool bNewShow = static_cast< BOOL >(
+ static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
+ OSL_ASSERT( xEqProp.is());
+ bool bOldShow = false;
+ if( xEqProp.is() &&
+ (xEqProp->getPropertyValue( C2U( "ShowEquation" )) >>= bOldShow) &&
+ bOldShow != bNewShow )
+ {
+ xEqProp->setPropertyValue( C2U( "ShowEquation" ), uno::makeAny( bNewShow ));
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_COEFF:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ bool bNewShow = static_cast< BOOL >(
+ static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
+ OSL_ASSERT( xEqProp.is());
+ bool bOldShow = false;
+ if( xEqProp.is() &&
+ (xEqProp->getPropertyValue( C2U( "ShowCorrelationCoefficient" )) >>= bOldShow) &&
+ bOldShow != bNewShow )
+ {
+ xEqProp->setPropertyValue( C2U( "ShowCorrelationCoefficient" ), uno::makeAny( bNewShow ));
+ bChanged = true;
+ }
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void RegressionCurveItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY );
+
+ switch( nWhichId )
+ {
+ case SCHATTR_REGRESSION_TYPE:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ SvxChartRegress eRegress = static_cast< SvxChartRegress >(
+ static_cast< sal_Int32 >( RegressionCurveHelper::getRegressionType( xCurve )));
+ rOutItemSet.Put( SvxChartRegressItem( eRegress, SCHATTR_REGRESSION_TYPE ));
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_EQUATION:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
+ OSL_ASSERT( xEqProp.is());
+ bool bShow = false;
+ if( xEqProp.is() &&
+ (xEqProp->getPropertyValue( C2U( "ShowEquation" )) >>= bShow))
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bShow ));
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_COEFF:
+ {
+ OSL_ASSERT( xCurve.is());
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties());
+ OSL_ASSERT( xEqProp.is());
+ bool bShow = false;
+ if( xEqProp.is() &&
+ (xEqProp->getPropertyValue( C2U( "ShowCorrelationCoefficient" )) >>= bShow))
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bShow ));
+ }
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
new file mode 100644
index 000000000000..6035f21696a9
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RegressionEquationItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "MultipleItemConverter.hxx"
+
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetEquationPropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aEquationPropertyMap;
+
+ return aEquationPropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+RegressionEquationItemConverter::RegressionEquationItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize ) :
+ ItemConverter( rPropertySet, rItemPool )
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ));
+
+ m_aConverters.push_back( new CharacterPropertyItemConverter(
+ rPropertySet, rItemPool, pRefSize, C2U("ReferencePageSize")));
+
+// // CharacterProperties are not at the title but at its contained XFormattedString objects
+// // take the first formatted string in the sequence
+// uno::Reference< chart2::XTitle > xTitle( rPropertySet, uno::UNO_QUERY );
+// if( xTitle.is())
+// {
+// uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText());
+// if( aStringSeq.getLength() > 0 )
+// {
+// m_aConverters.push_back(
+// new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet ));
+// }
+// }
+}
+
+RegressionEquationItemConverter::~RegressionEquationItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::DeleteItemConverterPtr() );
+}
+
+void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * RegressionEquationItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nRegEquationWhichPairs;
+}
+
+bool RegressionEquationItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType & rMap( lcl_GetEquationPropertyMap());
+ ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutProperty =(*aIt).second;
+ return true;
+}
+
+bool RegressionEquationItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+
+ switch( nWhichId )
+ {
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+ {
+// bool bUseSourceFormat =
+// (static_cast< const SfxBoolItem & >(
+// rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue() );
+
+// if( ! bUseSourceFormat )
+// {
+ uno::Any aValue( static_cast< sal_Int32 >(
+ static_cast< const SfxUInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue()));
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
+ bChanged = true;
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void RegressionEquationItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+ {
+ sal_Int32 nFormatKey = 0;
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nFormatKey )
+ {
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
new file mode 100644
index 000000000000..f7ddeb42c11e
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SCHWHICHPAIRS_HXX
+#define CHART_SCHWHICHPAIRS_HXX
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svx/xdef.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "chartview/ChartSfxItemIds.hxx"
+
+namespace
+{
+
+#define CHARACTER_WHICHPAIRS \
+ EE_ITEMS_START, EE_ITEMS_END, \
+ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
+
+const USHORT nTitleWhichPairs[] =
+{
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 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,
+ 0
+};
+
+const USHORT nAxisWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ CHARACTER_WHICHPAIRS,
+ 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_AXISTYPE, SCHATTR_AXISTYPE, // 39 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx
+ SCHATTR_AXIS_START, SCHATTR_AXIS_END, // 70 - 95 sch/schattr.hxx
+ SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx
+ 0
+};
+
+const USHORT nAllAxisWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ CHARACTER_WHICHPAIRS,
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx
+ SCHATTR_AXIS_SHOWDESCR, SCHATTR_AXIS_SHOWDESCR, // 85 sch/schattr.hxx
+ SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx
+ 0
+};
+
+const USHORT nGridWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ 0
+};
+
+const USHORT nLegendWhichPairs[] =
+{
+ 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
+};
+
+const USHORT nDataLabelWhichPairs[] =
+{
+ 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_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \
+ SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 sch/schattr.hxx*/ \
+ 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_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \
+ SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 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*/ \
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST /* 1244 - 1334 svx/svddef.hxx */
+
+const USHORT nDataPointWhichPairs[] =
+{
+ CHART_POINT_WHICHPAIRS,
+ 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
+
+const USHORT nSeriesOptionsWhichPairs[] =
+{
+ CHART_SERIES_OPTIONS_WHICHPAIRS,
+ 0
+};
+
+const USHORT nRowWhichPairs[] =
+{
+ CHART_POINT_WHICHPAIRS,
+ CHART_SERIES_OPTIONS_WHICHPAIRS,
+ 0
+};
+
+const USHORT 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
+};
+
+const USHORT nTextWhichPairs[] =
+{
+ CHARACTER_WHICHPAIRS,
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ 0
+};
+
+const USHORT nTextOrientWhichPairs[] =
+{
+ CHARACTER_WHICHPAIRS,
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ 0
+};
+
+const USHORT nStatWhichPairs[]=
+{
+ SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
+ SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
+ 0
+};
+
+const USHORT nErrorBarWhichPairs[]=
+{
+ SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ 0
+};
+
+// for CharacterProperties
+
+const USHORT nCharacterPropertyWhichPairs[] =
+{
+ CHARACTER_WHICHPAIRS,
+ 0
+};
+
+const USHORT nLinePropertyWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ 0
+};
+
+const USHORT 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 USHORT nLineAndFillPropertyWhichPairs[] =
+{
+ 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 USHORT nChartStyleWhichPairs[] =
+{
+ SCHATTR_DIAGRAM_STYLE, SCHATTR_DIAGRAM_STYLE,
+ 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 USHORT nRegressionCurveWhichPairs[] =
+{
+ SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ 0
+};
+
+const USHORT nRegEquationWhichPairs[] =
+{
+ 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,
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, // 10585 - 10585 svx/svxids.hrc
+ 0
+};
+
+} // anonymous namespace
+
+// CHART_SCHWHICHPAIRS_HXX
+#endif
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
new file mode 100644
index 000000000000..b1931d63cfbb
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "SeriesOptionsItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "MultipleItemConverter.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "DataSeriesHelper.hxx"
+
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+
+// for SfxBoolItem
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+
+//SfxIntegerListItem
+#include <svl/ilstitem.hxx>
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+
+#include <rtl/math.hxx>
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+namespace chart
+{
+namespace wrapper
+{
+
+// ========================================
+
+SeriesOptionsItemConverter::SeriesOptionsItemConverter(
+ const uno::Reference< frame::XModel >& xChartModel
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , const uno::Reference< beans::XPropertySet >& xPropertySet
+ , SfxItemPool& rItemPool )
+ : ItemConverter( xPropertySet, rItemPool )
+ , m_xChartModel(xChartModel)
+ , m_xCC(xContext)
+ , m_bAttachToMainAxis(true)
+ , m_bSupportingOverlapAndGapWidthProperties(false)
+ , m_bSupportingBarConnectors(false)
+ , m_nBarOverlap(0)
+ , m_nGapWidth(100)
+ , m_bConnectBars(false)
+ , m_bSupportingAxisSideBySide(false)
+ , m_bGroupBarsPerAxis(true)
+ , m_bAllSeriesAttachedToSameAxis(true)
+ , m_nAllSeriesAxisIndex(-1)
+ , m_bSupportingStartingAngle(false)
+ , m_nStartingAngle(90)
+ , m_bClockwise(false)
+ , m_aSupportedMissingValueTreatments()
+ , m_nMissingValueTreatment(0)
+ , m_bSupportingPlottingOfHiddenCells(false)
+ , m_bIncludeHiddenCells(true)
+{
+ 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 ) );
+
+ m_xCooSys = DataSeriesHelper::getCoordinateSystemOfSeries( xDataSeries, xDiagram );
+ if( m_xCooSys.is() )
+ {
+ uno::Reference< chart2::XAxis > 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 );
+ m_bSupportingOverlapAndGapWidthProperties = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
+
+ if( m_bSupportingOverlapAndGapWidthProperties )
+ {
+
+ sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+
+ uno::Sequence< sal_Int32 > m_aBarPositionSequence;
+ uno::Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
+ if( xChartTypeProps.is() )
+ {
+ if( xChartTypeProps->getPropertyValue( C2U( "OverlapSequence" ) ) >>= m_aBarPositionSequence )
+ {
+ if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() )
+ m_nBarOverlap = m_aBarPositionSequence[nAxisIndex];
+ }
+ if( xChartTypeProps->getPropertyValue( C2U( "GapwidthSequence" ) ) >>= m_aBarPositionSequence )
+ {
+ if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() )
+ m_nGapWidth = m_aBarPositionSequence[nAxisIndex];
+ }
+ }
+ }
+
+ m_bSupportingBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
+ if( m_bSupportingBarConnectors && xDiagramProperties.is() )
+ {
+ xDiagramProperties->getPropertyValue( C2U("ConnectBars")) >>= m_bConnectBars;
+ }
+
+ m_bSupportingAxisSideBySide = ChartTypeHelper::isSupportingAxisSideBySide( xChartType, nDimensionCount );
+ if( m_bSupportingAxisSideBySide && xDiagramProperties.is() )
+ {
+ xDiagramProperties->getPropertyValue( C2U("GroupBarsPerAxis")) >>= m_bGroupBarsPerAxis;
+ m_bAllSeriesAttachedToSameAxis = DataSeriesHelper::areAllSeriesAttachedToSameAxis( xChartType, m_nAllSeriesAxisIndex );
+ }
+
+ m_bSupportingStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
+ if( m_bSupportingStartingAngle )
+ {
+ xDiagramProperties->getPropertyValue( C2U( "StartingAngle" ) ) >>= m_nStartingAngle;
+ }
+
+ m_aSupportedMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType );
+ m_nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment(
+ ChartModelHelper::findDiagram(m_xChartModel), xChartType );
+
+ uno::Reference< XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ //test whether the data provider offers this property
+ xProp->getPropertyValue(C2U("IncludeHiddenCells"));
+ //if not exception is thrown the property is offered
+ m_bSupportingPlottingOfHiddenCells = true;
+ xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= m_bIncludeHiddenCells;
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+ }
+ }
+ catch( uno::Exception ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+SeriesOptionsItemConverter::~SeriesOptionsItemConverter()
+{
+}
+
+const USHORT * SeriesOptionsItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nSeriesOptionsWhichPairs;
+}
+
+bool SeriesOptionsItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyNameWithMemberId & /*rOutProperty*/ ) const
+{
+ return false;
+}
+
+bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ switch( nWhichId )
+ {
+ case SCHATTR_AXIS:
+ {
+ sal_Int32 nItemValue = static_cast< const SfxInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ bool bAttachToMainAxis = nItemValue == CHART_AXIS_PRIMARY_Y;
+ if( bAttachToMainAxis != m_bAttachToMainAxis )
+ {
+ //change model:
+ bChanged = DiagramHelper::attachSeriesToAxis( bAttachToMainAxis, uno::Reference< XDataSeries >::query( GetPropertySet() )
+ , ChartModelHelper::findDiagram(m_xChartModel), m_xCC );
+
+ if( bChanged )
+ m_bAttachToMainAxis = bAttachToMainAxis;
+ }
+ }
+ break;
+
+ case SCHATTR_BAR_OVERLAP:
+ case SCHATTR_BAR_GAPWIDTH:
+ {
+ if( m_bSupportingOverlapAndGapWidthProperties )
+ {
+ sal_Int32& rBarPosition = ( SCHATTR_BAR_OVERLAP == nWhichId ) ? m_nBarOverlap : m_nGapWidth;
+ rBarPosition = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+
+ rtl::OUString aPropName( C2U( "GapwidthSequence" ) );
+ if( SCHATTR_BAR_OVERLAP == nWhichId )
+ aPropName = C2U( "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() )
+ {
+ sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ uno::Sequence< sal_Int32 > m_aBarPositionSequence;
+ if( xChartTypeProps.is() )
+ {
+ if( xChartTypeProps->getPropertyValue( aPropName ) >>= m_aBarPositionSequence )
+ {
+ bool bGroupBarsPerAxis = static_cast< const SfxBoolItem & >(rItemSet.Get( SCHATTR_GROUP_BARS_PER_AXIS )).GetValue();
+ if(!bGroupBarsPerAxis)
+ {
+ //set the same value for all axes
+ for( sal_Int32 nN = 0; nN < m_aBarPositionSequence.getLength(); nN++ )
+ m_aBarPositionSequence[nN] = rBarPosition;
+ }
+ else if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() )
+ m_aBarPositionSequence[nAxisIndex] = rBarPosition;
+
+ xChartTypeProps->setPropertyValue( aPropName, uno::makeAny(m_aBarPositionSequence) );
+ bChanged = true;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_BAR_CONNECT:
+ {
+ sal_Bool bOldConnectBars = sal_False;
+ m_bConnectBars = static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ if( m_bSupportingBarConnectors )
+ {
+ uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ if( xDiagramProperties.is() &&
+ (xDiagramProperties->getPropertyValue( C2U("ConnectBars")) >>= bOldConnectBars) &&
+ bOldConnectBars != m_bConnectBars )
+ {
+ xDiagramProperties->setPropertyValue( C2U("ConnectBars"), uno::makeAny(m_bConnectBars) );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_GROUP_BARS_PER_AXIS:
+ {
+ bool bOldGroupBarsPerAxis = true;
+ m_bGroupBarsPerAxis = static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ if( m_bSupportingAxisSideBySide )
+ {
+ uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ if( xDiagramProperties.is() &&
+ (xDiagramProperties->getPropertyValue( C2U("GroupBarsPerAxis")) >>= bOldGroupBarsPerAxis) &&
+ bOldGroupBarsPerAxis != m_bGroupBarsPerAxis )
+ {
+ xDiagramProperties->setPropertyValue( C2U("GroupBarsPerAxis"), uno::makeAny(m_bGroupBarsPerAxis) );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_STARTING_ANGLE:
+ {
+ 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 );
+ if( xDiagramProperties.is() )
+ {
+ xDiagramProperties->setPropertyValue( C2U("StartingAngle"), uno::makeAny(m_nStartingAngle) );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_CLOCKWISE:
+ {
+ bool bClockwise = (static_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() );
+ if( m_xCooSys.is() )
+ {
+ uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ aScaleData.Orientation = bClockwise ? chart2::AxisOrientation_REVERSE : chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_MISSING_VALUE_TREATMENT:
+ {
+ if( m_aSupportedMissingValueTreatments.getLength() )
+ {
+ sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
+ if( m_nMissingValueTreatment != nNew )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
+ if( xDiagramProperties.is() )
+ {
+ xDiagramProperties->setPropertyValue( C2U( "MissingValueTreatment" ), uno::makeAny( nNew ));
+ bChanged = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ }
+ break;
+ case SCHATTR_INCLUDE_HIDDEN_CELLS:
+ {
+ if( m_bSupportingPlottingOfHiddenCells )
+ {
+ bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
+ if (bIncludeHiddenCells != m_bIncludeHiddenCells)
+ bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, m_xChartModel );
+ }
+ }
+ break;
+ }
+ return bChanged;
+}
+
+void SeriesOptionsItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_AXIS:
+ {
+ sal_Int32 nItemValue = m_bAttachToMainAxis ? CHART_AXIS_PRIMARY_Y : CHART_AXIS_SECONDARY_Y;
+ rOutItemSet.Put( SfxInt32Item(nWhichId,nItemValue ) );
+ break;
+ }
+ case SCHATTR_BAR_OVERLAP:
+ {
+ if( m_bSupportingOverlapAndGapWidthProperties )
+ rOutItemSet.Put( SfxInt32Item(nWhichId,m_nBarOverlap) );
+ break;
+ }
+ case SCHATTR_BAR_GAPWIDTH:
+ {
+ if( m_bSupportingOverlapAndGapWidthProperties )
+ rOutItemSet.Put( SfxInt32Item(nWhichId,m_nGapWidth) );
+ break;
+ }
+ case SCHATTR_BAR_CONNECT:
+ {
+ if( m_bSupportingBarConnectors )
+ rOutItemSet.Put( SfxBoolItem(nWhichId,m_bConnectBars));
+ break;
+ }
+ case SCHATTR_GROUP_BARS_PER_AXIS:
+ {
+ if( m_bSupportingAxisSideBySide )
+ rOutItemSet.Put( SfxBoolItem(nWhichId,m_bGroupBarsPerAxis) );
+ break;
+ }
+ case SCHATTR_AXIS_FOR_ALL_SERIES:
+ {
+ if( m_nAllSeriesAxisIndex != - 1)
+ rOutItemSet.Put( SfxInt32Item(nWhichId, m_nAllSeriesAxisIndex));
+ break;
+ }
+ case SCHATTR_STARTING_ANGLE:
+ {
+ if( m_bSupportingStartingAngle )
+ rOutItemSet.Put( SfxInt32Item(nWhichId,m_nStartingAngle));
+ break;
+ }
+ case SCHATTR_CLOCKWISE:
+ {
+ rOutItemSet.Put( SfxBoolItem(nWhichId,m_bClockwise) );
+ break;
+ }
+ case SCHATTR_MISSING_VALUE_TREATMENT:
+ {
+ if( m_aSupportedMissingValueTreatments.getLength() )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_nMissingValueTreatment ));
+ break;
+ }
+ case SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS:
+ {
+ SvULongs aList;
+ for ( sal_Int32 nN=0; nN<m_aSupportedMissingValueTreatments.getLength(); nN++ )
+ aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< USHORT >(nN) );
+ rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
+ break;
+ }
+ case SCHATTR_INCLUDE_HIDDEN_CELLS:
+ {
+ if( m_bSupportingPlottingOfHiddenCells )
+ rOutItemSet.Put( SfxBoolItem(nWhichId, m_bIncludeHiddenCells) );
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
new file mode 100644
index 000000000000..f2df5c96dd71
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
@@ -0,0 +1,697 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "StatisticsItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "ItemPropertyMap.hxx"
+#include "ErrorBar.hxx"
+#include "PropertyHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "StatisticsHelper.hxx"
+
+#include "GraphicPropertyItemConverter.hxx"
+
+#include <svl/stritem.hxx>
+#include <svx/chrtitem.hxx>
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+#include <functional>
+#include <algorithm>
+#include <vector>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+uno::Reference< beans::XPropertySet > lcl_GetYErrorBar(
+ const uno::Reference< beans::XPropertySet > & xProp )
+{
+ uno::Reference< beans::XPropertySet > xResult;
+
+ if( xProp.is())
+ try
+ {
+ ( xProp->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+::chart::RegressionCurveHelper::tRegressionType lcl_convertRegressionType( SvxChartRegress eRegress )
+{
+ ::chart::RegressionCurveHelper::tRegressionType eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_NONE;
+ switch( eRegress )
+ {
+ case CHREGRESS_LINEAR:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
+ break;
+ case CHREGRESS_LOG:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LOG;
+ break;
+ case CHREGRESS_EXP:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_EXP;
+ break;
+ case CHREGRESS_POWER:
+ eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_POWER;
+ break;
+ case CHREGRESS_NONE:
+ break;
+ }
+ return eType;
+}
+
+
+uno::Reference< beans::XPropertySet > lcl_GetDefaultErrorBar()
+{
+ // todo: use a valid context
+ return uno::Reference< beans::XPropertySet >(
+ ::chart::createErrorBar( uno::Reference< uno::XComponentContext >()));
+}
+
+void lcl_getErrorValues( const uno::Reference< beans::XPropertySet > & xErrorBarProp,
+ double & rOutPosError, double & rOutNegError )
+{
+ if( ! xErrorBarProp.is())
+ return;
+
+ try
+ {
+ xErrorBarProp->getPropertyValue( C2U( "PositiveError" )) >>= rOutPosError;
+ xErrorBarProp->getPropertyValue( C2U( "NegativeError" )) >>= rOutNegError;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void lcl_getErrorIndicatorValues(
+ const uno::Reference< beans::XPropertySet > & xErrorBarProp,
+ bool & rOutShowPosError, bool & rOutShowNegError )
+{
+ if( ! xErrorBarProp.is())
+ return;
+
+ try
+ {
+ xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= rOutShowPosError;
+ xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= rOutShowNegError;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
+ const uno::Reference< beans::XPropertySet > & xSeriesPropSet, const SfxItemSet * pItemSet )
+{
+ bool bEquationExists = true;
+
+ // ensure that a trendline is on
+ if( pItemSet )
+ {
+ SvxChartRegress eRegress = CHREGRESS_NONE;
+ const SfxPoolItem *pPoolItem = NULL;
+ if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ {
+ eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ bEquationExists = ( eRegress != CHREGRESS_NONE );
+ }
+ }
+
+ if( bEquationExists )
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropSet, uno::UNO_QUERY );
+ uno::Reference< chart2::XRegressionCurve > xCurve(
+ ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ));
+ if( xCurve.is())
+ {
+ return xCurve->getEquationProperties();
+ }
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+StatisticsItemConverter::StatisticsItemConverter(
+ const uno::Reference< frame::XModel > & xModel,
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_xModel( xModel )
+{
+ OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_NONE ) ==
+ static_cast< int >( CHREGRESS_NONE ));
+ OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_LINEAR ) ==
+ static_cast< int >( CHREGRESS_LINEAR ));
+ OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_LOG ) ==
+ static_cast< int >( CHREGRESS_LOG ));
+ OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_EXP ) ==
+ static_cast< int >( CHREGRESS_EXP ));
+ OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_POWER ) ==
+ static_cast< int >( CHREGRESS_POWER ));
+}
+
+StatisticsItemConverter::~StatisticsItemConverter()
+{}
+
+const USHORT * StatisticsItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nStatWhichPairs;
+}
+
+bool StatisticsItemConverter::GetItemProperty(
+ tWhichIdType /* nWhichId */,
+ tPropertyNameWithMemberId & /* rOutProperty */ ) const
+{
+ return false;
+}
+
+bool StatisticsItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_STAT_AVERAGE:
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt(
+ GetPropertySet(), uno::UNO_QUERY );
+ bool bOldHasMeanValueLine = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
+
+ bool bNewHasMeanValueLine =
+ static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
+
+ if( bOldHasMeanValueLine != bNewHasMeanValueLine )
+ {
+ if( ! bNewHasMeanValueLine )
+ RegressionCurveHelper::removeMeanValueLine( xRegCnt );
+ else
+ RegressionCurveHelper::addMeanValueLine(
+ xRegCnt, uno::Reference< uno::XComponentContext >(), GetPropertySet() );
+ bChanged = true;
+ }
+ }
+ break;
+
+ // Attention !!! This case must be passed before SCHATTR_STAT_PERCENT,
+ // SCHATTR_STAT_BIGERROR, SCHATTR_STAT_CONSTPLUS,
+ // SCHATTR_STAT_CONSTMINUS and SCHATTR_STAT_INDICATE
+ case SCHATTR_STAT_KIND_ERROR:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet() ));
+
+ SvxChartKindError eErrorKind =
+ static_cast< const SvxChartKindErrorItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+
+ if( !xErrorBarProp.is() && eErrorKind == CHERROR_NONE)
+ {
+ //nothing to do
+ }
+ else
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+
+ switch( eErrorKind )
+ {
+ case CHERROR_NONE:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE; break;
+ case CHERROR_VARIANT:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE; break;
+ case CHERROR_SIGMA:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION; break;
+ case CHERROR_PERCENT:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE; break;
+ case CHERROR_BIGERROR:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN; break;
+ case CHERROR_CONST:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE; break;
+ case CHERROR_STDERROR:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR; break;
+ case CHERROR_RANGE:
+ nStyle = ::com::sun::star::chart::ErrorBarStyle::FROM_DATA; break;
+ }
+
+ if( !xErrorBarProp.is() )
+ {
+ xErrorBarProp = lcl_GetDefaultErrorBar();
+ GetPropertySet()->setPropertyValue(
+ C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProp ));
+ }
+
+ xErrorBarProp->setPropertyValue( C2U( "ErrorBarStyle" ),
+ uno::makeAny( nStyle ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_PERCENT:
+ case SCHATTR_STAT_BIGERROR:
+ {
+ OSL_ENSURE( false, "Deprectaed item" );
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet()));
+ bool bOldHasErrorBar = xErrorBarProp.is();
+
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+
+ if( bOldHasErrorBar &&
+ ! ( ::rtl::math::approxEqual( fPos, fValue ) &&
+ ::rtl::math::approxEqual( fNeg, fValue )))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "PositiveError" ),
+ uno::makeAny( fValue ));
+ xErrorBarProp->setPropertyValue( C2U( "NegativeError" ),
+ uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTPLUS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet()));
+ bool bOldHasErrorBar = xErrorBarProp.is();
+
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+
+ if( bOldHasErrorBar &&
+ ! ::rtl::math::approxEqual( fPos, fValue ))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "PositiveError" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTMINUS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet()));
+ bool bOldHasErrorBar = xErrorBarProp.is();
+
+ double fValue =
+ static_cast< const SvxDoubleItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+
+ if( bOldHasErrorBar &&
+ ! ::rtl::math::approxEqual( fNeg, fValue ))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "NegativeError" ), uno::makeAny( fValue ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_TYPE:
+ {
+ SvxChartRegress eRegress =
+ static_cast< const SvxChartRegressItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt(
+ GetPropertySet(), uno::UNO_QUERY );
+
+ if( eRegress == CHREGRESS_NONE )
+ {
+ bChanged = RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
+ }
+ else
+ {
+ SvxChartRegress eOldRegress(
+ static_cast< SvxChartRegress >(
+ static_cast< sal_Int32 >(
+ RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ))));
+ if( eOldRegress != eRegress )
+ {
+ RegressionCurveHelper::replaceOrAddCurveAndReduceToOne(
+ lcl_convertRegressionType( eRegress ), xRegCnt,
+ uno::Reference< uno::XComponentContext >());
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_EQUATION:
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet ));
+ if( xEqProp.is())
+ {
+ bool bShowEq = false;
+ xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq;
+ bool bNewShowEq =
+ static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
+ if( bShowEq != bNewShowEq )
+ {
+ xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( bNewShowEq ));
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_COEFF:
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet ));
+ if( xEqProp.is())
+ {
+ bool bShowCoeff = false;
+ xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff;
+ bool bNewShowCoeff =
+ static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
+ if( bShowCoeff != bNewShowCoeff )
+ {
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bNewShowCoeff ));
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_INDICATE:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet()));
+ bool bOldHasErrorBar = xErrorBarProp.is();
+
+ SvxChartIndicate eIndicate =
+ static_cast< const SvxChartIndicateItem & >(
+ rItemSet.Get( nWhichId )).GetValue();
+
+ bool bNewIndPos = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_UP );
+ bool bNewIndNeg = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_DOWN );
+
+ bool bShowPos, bShowNeg;
+ lcl_getErrorIndicatorValues( xErrorBarProp, bShowPos, bShowNeg );
+
+ if( bOldHasErrorBar &&
+ ( bShowPos != bNewIndPos ||
+ bShowNeg != bNewIndNeg ))
+ {
+ xErrorBarProp->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny( bNewIndPos ));
+ xErrorBarProp->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny( bNewIndNeg ));
+ bChanged = true;
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_RANGE_POS:
+ case SCHATTR_STAT_RANGE_NEG:
+ {
+ // @todo: also be able to deal with x-error bars
+ const bool bYError = true;
+ uno::Reference< chart2::data::XDataSource > xErrorBarSource( lcl_GetYErrorBar( GetPropertySet()), 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( xErrorBarSource.is() && xDataProvider.is())
+ {
+ ::rtl::OUString aNewRange( static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue());
+ bool bApplyNewRange = false;
+
+ bool bIsPositiveValue( nWhichId == SCHATTR_STAT_RANGE_POS );
+ if( xChartDoc->hasInternalDataProvider())
+ {
+ if( aNewRange.getLength())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, bIsPositiveValue, bYError ));
+ if( ! xSeq.is())
+ {
+ // no data range for error bars yet => create
+ uno::Reference< chart2::XInternalDataProvider > xIntDataProvider( xDataProvider, uno::UNO_QUERY );
+ OSL_ASSERT( xIntDataProvider.is());
+ if( xIntDataProvider.is())
+ {
+ xIntDataProvider->appendSequence();
+ aNewRange = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("last"));
+ bApplyNewRange = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, bIsPositiveValue, bYError ));
+ bApplyNewRange =
+ ! ( xSeq.is() && aNewRange.equals( xSeq->getSourceRangeRepresentation()));
+ }
+
+ if( bApplyNewRange )
+ StatisticsHelper::setErrorDataSequence(
+ xErrorBarSource, xDataProvider, aNewRange, bIsPositiveValue, bYError );
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void StatisticsItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_STAT_AVERAGE:
+ rOutItemSet.Put(
+ SfxBoolItem( nWhichId,
+ RegressionCurveHelper::hasMeanValueLine(
+ uno::Reference< chart2::XRegressionCurveContainer >(
+ GetPropertySet(), uno::UNO_QUERY ))));
+ break;
+
+ case SCHATTR_STAT_KIND_ERROR:
+ {
+ SvxChartKindError eErrorKind = CHERROR_NONE;
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ lcl_GetYErrorBar( GetPropertySet()));
+ if( xErrorBarProp.is() )
+ {
+ sal_Int32 nStyle = 0;
+ if( xErrorBarProp->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle )
+ {
+ switch( nStyle )
+ {
+ case ::com::sun::star::chart::ErrorBarStyle::NONE:
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
+ eErrorKind = CHERROR_VARIANT; break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
+ eErrorKind = CHERROR_SIGMA; break;
+ case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
+ eErrorKind = CHERROR_CONST; break;
+ case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
+ eErrorKind = CHERROR_PERCENT; break;
+ case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ eErrorKind = CHERROR_BIGERROR; break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
+ eErrorKind = CHERROR_STDERROR; break;
+ case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
+ eErrorKind = CHERROR_RANGE; break;
+ }
+ }
+ }
+ rOutItemSet.Put( SvxChartKindErrorItem( eErrorKind, SCHATTR_STAT_KIND_ERROR ));
+ }
+ break;
+
+ case SCHATTR_STAT_PERCENT:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
+ if( xErrorBarProp.is())
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_BIGERROR:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
+ if( xErrorBarProp.is())
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTPLUS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
+ if( xErrorBarProp.is())
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId ));
+ }
+ }
+ break;
+
+ case SCHATTR_STAT_CONSTMINUS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
+ if( xErrorBarProp.is())
+ {
+ double fPos, fNeg;
+ lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
+ rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId ));
+ }
+ }
+ break;
+
+ case SCHATTR_REGRESSION_TYPE:
+ {
+ SvxChartRegress eRegress = static_cast< SvxChartRegress >(
+ static_cast< sal_Int32 >(
+ RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine(
+ uno::Reference< chart2::XRegressionCurveContainer >(
+ GetPropertySet(), uno::UNO_QUERY ) )));
+ rOutItemSet.Put( SvxChartRegressItem( eRegress, SCHATTR_REGRESSION_TYPE ));
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_EQUATION:
+ {
+ bool bShowEq = false;
+ uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 ));
+ if( xEqProp.is())
+ xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq;
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq ));
+ }
+ break;
+
+ case SCHATTR_REGRESSION_SHOW_COEFF:
+ {
+ bool bShowCoeff = false;
+ uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 ));
+ if( xEqProp.is())
+ xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff;
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff ));
+ }
+ break;
+
+ case SCHATTR_STAT_INDICATE:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
+ SvxChartIndicate eIndicate = CHINDICATE_BOTH;
+ if( xErrorBarProp.is())
+ {
+ bool bShowPos, bShowNeg;
+ lcl_getErrorIndicatorValues( xErrorBarProp, bShowPos, bShowNeg );
+
+ if( bShowPos )
+ {
+ if( bShowNeg )
+ eIndicate = CHINDICATE_BOTH;
+ else
+ eIndicate = CHINDICATE_UP;
+ }
+ else
+ {
+ if( bShowNeg )
+ eIndicate = CHINDICATE_DOWN;
+ else
+ eIndicate = CHINDICATE_NONE;
+ }
+ }
+ rOutItemSet.Put( SvxChartIndicateItem( eIndicate, SCHATTR_STAT_INDICATE ));
+ }
+ break;
+
+ case SCHATTR_STAT_RANGE_POS:
+ case SCHATTR_STAT_RANGE_NEG:
+ {
+ uno::Reference< chart2::data::XDataSource > xErrorBarSource( lcl_GetYErrorBar( GetPropertySet()), uno::UNO_QUERY );
+ if( xErrorBarSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarSource, (nWhichId == SCHATTR_STAT_RANGE_POS) /*, true */ /* y */ ));
+ if( xSeq.is())
+ rOutItemSet.Put( SfxStringItem( nWhichId, String( xSeq->getSourceRangeRepresentation())));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
new file mode 100644
index 000000000000..f745dd37e9c3
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "TitleItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "MultipleItemConverter.hxx"
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/chart2/XTitled.hpp>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::comphelper::ItemPropertyMapType & lcl_GetTitlePropertyMap()
+{
+ static ::comphelper::ItemPropertyMapType aTitlePropertyMap(
+ ::comphelper::MakeItemPropertyMap
+ IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 )
+ );
+
+ return aTitlePropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+// ========================================
+
+class FormattedStringsConverter : public ::comphelper::MultipleItemConverter
+{
+public:
+ FormattedStringsConverter(
+ const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
+ SfxItemPool & rItemPool,
+ ::std::auto_ptr< awt::Size > pRefSize,
+ const uno::Reference< beans::XPropertySet > & xParentProp );
+ virtual ~FormattedStringsConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+// ----------------------------------------
+
+FormattedStringsConverter::FormattedStringsConverter(
+ const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
+ SfxItemPool & rItemPool,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize,
+ const uno::Reference< beans::XPropertySet > & xParentProp ) :
+ MultipleItemConverter( rItemPool )
+{
+ bool bHasRefSize = (pRefSize.get() && xParentProp.is());
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ uno::Reference< beans::XPropertySet > xProp( aStrings[ i ], uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ if( bHasRefSize )
+ m_aConverters.push_back( new CharacterPropertyItemConverter(
+ xProp, rItemPool,
+ ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize )),
+ C2U( "ReferencePageSize" ),
+ xParentProp ));
+ else
+ m_aConverters.push_back( new CharacterPropertyItemConverter( xProp, rItemPool ));
+ }
+ }
+}
+
+FormattedStringsConverter::~FormattedStringsConverter()
+{
+}
+
+const USHORT * FormattedStringsConverter::GetWhichPairs() const
+{
+ return nCharacterPropertyWhichPairs;
+}
+
+// ========================================
+
+TitleItemConverter::TitleItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
+ ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize ) :
+ ItemConverter( rPropertySet, rItemPool )
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ xNamedPropertyContainerFactory,
+ GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ));
+
+ // CharacterProperties are not at the title but at its contained XFormattedString objects
+ // take the first formatted string in the sequence
+ uno::Reference< chart2::XTitle > xTitle( rPropertySet, uno::UNO_QUERY );
+ if( xTitle.is())
+ {
+ uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText());
+ if( aStringSeq.getLength() > 0 )
+ {
+ m_aConverters.push_back(
+ new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet ));
+ }
+ }
+}
+
+TitleItemConverter::~TitleItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::DeleteItemConverterPtr() );
+}
+
+void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool TitleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * TitleItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nTitleWhichPairs;
+}
+
+bool TitleItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
+{
+ ::comphelper::ItemPropertyMapType & rMap( lcl_GetTitlePropertyMap());
+ ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutProperty =(*aIt).second;
+ return true;
+}
+
+
+bool TitleItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet )
+ throw( uno::Exception )
+{
+ bool bChanged = false;
+
+ switch( nWhichId )
+ {
+ 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 fOldVal = 0.0;
+ bool bPropExisted =
+ ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldVal );
+
+ if( ! bPropExisted ||
+ ( bPropExisted && fOldVal != fVal ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fVal ));
+ bChanged = true;
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void TitleItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( uno::Exception )
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert double to int (times 100)
+ double fVal = 0;
+
+ if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 ) ) ));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/makefile.mk b/chart2/source/controller/itemsetwrapper/makefile.mk
new file mode 100644
index 000000000000..8f12443c13f6
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcitemsetwrapper
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= $(SLO)$/ItemConverter.obj \
+ $(SLO)$/AxisItemConverter.obj \
+ $(SLO)$/MultipleItemConverter.obj \
+ $(SLO)$/MultipleChartConverters.obj \
+ $(SLO)$/CharacterPropertyItemConverter.obj \
+ $(SLO)$/SeriesOptionsItemConverter.obj \
+ $(SLO)$/DataPointItemConverter.obj \
+ $(SLO)$/GraphicPropertyItemConverter.obj \
+ $(SLO)$/LegendItemConverter.obj \
+ $(SLO)$/StatisticsItemConverter.obj \
+ $(SLO)$/TitleItemConverter.obj \
+ $(SLO)$/RegressionCurveItemConverter.obj \
+ $(SLO)$/RegressionEquationItemConverter.obj \
+ $(SLO)$/ErrorBarItemConverter.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
new file mode 100644
index 000000000000..bf8afc65e78f
--- /dev/null
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -0,0 +1,1603 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+#include "servicenames.hxx"
+#include "ResId.hxx"
+#include "dlg_DataSource.hxx"
+#include "ChartModelHelper.hxx"
+#include "ControllerCommandDispatch.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 "macros.hxx"
+#include "dlg_CreationWizard.hxx"
+#include "dlg_ChartType.hxx"
+//#include "svx/ActionDescriptionProvider.hxx"
+#include "AccessibleChartView.hxx"
+#include "DrawCommandDispatch.hxx"
+#include "ShapeController.hxx"
+#include "UndoManager.hxx"
+
+#include <comphelper/InlineContainer.hxx>
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XUndoSupplier.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/embed/XEmbeddedClient.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/frame/LayoutManagerEvents.hpp>
+
+//-------
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+//-------
+
+//-------
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+//-------
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+// this is needed to properly destroy the auto_ptr to the AcceleratorExecute
+// object in the DTOR
+#include <svtools/acceleratorexecute.hxx>
+#include <svx/ActionDescriptionProvider.hxx>
+
+// enable the following define to let the controller listen to model changes and
+// react on this by rebuilding the view
+#define TEST_ENABLE_MODIFY_LISTENER
+
+/*
+#include <vcl/svapp.hxx>
+*/
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+DBG_NAME(ChartController)
+//-----------------------------------------------------------------
+// ChartController Constructor and Destructor
+//-----------------------------------------------------------------
+
+ChartController::ChartController(uno::Reference<uno::XComponentContext> const & xContext)
+ : m_aLifeTimeManager( NULL )
+ , m_bSuspended( sal_False )
+ , m_bCanClose( sal_True )
+ , m_xCC(xContext) //@todo is it allowed to hold this context??
+ , m_xFrame( NULL )
+ , m_aModelMutex()
+ , m_aModel( NULL, m_aModelMutex )
+ , m_pChartWindow( NULL )
+ , m_xViewWindow()
+ , m_xChartView()
+ , m_pDrawModelWrapper()
+ , m_pDrawViewWrapper(NULL)
+ , m_eDragMode(SDRDRAG_MOVE)
+ , m_bWaitingForDoubleClick(false)
+ , m_bWaitingForMouseUp(false)
+ , m_bConnectingToView(false)
+ , m_xUndoManager( 0 )
+ , m_aDispatchContainer( m_xCC, this )
+ , m_eDrawMode( CHARTDRAW_SELECT )
+{
+ DBG_CTOR(ChartController,NULL);
+// m_aDispatchContainer.setUndoManager( m_xUndoManager );
+ m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) );
+}
+
+ChartController::~ChartController()
+{
+ DBG_DTOR(ChartController,NULL);
+ stopDoubleClickWaiting();
+}
+
+//-----------------------------------------------------------------
+
+ChartController::RefCountable::RefCountable() : m_nRefCount(0)
+{
+}
+
+ChartController::RefCountable::~RefCountable()
+{
+}
+void ChartController::RefCountable::acquire()
+{
+ m_nRefCount++;
+}
+void ChartController::RefCountable::release()
+{
+ m_nRefCount--;
+ if(!m_nRefCount)
+ delete this;
+}
+
+//-----------------------------------------------------------------
+
+ChartController::TheModel::TheModel( const uno::Reference< frame::XModel > & xModel )
+ : m_xModel( xModel )
+ , m_xCloseable( NULL )
+ , m_bOwnership( sal_True )
+ , m_bOwnershipIsWellKnown( sal_False )
+{
+ m_xCloseable =
+ uno::Reference< util::XCloseable >( xModel, uno::UNO_QUERY );
+}
+
+ChartController::TheModel::~TheModel()
+{
+}
+
+void ChartController::TheModel::SetOwnerShip( sal_Bool bGetsOwnership )
+{
+ m_bOwnership = bGetsOwnership;
+ m_bOwnershipIsWellKnown = sal_True;
+}
+
+void ChartController::TheModel::addListener( ChartController* pController )
+{
+ if(m_xCloseable.is())
+ {
+ //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(
+ 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(
+ static_cast<util::XCloseListener*>(pController) );
+}
+
+void ChartController::TheModel::tryTermination()
+{
+ if(!m_bOwnership)
+ return;
+
+ try
+ {
+ if(m_xCloseable.is())
+ {
+ try
+ {
+ //@todo ? are we allowed to use sal_True here if we have the explicit ownership?
+ //I think yes, because there might be other closelistners later in the list which might be interested still
+ //but make sure that we do not throw the CloseVetoException here ourselfs
+ //so stop listening before trying to terminate or check the source of queryclosing event
+ m_xCloseable->close(sal_True);
+
+ m_bOwnership = false;
+ m_bOwnershipIsWellKnown = sal_True;
+ }
+ catch( util::CloseVetoException& )
+ {
+ //since we have indicated to give up the ownership with paramter true in close call
+ //the one who has thrown the CloseVetoException is the new owner
+
+#if OSL_DEBUG_LEVEL > 2
+ OSL_ENSURE( !m_bOwnership,
+ "INFO: a well known owner has catched a CloseVetoException after calling close(true)" );
+#endif
+
+ m_bOwnership = false;
+ m_bOwnershipIsWellKnown = sal_True;
+ return;
+ }
+
+ }
+ else if( m_xModel.is() )
+ {
+ //@todo correct??
+ m_xModel->dispose();
+ return;
+ }
+ }
+ catch( uno::Exception& ex)
+ {
+ (void)(ex); // no warning in non-debug builds
+ OSL_ENSURE( sal_False, ( rtl::OString("Termination of model failed: ")
+ + rtl::OUStringToOString( ex.Message, RTL_TEXTENCODING_ASCII_US ) ).getStr() );
+ }
+}
+
+//-----------------------------------------------------------------
+
+ChartController::TheModelRef::TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex )
+ : m_pTheModel(pTheModel), m_rModelMutex(rMutex)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_rModelMutex );
+ if(m_pTheModel)
+ m_pTheModel->acquire();
+}
+ChartController::TheModelRef::TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex )
+ : m_rModelMutex(rMutex)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_rModelMutex );
+ m_pTheModel=rTheModel.operator->();
+ if(m_pTheModel)
+ m_pTheModel->acquire();
+}
+ChartController::TheModelRef& ChartController::TheModelRef::operator=(TheModel* pTheModel)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_rModelMutex );
+ if(m_pTheModel==pTheModel)
+ return *this;
+ if(m_pTheModel)
+ m_pTheModel->release();
+ m_pTheModel=pTheModel;
+ if(m_pTheModel)
+ m_pTheModel->acquire();
+ return *this;
+}
+ChartController::TheModelRef& ChartController::TheModelRef::operator=(const TheModelRef& rTheModel)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_rModelMutex );
+ TheModel* pNew=rTheModel.operator->();
+ if(m_pTheModel==pNew)
+ return *this;
+ if(m_pTheModel)
+ m_pTheModel->release();
+ m_pTheModel=pNew;
+ if(m_pTheModel)
+ m_pTheModel->acquire();
+ return *this;
+}
+ChartController::TheModelRef::~TheModelRef()
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_rModelMutex );
+ if(m_pTheModel)
+ m_pTheModel->release();
+}
+sal_Bool ChartController::TheModelRef::is() const
+{
+ return (m_pTheModel != 0);
+}
+
+
+//-----------------------------------------------------------------
+// private methods
+//-----------------------------------------------------------------
+
+ sal_Bool ChartController
+::impl_isDisposedOrSuspended() const
+{
+ if( m_aLifeTimeManager.impl_isDisposed() )
+ return sal_True;
+
+ if( m_bSuspended )
+ {
+ OSL_ENSURE( sal_False, "This Controller is suspended" );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+
+APPHELPER_XSERVICEINFO_IMPL(ChartController,CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > ChartController
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 2 );
+ aSNS.getArray()[ 0 ] = CHART_CONTROLLER_SERVICE_NAME;
+ aSNS.getArray()[ 1 ] = ::rtl::OUString::createFromAscii("com.sun.star.frame.Controller");
+ //// @todo : add additional services if you support any further
+ return aSNS;
+}
+
+//-----------------------------------------------------------------
+// XController
+//-----------------------------------------------------------------
+
+ void SAL_CALL ChartController
+::attachFrame( const uno::Reference<frame::XFrame>& xFrame )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ if( impl_isDisposedOrSuspended() ) //@todo? allow attaching the frame while suspended?
+ return; //behave passive if already disposed or suspended
+
+ if(m_xFrame.is()) //what happens, if we do have a Frame already??
+ {
+ //@todo? throw exception?
+ OSL_ENSURE( sal_False, "there is already a frame attached to the controller" );
+ return;
+ }
+
+ //--attach frame
+ m_xFrame = xFrame; //the frameloader is responsible to call xFrame->setComponent
+
+ //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
+ //the frame or the disposer of the frame has the duty to call suspend and dispose on this object
+ //so we do not need to add as lang::XEventListener for DisposingEvents right?
+
+ //@todo nothing right???
+
+
+
+ //--------------------------------------------------
+ //create view @todo is this the correct place here??
+
+ Window* pParent = NULL;
+ //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 = VCLXWindow::GetImplementation(xContainerWindow);
+ pParentComponent->setVisible(sal_True);
+
+ pParent = VCLUnoHelper::GetWindow( xContainerWindow );
+ }
+
+ if(m_pChartWindow)
+ {
+ //@todo delete ...
+ m_pChartWindow->clear();
+ m_apDropTargetHelper.reset();
+ }
+ {
+ awt::Size aPageSize( ChartModelHelper::getPageSize(getModel()) );
+
+ // calls to VCL
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ m_pChartWindow = new ChartWindow(this,pParent,pParent?pParent->GetStyle():0);
+ m_pChartWindow->SetBackground();//no Background
+ m_xViewWindow = uno::Reference< awt::XWindow >( m_pChartWindow->GetComponentInterface(), uno::UNO_QUERY );
+ m_pChartWindow->Show();
+ m_apDropTargetHelper.reset(
+ new ChartDropTargetHelper( m_pChartWindow->GetDropTarget(),
+ uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY )));
+
+ impl_createDrawViewController();
+ }
+
+ //create the menu
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ try
+ {
+ uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
+ xPropSet->getPropertyValue( C2U( "LayoutManager" ) ) >>= xLayoutManager;
+ if ( xLayoutManager.is() )
+ {
+ xLayoutManager->lock();
+ xLayoutManager->requestElement( C2U( "private:resource/menubar/menubar" ) );
+ //@todo: createElement should become unnecessary, remove when #i79198# is fixed
+ xLayoutManager->createElement( C2U( "private:resource/toolbar/standardbar" ) );
+ xLayoutManager->requestElement( C2U( "private:resource/toolbar/standardbar" ) );
+ //@todo: createElement should become unnecessary, remove when #i79198# is fixed
+ xLayoutManager->createElement( C2U( "private:resource/toolbar/toolbar" ) );
+ xLayoutManager->requestElement( C2U( "private:resource/toolbar/toolbar" ) );
+
+ // #i12587# support for shapes in chart
+ xLayoutManager->createElement( C2U( "private:resource/toolbar/drawbar" ) );
+ xLayoutManager->requestElement( C2U( "private:resource/toolbar/drawbar" ) );
+
+ xLayoutManager->requestElement( C2U( "private:resource/statusbar/statusbar" ) );
+ xLayoutManager->unlock();
+
+ // add as listener to get notified when
+ m_xLayoutManagerEventBroadcaster.set( xLayoutManager, uno::UNO_QUERY );
+ if( m_xLayoutManagerEventBroadcaster.is())
+ m_xLayoutManagerEventBroadcaster->addLayoutManagerEventListener( this );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+//XModeChangeListener
+void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent )
+ throw ( uno::RuntimeException )
+{
+ //adjust controller to view status changes
+
+ if( rEvent.NewMode.equals(C2U("dirty")) )
+ {
+ //the view has become dirty, we should repaint it if we have a window
+ if( m_pChartWindow )
+ m_pChartWindow->ForceInvalidate();
+ }
+ else if( rEvent.NewMode.equals(C2U("invalid")) )
+ {
+ //the view is about to become invalid so end all actions on it
+ impl_invalidateAccessible();
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_pDrawViewWrapper && m_pDrawViewWrapper->IsTextEdit() )
+ this->EndTextEdit();
+ if( m_pDrawViewWrapper )
+ {
+ m_pDrawViewWrapper->UnmarkAll();
+ //m_pDrawViewWrapper->hideMarkHandles(); todo??
+ m_pDrawViewWrapper->HideSdrPage();
+ }
+ }
+ else
+ {
+ //the view was rebuild so we can start some actions on it again
+ if( !m_bConnectingToView )
+ {
+ if(m_pChartWindow && m_aModel.is() )
+ {
+ m_bConnectingToView = true;
+
+ GetDrawModelWrapper();
+ if(m_pDrawModelWrapper)
+ {
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_pDrawViewWrapper )
+ m_pDrawViewWrapper->ReInit();
+ }
+
+ //reselect object
+ if( m_aSelection.hasSelection() )
+ this->impl_selectObjectAndNotiy();
+ else
+ ChartModelHelper::triggerRangeHighlighting( getModel() );
+
+ impl_initializeAccessible();
+
+ if( m_pChartWindow )
+ m_pChartWindow->Invalidate();
+ }
+
+ m_bConnectingToView = false;
+ }
+ }
+ }
+}
+
+ sal_Bool SAL_CALL ChartController
+::attachModel( const uno::Reference< frame::XModel > & xModel )
+ throw(uno::RuntimeException)
+{
+ impl_invalidateAccessible();
+
+ //is called to attach the controller to a new model.
+ //return true if attach was successfully, false otherwise (e.g. if you do not work with a model)
+
+ ::vos::OClearableGuard aGuard( Application::GetSolarMutex());
+ if( impl_isDisposedOrSuspended() ) //@todo? allow attaching a new model while suspended?
+ return sal_False; //behave passive if already disposed or suspended
+ aGuard.clear();
+
+
+ TheModelRef aNewModelRef( new TheModel( xModel), 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);
+ m_pDrawModelWrapper.reset();
+
+ aOldModelRef->removeListener( this );
+ //@todo?? termination correct?
+// aOldModelRef->tryTermination();
+#ifdef TEST_ENABLE_MODIFY_LISTENER
+ uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aOldModelRef->getModel(),uno::UNO_QUERY );
+ if( xMBroadcaster.is())
+ xMBroadcaster->removeModifyListener( this );
+#endif
+ }
+
+ //--handle relations to the new model
+ aNewModelRef->addListener( this );
+
+ // set new model at dispatchers
+ m_aDispatchContainer.setModel( aNewModelRef->getModel());
+ 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() );
+
+ DrawCommandDispatch* pDrawDispatch = new DrawCommandDispatch( m_xCC, this );
+ if ( pDrawDispatch )
+ {
+ pDrawDispatch->initialize();
+ m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch );
+ }
+
+ ShapeController* pShapeController = new ShapeController( m_xCC, this );
+ if ( pShapeController )
+ {
+ pShapeController->initialize();
+ m_aDispatchContainer.setShapeController( pShapeController );
+ }
+
+#ifdef TEST_ENABLE_MODIFY_LISTENER
+ uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aNewModelRef->getModel(),uno::UNO_QUERY );
+ if( xMBroadcaster.is())
+ xMBroadcaster->addModifyListener( this );
+#endif
+
+ //select chart area per default:
+ select( uno::makeAny( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) ) );
+
+ uno::Reference< lang::XMultiServiceFactory > xFact( getModel(), uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ m_xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
+ GetDrawModelWrapper();
+ uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
+ if( xViewBroadcaster.is() )
+ xViewBroadcaster->addModeChangeListener(this);
+ }
+
+ //the frameloader is responsible to call xModel->connectController
+ if( m_pChartWindow )
+ m_pChartWindow->Invalidate();
+
+ uno::Reference< chart2::XUndoSupplier > xUndoSupplier( getModel(), uno::UNO_QUERY );
+ if( xUndoSupplier.is())
+ m_xUndoManager.set( xUndoSupplier->getUndoManager());
+
+ return sal_True;
+}
+
+ uno::Reference< frame::XFrame > SAL_CALL ChartController
+::getFrame() throw(uno::RuntimeException)
+{
+ //provides access to owner frame of this controller
+ //return the frame containing this controller
+
+ return m_xFrame;
+}
+
+ uno::Reference< frame::XModel > SAL_CALL ChartController
+::getModel() throw(uno::RuntimeException)
+{
+ //provides access to currently attached model
+ //returns the currently attached model
+
+ //return nothing, if you do not have a model
+ TheModelRef aModelRef( m_aModel, m_aModelMutex);
+ if(aModelRef.is())
+ return aModelRef->getModel();
+
+ return uno::Reference< frame::XModel > ();
+}
+
+ uno::Any SAL_CALL ChartController
+::getViewData() throw(uno::RuntimeException)
+{
+ //provides access to current view status
+ //set of data that can be used to restore the current view status at later time
+ // by using XController::restoreViewData()
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( impl_isDisposedOrSuspended() )
+ return uno::Any(); //behave passive if already disposed or suspended //@todo? or throw an exception??
+
+ //-- collect current view state
+ uno::Any aRet;
+ //// @todo integrate specialized implementation
+
+ return aRet;
+}
+
+ void SAL_CALL ChartController
+::restoreViewData( const uno::Any& /* Value */ )
+ throw(uno::RuntimeException)
+{
+ //restores the view status using the data gotten from a previous call to XController::getViewData()
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( impl_isDisposedOrSuspended() )
+ return; //behave passive if already disposed or suspended //@todo? or throw an exception??
+
+ //// @todo integrate specialized implementation
+}
+
+ sal_Bool SAL_CALL ChartController
+::suspend( sal_Bool bSuspend )
+ throw(uno::RuntimeException)
+{
+ //is called to prepare the controller for closing the view
+ //bSuspend==true: force the controller to suspend his work
+ //bSuspend==false try to reactivate the controller
+ //returns true if request was accepted and of course successfully finished, false otherwise
+
+ //we may show dialogs here to ask the user for saving changes ... @todo?
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_aLifeTimeManager.impl_isDisposed() )
+ return sal_False; //behave passive if already disposed, return false because request was not accepted //@todo? correct
+
+ if(bSuspend==m_bSuspended)
+ {
+ OSL_ENSURE( sal_False, "new suspend mode equals old suspend mode" );
+ return sal_True;
+ }
+
+ //change suspend mode
+ if(bSuspend)
+ {
+ //aGuard.clear();
+ //@todo ??? try to stop all what may prevent me from becoming disposed
+ //aGuard.reset();
+
+ m_bSuspended = bSuspend;
+ return sal_True;
+ }
+ else
+ {
+ //aGuard.clear();
+ //@todo ??? redo what was made in section bSuspend==true
+ //aGuard.reset();
+
+ m_bSuspended = bSuspend;
+ }
+ return sal_True;
+
+
+ /*
+ if ( bSuspend )
+ getFrame()->removeFrameActionListener( pImp );
+ else
+ getFrame()->addFrameActionListener( pImp );
+ */
+}
+
+
+void ChartController::impl_createDrawViewController()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if(!m_pDrawViewWrapper)
+ {
+ if( m_pDrawModelWrapper )
+ {
+ m_pDrawViewWrapper = new DrawViewWrapper(&m_pDrawModelWrapper->getSdrModel(),m_pChartWindow,true);
+ m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
+ }
+ }
+}
+void ChartController::impl_deleteDrawViewController()
+{
+ if( m_pDrawViewWrapper )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_pDrawViewWrapper->IsTextEdit() )
+ this->EndTextEdit();
+ DELETEZ( m_pDrawViewWrapper );
+ }
+}
+
+//-----------------------------------------------------------------
+// XComponent (base of XController)
+//-----------------------------------------------------------------
+
+ void SAL_CALL ChartController
+::dispose() throw(uno::RuntimeException)
+{
+ try
+ {
+ //This object should release all resources and references in the
+ //easiest possible manner
+ //This object must notify all registered listeners using the method
+ //<member>XEventListener::disposing</member>
+
+ //hold no mutex
+ if( !m_aLifeTimeManager.dispose() )
+ return;
+
+// OSL_ENSURE( m_bSuspended, "dispose was called but controller is not suspended" );
+
+ this->stopDoubleClickWaiting();
+
+ //end range highlighting
+ if( m_aModel.is())
+ {
+ uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener;
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( getModel(), uno::UNO_QUERY );
+ if( xDataReceiver.is() )
+ xSelectionChangeListener = uno::Reference< view::XSelectionChangeListener >( xDataReceiver->getRangeHighlighter(), uno::UNO_QUERY );
+ if( xSelectionChangeListener.is() )
+ {
+ uno::Reference< frame::XController > xController( this );
+ uno::Reference< lang::XComponent > xComp( xController, uno::UNO_QUERY );
+ //lang::EventObject aEvent( static_cast< lang::XComponent* >( this ) );
+ lang::EventObject aEvent( xComp );
+ xSelectionChangeListener->disposing( aEvent );
+ }
+ }
+
+ //--release all resources and references
+ {
+ uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
+ if( xViewBroadcaster.is() )
+ xViewBroadcaster->removeModeChangeListener(this);
+ // /--
+ impl_invalidateAccessible();
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ impl_deleteDrawViewController();
+ m_pDrawModelWrapper.reset();
+
+ m_apDropTargetHelper.reset();
+
+ //the accessible view is disposed within window destructor of m_pChartWindow
+ m_pChartWindow->clear();
+ m_pChartWindow = NULL;//m_pChartWindow is deleted via UNO due to dispose of m_xViewWindow (trigerred by Framework (Controller pretends to be XWindow also))
+ m_xViewWindow->dispose();
+ m_xChartView.clear();
+ // \--
+ }
+
+ // remove as listener to layout manager events
+ if( m_xLayoutManagerEventBroadcaster.is())
+ {
+ m_xLayoutManagerEventBroadcaster->removeLayoutManagerEventListener( this );
+ m_xLayoutManagerEventBroadcaster.set( 0 );
+ }
+
+ m_xFrame.clear();
+ m_xUndoManager.clear();
+
+ TheModelRef aModelRef( m_aModel, m_aModelMutex);
+ m_aModel = NULL;
+
+ if( aModelRef.is())
+ {
+ uno::Reference< frame::XModel > xModel( aModelRef->getModel() );
+ if(xModel.is())
+ xModel->disconnectController( uno::Reference< frame::XController >( this ));
+
+ aModelRef->removeListener( this );
+#ifdef TEST_ENABLE_MODIFY_LISTENER
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xMBroadcaster( aModelRef->getModel(),uno::UNO_QUERY );
+ if( xMBroadcaster.is())
+ xMBroadcaster->removeModifyListener( this );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+#endif
+ aModelRef->tryTermination();
+ }
+
+ //// @todo integrate specialized implementation
+ //e.g. release further resources and references
+
+ m_aDispatchContainer.DisposeAndClear();
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ void SAL_CALL ChartController
+::addEventListener( const uno::Reference<lang::XEventListener>& xListener )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ 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( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
+}
+
+ void SAL_CALL ChartController
+::removeEventListener( const uno::Reference<
+ lang::XEventListener>& xListener )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_aLifeTimeManager.impl_isDisposed(false) )
+ return; //behave passive if already disposed or suspended
+
+ //--remove listener
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
+}
+
+
+//-----------------------------------------------------------------
+// util::XCloseListener
+//-----------------------------------------------------------------
+ void SAL_CALL ChartController
+::queryClosing( const lang::EventObject& rSource, sal_Bool bGetsOwnership )
+ throw(util::CloseVetoException, uno::RuntimeException)
+{
+ //do not use the m_aControllerMutex here because this call is not allowed to block
+
+ TheModelRef aModelRef( m_aModel, m_aModelMutex);
+
+ if( !aModelRef.is() )
+ return;
+
+ if( !(aModelRef->getModel() == rSource.Source) )
+ {
+ OSL_ENSURE( sal_False, "queryClosing was called on a controller from an unknown source" );
+ return;
+ }
+
+ if( !m_bCanClose )//@todo tryaqcuire mutex
+ {
+ if( bGetsOwnership )
+ {
+ aModelRef->SetOwnerShip( bGetsOwnership );
+ }
+
+ throw util::CloseVetoException();
+ }
+ else
+ {
+ //@ todo prepare to to closing model -> don't start any further hindering actions
+ }
+}
+
+ void SAL_CALL ChartController
+::notifyClosing( const lang::EventObject& rSource )
+ throw(uno::RuntimeException)
+{
+ //Listener should deregister himself and relaese all references to the closing object.
+
+ TheModelRef aModelRef( m_aModel, m_aModelMutex);
+ if( impl_releaseThisModel( rSource.Source ) )
+ {
+ //--stop listening to the closing model
+ aModelRef->removeListener( this );
+
+ // #i79087# If the model using this controller is closed, the frame is
+ // expected to be closed as well
+ Reference< util::XCloseable > xFrameCloseable( m_xFrame, uno::UNO_QUERY );
+ if( xFrameCloseable.is())
+ {
+ try
+ {
+ xFrameCloseable->close( sal_False /* DeliverOwnership */ );
+ m_xFrame.clear();
+ }
+ catch( util::CloseVetoException & )
+ {
+ // closing was vetoed
+ }
+ }
+ }
+}
+
+bool ChartController::impl_releaseThisModel( const uno::Reference< uno::XInterface > & xModel )
+{
+ bool bReleaseModel = sal_False;
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aModelMutex );
+ if( m_aModel.is() && m_aModel->getModel() == xModel )
+ {
+ m_aModel = NULL;
+ m_xUndoManager.clear();
+ bReleaseModel = true;
+ }
+ }
+ if( bReleaseModel )
+ m_aDispatchContainer.setModel( 0 );
+ return bReleaseModel;
+}
+
+//-----------------------------------------------------------------
+// util::XEventListener (base of XCloseListener)
+//-----------------------------------------------------------------
+ void SAL_CALL ChartController
+::disposing( const lang::EventObject& rSource )
+ throw(uno::RuntimeException)
+{
+ if( !impl_releaseThisModel( rSource.Source ))
+ {
+ if( rSource.Source == m_xLayoutManagerEventBroadcaster )
+ m_xLayoutManagerEventBroadcaster.set( 0 );
+ }
+}
+
+void SAL_CALL ChartController::layoutEvent( const lang::EventObject& aSource, ::sal_Int16 eLayoutEvent, const uno::Any& /* aInfo */ )
+ throw (uno::RuntimeException)
+{
+ if( eLayoutEvent == frame::LayoutManagerEvents::MERGEDMENUBAR )
+ {
+ Reference< frame::XLayoutManager > xLM( aSource.Source, uno::UNO_QUERY );
+ if( xLM.is())
+ {
+ xLM->createElement( C2U("private:resource/statusbar/statusbar"));
+ xLM->requestElement( C2U("private:resource/statusbar/statusbar"));
+ }
+ }
+}
+
+
+//-----------------------------------------------------------------
+// XDispatchProvider (required interface)
+//-----------------------------------------------------------------
+
+namespace
+{
+bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
+{
+ if( aCommand.equals("MainTitle")
+ || aCommand.equals("SubTitle")
+ || aCommand.equals("XTitle")
+ || aCommand.equals("YTitle")
+ || aCommand.equals("ZTitle")
+ || aCommand.equals("SecondaryXTitle")
+ || aCommand.equals("SecondaryYTitle")
+ || aCommand.equals("AllTitles")
+ || aCommand.equals("DiagramAxisX")
+ || aCommand.equals("DiagramAxisY")
+ || aCommand.equals("DiagramAxisZ")
+ || aCommand.equals("DiagramAxisA")
+ || aCommand.equals("DiagramAxisB")
+ || aCommand.equals("DiagramAxisAll")
+ || aCommand.equals("DiagramGridXMain")
+ || aCommand.equals("DiagramGridYMain")
+ || aCommand.equals("DiagramGridZMain")
+ || aCommand.equals("DiagramGridXHelp")
+ || aCommand.equals("DiagramGridYHelp")
+ || aCommand.equals("DiagramGridZHelp")
+ || aCommand.equals("DiagramGridAll")
+
+ || aCommand.equals("DiagramWall")
+ || aCommand.equals("DiagramFloor")
+ || aCommand.equals("DiagramArea")
+ || aCommand.equals("Legend")
+
+ || aCommand.equals("FormatWall")
+ || aCommand.equals("FormatFloor")
+ || aCommand.equals("FormatChartArea")
+ || aCommand.equals("FormatLegend")
+
+ || aCommand.equals("FormatTitle")
+ || aCommand.equals("FormatAxis")
+ || aCommand.equals("FormatDataSeries")
+ || aCommand.equals("FormatDataPoint")
+ || aCommand.equals("FormatDataLabels")
+ || aCommand.equals("FormatDataLabel")
+ || aCommand.equals("FormatYErrorBars")
+ || aCommand.equals("FormatMeanValue")
+ || aCommand.equals("FormatTrendline")
+ || aCommand.equals("FormatTrendlineEquation")
+ || aCommand.equals("FormatStockLoss")
+ || aCommand.equals("FormatStockGain")
+ || aCommand.equals("FormatMajorGrid")
+ || aCommand.equals("FormatMinorGrid")
+ )
+ return true;
+
+ // else
+ return false;
+}
+} // anonymous namespace
+
+ uno::Reference<frame::XDispatch> SAL_CALL ChartController
+::queryDispatch( const util::URL& rURL
+ , const rtl::OUString& rTargetFrameName
+ , sal_Int32 /* nSearchFlags */)
+ throw(uno::RuntimeException)
+{
+ if ( !m_aLifeTimeManager.impl_isDisposed() && getModel().is() )
+ {
+ if( rTargetFrameName.getLength() &&
+ rTargetFrameName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("_self")))
+ return m_aDispatchContainer.getDispatchForURL( rURL );
+ }
+ return uno::Reference< frame::XDispatch > ();
+}
+
+ uno::Sequence<uno::Reference<frame::XDispatch > > ChartController
+::queryDispatches( const uno::Sequence<
+ frame::DispatchDescriptor>& xDescripts)
+ throw(uno::RuntimeException)
+{
+ if ( !m_aLifeTimeManager.impl_isDisposed() )
+ {
+ return m_aDispatchContainer.getDispatchesForURLs( xDescripts );
+ }
+ return uno::Sequence<uno::Reference<frame::XDispatch > > ();
+}
+
+//-----------------------------------------------------------------
+// frame::XDispatch
+//-----------------------------------------------------------------
+
+ void SAL_CALL ChartController
+::dispatch( const util::URL& rURL
+ , const uno::Sequence< beans::PropertyValue >& rArgs )
+ throw (uno::RuntimeException)
+{
+ //@todo avoid OString (see Mathias mail on bug #104387#)
+ rtl::OString aCommand( rtl::OUStringToOString( rURL.Path, RTL_TEXTENCODING_ASCII_US ) );
+
+ if(aCommand.equals("Paste"))
+ this->executeDispatch_Paste();
+ else if(aCommand.equals("Copy"))
+ this->executeDispatch_Copy();
+ else if(aCommand.equals("Cut"))
+ this->executeDispatch_Cut();
+ else if(aCommand.equals("DataRanges"))
+ this->executeDispatch_SourceData();
+ //----------------------------------
+ else if(aCommand.equals("Update")) //Update Chart
+ {
+ ChartViewHelper::setViewToDirtyState( getModel() );
+ if( m_pChartWindow )
+ m_pChartWindow->Invalidate();
+ }
+ else if(aCommand.equals("DiagramData"))
+ this->executeDispatch_EditData();
+ //insert objects
+ else if( aCommand.equals("InsertTitles")
+ || aCommand.equals("InsertMenuTitles") )
+ this->executeDispatch_InsertTitles();
+ else if( aCommand.equals("InsertMenuLegend") )
+ this->executeDispatch_OpenLegendDialog();
+ else if( aCommand.equals("InsertLegend") )
+ this->executeDispatch_InsertLegend();
+ else if( aCommand.equals("DeleteLegend") )
+ this->executeDispatch_DeleteLegend();
+ else if( aCommand.equals("InsertMenuDataLabels"))
+ this->executeDispatch_InsertMenu_DataLabels();
+ else if( aCommand.equals("InsertMenuAxes")
+ || aCommand.equals("InsertRemoveAxes") )
+ this->executeDispatch_InsertAxes();
+ else if( aCommand.equals("InsertMenuGrids"))
+ this->executeDispatch_InsertGrid();
+ else if( aCommand.equals("InsertMenuTrendlines"))
+ this->executeDispatch_InsertMenu_Trendlines();
+ else if( aCommand.equals("InsertMenuMeanValues"))
+ this->executeDispatch_InsertMenu_MeanValues();
+ else if( aCommand.equals("InsertMenuYErrorBars"))
+ this->executeDispatch_InsertMenu_YErrorBars();
+ else if( aCommand.equals("InsertSymbol"))
+ this->executeDispatch_InsertSpecialCharacter();
+ else if( aCommand.equals("InsertTrendline"))
+ this->executeDispatch_InsertTrendline();
+ else if( aCommand.equals("DeleteTrendline"))
+ this->executeDispatch_DeleteTrendline();
+ else if( aCommand.equals("InsertMeanValue"))
+ this->executeDispatch_InsertMeanValue();
+ else if( aCommand.equals("DeleteMeanValue"))
+ this->executeDispatch_DeleteMeanValue();
+ else if( aCommand.equals("InsertYErrorBars"))
+ this->executeDispatch_InsertYErrorBars();
+ else if( aCommand.equals("DeleteYErrorBars"))
+ this->executeDispatch_DeleteYErrorBars();
+ else if( aCommand.equals("InsertTrendlineEquation"))
+ this->executeDispatch_InsertTrendlineEquation();
+ else if( aCommand.equals("DeleteTrendlineEquation"))
+ this->executeDispatch_DeleteTrendlineEquation();
+ else if( aCommand.equals("InsertTrendlineEquationAndR2"))
+ this->executeDispatch_InsertTrendlineEquation( true );
+ else if( aCommand.equals("InsertR2Value"))
+ this->executeDispatch_InsertR2Value();
+ else if( aCommand.equals("DeleteR2Value"))
+ this->executeDispatch_DeleteR2Value();
+ else if( aCommand.equals("InsertDataLabels") )
+ this->executeDispatch_InsertDataLabels();
+ else if( aCommand.equals("InsertDataLabel") )
+ this->executeDispatch_InsertDataLabel();
+ else if( aCommand.equals("DeleteDataLabels") )
+ this->executeDispatch_DeleteDataLabels();
+ else if( aCommand.equals("DeleteDataLabel") )
+ this->executeDispatch_DeleteDataLabel();
+ else if( aCommand.equals("ResetAllDataPoints") )
+ this->executeDispatch_ResetAllDataPoints();
+ else if( aCommand.equals("ResetDataPoint") )
+ this->executeDispatch_ResetDataPoint();
+ else if( aCommand.equals("InsertAxis") )
+ this->executeDispatch_InsertAxis();
+ else if( aCommand.equals("InsertMajorGrid") )
+ this->executeDispatch_InsertMajorGrid();
+ else if( aCommand.equals("InsertMinorGrid") )
+ this->executeDispatch_InsertMinorGrid();
+ else if( aCommand.equals("InsertAxisTitle") )
+ this->executeDispatch_InsertAxisTitle();
+ else if( aCommand.equals("DeleteAxis") )
+ this->executeDispatch_DeleteAxis();
+ else if( aCommand.equals("DeleteMajorGrid") )
+ this->executeDispatch_DeleteMajorGrid();
+ else if( aCommand.equals("DeleteMinorGrid") )
+ this->executeDispatch_DeleteMinorGrid();
+ //format objects
+ else if( aCommand.equals("FormatSelection") )
+ this->executeDispatch_ObjectProperties();
+ else if( aCommand.equals("TransformDialog"))
+ {
+ if ( isShapeContext() )
+ {
+ this->impl_ShapeControllerDispatch( rURL, rArgs );
+ }
+ else
+ {
+ this->executeDispatch_PositionAndSize();
+ }
+ }
+ else if( lcl_isFormatObjectCommand(aCommand) )
+ this->executeDispatch_FormatObject(rURL.Path);
+ //more format
+//MENUCHANGE else if(aCommand.equals("SelectSourceRanges"))
+//MENUCHANGE this->executeDispatch_SourceData();
+ else if( aCommand.equals("DiagramType"))
+ this->executeDispatch_ChartType();
+ else if( aCommand.equals("View3D"))
+ this->executeDispatch_View3D();
+ else if ( aCommand.equals( "Forward" ) )
+ {
+ if ( isShapeContext() )
+ {
+ this->impl_ShapeControllerDispatch( rURL, rArgs );
+ }
+ else
+ {
+ this->executeDispatch_MoveSeries( sal_True );
+ }
+ }
+ else if ( aCommand.equals( "Backward" ) )
+ {
+ if ( isShapeContext() )
+ {
+ this->impl_ShapeControllerDispatch( rURL, rArgs );
+ }
+ else
+ {
+ this->executeDispatch_MoveSeries( sal_False );
+ }
+ }
+ else if( aCommand.equals("NewArrangement"))
+ this->executeDispatch_NewArrangement();
+ else if( aCommand.equals("ToggleLegend"))
+ this->executeDispatch_ToggleLegend();
+ else if( aCommand.equals("ToggleGridHorizontal"))
+ this->executeDispatch_ToggleGridHorizontal();
+ else if( aCommand.equals("ScaleText"))
+ this->executeDispatch_ScaleText();
+ else if( aCommand.equals("StatusBarVisible"))
+ {
+ // workaround: this should not be necessary.
+ uno::Reference< beans::XPropertySet > xPropSet( m_xFrame, uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
+ xPropSet->getPropertyValue( C2U( "LayoutManager" ) ) >>= xLayoutManager;
+ if ( xLayoutManager.is() )
+ {
+ bool bIsVisible( xLayoutManager->isElementVisible( C2U("private:resource/statusbar/statusbar")));
+ if( bIsVisible )
+ {
+ xLayoutManager->hideElement( C2U( "private:resource/statusbar/statusbar"));
+ xLayoutManager->destroyElement( C2U( "private:resource/statusbar/statusbar"));
+ }
+ else
+ {
+ xLayoutManager->createElement( C2U( "private:resource/statusbar/statusbar"));
+ xLayoutManager->showElement( C2U( "private:resource/statusbar/statusbar"));
+ }
+ // @todo: update menu state (checkmark next to "Statusbar").
+ }
+ }
+ }
+
+ /*
+ case SID_TEXTEDIT:
+ this->executeDispatch_EditText();
+ */
+}
+
+ void SAL_CALL ChartController
+::addStatusListener( const uno::Reference<frame::XStatusListener >& /* xControl */
+ , const util::URL& /* aURL */ )
+ throw (uno::RuntimeException)
+{
+// // TODO: add listener by URL !
+// ::vos::OGuard aGuard( Application::GetSolarMutex());
+// 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( ::getCppuType( & xControl ), xControl );
+}
+
+ void SAL_CALL ChartController
+::removeStatusListener( const uno::Reference<frame::XStatusListener >& /* xControl */
+ , const util::URL& /* aURL */ )
+ throw (uno::RuntimeException)
+{
+// // TODO: remove listener by URL !
+// ::vos::OGuard aGuard( Application::GetSolarMutex());
+// if( m_aLifeTimeManager.impl_isDisposed() )
+// return; //behave passive if already disposed or suspended
+
+// //--remove listener
+// m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType( & xControl ), xControl );
+}
+
+//-----------------------------------------------------------------
+// XContextMenuInterception (optional interface)
+//-----------------------------------------------------------------
+ void SAL_CALL ChartController
+::registerContextMenuInterceptor( const uno::Reference<
+ ui::XContextMenuInterceptor > & /* xInterceptor */)
+ throw(uno::RuntimeException)
+{
+ //@todo
+}
+
+ void SAL_CALL ChartController
+::releaseContextMenuInterceptor( const uno::Reference<
+ ui::XContextMenuInterceptor > & /* xInterceptor */)
+ throw(uno::RuntimeException)
+{
+ //@todo
+}
+
+// ____ XEmbeddedClient ____
+// implementation see: ChartController_EditData.cxx
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void SAL_CALL ChartController::executeDispatch_ChartType()
+{
+ // using assignment for broken gcc 3.3
+ UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_CHARTTYPE ))), m_xUndoManager, getModel() );
+
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ //prepare and open dialog
+ ChartTypeDialog aDlg( m_pChartWindow, getModel(), m_xCC );
+ if( aDlg.Execute() == RET_OK )
+ {
+ impl_adaptDataSeriesAutoResize();
+ aUndoGuard.commitAction();
+ }
+ // \--
+}
+
+void SAL_CALL ChartController::executeDispatch_SourceData()
+{
+ //-------------------------------------------------------------
+ //convert properties to ItemSet
+ uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ DBG_ASSERT( xChartDoc.is(), "Invalid XChartDocument" );
+ if( !xChartDoc.is())
+ return;
+
+ // using assignment for broken gcc 3.3
+ UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_DATA_RANGES ))), m_xUndoManager, getModel() );
+ if( xChartDoc.is())
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ ::chart::DataSourceDialog aDlg( m_pChartWindow, xChartDoc, m_xCC );
+ if( aDlg.Execute() == RET_OK )
+ {
+ impl_adaptDataSeriesAutoResize();
+ aUndoGuard.commitAction();
+ }
+ // \--
+ }
+}
+
+void SAL_CALL ChartController::executeDispatch_MoveSeries( sal_Bool bForward )
+{
+ ControllerLockGuard aCLGuard( getModel() );
+
+ //get selected series
+ ::rtl::OUString aObjectCID(m_aSelection.getSelectedCID());
+ uno::Reference< XDataSeries > xGivenDataSeries( ObjectIdentifier::getDataSeriesForCID( //yyy todo also legendentries and labels?
+ aObjectCID, getModel() ) );
+
+ UndoGuardWithSelection aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ (bForward ? ActionDescriptionProvider::MOVE_TOTOP : ActionDescriptionProvider::MOVE_TOBOTTOM),
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATASERIES )))),
+ m_xUndoManager, getModel());
+
+ bool bChanged = DiagramHelper::moveSeries( ChartModelHelper::findDiagram( getModel() ), xGivenDataSeries, bForward );
+ if( bChanged )
+ {
+ m_aSelection.setSelection( ObjectIdentifier::getMovedSeriesCID( aObjectCID, bForward ) );
+ aUndoGuard.commitAction();
+ }
+}
+
+// ____ XMultiServiceFactory ____
+uno::Reference< uno::XInterface > SAL_CALL
+ ChartController::createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xResult;
+
+ if( aServiceSpecifier.equals( CHART_ACCESSIBLE_TEXT_SERVICE_NAME ))
+ xResult.set( impl_createAccessibleTextContext());
+ return xResult;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL
+ ChartController::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier,
+ const uno::Sequence< uno::Any >& /* Arguments */ )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ // ignore Arguments
+ return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL
+ ChartController::getAvailableServiceNames()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aServiceNames;
+
+ if( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc(1);
+ aServiceNames[0] = CHART_ACCESSIBLE_TEXT_SERVICE_NAME;
+ }
+
+ return aServiceNames;
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ChartController::modified( const lang::EventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+ // the source can also be a subobject of the ChartModel
+ // @todo: change the source in ChartModel to always be the model itself ?
+// if( getModel() == aEvent.Source )
+
+
+ //todo? update menu states ?
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+IMPL_LINK( ChartController, NotifyUndoActionHdl, SdrUndoAction*, pUndoAction )
+{
+ ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID();
+ if ( aObjectCID.getLength() == 0 )
+ {
+ UndoManager* pUndoManager = UndoManager::getImplementation( m_xUndoManager );
+ if ( pUndoManager )
+ {
+ pUndoManager->addShapeUndoAction( pUndoAction );
+ }
+ }
+ return 0L;
+}
+
+DrawModelWrapper* ChartController::GetDrawModelWrapper()
+{
+ if( !m_pDrawModelWrapper.get() )
+ {
+ ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( m_xChartView );
+ if( pProvider )
+ m_pDrawModelWrapper = pProvider->getDrawModelWrapper();
+ if ( m_pDrawModelWrapper.get() )
+ {
+ m_pDrawModelWrapper->getSdrModel().SetNotifyUndoActionHdl( LINK( this, ChartController, NotifyUndoActionHdl ) );
+ }
+ }
+ return m_pDrawModelWrapper.get();
+}
+
+DrawViewWrapper* ChartController::GetDrawViewWrapper()
+{
+ if ( !m_pDrawViewWrapper )
+ {
+ impl_createDrawViewController();
+ }
+ return m_pDrawViewWrapper;
+}
+
+uno::Reference< XAccessible > ChartController::CreateAccessible()
+{
+ uno::Reference< XAccessible > xResult = new AccessibleChartView( m_xCC, GetDrawViewWrapper() );
+ impl_initializeAccessible( uno::Reference< lang::XInitialization >( xResult, uno::UNO_QUERY ) );
+ return xResult;
+}
+
+void ChartController::impl_invalidateAccessible()
+{
+ if( m_pChartWindow )
+ {
+ Reference< lang::XInitialization > xInit( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY );
+ if(xInit.is())
+ {
+ uno::Sequence< uno::Any > aArguments(3);//empty arguments -> invalid accessible
+ xInit->initialize(aArguments);
+ }
+ }
+}
+void ChartController::impl_initializeAccessible()
+{
+ if( m_pChartWindow )
+ this->impl_initializeAccessible( Reference< lang::XInitialization >( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY ) );
+}
+void ChartController::impl_initializeAccessible( const uno::Reference< lang::XInitialization >& xInit )
+{
+ if(xInit.is())
+ {
+ uno::Sequence< uno::Any > aArguments(5);
+ uno::Reference<view::XSelectionSupplier> xSelectionSupplier(this);
+ aArguments[0]=uno::makeAny(xSelectionSupplier);
+ uno::Reference<frame::XModel> xModel(getModel());
+ aArguments[1]=uno::makeAny(xModel);
+ aArguments[2]=uno::makeAny(m_xChartView);
+ uno::Reference< XAccessible > xParent;
+ if( m_pChartWindow )
+ {
+ Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow());
+ if( pParentWin )
+ xParent.set( pParentWin->GetAccessible());
+ }
+ aArguments[3]=uno::makeAny(xParent);
+ aArguments[4]=uno::makeAny(m_xViewWindow);
+
+ xInit->initialize(aArguments);
+ }
+}
+
+::std::set< ::rtl::OUString > ChartController::impl_getAvailableCommands()
+{
+ return ::comphelper::MakeSet< ::rtl::OUString >
+ // commands for container forward
+ ( C2U("AddDirect")) ( C2U("NewDoc")) ( C2U("Open"))
+ ( C2U("Save")) ( C2U("SaveAs")) ( C2U("SendMail"))
+ ( C2U("EditDoc")) ( C2U("ExportDirectToPDF")) ( C2U("PrintDefault"))
+
+ // own commands
+ ( C2U("Cut") ) ( C2U("Copy") ) ( C2U("Paste") )
+ ( C2U("DataRanges") ) ( C2U("DiagramData") )
+ // insert objects
+ ( C2U("InsertMenuTitles") ) ( C2U("InsertTitles") )
+ ( C2U("InsertMenuLegend") ) ( C2U("InsertLegend") ) ( C2U("DeleteLegend") )
+ ( C2U("InsertMenuDataLabels") )
+ ( C2U("InsertMenuAxes") ) ( C2U("InsertRemoveAxes") ) ( C2U("InsertMenuGrids") )
+ ( C2U("InsertSymbol") )
+ ( C2U("InsertTrendlineEquation") ) ( C2U("InsertTrendlineEquationAndR2") )
+ ( C2U("InsertR2Value") ) ( C2U("DeleteR2Value") )
+ ( C2U("InsertMenuTrendlines") ) ( C2U("InsertTrendline") )
+ ( C2U("InsertMenuMeanValues") ) ( C2U("InsertMeanValue") )
+ ( C2U("InsertMenuYErrorBars") ) ( C2U("InsertYErrorBars") )
+ ( C2U("InsertDataLabels") ) ( C2U("InsertDataLabel") )
+ ( C2U("DeleteTrendline") ) ( C2U("DeleteMeanValue") ) ( C2U("DeleteTrendlineEquation") )
+ ( C2U("DeleteYErrorBars") )
+ ( C2U("DeleteDataLabels") ) ( C2U("DeleteDataLabel") )
+ //format objects
+//MENUCHANGE ( C2U("SelectSourceRanges") )
+ ( C2U("FormatSelection") ) ( C2U("TransformDialog") )
+ ( C2U("DiagramType") ) ( C2U("View3D") )
+ ( C2U("Forward") ) ( C2U("Backward") )
+ ( C2U("MainTitle") ) ( C2U("SubTitle") )
+ ( C2U("XTitle") ) ( C2U("YTitle") ) ( C2U("ZTitle") )
+ ( C2U("SecondaryXTitle") ) ( C2U("SecondaryYTitle") )
+ ( C2U("AllTitles") ) ( C2U("Legend") )
+ ( C2U("DiagramAxisX") ) ( C2U("DiagramAxisY") ) ( C2U("DiagramAxisZ") )
+ ( C2U("DiagramAxisA") ) ( C2U("DiagramAxisB") ) ( C2U("DiagramAxisAll") )
+ ( C2U("DiagramGridXMain") ) ( C2U("DiagramGridYMain") ) ( C2U("DiagramGridZMain") )
+ ( C2U("DiagramGridXHelp") ) ( C2U("DiagramGridYHelp") ) ( C2U("DiagramGridZHelp") )
+ ( C2U("DiagramGridAll") )
+ ( C2U("DiagramWall") ) ( C2U("DiagramFloor") ) ( C2U("DiagramArea") )
+
+ //context menu - format objects entries
+ ( C2U("FormatWall") ) ( C2U("FormatFloor") ) ( C2U("FormatChartArea") )
+ ( C2U("FormatLegend") )
+
+ ( C2U("FormatAxis") ) ( C2U("FormatTitle") )
+ ( C2U("FormatDataSeries") ) ( C2U("FormatDataPoint") )
+ ( C2U("ResetAllDataPoints") ) ( C2U("ResetDataPoint") )
+ ( C2U("FormatDataLabels") ) ( C2U("FormatDataLabel") )
+ ( C2U("FormatMeanValue") ) ( C2U("FormatTrendline") ) ( C2U("FormatTrendlineEquation") )
+ ( C2U("FormatYErrorBars") )
+ ( C2U("FormatStockLoss") ) ( C2U("FormatStockGain") )
+
+ ( C2U("FormatMajorGrid") ) ( C2U("InsertMajorGrid") ) ( C2U("DeleteMajorGrid") )
+ ( C2U("FormatMinorGrid") ) ( C2U("InsertMinorGrid") ) ( C2U("DeleteMinorGrid") )
+ ( C2U("InsertAxis") ) ( C2U("DeleteAxis") ) ( C2U("InsertAxisTitle") )
+
+ // toolbar commands
+ ( C2U("ToggleGridHorizontal"))( C2U("ToggleLegend") ) ( C2U("ScaleText") )
+ ( C2U("NewArrangement") ) ( C2U("Update") )
+ ( C2U("DefaultColors") ) ( C2U("BarWidth") ) ( C2U("NumberOfLines") )
+ ( C2U("ArrangeRow") )
+ ( C2U("StatusBarVisible") )
+ ( C2U("ChartElementSelector") )
+ ;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
new file mode 100644
index 000000000000..f2b64eb7a9c5
--- /dev/null
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -0,0 +1,737 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_CONTROLLER_HXX
+#define _CHART_CONTROLLER_HXX
+
+#include "LifeTime.hxx"
+#include "ServiceMacros.hxx"
+#include "CommandDispatchContainer.hxx"
+#include "SelectionHelper.hxx"
+
+// header for enum SdrDragMode
+#include <svx/svdtypes.hxx>
+// header for class Timer
+#include <vcl/timer.hxx>
+// header for class MouseEvent
+#include <vcl/event.hxx>
+
+#include <cppuhelper/implbase12.hxx>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/ui/XContextMenuInterception.hpp>
+#include <com/sun/star/uno/XWeak.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XModeChangeListener.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XLayoutManagerListener.hpp>
+#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
+
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include <set>
+
+
+class SdrModel;
+
+namespace svt
+{
+ class AcceleratorExecute;
+}
+
+class DropTargetHelper;
+
+namespace com { namespace sun { namespace star {
+namespace graphic {
+ class XGraphic;
+}
+}}}
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT };
+
+class WindowController
+{
+public:
+ virtual ~WindowController() {};
+
+ virtual void PrePaint()=0;
+ virtual void execute_Paint( const Rectangle& rRect )=0;
+ virtual void execute_MouseButtonDown( const MouseEvent& rMEvt )=0;
+ virtual void execute_MouseMove( const MouseEvent& rMEvt )=0;
+ virtual void execute_Tracking( const TrackingEvent& rTEvt )=0;
+ virtual void execute_MouseButtonUp( const MouseEvent& rMEvt )=0;
+ virtual void execute_Resize()=0;
+ virtual void execute_Activate()=0;
+ virtual void execute_Deactivate()=0;
+ virtual void execute_GetFocus()=0;
+ virtual void execute_LoseFocus()=0;
+ virtual void execute_Command( const CommandEvent& rCEvt )=0;
+ virtual bool execute_KeyInput( const KeyEvent& rKEvt )=0;
+
+ /** get help text to be shown in a quick help
+
+ @param aAtLogicPosition the position in logic coordinates (of the
+ window) of the mouse cursor to determine for
+ which object help is requested.
+
+ @param bIsBalloonHelp determines whether to return the long text version
+ (balloon help) or the shorter one (quick help).
+
+ @param rOutQuickHelpText is filled with the quick help text
+
+ @param rOutEqualRect is filled with a rectangle that denotes the region
+ in which the quick help does not change.
+
+ @return </TRUE>, if a quick help should be shown.
+ */
+ virtual bool requestQuickHelp(
+ ::Point aAtLogicPosition, bool bIsBalloonHelp,
+ ::rtl::OUString & rOutQuickHelpText, ::com::sun::star::awt::Rectangle & rOutEqualRect ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() = 0;
+};
+
+class ChartWindow;
+class DrawModelWrapper;
+class DrawViewWrapper;
+class ViewElementListProvider;
+class ReferenceSizeProvider;
+
+class ChartController : public ::cppu::WeakImplHelper12 <
+ ::com::sun::star::frame::XController //comprehends XComponent (required interface)
+ ,::com::sun::star::frame::XDispatchProvider //(required interface)
+ ,::com::sun::star::view::XSelectionSupplier //(optional interface)
+ ,::com::sun::star::ui::XContextMenuInterception //(optional interface)
+ ,::com::sun::star::util::XCloseListener //(needed for communication with XModel)
+ ,::com::sun::star::lang::XServiceInfo
+ // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ ,::com::sun::star::frame::XDispatch
+ ,::com::sun::star::awt::XWindow //this is the Window Controller part of this Controller, that will be given to a Frame via setComponent
+ ,::com::sun::star::lang::XMultiServiceFactory
+ ,::com::sun::star::util::XModifyListener
+ ,::com::sun::star::util::XModeChangeListener
+ ,::com::sun::star::frame::XLayoutManagerListener
+ >
+ , public WindowController
+{
+ friend class DrawCommandDispatch;
+ friend class ShapeController;
+
+public:
+ //no default constructor
+ ChartController(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext);
+ virtual ~ChartController();
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XServiceInfo
+ //-----------------------------------------------------------------
+
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ChartController)
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XController (required interface)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ attachFrame( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XFrame > & xFrame )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ attachModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL
+ getFrame() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL
+ getModel() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getViewData() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ restoreViewData( const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ suspend( sal_Bool bSuspend )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XComponent (base of XController)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XDispatchProvider (required interface)
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch> SAL_CALL
+ queryDispatch( const ::com::sun::star::util::URL& rURL
+ , const rtl::OUString& rTargetFrameName
+ , sal_Int32 nSearchFlags)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > > SAL_CALL
+ queryDispatches( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::frame::DispatchDescriptor > & xDescripts)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::view::XSelectionSupplier (optional interface)
+ //-----------------------------------------------------------------
+ virtual sal_Bool SAL_CALL
+ select( const ::com::sun::star::uno::Any& rSelection )
+ throw ( com::sun::star::lang::IllegalArgumentException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getSelection() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addSelectionChangeListener( const ::com::sun::star::uno::Reference<
+ com::sun::star::view::XSelectionChangeListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeSelectionChangeListener( const ::com::sun::star::uno::Reference<
+ com::sun::star::view::XSelectionChangeListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::ui::XContextMenuInterception (optional interface)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ registerContextMenuInterceptor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ui::XContextMenuInterceptor > & xInterceptor)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //additional interfaces
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XCloseListener
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ queryClosing( const ::com::sun::star::lang::EventObject& Source
+ , sal_Bool GetsOwnership )
+ throw (::com::sun::star::util::CloseVetoException
+ , ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ notifyClosing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-------------------------------------------------------------------------------------
+ // ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
+ //-------------------------------------------------------------------------------------
+ virtual void SAL_CALL
+ disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XDispatch
+ //-----------------------------------------------------------------
+
+ virtual void SAL_CALL
+ dispatch( const ::com::sun::star::util::URL& aURL
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& aArgs )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addStatusListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XStatusListener >& xControl
+ , const ::com::sun::star::util::URL& aURL )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeStatusListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XStatusListener >& xControl
+ , const ::com::sun::star::util::URL& aURL )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::awt::XWindow
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ setPosSize( sal_Int32 X, sal_Int32 Y
+ , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL
+ getPosSize()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setVisible( sal_Bool Visible )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setEnable( sal_Bool Enable )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setFocus() throw (::com::sun::star::uno::RuntimeException);
+
+ //----------------
+ virtual void SAL_CALL
+ addWindowListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindowListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeWindowListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindowListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addFocusListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeFocusListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addKeyListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeKeyListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addMouseListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeMouseListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addMouseMotionListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseMotionListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeMouseMotionListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XMouseMotionListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addPaintListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XPaintListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removePaintListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XPaintListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang XMultiServiceFactory
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& Arguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModifyListener
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModeChangeListener
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL modeChanged(
+ const ::com::sun::star::util::ModeChangeEvent& _rSource )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XLayoutManagerListener
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL layoutEvent(
+ const ::com::sun::star::lang::EventObject& aSource,
+ ::sal_Int16 eLayoutEvent,
+ const ::com::sun::star::uno::Any& aInfo )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // chart2::WindowController
+ //-----------------------------------------------------------------
+ virtual void PrePaint();
+ virtual void execute_Paint( const Rectangle& rRect );
+ virtual void execute_MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void execute_MouseMove( const MouseEvent& rMEvt );
+ virtual void execute_Tracking( const TrackingEvent& rTEvt );
+ virtual void execute_MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void execute_Resize();
+ virtual void execute_Activate();
+ virtual void execute_Deactivate();
+ virtual void execute_GetFocus();
+ virtual void execute_LoseFocus();
+ virtual void execute_Command( const CommandEvent& rCEvt );
+ virtual bool execute_KeyInput( const KeyEvent& rKEvt );
+
+ virtual bool requestQuickHelp(
+ ::Point aAtLogicPosition, bool bIsBalloonHelp,
+ ::rtl::OUString & rOutQuickHelpText, ::com::sun::star::awt::Rectangle & rOutEqualRect );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+
+ static bool isObjectDeleteable( const ::com::sun::star::uno::Any& rSelection );
+
+ void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; }
+ ChartDrawMode getDrawMode() const { return m_eDrawMode; }
+
+ bool isShapeContext() const;
+
+ DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
+
+public:
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //private
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+ //-----------------------------------------------------------------
+
+
+private:
+ DrawModelWrapper* GetDrawModelWrapper();
+ DrawViewWrapper* GetDrawViewWrapper();
+
+private:
+ class TheModelRef;
+ friend class ChartController::TheModelRef;
+ class RefCountable
+ {
+ public:
+ RefCountable();
+ virtual ~RefCountable();
+ void acquire();
+ void release();
+ private:
+ sal_Int32 volatile m_nRefCount;
+ };
+ class TheModel : public RefCountable
+ {
+ public:
+ TheModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ virtual ~TheModel();
+
+ void SetOwnerShip( sal_Bool bGetsOwnership );
+ void addListener( ChartController* pController );
+ void removeListener( ChartController* pController );
+ void tryTermination();
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ getModel() { return m_xModel;}
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xCloseable;
+
+ //the ownership between model and controller is not clear at first
+ //each controller might consider himself as owner of the model first
+ sal_Bool volatile m_bOwnership;
+ //with a XCloseable::close call and during XCloseListener::queryClosing
+ //the ownership can be regulated more explicit,
+ //if so the ownership is considered to be well known
+ sal_Bool volatile m_bOwnershipIsWellKnown;
+ };
+ class TheModelRef
+ {
+ public:
+ TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex );
+ TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex );
+ TheModelRef& operator=(ChartController::TheModel* pTheModel);
+ TheModelRef& operator=(const TheModelRef& rTheModel);
+ virtual ~TheModelRef();
+ sal_Bool is() const;
+ TheModel* operator->() const { return m_pTheModel; }
+ private:
+ TheModel* m_pTheModel;
+ mutable ::osl::Mutex& m_rModelMutex;
+ };
+
+private:
+ mutable ::apphelper::LifeTimeManager m_aLifeTimeManager;
+
+ mutable ::osl::Mutex m_aControllerMutex;
+ sal_Bool volatile m_bSuspended;
+ sal_Bool volatile m_bCanClose;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ //model
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ mutable ::osl::Mutex m_aModelMutex;
+ TheModelRef m_aModel;
+
+ //view
+ ChartWindow* m_pChartWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xViewWindow;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > m_xChartView;
+ ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
+ DrawViewWrapper* m_pDrawViewWrapper;
+
+ Selection m_aSelection;
+ SdrDragMode m_eDragMode;
+
+ Timer m_aDoubleClickTimer;
+ bool volatile m_bWaitingForDoubleClick;
+ bool volatile m_bWaitingForMouseUp;
+
+ bool volatile m_bConnectingToView;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
+ /// needed for dispatching URLs in FeatureStateEvents
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+
+ ::std::auto_ptr< ::svt::AcceleratorExecute > m_apAccelExecute;
+
+ CommandDispatchContainer m_aDispatchContainer;
+
+ ::std::auto_ptr< DropTargetHelper > m_apDropTargetHelper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XLayoutManagerEventBroadcaster >
+ m_xLayoutManagerEventBroadcaster;
+
+ ChartDrawMode m_eDrawMode;
+
+private:
+ //private methods
+
+ sal_Bool impl_isDisposedOrSuspended() const;
+ ::std::auto_ptr< ReferenceSizeProvider > impl_createReferenceSizeProvider();
+ void impl_adaptDataSeriesAutoResize();
+
+ void impl_createDrawViewController();
+ void impl_deleteDrawViewController();
+
+ //executeDispatch methods
+ void SAL_CALL executeDispatch_ObjectProperties();
+ void SAL_CALL executeDispatch_FormatObject( const ::rtl::OUString& rDispatchCommand );
+ void SAL_CALL executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID );
+ bool executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso );
+
+ void SAL_CALL executeDispatch_ChartType();
+
+ void executeDispatch_InsertTitles();
+ void executeDispatch_InsertLegend();
+ void executeDispatch_DeleteLegend();
+ void executeDispatch_OpenLegendDialog();
+ void executeDispatch_InsertAxes();
+ void executeDispatch_InsertGrid();
+
+ void executeDispatch_InsertMenu_DataLabels();
+ void executeDispatch_InsertMenu_YErrorBars();
+ void executeDispatch_InsertMenu_Trendlines();
+ void executeDispatch_InsertMenu_MeanValues();
+
+ void executeDispatch_InsertMeanValue();
+ void executeDispatch_InsertTrendline();
+ void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false );
+ void executeDispatch_InsertYErrorBars();
+
+ void executeDispatch_InsertR2Value();
+ void executeDispatch_DeleteR2Value();
+
+ void executeDispatch_DeleteMeanValue();
+ void executeDispatch_DeleteTrendline();
+ void executeDispatch_DeleteTrendlineEquation();
+ void executeDispatch_DeleteYErrorBars();
+
+ void executeDispatch_InsertDataLabels();
+ void executeDispatch_InsertDataLabel();
+ void executeDispatch_DeleteDataLabels();
+ void executeDispatch_DeleteDataLabel();
+
+ void executeDispatch_ResetAllDataPoints();
+ void executeDispatch_ResetDataPoint();
+
+ void executeDispatch_InsertAxis();
+ void executeDispatch_InsertAxisTitle();
+ void executeDispatch_InsertMajorGrid();
+ void executeDispatch_InsertMinorGrid();
+ void executeDispatch_DeleteAxis();
+ void executeDispatch_DeleteMajorGrid();
+ void executeDispatch_DeleteMinorGrid();
+
+ void SAL_CALL executeDispatch_InsertSpecialCharacter();
+ void SAL_CALL executeDispatch_EditText( const Point* pMousePixel = NULL );
+ void SAL_CALL executeDispatch_SourceData();
+ void SAL_CALL executeDispatch_MoveSeries( sal_Bool bForward );
+
+ void StartTextEdit( const Point* pMousePixel = NULL );
+ bool EndTextEdit();
+
+ void SAL_CALL executeDispatch_View3D();
+ void SAL_CALL executeDispatch_PositionAndSize();
+
+ void executeDispatch_EditData();
+
+ void executeDispatch_NewArrangement();
+ void executeDispatch_ScaleText();
+
+ void executeDispatch_Paste();
+ void executeDispatch_Copy();
+ void executeDispatch_Cut();
+ bool executeDispatch_Delete();
+ void executeDispatch_ToggleLegend();
+ void executeDispatch_ToggleGridHorizontal();
+
+ void impl_ShapeControllerDispatch( const ::com::sun::star::util::URL& rURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ //
+ DECL_LINK( DoubleClickWaitingHdl, void* );
+ void execute_DoubleClick( const Point* pMousePixel = NULL );
+ void startDoubleClickWaiting();
+ void stopDoubleClickWaiting();
+
+ void impl_selectObjectAndNotiy();
+ void impl_notifySelectionChangeListeners();
+ void impl_invalidateAccessible();
+ void impl_initializeAccessible();
+ void impl_initializeAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization >& xInit );
+
+ //sets the model member to null if it equals the parameter
+ //returns true if successful
+ bool impl_releaseThisModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > & xModel );
+
+ enum eMoveOrResizeType
+ {
+ MOVE_OBJECT,
+ CENTERED_RESIZE_OBJECT
+ };
+ /// @return </TRUE>, if resize/move was successful
+ bool impl_moveOrResizeObject(
+ const ::rtl::OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY );
+ bool impl_DragDataPoint( const ::rtl::OUString & rCID, double fOffset );
+
+ ::std::set< ::rtl::OUString > impl_getAvailableCommands();
+
+ /** Creates a helper accesibility 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.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext >
+ impl_createAccessibleTextContext();
+
+ void impl_PasteGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > & xGraphic,
+ const ::Point & aPosition );
+ void impl_PasteShapes( SdrModel* pModel );
+ void impl_PasteStringAsTextShape( const ::rtl::OUString& rString, const ::com::sun::star::awt::Point& rPosition );
+ void impl_SetMousePointer( const MouseEvent & rEvent );
+
+ void impl_ClearSelection();
+
+ void impl_switchDiagramPositioningToExcludingPositioning();
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+#endif
+
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
new file mode 100644
index 000000000000..0248732a63a7
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+#include "macros.hxx"
+
+#include "dlg_DataEditor.hxx"
+#include "DataSourceHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "UndoGuard.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+
+// for RET_OK
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace chart
+{
+
+void ChartController::executeDispatch_EditData()
+{
+ Reference< chart2::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ if( xChartDoc.is())
+ {
+ Window* pParent( NULL );
+
+ Reference< ::com::sun::star::chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider());
+
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ // using assignment for broken gcc 3.3
+ UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData(
+ ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_CHART_DATA ))),
+ m_xUndoManager, getModel() );
+ DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC );
+ // the dialog has no OK/Cancel
+ aDataEditorDialog.Execute();
+ aUndoGuard.commitAction();
+ // \--
+ }
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
new file mode 100644
index 000000000000..0a7a4057ef9a
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -0,0 +1,946 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+
+#include "dlg_InsertAxis_Grid.hxx"
+#include "dlg_InsertDataLabel.hxx"
+#include "dlg_InsertLegend.hxx"
+#include "dlg_InsertTrendline.hxx"
+#include "dlg_InsertErrorBars.hxx"
+#include "dlg_InsertTitle.hxx"
+#include "dlg_ObjectProperties.hxx"
+
+#include "ChartWindow.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "TitleHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "macros.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "ViewElementListProvider.hxx"
+#include "MultipleChartConverters.hxx"
+#include "ControllerLockGuard.hxx"
+#include "UndoGuard.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "ReferenceSizeProvider.hxx"
+#include "ObjectIdentifier.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "RegressionCurveItemConverter.hxx"
+#include "StatisticsHelper.hxx"
+#include "ErrorBarItemConverter.hxx"
+#include "MultipleItemConverter.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include "LegendHelper.hxx"
+
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <svx/ActionDescriptionProvider.hxx>
+
+//--------------------------------------
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class OUStringBuffer
+#include <rtl/ustrbuf.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+// header for class ::vos::OGuard
+#include <vos/mutex.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+
+namespace
+{
+struct lcl_InsertMeanValueLine
+{
+public:
+ lcl_InsertMeanValueLine( const uno::Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext )
+ {}
+
+ void operator()( const uno::Reference< chart2::XDataSeries > & xSeries )
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ xSeries, uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ ::chart::RegressionCurveHelper::addMeanValueLine(
+ xRegCurveCnt, m_xContext, uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ));
+ }
+ }
+
+private:
+ uno::Reference< uno::XComponentContext > m_xContext;
+};
+
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+void ChartController::executeDispatch_InsertAxes()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXES )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ InsertAxisOrGridDialogData aDialogInput;
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
+ AxisHelper::getAxisOrGridExcistence( aDialogInput.aExistenceList, xDiagram, sal_True );
+ AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, sal_True );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchAxisDlg aDlg( m_pChartWindow, aDialogInput );
+ if( aDlg.Execute() == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+
+ InsertAxisOrGridDialogData aDialogOutput;
+ aDlg.getResult( aDialogOutput );
+ ::std::auto_ptr< ReferenceSizeProvider > mpRefSizeProvider(
+ impl_createReferenceSizeProvider());
+ bool bChanged = AxisHelper::changeVisibilityOfAxes( xDiagram
+ , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC
+ , mpRefSizeProvider.get() );
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRIDS )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ InsertAxisOrGridDialogData aDialogInput;
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram(getModel());
+ AxisHelper::getAxisOrGridExcistence( aDialogInput.aExistenceList, xDiagram, sal_False );
+ AxisHelper::getAxisOrGridPossibilities( aDialogInput.aPossibilityList, xDiagram, sal_False );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchGridDlg aDlg( m_pChartWindow, aDialogInput );//aItemSet, b3D, bNet, bSecondaryX, bSecondaryY );
+ if( aDlg.Execute() == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ InsertAxisOrGridDialogData aDialogOutput;
+ aDlg.getResult( aDialogOutput );
+ bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
+ , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void ChartController::executeDispatch_InsertTitles()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLES )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ TitleDialogData aDialogInput;
+ aDialogInput.readFromModel( getModel() );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchTitleDlg aDlg( m_pChartWindow, aDialogInput );
+ if( aDlg.Execute() == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ TitleDialogData aDialogOutput( impl_createReferenceSizeProvider());
+ aDlg.getResult( aDialogOutput );
+ bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteLegend()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, getModel() );
+
+ LegendHelper::hideLegend( getModel() );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertLegend()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, getModel() );
+
+ Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_OpenLegendDialog()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ //prepare and open dialog
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchLegendDlg aDlg( m_pChartWindow, m_xCC );
+ aDlg.init( getModel() );
+ if( aDlg.Execute() == RET_OK )
+ {
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ bool bChanged = aDlg.writeToModel( getModel() );
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void ChartController::executeDispatch_InsertMenu_DataLabels()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, getModel() );
+
+ //if a series is selected insert labels for that series only:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ // add labels
+ DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
+
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ rtl::OUString aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticles(
+ ObjectIdentifier::getSeriesParticleFromCID(m_aSelection.getSelectedCID()), aChildParticle );
+
+ bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true );
+ if( bSuccess )
+ aUndoGuard.commitAction();
+ return;
+ }
+
+ try
+ {
+ wrapper::AllDataLabelItemConverter aItemConverter(
+ getModel(),
+ m_pDrawModelWrapper->GetItemPool(),
+ m_pDrawModelWrapper->getSdrModel(),
+ uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+
+ //prepare and open dialog
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ //get number formatter
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( getModel(), uno::UNO_QUERY );
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
+
+ DataLabelsDialog aDlg( m_pChartWindow, aItemSet, pNumberFormatter);
+
+ if( aDlg.Execute() == RET_OK )
+ {
+ SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
+ aDlg.FillItemSet( aOutItemSet );
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMenu_YErrorBars()
+{
+ //if a series is selected insert error bars for that series only:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is())
+ {
+ executeDispatch_InsertYErrorBars();
+ return;
+ }
+
+ //if no series is selected insert error bars for all series
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ wrapper::AllSeriesStatisticsConverter aItemConverter(
+ getModel(), m_pDrawModelWrapper->GetItemPool() );
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+
+ //prepare and open dialog
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ InsertErrorBarsDialog aDlg(
+ m_pChartWindow, aItemSet,
+ uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ));
+ aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rtl::OUString() ) );
+
+ if( aDlg.Execute() == RET_OK )
+ {
+ SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
+ aDlg.FillItemSet( aOutItemSet );
+
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMeanValue()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
+ m_xUndoManager, getModel() );
+ lcl_InsertMeanValueLine( m_xCC ).operator()(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertMenu_MeanValues()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
+ m_xUndoManager, getModel() );
+
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ //if a series is selected insert mean value only for that series:
+ lcl_InsertMeanValueLine( m_xCC ).operator()(xSeries);
+ }
+ else
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries(
+ DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( getModel() )));
+ ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC ));
+ }
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertMenu_Trendlines()
+{
+ //if a series is selected insert only for that series:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is())
+ {
+ executeDispatch_InsertTrendline();
+ return;
+ }
+
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ wrapper::AllSeriesStatisticsConverter aItemConverter(
+ getModel(), m_pDrawModelWrapper->GetItemPool() );
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+
+ //prepare and open dialog
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ InsertTrendlineDialog aDlg( m_pChartWindow, aItemSet );
+ aDlg.adjustSize();
+
+ if( aDlg.Execute() == RET_OK )
+ {
+ SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
+ aDlg.FillItemSet( aOutItemSet );
+
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+ bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertTrendline()
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel()), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ UndoLiveUpdateGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
+ m_xUndoManager, getModel() );
+
+ // add a linear curve
+ RegressionCurveHelper::addRegressionCurve(
+ RegressionCurveHelper::REGRESSION_TYPE_LINEAR, xRegCurveCnt, m_xCC );
+
+ // get an appropriate item converter
+ uno::Reference< chart2::XRegressionCurve > xCurve(
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ));
+ uno::Reference< beans::XPropertySet > xCurveProp( xCurve, uno::UNO_QUERY );
+ if( !xCurveProp.is())
+ return;
+ wrapper::RegressionCurveItemConverter aItemConverter(
+ xCurveProp, xRegCurveCnt, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
+ m_pDrawModelWrapper->getSdrModel(),
+ uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+
+ // open dialog
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+ ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter(
+ ObjectIdentifier::createDataCurveCID(
+ ObjectIdentifier::getSeriesParticleFromCID( m_aSelection.getSelectedCID()),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt, xCurve ), false ));
+ aDialogParameter.init( getModel() );
+ ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
+ uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
+
+ // note: when a user pressed "OK" but didn't change any settings in the
+ // dialog, the SfxTabDialog returns "Cancel"
+ if( aDlg.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
+ {
+ const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ if( pOutItemSet )
+ {
+ ControllerLockGuard aCLGuard( getModel() );
+ aItemConverter.ApplyItemSet( *pOutItemSet );
+ }
+ aUndoGuard.commitAction();
+ }
+ }
+}
+
+void ChartController::executeDispatch_InsertYErrorBars()
+{
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is())
+ {
+ UndoLiveUpdateGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))),
+ m_xUndoManager, getModel() );
+
+ // add error bars with standard deviation
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ StatisticsHelper::addErrorBars( xSeries, m_xCC, ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION ));
+
+ // get an appropriate item converter
+ wrapper::ErrorBarItemConverter aItemConverter(
+ getModel(), xErrorBarProp, m_pDrawModelWrapper->getSdrModel().GetItemPool(),
+ m_pDrawModelWrapper->getSdrModel(),
+ uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY ));
+
+ // open dialog
+ SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();
+ aItemConverter.FillItemSet( aItemSet );
+ ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter(
+ ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS, ::rtl::OUString(), m_aSelection.getSelectedCID()));
+ aDialogParameter.init( getModel() );
+ ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get());
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider,
+ uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ));
+ aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), 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.Execute() == RET_OK || aDlg.DialogWasClosedWithOK())
+ {
+ const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ if( pOutItemSet )
+ {
+ ControllerLockGuard aCLGuard( getModel() );
+ aItemConverter.ApplyItemSet( *pOutItemSet );
+ }
+ aUndoGuard.commitAction();
+ }
+ }
+}
+
+void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
+{
+ uno::Reference< chart2::XRegressionCurve > xRegCurve(
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( !xRegCurve.is() )
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ xRegCurve.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
+ }
+ if( xRegCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties());
+ if( xEqProp.is())
+ {
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, getModel() );
+ xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true ));
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 ));
+ aUndoGuard.commitAction();
+ }
+ }
+}
+
+void ChartController::executeDispatch_InsertR2Value()
+{
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xEqProp.is())
+ {
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, getModel() );
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true ));
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteR2Value()
+{
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xEqProp.is())
+ {
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, getModel() );
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteMeanValue()
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
+ m_xUndoManager, getModel() );
+ RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteTrendline()
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
+ m_xUndoManager, getModel() );
+ RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteTrendlineEquation()
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, getModel() );
+ RegressionCurveHelper::removeEquations( xRegCurveCnt );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteYErrorBars()
+{
+ uno::Reference< chart2::XDataSeries > xDataSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
+ if( xDataSeries.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
+ m_xUndoManager, getModel() );
+ StatisticsHelper::removeErrorBars( xDataSeries );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_InsertDataLabels()
+{
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, getModel() );
+ DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_InsertDataLabel()
+{
+ UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
+ m_xUndoManager, getModel() );
+ DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_DeleteDataLabels()
+{
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, getModel() );
+ DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteDataLabel()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
+ m_xUndoManager, getModel() );
+ DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_ResetAllDataPoints()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINTS )))),
+ m_xUndoManager, getModel() );
+ uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ xSeries->resetAllDataPoints();
+ aUndoGuard.commitAction();
+}
+void ChartController::executeDispatch_ResetDataPoint()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINT )))),
+ m_xUndoManager, getModel() );
+ uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
+ xSeries->resetDataPoint( nPointIndex );
+ }
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertAxisTitle()
+{
+ try
+ {
+ uno::Reference< XTitle > xTitle;
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))),
+ m_xUndoManager, getModel() );
+
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram(getModel()), nCooSysIndex, nDimensionIndex, nAxisIndex );
+
+ TitleHelper::eTitleType eTitleType = TitleHelper::X_AXIS_TITLE;
+ if( nDimensionIndex==0 )
+ eTitleType = nAxisIndex==0 ? TitleHelper::X_AXIS_TITLE : TitleHelper::SECONDARY_X_AXIS_TITLE;
+ else if( nDimensionIndex==1 )
+ eTitleType = nAxisIndex==0 ? TitleHelper::Y_AXIS_TITLE : TitleHelper::SECONDARY_Y_AXIS_TITLE;
+ else
+ eTitleType = TitleHelper::Z_AXIS_TITLE;
+
+ ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider());
+ xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getModel(), m_xCC, apRefSizeProvider.get() );
+ aUndoGuard.commitAction();
+ }
+
+ /*
+ if( xTitle.is() )
+ {
+ OUString aTitleCID = ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, getModel() );
+ select( uno::makeAny(aTitleCID) );
+ executeDispatch_EditText();
+ }
+ */
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertAxis()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeAxisVisible( xAxis );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteAxis()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeAxisInvisible( xAxis );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMajorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteMajorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMinorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridVisible( aSubGrids[nN] );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteMinorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
+ if( xAxis.is() )
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridInvisible( aSubGrids[nN] );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
new file mode 100644
index 000000000000..619d308ffad2
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+
+#include "macros.hxx"
+#include "ChartWindow.hxx"
+#include "DrawViewWrapper.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "UndoGuard.hxx"
+#include "Strings.hrc"
+#include "ObjectNameProvider.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "CommonConverters.hxx"
+#include <svx/ActionDescriptionProvider.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+#include <svx/svxids.hrc>
+#include <svx/rectenum.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& rPosAndSize, const awt::Size aOriginalSize )
+{
+ long nPosX(0);
+ long nPosY(0);
+ long nSizX(0);
+ long nSizY(0);
+
+ RECT_POINT eRP = (RECT_POINT)RP_LT;
+
+ const SfxPoolItem* pPoolItem=NULL;
+ //read position
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,TRUE,&pPoolItem))
+ nPosX=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,TRUE,&pPoolItem))
+ nPosY=((const SfxInt32Item*)pPoolItem)->GetValue();
+ //read size
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,TRUE,&pPoolItem))
+ nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue();
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,TRUE,&pPoolItem))
+ nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue();
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,TRUE,&pPoolItem))
+ eRP=(RECT_POINT)((const SfxAllEnumItem*)pPoolItem)->GetValue();
+
+ switch( eRP )
+ {
+ case RP_LT:
+ break;
+ case RP_MT:
+ nPosX += ( aOriginalSize.Width - nSizX ) / 2;
+ break;
+ case RP_RT:
+ nPosX += aOriginalSize.Width - nSizX;
+ break;
+ case RP_LM:
+ nPosY += ( aOriginalSize.Height - nSizY ) / 2;
+ break;
+ case RP_MM:
+ nPosX += ( aOriginalSize.Width - nSizX ) / 2;
+ nPosY += ( aOriginalSize.Height - nSizY ) / 2;
+ break;
+ case RP_RM:
+ nPosX += aOriginalSize.Width - nSizX;
+ nPosY += ( aOriginalSize.Height - nSizY ) / 2;
+ break;
+ case RP_LB:
+ nPosY += aOriginalSize.Height - nSizY;
+ break;
+ case RP_MB:
+ nPosX += ( aOriginalSize.Width - nSizX ) / 2;
+ nPosY += aOriginalSize.Height - nSizY;
+ break;
+ case RP_RB:
+ nPosX += aOriginalSize.Width - nSizX;
+ nPosY += aOriginalSize.Height - nSizY;
+ break;
+ default:
+ break;
+ }
+
+ rPosAndSize = Rectangle(Point(nPosX,nPosY),Size(nSizX,nSizY));
+}
+
+void SAL_CALL ChartController::executeDispatch_PositionAndSize()
+{
+ const ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
+
+ if( !aCID.getLength() )
+ return;
+
+ awt::Size aSelectedSize;
+ ExplicitValueProvider* pProvider( ExplicitValueProvider::getExplicitValueProvider( m_xChartView ) );
+ if( pProvider )
+ aSelectedSize = ToSize( ( pProvider->getRectangleOfObject( aCID ) ) );
+
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::POS_SIZE,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))),
+ m_xUndoManager, getModel() );
+
+ SfxAbstractTabDialog * pDlg = NULL;
+ try
+ {
+ SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject();
+
+ //prepare and open dialog
+ SdrView* pSdrView = m_pDrawViewWrapper;
+ bool bResizePossible = m_aSelection.isResizeableObjectSelected();
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT( pFact, "No dialog factory" );
+ pDlg = pFact->CreateSchTransformTabDialog(
+ m_pChartWindow, &aItemSet, pSdrView, RID_SCH_TransformTabDLG_SVXPAGE_ANGLE, bResizePossible );
+ DBG_ASSERT( pDlg, "Couldn't create SchTransformTabDialog" );
+
+
+ if( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutItemSet = pDlg->GetOutputItemSet();
+ if(pOutItemSet)
+ {
+ Rectangle aObjectRect;
+ aItemSet.Put(*pOutItemSet);//overwrite old values with new values (-> all items are set)
+ lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect, aSelectedSize );
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
+
+ bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
+ , getModel()
+ , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
+ , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
+ if( bChanged )
+ aUndoGuard.commitAction();
+ }
+ }
+ delete pDlg;
+ }
+ catch( uno::Exception& e)
+ {
+ delete pDlg;
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
new file mode 100644
index 000000000000..649b9cb62f9d
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -0,0 +1,860 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+#include "ChartWindow.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "macros.hxx"
+#include "dlg_ObjectProperties.hxx"
+#include "dlg_View3D.hxx"
+#include "dlg_InsertErrorBars.hxx"
+#include "ViewElementListProvider.hxx"
+#include "DataPointItemConverter.hxx"
+#include "AxisItemConverter.hxx"
+#include "MultipleChartConverters.hxx"
+#include "TitleItemConverter.hxx"
+#include "LegendItemConverter.hxx"
+#include "RegressionCurveItemConverter.hxx"
+#include "RegressionEquationItemConverter.hxx"
+#include "ErrorBarItemConverter.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "TitleHelper.hxx"
+#include "LegendHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ColorPerPointHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ControllerLockGuard.hxx"
+#include "UndoGuard.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "ReferenceSizeProvider.hxx"
+#include "RegressionCurveHelper.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+//for auto_ptr
+#include <memory>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <svx/ActionDescriptionProvider.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+namespace
+{
+
+::comphelper::ItemConverter* createItemConverter(
+ const ::rtl::OUString & aObjectCID
+ , const uno::Reference< frame::XModel > & xChartModel
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , SdrModel & rDrawModel
+ , NumberFormatterWrapper * pNumberFormatterWrapper = NULL
+ , ExplicitValueProvider * pExplicitValueProvider = NULL
+ , ::std::auto_ptr< ReferenceSizeProvider > pRefSizeProvider =
+ ::std::auto_ptr< ReferenceSizeProvider >()
+ )
+{
+ ::comphelper::ItemConverter* pItemConverter=NULL;
+
+ //-------------------------------------------------------------
+ //get type of selected object
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( aObjectCID );
+ if( OBJECTTYPE_UNKNOWN==eObjectType )
+ {
+ DBG_ERROR("unknown ObjectType");
+ return NULL;
+ }
+ //--
+ rtl::OUString aParticleID = ObjectIdentifier::getParticleID( aObjectCID );
+ bool bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
+ //-------------------------------------------------------------
+ if( !bAffectsMultipleObjects )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties =
+ ObjectIdentifier::getObjectPropertySet( aObjectCID, xChartModel );
+ if(!xObjectProperties.is())
+ return NULL;
+ //create itemconverter for a single object
+ switch(eObjectType)
+ {
+ case OBJECTTYPE_PAGE:
+ pItemConverter = new wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES );
+ break;
+ case OBJECTTYPE_TITLE:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ pItemConverter = new wrapper::TitleItemConverter( xObjectProperties,
+ rDrawModel.GetItemPool(), rDrawModel,
+ uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ pRefSize );
+ }
+ break;
+ case OBJECTTYPE_LEGEND:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ pItemConverter = new wrapper::LegendItemConverter( xObjectProperties,
+ rDrawModel.GetItemPool(), rDrawModel,
+ uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ pRefSize );
+ }
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ break;
+ case OBJECTTYPE_DIAGRAM:
+ break;
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ pItemConverter = new wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES );
+ break;
+ case OBJECTTYPE_AXIS:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ uno::Reference< beans::XPropertySet > xDiaProp;
+ xDiaProp.set( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+
+ // the second property set contains the property CoordinateOrigin
+ // nOriginIndex is the index of the corresponding index of the
+ // origin (x=0, y=1, z=2)
+
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ if( pExplicitValueProvider )
+ pExplicitValueProvider->getExplicitValuesForAxis(
+ uno::Reference< XAxis >( xObjectProperties, uno::UNO_QUERY ),
+ aExplicitScale, aExplicitIncrement );
+
+ pItemConverter = new wrapper::AxisItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel,
+ uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ),
+ &aExplicitScale, &aExplicitIncrement,
+ pRefSize );
+ }
+ break;
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_POINT:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ wrapper::GraphicPropertyItemConverter::eGraphicObjectType eMapTo =
+ wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT;
+
+ uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( aObjectCID, xChartModel );
+ uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
+
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ if( !ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ) )
+ eMapTo = wrapper::GraphicPropertyItemConverter::LINE_DATA_POINT;
+ /*
+ FILLED_DATA_POINT,
+ LINE_DATA_POINT,
+ LINE_PROPERTIES,
+ FILL_PROPERTIES,
+ LINE_AND_FILL_PROPERTIES
+ */
+ bool bDataSeries = ( eObjectType == OBJECTTYPE_DATA_SERIES || eObjectType == OBJECTTYPE_DATA_LABELS );
+
+ //special color for pie chart:
+ bool bUseSpecialFillColor = false;
+ sal_Int32 nSpecialFillColor =0;
+ sal_Int32 nPointIndex = -1; /*-1 for whole series*/
+ if(!bDataSeries)
+ {
+ nPointIndex = aParticleID.toInt32();
+ uno::Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ bool bVaryColorsByPoint = false;
+ if( xSeriesProp.is() &&
+ (xSeriesProp->getPropertyValue(C2U("VaryColorsByPoint")) >>= bVaryColorsByPoint) &&
+ bVaryColorsByPoint )
+ {
+ if( !ColorPerPointHelper::hasPointOwnColor( xSeriesProp, nPointIndex, xObjectProperties ) )
+ {
+ bUseSpecialFillColor = true;
+ OSL_ASSERT( xDiagram.is());
+ uno::Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
+ if( xColorScheme.is())
+ nSpecialFillColor = xColorScheme->getColorByIndex( nPointIndex );
+ }
+ }
+ }
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, xSeries, nPointIndex, xDiagram );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
+ xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
+
+ pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext,
+ xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel,
+ pNumberFormatterWrapper,
+ uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, false,
+ nNumberFormat, nPercentNumberFormat );
+ break;
+ }
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ pItemConverter = new wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES );
+ break;
+
+ case OBJECTTYPE_DATA_ERRORS:
+ pItemConverter = new wrapper::ErrorBarItemConverter(
+ xChartModel, xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ 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 ));
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ pItemConverter = new wrapper::RegressionEquationItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(), rDrawModel,
+ uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ pRefSize );
+ break;
+ }
+ case OBJECTTYPE_DATA_ERRORS_X:
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ pItemConverter = new wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
+ wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES );
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ break;
+ }
+ }
+ else
+ {
+ //create itemconverter for a all objects of given type
+ switch(eObjectType)
+ {
+ case OBJECTTYPE_TITLE:
+ pItemConverter = new wrapper::AllTitleItemConverter( xChartModel, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ break;
+ case OBJECTTYPE_AXIS:
+ {
+ ::std::auto_ptr< awt::Size > pRefSize;
+ if( pRefSizeProvider.get() )
+ pRefSize.reset( new awt::Size( pRefSizeProvider->getPageSize()));
+
+ pItemConverter = new wrapper::AllAxisItemConverter( xChartModel, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), pRefSize );
+ }
+ break;
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ pItemConverter = new wrapper::AllGridItemConverter( xChartModel, rDrawModel.GetItemPool(),
+ rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ));
+ break;
+ default: //for this type it is not supported to change all elements at once
+ break;
+ }
+
+ }
+ return pItemConverter;
+}
+
+rtl::OUString lcl_getTitleCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< frame::XModel > & xChartModel )
+{
+ if( rDispatchCommand.equals("AllTitles"))
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_TITLE, C2U("ALLELEMENTS") );
+
+ TitleHelper::eTitleType nTitleType( TitleHelper::MAIN_TITLE );
+ if( rDispatchCommand.equals("SubTitle") )
+ nTitleType = TitleHelper::SUB_TITLE;
+ else if( rDispatchCommand.equals("XTitle") )
+ nTitleType = TitleHelper::X_AXIS_TITLE;
+ else if( rDispatchCommand.equals("YTitle") )
+ nTitleType = TitleHelper::Y_AXIS_TITLE;
+ else if( rDispatchCommand.equals("ZTitle") )
+ nTitleType = TitleHelper::Z_AXIS_TITLE;
+ else if( rDispatchCommand.equals("SecondaryXTitle") )
+ nTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
+ else if( rDispatchCommand.equals("SecondaryYTitle") )
+ nTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
+
+ uno::Reference< XTitle > xTitle( TitleHelper::getTitle( nTitleType, xChartModel ) );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, xChartModel );
+}
+
+rtl::OUString lcl_getAxisCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< frame::XModel >& xChartModel )
+{
+ if( rDispatchCommand.equals("DiagramAxisAll"))
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_AXIS, C2U("ALLELEMENTS") );
+
+ sal_Int32 nDimensionIndex=0;
+ bool bMainAxis=true;
+ if( rDispatchCommand.equals("DiagramAxisX"))
+ {
+ nDimensionIndex=0; bMainAxis=true;
+ }
+ else if( rDispatchCommand.equals("DiagramAxisY"))
+ {
+ nDimensionIndex=1; bMainAxis=true;
+ }
+ else if( rDispatchCommand.equals("DiagramAxisZ"))
+ {
+ nDimensionIndex=2; bMainAxis=true;
+ }
+ else if( rDispatchCommand.equals("DiagramAxisA"))
+ {
+ nDimensionIndex=0; bMainAxis=false;
+ }
+ else if( rDispatchCommand.equals("DiagramAxisB"))
+ {
+ nDimensionIndex=1; bMainAxis=false;
+ }
+
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel );
+}
+
+rtl::OUString lcl_getGridCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< frame::XModel >& xChartModel )
+{
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+
+ if( rDispatchCommand.equals("DiagramGridAll"))
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_GRID, C2U("ALLELEMENTS") );
+
+ sal_Int32 nDimensionIndex=0;
+ bool bMainGrid=true;
+
+ //x and y is swapped in the commands
+
+ if( rDispatchCommand.equals("DiagramGridYMain"))
+ {
+ nDimensionIndex=0; bMainGrid=true;
+ }
+ else if( rDispatchCommand.equals("DiagramGridXMain"))
+ {
+ nDimensionIndex=1; bMainGrid=true;
+ }
+ else if( rDispatchCommand.equals("DiagramGridZMain"))
+ {
+ nDimensionIndex=2; bMainGrid=true;
+ }
+ else if( rDispatchCommand.equals("DiagramGridYHelp"))
+ {
+ nDimensionIndex=0; bMainGrid=false;
+ }
+ else if( rDispatchCommand.equals("DiagramGridXHelp"))
+ {
+ nDimensionIndex=1; bMainGrid=false;
+ }
+ else if( rDispatchCommand.equals("DiagramGridZHelp"))
+ {
+ nDimensionIndex=2; bMainGrid=false;
+ }
+
+ bool bMainAxis = true;
+ uno::Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+
+ sal_Int32 nSubGridIndex= bMainGrid ? (-1) : 0;
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) );
+ return aCID;
+}
+rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument, const rtl::OUString& rSelectedCID )
+{
+ ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
+ rtl::OUString aParticleID;
+
+ uno::Reference< frame::XModel > xChartModel( xChartDocument, uno::UNO_QUERY );
+ const ObjectType eSelectedType = ObjectIdentifier::getObjectType( rSelectedCID );
+ uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartModel );
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xSeries, uno::UNO_QUERY );
+
+ //-------------------------------------------------------------------------
+ //legend
+ if( rDispatchCommand.equals("Legend") || rDispatchCommand.equals("FormatLegend") )
+ {
+ eObjectType = OBJECTTYPE_LEGEND;
+ //@todo set particular aParticleID if we have more than one legend
+ }
+ //-------------------------------------------------------------------------
+ //wall floor area
+ else if( rDispatchCommand.equals("DiagramWall") || rDispatchCommand.equals("FormatWall") )
+ {
+ //OBJECTTYPE_DIAGRAM;
+ eObjectType = OBJECTTYPE_DIAGRAM_WALL;
+ //@todo set particular aParticleID if we have more than one diagram
+ }
+ else if( rDispatchCommand.equals("DiagramFloor") || rDispatchCommand.equals("FormatFloor") )
+ {
+ eObjectType = OBJECTTYPE_DIAGRAM_FLOOR;
+ //@todo set particular aParticleID if we have more than one diagram
+ }
+ else if( rDispatchCommand.equals("DiagramArea") || rDispatchCommand.equals("FormatChartArea") )
+ {
+ eObjectType = OBJECTTYPE_PAGE;
+ }
+ //-------------------------------------------------------------------------
+ //title
+ else if( rDispatchCommand.equals("MainTitle")
+ || rDispatchCommand.equals("SubTitle")
+ || rDispatchCommand.equals("XTitle")
+ || rDispatchCommand.equals("YTitle")
+ || rDispatchCommand.equals("ZTitle")
+ || rDispatchCommand.equals("SecondaryXTitle")
+ || rDispatchCommand.equals("SecondaryYTitle")
+ || rDispatchCommand.equals("AllTitles")
+ )
+ {
+ return lcl_getTitleCIDForCommand( rDispatchCommand, xChartModel );
+ }
+ //-------------------------------------------------------------------------
+ //axis
+ else if( rDispatchCommand.equals("DiagramAxisX")
+ || rDispatchCommand.equals("DiagramAxisY")
+ || rDispatchCommand.equals("DiagramAxisZ")
+ || rDispatchCommand.equals("DiagramAxisA")
+ || rDispatchCommand.equals("DiagramAxisB")
+ || rDispatchCommand.equals("DiagramAxisAll")
+ )
+ {
+ return lcl_getAxisCIDForCommand( rDispatchCommand, xChartModel );
+ }
+ //-------------------------------------------------------------------------
+ //grid
+ else if( rDispatchCommand.equals("DiagramGridYMain")
+ || rDispatchCommand.equals("DiagramGridXMain")
+ || rDispatchCommand.equals("DiagramGridZMain")
+ || rDispatchCommand.equals("DiagramGridYHelp")
+ || rDispatchCommand.equals("DiagramGridXHelp")
+ || rDispatchCommand.equals("DiagramGridZHelp")
+ || rDispatchCommand.equals("DiagramGridAll")
+ )
+ {
+ return lcl_getGridCIDForCommand( rDispatchCommand, xChartModel );
+ }
+ //-------------------------------------------------------------------------
+ //data series
+ else if( rDispatchCommand.equals("FormatDataSeries") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_SERIES )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_DATA_SERIES, ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ) );
+ }
+ //-------------------------------------------------------------------------
+ //data point
+ else if( rDispatchCommand.equals("FormatDataPoint") )
+ {
+ return rSelectedCID;
+ }
+ //-------------------------------------------------------------------------
+ //data labels
+ else if( rDispatchCommand.equals("FormatDataLabels") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_LABELS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_LABELS, ::rtl::OUString(), rSelectedCID );
+ }
+ //-------------------------------------------------------------------------
+ //data labels
+ else if( rDispatchCommand.equals("FormatDataLabel") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_LABEL )
+ return rSelectedCID;
+ else
+ {
+ sal_Int32 nPointIndex = ObjectIdentifier::getParticleID( rSelectedCID ).toInt32();
+ if( nPointIndex>=0 )
+ {
+ OUString aSeriesParticle = ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID );
+ OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ OUString aLabelsCID = ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle );
+ OUString aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_LABEL, ::rtl::OUString(), aLabelsCID );
+
+ return ObjectIdentifier::createPointCID( aLabelCID_Stub, nPointIndex );
+ }
+ }
+ }
+ //-------------------------------------------------------------------------
+ //mean value line
+ else if( rDispatchCommand.equals("FormatMeanValue") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_AVERAGE_LINE )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getMeanValueLine( xRegCurveCnt ) ), true );
+ }
+ //-------------------------------------------------------------------------
+ //trend line
+ else if( rDispatchCommand.equals("FormatTrendline") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_CURVE )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ), false );
+ }
+ //-------------------------------------------------------------------------
+ //trend line equation
+ else if( rDispatchCommand.equals("FormatTrendlineEquation") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveEquationCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ) );
+ }
+ //-------------------------------------------------------------------------
+ // y error bars
+ else if( rDispatchCommand.equals("FormatYErrorBars") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_ERRORS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS, ::rtl::OUString(), rSelectedCID );
+ }
+ //-------------------------------------------------------------------------
+ // axis
+ else if( rDispatchCommand.equals("FormatAxis") )
+ {
+ if( eSelectedType == OBJECTTYPE_AXIS )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis , xChartModel );
+ }
+ }
+ //-------------------------------------------------------------------------
+ // major grid
+ else if( rDispatchCommand.equals("FormatMajorGrid") )
+ {
+ if( eSelectedType == OBJECTTYPE_GRID )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel );
+ }
+
+ }
+ //-------------------------------------------------------------------------
+ // minor grid
+ else if( rDispatchCommand.equals("FormatMinorGrid") )
+ {
+ if( eSelectedType == OBJECTTYPE_SUBGRID )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, 0 /*sub grid index*/ );
+ }
+ }
+ //-------------------------------------------------------------------------
+ // title
+ else if( rDispatchCommand.equals("FormatTitle") )
+ {
+ if( eSelectedType == OBJECTTYPE_TITLE )
+ return rSelectedCID;
+ }
+ //-------------------------------------------------------------------------
+ // stock loss
+ else if( rDispatchCommand.equals("FormatStockLoss") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_STOCK_LOSS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_LOSS, rtl::OUString());
+ }
+ //-------------------------------------------------------------------------
+ // stock gain
+ else if( rDispatchCommand.equals("FormatStockGain") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_STOCK_GAIN )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_GAIN, rtl::OUString() );
+ }
+
+ return ObjectIdentifier::createClassifiedIdentifier(
+ eObjectType, aParticleID );
+}
+
+}
+// anonymous namespace
+
+void SAL_CALL ChartController::executeDispatch_FormatObject(const ::rtl::OUString& rDispatchCommand)
+{
+ uno::Reference< XChartDocument > xChartDocument( getModel(), uno::UNO_QUERY );
+ rtl::OString aCommand( rtl::OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) );
+ rtl::OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument, m_aSelection.getSelectedCID() );
+ executeDlg_ObjectProperties( rObjectCID );
+}
+
+void SAL_CALL ChartController::executeDispatch_ObjectProperties()
+{
+ executeDlg_ObjectProperties( m_aSelection.getSelectedCID() );
+}
+
+namespace
+{
+
+rtl::OUString lcl_getFormatCIDforSelectedCID( const ::rtl::OUString& rSelectedCID )
+{
+ ::rtl::OUString aFormatCID(rSelectedCID);
+
+ //get type of selected object
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( aFormatCID );
+
+ // some legend entries are handled as if they were data series
+ if( OBJECTTYPE_LEGEND_ENTRY==eObjectType )
+ {
+ rtl::OUString aParentParticle( ObjectIdentifier::getFullParentParticle( rSelectedCID ) );
+ aFormatCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
+ }
+
+ // treat diagram as wall
+ if( OBJECTTYPE_DIAGRAM==eObjectType )
+ aFormatCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() );
+
+ return aFormatCID;
+}
+
+}//end anonymous namespace
+
+void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUString& rSelectedObjectCID )
+{
+ rtl::OUString aObjectCID = lcl_getFormatCIDforSelectedCID( rSelectedObjectCID );
+
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::FORMAT,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
+ m_xUndoManager, getModel() );
+
+ bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false );
+ if( bSuccess )
+ aUndoGuard.commitAction();
+}
+
+bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso )
+{
+ //return true if the properties were changed successfully
+ bool bRet = false;
+ if( !rObjectCID.getLength() )
+ {
+ //DBG_ERROR("empty ObjectID");
+ return bRet;
+ }
+ try
+ {
+ NumberFormatterWrapper aNumberFormatterWrapper( uno::Reference< util::XNumberFormatsSupplier >(getModel(), uno::UNO_QUERY) );
+
+ //-------------------------------------------------------------
+ //get type of object
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
+ if( OBJECTTYPE_UNKNOWN==eObjectType )
+ {
+ //DBG_ERROR("unknown ObjectType");
+ return bRet;
+ }
+ if( OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType )
+ {
+ if( !DiagramHelper::isSupportingFloorAndWall( ChartModelHelper::findDiagram( getModel() ) ) )
+ return bRet;
+ }
+
+ //-------------------------------------------------------------
+ //convert properties to ItemSet
+
+ awt::Size aPageSize( ChartModelHelper::getPageSize(getModel()) );
+
+ ::std::auto_ptr< ReferenceSizeProvider > pRefSizeProv(
+ impl_createReferenceSizeProvider());
+ ::std::auto_ptr< ::comphelper::ItemConverter > apItemConverter(
+ createItemConverter( rObjectCID, getModel(), m_xCC,
+ m_pDrawModelWrapper->getSdrModel(),
+ &aNumberFormatterWrapper,
+ ExplicitValueProvider::getExplicitValueProvider(m_xChartView),
+ pRefSizeProv ));
+ if(!apItemConverter.get())
+ return bRet;
+
+ SfxItemSet aItemSet = apItemConverter->CreateEmptyItemSet();
+ apItemConverter->FillItemSet( aItemSet );
+
+ //-------------------------------------------------------------
+ //prepare dialog
+ ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( rObjectCID );
+ aDialogParameter.init( getModel() );
+ ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ SchAttribTabDlg aDlg( m_pChartWindow, &aItemSet, &aDialogParameter, &aViewElementListProvider
+ , uno::Reference< util::XNumberFormatsSupplier >( getModel(), uno::UNO_QUERY ) );
+
+ if(aDialogParameter.HasSymbolProperties())
+ {
+ SfxItemSet* pSymbolShapeProperties=NULL;
+ uno::Reference< beans::XPropertySet > xObjectProperties =
+ ObjectIdentifier::getObjectPropertySet( rObjectCID, getModel() );
+ wrapper::DataPointItemConverter aSymbolItemConverter( getModel(), m_xCC
+ , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, getModel() )
+ , m_pDrawModelWrapper->getSdrModel().GetItemPool()
+ , m_pDrawModelWrapper->getSdrModel()
+ , &aNumberFormatterWrapper
+ , uno::Reference< lang::XMultiServiceFactory >( getModel(), uno::UNO_QUERY )
+ , wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT );
+
+ pSymbolShapeProperties = new SfxItemSet( aSymbolItemConverter.CreateEmptyItemSet() );
+ aSymbolItemConverter.FillItemSet( *pSymbolShapeProperties );
+
+ sal_Int32 nStandardSymbol=0;//@todo get from somewhere
+ Graphic* pAutoSymbolGraphic = new Graphic( aViewElementListProvider.GetSymbolGraphic( nStandardSymbol, pSymbolShapeProperties ) );
+ // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic
+ aDlg.setSymbolInformation( pSymbolShapeProperties, pAutoSymbolGraphic );
+ }
+ if( aDialogParameter.HasStatisticProperties() )
+ {
+ aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, rObjectCID ) );
+ }
+
+ //-------------------------------------------------------------
+ //open the dialog
+ if( aDlg.Execute() == RET_OK || (bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso && aDlg.DialogWasClosedWithOK()) )
+ {
+ const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
+ if(pOutItemSet)
+ {
+ ControllerLockGuard aCLGuard( getModel());
+ apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now
+ bRet = true;
+ }
+ }
+ }
+ catch( util::CloseVetoException& )
+ {
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+ return bRet;
+}
+
+void SAL_CALL ChartController::executeDispatch_View3D()
+{
+ try
+ {
+ // using assignment for broken gcc 3.3
+ UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_3D_VIEW ))),
+ m_xUndoManager, getModel());
+
+ // /--
+ //open dialog
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorTable() );
+ if( aDlg.Execute() == RET_OK )
+ aUndoGuard.commitAction();
+ // \--
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
new file mode 100644
index 000000000000..a6e82430d8f6
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+
+#include "DrawViewWrapper.hxx"
+#include "ChartWindow.hxx"
+#include "TitleHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "ControllerLockGuard.hxx"
+#include "AccessibleTextHelper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+
+#include <svx/svdotext.hxx>
+
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class SdrOutliner
+#include <svx/svdoutl.hxx>
+#include <svx/svxdlg.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <svl/stritem.hxx>
+#include <editeng/fontitem.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void SAL_CALL ChartController::executeDispatch_EditText( const Point* pMousePixel )
+{
+ this->StartTextEdit( pMousePixel );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void ChartController::StartTextEdit( const Point* pMousePixel )
+{
+ //the first marked object will be edited
+
+ SdrObject* pTextObj = m_pDrawViewWrapper->getTextEditObject();
+ if(!pTextObj)
+ return;
+
+ m_xUndoManager->preAction( getModel());
+ SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
+ //pOutliner->SetRefDevice(m_pChartWindow);
+ //pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool);
+ //pOutliner->SetDefaultLanguage( eLang );
+ //pOutliner->SetHyphenator( xHyphenator );
+
+ //#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( C2U("SdrViewIsInEditMode"), uno::makeAny(sal_True) );
+
+ sal_Bool bEdit = m_pDrawViewWrapper->SdrBeginTextEdit( pTextObj
+ , m_pDrawViewWrapper->GetPageView()
+ , m_pChartWindow
+ , sal_False //bIsNewObj
+ , pOutliner
+ , 0L //pOutlinerView
+ , sal_True //bDontDeleteOutliner
+ , sal_True //bOnlyOneView
+ );
+ if(bEdit)
+ {
+ // set undo manager at topmost shell ( SdDrawTextObjectBar )
+ /*
+ if( pViewSh )
+ pViewSh->GetViewFrame()->GetDispatcher()->GetShell( 0 )->
+ SetUndoManager(&pOutliner->GetUndoManager());
+ */
+ m_pDrawViewWrapper->SetEditMode();
+
+ // #i12587# support for shapes in chart
+ if ( pMousePixel )
+ {
+ OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+ if ( pOutlinerView )
+ {
+ MouseEvent aEditEvt( *pMousePixel, 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
+ pOutlinerView->MouseButtonDown( aEditEvt );
+ pOutlinerView->MouseButtonUp( aEditEvt );
+ }
+ }
+
+ //we invalidate the outliner region because the outliner has some
+ //paint problems (some characters are painted twice a little bit shifted)
+ m_pChartWindow->Invalidate( m_pDrawViewWrapper->GetMarkedObjBoundRect() );
+ }
+}
+
+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( C2U("SdrViewIsInEditMode"), uno::makeAny(sal_False) );
+
+ SdrObject* pTextObject = m_pDrawViewWrapper->getTextEditObject();
+ if(!pTextObject)
+ return false;
+
+ SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
+ OutlinerParaObject* pParaObj = pTextObject->GetOutlinerParaObject();
+ if( pParaObj && pOutliner )
+ {
+ pOutliner->SetText( *pParaObj );
+
+ String aString = pOutliner->GetText(
+ pOutliner->GetParagraph( 0 ),
+ pOutliner->GetParagraphCount() );
+
+ ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID();
+ if ( aObjectCID.getLength() > 0 )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet =
+ ObjectIdentifier::getObjectPropertySet( aObjectCID, getModel() );
+
+ // lock controllers till end of block
+ ControllerLockGuard aCLGuard( getModel() );
+
+ TitleHelper::setCompleteString( aString, uno::Reference<
+ ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC );
+
+ try
+ {
+ m_xUndoManager->postAction( C2U("Edit Text") );
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ else
+ {
+ try
+ {
+ m_xUndoManager->cancelAction();
+ }
+ catch ( uno::RuntimeException& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ if( m_pDrawViewWrapper && !m_pDrawViewWrapper->IsTextEdit() )
+ this->StartTextEdit();
+
+ SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT( pFact, "No dialog factory" );
+
+ SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+
+ //set fixed current font
+ aSet.Put( SfxBoolItem( FN_PARAM_2, TRUE ) ); //maybe not necessary in future
+
+ Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont();
+ aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );
+
+ SfxAbstractDialog * pDlg = pFact->CreateSfxDialog( m_pChartWindow, aSet, getFrame(), RID_SVXDLG_CHARMAP );
+ DBG_ASSERT( pDlg, "Couldn't create SvxCharacterMap dialog" );
+ if( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pSet = pDlg->GetOutputItemSet();
+ const SfxPoolItem* pItem=0;
+ String aString;
+ if ( pSet && pSet->GetItemState( SID_CHARMAP, TRUE, &pItem) == SFX_ITEM_SET &&
+ pItem->ISA(SfxStringItem) )
+ aString = dynamic_cast<const SfxStringItem*>(pItem)->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(String());
+
+ //SfxUndoManager& rUndoMgr = pOutliner->GetUndoManager();
+ //rUndoMgr.EnterListAction( String( SchResId( STR_UNDO_INSERT_SPECCHAR )), String( SchResId( STR_UNDO_INSERT_SPECCHAR )));
+ pOutlinerView->InsertText(aString, TRUE);
+
+ ESelection aSel = pOutlinerView->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOutlinerView->SetSelection(aSel);
+
+ //rUndoMgr.LeaveListAction();
+
+ // show changes
+ pOutliner->SetUpdateMode(TRUE);
+ pOutlinerView->ShowCursor();
+ }
+
+ delete pDlg;
+}
+
+uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ ChartController::impl_createAccessibleTextContext()
+{
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xResult(
+ new AccessibleTextHelper( m_pDrawViewWrapper ));
+
+ return xResult;
+}
+
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
new file mode 100644
index 000000000000..779e3c32f1e7
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -0,0 +1,919 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartController.hxx"
+#include "ChartWindow.hxx"
+#include "ChartModelHelper.hxx"
+#include "TitleHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "UndoGuard.hxx"
+#include "ControllerLockGuard.hxx"
+#include "macros.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "ObjectIdentifier.hxx"
+#include "ReferenceSizeProvider.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "ChartTransferable.hxx"
+#include "DrawViewWrapper.hxx"
+#include "LegendHelper.hxx"
+#include "AxisHelper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "ShapeController.hxx"
+#include "DiagramHelper.hxx"
+#include "ObjectNameProvider.hxx"
+
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/io/XInputStream.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 <svx/ActionDescriptionProvider.hxx>
+// for TransferableDataHelper/TransferableHelper
+#include <svtools/transfer.hxx>
+// for SotStorageStreamRef
+#include <sot/storage.hxx>
+// for Graphic
+#include <vcl/graph.hxx>
+// for SvxDrawingLayerImport/SvxUnoDrawingModel
+#include <svx/unomodel.hxx>
+// for SdrModel
+#include <svx/svdmodel.hxx>
+// for OInputStreamWrapper
+#include <unotools/streamwrap.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+// for OutlinerView
+#include <editeng/outliner.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/unopage.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+bool lcl_deleteDataSeries(
+ const OUString & rCID,
+ const Reference< frame::XModel > & xModel,
+ const Reference< chart2::XUndoManager > & xUndoManager )
+{
+ bool bResult = false;
+ uno::Reference< chart2::XDataSeries > xSeries( ::chart::ObjectIdentifier::getDataSeriesForCID( rCID, xModel ));
+ uno::Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ if( xSeries.is() && xChartDoc.is())
+ {
+ uno::Reference< chart2::XChartType > xChartType(
+ ::chart::DataSeriesHelper::getChartTypeOfSeries( xSeries, xChartDoc->getFirstDiagram()));
+ if( xChartType.is())
+ {
+ ::chart::UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_DATASERIES )))),
+ xUndoManager, xModel );
+
+ Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) );
+ uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) );
+
+ ::chart::DataSeriesHelper::deleteSeries( xSeries, xChartType );
+
+ ::chart::AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram );
+
+ bResult = true;
+ aUndoGuard.commitAction();
+ }
+ }
+ return bResult;
+}
+
+bool lcl_deleteDataCurve(
+ const OUString & rCID,
+ const Reference< frame::XModel > & xModel,
+ const Reference< chart2::XUndoManager > & xUndoManager )
+{
+ bool bResult = false;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ::chart::ObjectIdentifier::getObjectPropertySet(
+ ::chart::ObjectIdentifier::getSeriesParticleFromCID( rCID ), xModel ), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ ::chart::UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_CURVE )))),
+ xUndoManager, xModel );
+ ::chart::RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt );
+ bResult = true;
+ aUndoGuard.commitAction();
+ }
+ return bResult;
+}
+
+// void lcl_CopyPageContentToPage(
+// const Reference< drawing::XDrawPage > & xSourcePage,
+// const Reference< drawing::XDrawPage > & xDestPage )
+// {
+// try
+// {
+// Reference< container::XIndexAccess > xSourceIA( xSourcePage, uno::UNO_QUERY_THROW );
+// sal_Int32 nCount( xSourceIA->getCount());
+// for( sal_Int32 i=0; i<nCount; ++i )
+// {
+// Reference< drawing::XShape > xShape;
+// if( xSourceIA->getByIndex( i ) >>= xShape )
+// xDestPage->add( xShape );
+// }
+// }
+// catch( const uno::Exception & ex )
+// {
+// ASSERT_EXCEPTION( ex );
+// }
+// }
+
+// // copies all shapes on all pages of xSource to the only page of xDestination
+// void lcl_CopyShapesToChart(
+// const Reference< frame::XModel > & xSource, const Reference< frame::XModel > & xDestination )
+// {
+// try
+// {
+// Reference< drawing::XDrawPageSupplier > xDestPGSupp( xDestination, uno::UNO_QUERY_THROW );
+// Reference< drawing::XDrawPage > xDestPage( xDestPGSupp->getDrawPage());
+// Reference< drawing::XDrawPagesSupplier > xSourcePGsSupp( xSource, uno::UNO_QUERY_THROW );
+// Reference< drawing::XDrawPages > xSourcePages( xSourcePGsSupp->getDrawPages());
+
+// sal_Int32 nCount( xSourcePages->getCount());
+// for( sal_Int32 i=0; i<nCount; ++i )
+// {
+// Reference< drawing::XDrawPage > xSourcePage( xSourcePages->getByIndex( i ), uno::UNO_QUERY_THROW );
+// lcl_CopyPageContentToPage( xSourcePage, xDestPage );
+// }
+// }
+// catch( const uno::Exception & ex )
+// {
+// ASSERT_EXCEPTION( ex );
+// }
+// }
+
+} // anonymous namespace
+
+
+namespace chart
+{
+
+::std::auto_ptr< ReferenceSizeProvider > ChartController::impl_createReferenceSizeProvider()
+{
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+
+ return ::std::auto_ptr< ReferenceSizeProvider >(
+ new ReferenceSizeProvider( aPageSize,
+ Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY )));
+}
+
+void ChartController::impl_adaptDataSeriesAutoResize()
+{
+ ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider(
+ impl_createReferenceSizeProvider());
+ if( apRefSizeProvider.get())
+ apRefSizeProvider->setValuesAtAllDataSeries();
+}
+
+void ChartController::executeDispatch_NewArrangement()
+{
+ // remove manual positions at titles, legend and the diagram, remove manual
+ // size at the diagram
+
+ try
+ {
+ Reference< frame::XModel > xModel( getModel() );
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+ if( xDiagram.is())
+ {
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_REARRANGE_CHART ))),
+ m_xUndoManager, xModel );
+ ControllerLockGuard aCtlLockGuard( xModel );
+
+ // diagram
+ Reference< beans::XPropertyState > xState( xDiagram, uno::UNO_QUERY_THROW );
+ xState->setPropertyToDefault( C2U("RelativeSize"));
+ xState->setPropertyToDefault( C2U("RelativePosition"));
+ xState->setPropertyToDefault( C2U("PosSizeExcludeAxes"));
+
+ // 3d rotation
+ ThreeDHelper::set3DSettingsToDefault( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ) );
+
+ // legend
+ Reference< beans::XPropertyState > xLegendState( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendState.is())
+ xLegendState->setPropertyToDefault( C2U("RelativePosition"));
+
+ // titles
+ for( sal_Int32 eType = TitleHelper::TITLE_BEGIN;
+ eType < TitleHelper::NORMAL_TITLE_END;
+ ++eType )
+ {
+ Reference< beans::XPropertyState > xTitleState(
+ TitleHelper::getTitle(
+ static_cast< TitleHelper::eTitleType >( eType ), xModel ), uno::UNO_QUERY );
+ if( xTitleState.is())
+ xTitleState->setPropertyToDefault( C2U("RelativePosition"));
+ }
+
+ // regression curve equations
+ ::std::vector< Reference< chart2::XRegressionCurve > > aRegressionCurves(
+ RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( xDiagram ));
+ ::std::for_each( aRegressionCurves.begin(), aRegressionCurves.end(),
+ RegressionCurveHelper::resetEquationPosition );
+
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ChartController::executeDispatch_ScaleText()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_SCALE_TEXT ))),
+ m_xUndoManager, getModel() );
+ ControllerLockGuard aCtlLockGuard( getModel() );
+ ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider());
+ OSL_ASSERT( apRefSizeProv.get());
+ if( apRefSizeProv.get())
+ apRefSizeProv->toggleAutoResizeState();
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_Paste()
+{
+ if( m_pChartWindow )
+ {
+ Graphic aGraphic;
+ // paste location: center of window
+ Point aPos;
+ aPos = m_pChartWindow->PixelToLogic( Rectangle( aPos, m_pChartWindow->GetSizePixel()).Center());
+
+ // handle different formats
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( m_pChartWindow ));
+ if( aDataHelper.GetTransferable().is())
+ {
+ if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
+ {
+ SotStorageStreamRef xStm;
+ if ( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStm ) )
+ {
+ xStm->Seek( 0 );
+ Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( *xStm ) );
+ ::boost::scoped_ptr< SdrModel > spModel( new SdrModel() );
+ if ( SvxDrawingLayerImport( spModel.get(), xInputStream ) )
+ {
+ impl_PasteShapes( spModel.get() );
+ }
+ }
+ }
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) )
+ {
+ // graphic exchange format (graphic manager bitmap format?)
+ SotStorageStreamRef xStm;
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ))
+ (*xStm) >> aGraphic;
+ }
+ else if( aDataHelper.HasFormat( FORMAT_GDIMETAFILE ))
+ {
+ // meta file
+ GDIMetaFile aMetafile;
+ if( aDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMetafile ))
+ aGraphic = Graphic( aMetafile );
+ }
+ else if( aDataHelper.HasFormat( FORMAT_BITMAP ))
+ {
+ // bitmap (non-graphic-manager)
+ Bitmap aBmp;
+ if( aDataHelper.GetBitmap( FORMAT_BITMAP, aBmp ))
+ aGraphic = Graphic( aBmp );
+ }
+ else if( aDataHelper.HasFormat( FORMAT_STRING ))
+ {
+ OUString aString;
+ if( aDataHelper.GetString( FORMAT_STRING, aString ) && m_pDrawModelWrapper )
+ {
+ if( m_pDrawViewWrapper )
+ {
+ OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+ if( pOutlinerView )//in case of edit mode insert into edited string
+ pOutlinerView->InsertText( aString );
+ else
+ {
+ impl_PasteStringAsTextShape( aString, awt::Point( 0, 0 ) );
+ }
+ }
+ }
+ }
+ }
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic());
+ if( xGraphic.is())
+ impl_PasteGraphic( xGraphic, aPos );
+ }
+ }
+}
+
+// note: aPosition is ignored for now. The object is always pasted centered to
+// the page
+void ChartController::impl_PasteGraphic(
+ uno::Reference< graphic::XGraphic > & xGraphic,
+ const ::Point & /* aPosition */ )
+{
+ // 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 );
+ DrawModelWrapper * pDrawModelWrapper( this->GetDrawModelWrapper());
+ if( ! (xGraphic.is() && xModelProp.is()))
+ return;
+ uno::Reference< lang::XMultiServiceFactory > xFact( pDrawModelWrapper->getShapeFactory());
+ uno::Reference< drawing::XShape > xGraphicShape(
+ xFact->createInstance( C2U( "com.sun.star.drawing.GraphicObjectShape" )), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xGraphicShapeProp( xGraphicShape, uno::UNO_QUERY );
+ if( xGraphicShapeProp.is() && xGraphicShape.is())
+ {
+ uno::Reference< drawing::XShapes > xPage( pDrawModelWrapper->getMainDrawPage(), uno::UNO_QUERY );
+ 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 );
+ }
+ //select new shape
+ m_aSelection.setSelection( xGraphicShape );
+ m_aSelection.applySelection( m_pDrawViewWrapper );
+ }
+ xGraphicShapeProp->setPropertyValue( C2U("Graphic"), uno::makeAny( xGraphic ));
+ uno::Reference< beans::XPropertySet > xGraphicProp( xGraphic, uno::UNO_QUERY );
+
+ awt::Size aGraphicSize( 1000, 1000 );
+ // first try size in 100th mm, then pixel size
+ if( ! ( xGraphicProp->getPropertyValue( C2U("Size100thMM")) >>= aGraphicSize ) &&
+ ( ( xGraphicProp->getPropertyValue( C2U("SizePixel")) >>= aGraphicSize ) && m_pChartWindow ))
+ {
+ ::Size aVCLSize( m_pChartWindow->PixelToLogic( Size( aGraphicSize.Width, aGraphicSize.Height )));
+ aGraphicSize.Width = aVCLSize.getWidth();
+ aGraphicSize.Height = aVCLSize.getHeight();
+ }
+ xGraphicShape->setSize( aGraphicSize );
+ xGraphicShape->setPosition( awt::Point( 0, 0 ) );
+ }
+}
+
+void ChartController::impl_PasteShapes( SdrModel* pModel )
+{
+ DrawModelWrapper* pDrawModelWrapper( this->GetDrawModelWrapper() );
+ if ( pDrawModelWrapper && m_pDrawViewWrapper )
+ {
+ Reference< drawing::XDrawPage > xDestPage( pDrawModelWrapper->getMainDrawPage() );
+ SdrPage* pDestPage = GetSdrPageFromXDrawPage( xDestPage );
+ if ( pDestPage )
+ {
+ Reference< drawing::XShape > xSelShape;
+ m_pDrawViewWrapper->BegUndo( SVX_RESSTR( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) );
+ sal_uInt16 nCount = pModel->GetPageCount();
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ const SdrPage* pPage = pModel->GetPage( i );
+ SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ SdrObject* pNewObj = ( pObj ? pObj->Clone() : NULL );
+ if ( pNewObj )
+ {
+ pNewObj->SetModel( &pDrawModelWrapper->getSdrModel() );
+ pNewObj->SetPage( pDestPage );
+
+ // set position
+ Reference< drawing::XShape > xShape( pNewObj->getUnoShape(), uno::UNO_QUERY );
+ if ( xShape.is() )
+ {
+ xShape->setPosition( awt::Point( 0, 0 ) );
+ }
+
+ pDestPage->InsertObject( pNewObj );
+ m_pDrawViewWrapper->AddUndo( new SdrUndoInsertObj( *pNewObj ) );
+ xSelShape = xShape;
+ }
+ }
+ }
+
+ Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY );
+ if ( xModifiable.is() )
+ {
+ xModifiable->setModified( true );
+ }
+
+ // select last inserted shape
+ m_aSelection.setSelection( xSelShape );
+ m_aSelection.applySelection( m_pDrawViewWrapper );
+
+ m_pDrawViewWrapper->EndUndo();
+
+ impl_switchDiagramPositioningToExcludingPositioning();
+ }
+ }
+}
+
+void ChartController::impl_PasteStringAsTextShape( const OUString& rString, const awt::Point& rPosition )
+{
+ DrawModelWrapper* pDrawModelWrapper( this->GetDrawModelWrapper() );
+ if ( pDrawModelWrapper && m_pDrawViewWrapper )
+ {
+ const Reference< lang::XMultiServiceFactory >& xShapeFactory( pDrawModelWrapper->getShapeFactory() );
+ const Reference< drawing::XDrawPage >& xDrawPage( pDrawModelWrapper->getMainDrawPage() );
+ OSL_ASSERT( xShapeFactory.is() && xDrawPage.is() );
+
+ if ( xShapeFactory.is() && xDrawPage.is() )
+ {
+ try
+ {
+ Reference< drawing::XShape > xTextShape(
+ xShapeFactory->createInstance( C2U( "com.sun.star.drawing.TextShape" ) ), uno::UNO_QUERY_THROW );
+ xDrawPage->add( xTextShape );
+
+ Reference< text::XTextRange > xRange( xTextShape, uno::UNO_QUERY_THROW );
+ xRange->setString( rString );
+
+ float fCharHeight = 10.0;
+ Reference< beans::XPropertySet > xProperties( xTextShape, uno::UNO_QUERY_THROW );
+ xProperties->setPropertyValue( C2U( "TextAutoGrowHeight" ), uno::makeAny( true ) );
+ xProperties->setPropertyValue( C2U( "TextAutoGrowWidth" ), uno::makeAny( true ) );
+ xProperties->setPropertyValue( C2U( "CharHeight" ), uno::makeAny( fCharHeight ) );
+ xProperties->setPropertyValue( C2U( "CharHeightAsian" ), uno::makeAny( fCharHeight ) );
+ xProperties->setPropertyValue( C2U( "CharHeightComplex" ), uno::makeAny( fCharHeight ) );
+ xProperties->setPropertyValue( C2U( "TextVerticalAdjust" ), uno::makeAny( drawing::TextVerticalAdjust_CENTER ) );
+ xProperties->setPropertyValue( C2U( "TextHorizontalAdjust" ), uno::makeAny( drawing::TextHorizontalAdjust_CENTER ) );
+ xProperties->setPropertyValue( C2U( "CharFontName" ), uno::makeAny( C2U( "Albany" ) ) );
+
+ xTextShape->setPosition( rPosition );
+
+ m_aSelection.setSelection( xTextShape );
+ m_aSelection.applySelection( m_pDrawViewWrapper );
+
+ SdrObject* pObj = DrawViewWrapper::getSdrObject( xTextShape );
+ if ( pObj )
+ {
+ m_pDrawViewWrapper->BegUndo( SVX_RESSTR( RID_SVX_3D_UNDO_EXCHANGE_PASTE ) );
+ m_pDrawViewWrapper->AddUndo( new SdrUndoInsertObj( *pObj ) );
+ m_pDrawViewWrapper->EndUndo();
+
+ impl_switchDiagramPositioningToExcludingPositioning();
+ }
+ }
+ catch ( const uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+void ChartController::executeDispatch_Copy()
+{
+ if ( m_pDrawViewWrapper )
+ {
+ OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+ if ( pOutlinerView )
+ {
+ pOutlinerView->Copy();
+ }
+ else
+ {
+ Reference< datatransfer::XTransferable > xTransferable;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ SdrObject* pSelectedObj = 0;
+ if ( m_pDrawModelWrapper )
+ {
+ ObjectIdentifier aSelOID( m_aSelection.getSelectedOID() );
+ if ( aSelOID.isAutoGeneratedObject() )
+ {
+ pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() );
+ }
+ else if ( aSelOID.isAdditionalShape() )
+ {
+ pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() );
+ }
+ if ( pSelectedObj )
+ {
+ xTransferable = Reference< datatransfer::XTransferable >( new ChartTransferable(
+ &m_pDrawModelWrapper->getSdrModel(), pSelectedObj, aSelOID.isAdditionalShape() ) );
+ }
+ }
+ }
+ if ( xTransferable.is() )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard( TransferableHelper::GetSystemClipboard() );
+ if ( xClipboard.is() )
+ {
+ xClipboard->setContents( xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >() );
+ }
+ }
+ }
+ }
+}
+
+void ChartController::executeDispatch_Cut()
+{
+ executeDispatch_Copy();
+ executeDispatch_Delete();
+}
+
+//static
+bool ChartController::isObjectDeleteable( const uno::Any& rSelection )
+{
+ ObjectIdentifier aSelOID( rSelection );
+ if ( aSelOID.isAutoGeneratedObject() )
+ {
+ OUString aSelObjCID( aSelOID.getObjectCID() );
+ ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID ));
+ if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) )
+ return true;
+ if( (OBJECTTYPE_DATA_SERIES == aObjectType) || (OBJECTTYPE_LEGEND_ENTRY == aObjectType) )
+ return true;
+ if( (OBJECTTYPE_DATA_CURVE_EQUATION == aObjectType) || (OBJECTTYPE_DATA_CURVE == aObjectType) ||
+ (OBJECTTYPE_DATA_AVERAGE_LINE == aObjectType) || (OBJECTTYPE_DATA_ERRORS == aObjectType))
+ return true;
+ if( (OBJECTTYPE_DATA_LABELS == aObjectType) || (OBJECTTYPE_DATA_LABEL == aObjectType) )
+ return true;
+ if( (OBJECTTYPE_AXIS == aObjectType) || (OBJECTTYPE_GRID == aObjectType) || (OBJECTTYPE_SUBGRID == aObjectType) )
+ return true;
+ }
+ else if ( aSelOID.isAdditionalShape() )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool ChartController::isShapeContext() const
+{
+ if ( m_aSelection.isAdditionalShapeSelected() ||
+ ( m_pDrawViewWrapper && m_pDrawViewWrapper->AreObjectsMarked() &&
+ ( m_pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) ) )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void ChartController::impl_ClearSelection()
+{
+ if( m_aSelection.hasSelection())
+ {
+ m_aSelection.clearSelection();
+ impl_notifySelectionChangeListeners();
+ }
+}
+
+bool ChartController::executeDispatch_Delete()
+{
+ bool bReturn = false;
+
+ // remove the selected object
+ //
+ rtl::OUString aCID( m_aSelection.getSelectedCID() );
+ if( aCID.getLength() )
+ {
+ if( !isObjectDeleteable( uno::Any( aCID ) ) )
+ return false;
+
+ //remove chart object
+ uno::Reference< chart2::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ if( !xChartDoc.is() )
+ return false;
+
+ ObjectType aObjectType( ObjectIdentifier::getObjectType( aCID ));
+ switch( aObjectType )
+ {
+ case OBJECTTYPE_TITLE:
+ {
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))),
+ m_xUndoManager, getModel());
+ TitleHelper::removeTitle(
+ ObjectIdentifier::getTitleTypeForCID( aCID ), getModel() );
+ bReturn = true;
+ aUndoGuard.commitAction();
+ break;
+ }
+ case OBJECTTYPE_LEGEND:
+ {
+ uno::Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+ if( xDiagram.is())
+ {
+ uno::Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ {
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, getModel() );
+ xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( false ));
+ bReturn = true;
+ aUndoGuard.commitAction();
+ }
+ }
+ break;
+ }
+
+ case OBJECTTYPE_DATA_SERIES:
+ bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager );
+ break;
+
+ case OBJECTTYPE_LEGEND_ENTRY:
+ {
+ ObjectType eParentObjectType = ObjectIdentifier::getObjectType(
+ ObjectIdentifier::getFullParentParticle( aCID ));
+ if( eParentObjectType == OBJECTTYPE_DATA_SERIES )
+ bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager );
+ else if( eParentObjectType == OBJECTTYPE_DATA_CURVE )
+ bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager );
+ break;
+ }
+
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getObjectPropertySet(
+ ObjectIdentifier::getFullParentParticle( aCID ), getModel()), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
+ m_xUndoManager, getModel() );
+ RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt );
+ bReturn = true;
+ aUndoGuard.commitAction();
+ }
+ break;
+ }
+
+ case OBJECTTYPE_DATA_CURVE:
+ bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager );
+ break;
+
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( aCID, getModel()));
+ if( xEqProp.is())
+ {
+ uno::Reference< frame::XModel > xModel( getModel() );
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, xModel );
+ {
+ ControllerLockGuard aCtlLockGuard( xModel );
+ xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false ));
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ }
+ bReturn = true;
+ aUndoGuard.commitAction();
+ }
+ break;
+ }
+
+ case OBJECTTYPE_DATA_ERRORS:
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(
+ ObjectIdentifier::getObjectPropertySet( aCID, getModel() ));
+ if( xErrorBarProp.is())
+ {
+ uno::Reference< frame::XModel > xModel( getModel() );
+ // using assignment for broken gcc 3.3
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))),
+ m_xUndoManager, xModel );
+ {
+ ControllerLockGuard aCtlLockGuard( xModel );
+ xErrorBarProp->setPropertyValue(
+ C2U("ErrorBarStyle"),
+ uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ));
+ }
+ bReturn = true;
+ aUndoGuard.commitAction();
+ }
+ break;
+ }
+
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties =
+ ObjectIdentifier::getObjectPropertySet( aCID, getModel() );
+ if( xObjectProperties.is() )
+ {
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String(
+ SchResId( aObjectType == OBJECTTYPE_DATA_LABEL ? STR_OBJECT_LABEL : STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, getModel() );
+ chart2::DataPointLabel aLabel;
+ xObjectProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = false;
+ aLabel.ShowNumberInPercent = false;
+ aLabel.ShowCategoryName = false;
+ aLabel.ShowLegendSymbol = false;
+ if( aObjectType == OBJECTTYPE_DATA_LABELS )
+ {
+ uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( aCID, getModel() ));
+ ::chart::DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "Label" ), uno::makeAny(aLabel) );
+ }
+ else
+ xObjectProperties->setPropertyValue( C2U( "Label" ), uno::makeAny(aLabel) );
+ bReturn = true;
+ aUndoGuard.commitAction();
+ }
+ break;
+ }
+ case OBJECTTYPE_AXIS:
+ {
+ executeDispatch_DeleteAxis();
+ bReturn = true;
+ break;
+ }
+ case OBJECTTYPE_GRID:
+ {
+ executeDispatch_DeleteMajorGrid();
+ bReturn = true;
+ break;
+ }
+ case OBJECTTYPE_SUBGRID:
+ {
+ executeDispatch_DeleteMinorGrid();
+ bReturn = true;
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ //remove additional shape
+ impl_ClearSelection();
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( m_pDrawViewWrapper )
+ {
+ m_pDrawViewWrapper->DeleteMarked();
+ bReturn = true;
+ }
+ }
+ }
+ return bReturn;
+}
+
+void ChartController::executeDispatch_ToggleLegend()
+{
+ Reference< frame::XModel > xModel( getModel() );
+ UndoGuard aUndoGuard = UndoGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_LEGEND ))), m_xUndoManager, xModel );
+ Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( xModel ), uno::UNO_QUERY );
+ bool bChanged = false;
+ if( xLegendProp.is())
+ {
+ try
+ {
+ bool bShow = false;
+ if( xLegendProp->getPropertyValue( C2U("Show")) >>= bShow )
+ {
+ xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( ! bShow ));
+ bChanged = true;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ xLegendProp.set( LegendHelper::getLegend( xModel, m_xCC, true ), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ bChanged = true;
+ }
+
+ if( bChanged )
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_ToggleGridHorizontal()
+{
+ Reference< frame::XModel > xModel( getModel() );
+ UndoGuard aUndoGuard = UndoGuard(
+ ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ ))), m_xUndoManager, xModel );
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() ));
+ if( xDiagram.is())
+ {
+ sal_Int32 nDimensionIndex = 1;
+ sal_Int32 nCooSysIndex = 0;
+ bool bIsMainGrid = true;
+
+ bool bHasMainYGrid = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram );
+
+ if( bHasMainYGrid )
+ AxisHelper::hideGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram );
+ else
+ AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram, m_xCC );
+
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::impl_ShapeControllerDispatch( const util::URL& rURL, const Sequence< beans::PropertyValue >& rArgs )
+{
+ Reference< frame::XDispatch > xDispatch( m_aDispatchContainer.getShapeController() );
+ if ( xDispatch.is() )
+ {
+ xDispatch->dispatch( rURL, rArgs );
+ }
+}
+
+void ChartController::impl_switchDiagramPositioningToExcludingPositioning()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::POS_SIZE,
+ ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)),
+ m_xUndoManager, m_aModel->getModel() );
+ if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) )
+ aUndoGuard.commitAction();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
new file mode 100644
index 000000000000..56908ac4ef79
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -0,0 +1,2029 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ChartWindow.hxx"
+#include "ResId.hxx"
+#include "CommonConverters.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "TitleHelper.hxx"
+#include "UndoGuard.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ObjectNameProvider.hxx"
+#include "Strings.hrc"
+#include "SchSlotIds.hxx"
+#include "macros.hxx"
+#include "DragMethod_PieSegment.hxx"
+#include "DragMethod_RotateDiagram.hxx"
+#include "ObjectHierarchy.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "RelativePositionHelper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "StatisticsHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisHelper.hxx"
+#include "LegendHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "MenuResIds.hrc"
+#include "DrawCommandDispatch.hxx"
+
+#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/frame/XDispatchHelper.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <comphelper/InlineContainer.hxx>
+
+#include <svtools/contextmenuhelper.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/ActionDescriptionProvider.hxx>
+
+// header for class E3dObject
+#include <svx/obj3d.hxx>
+// header for class E3dScene
+#include <svx/scene3d.hxx>
+// header for class SdrDragMethod
+#include <svx/svddrgmt.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+// for InfoBox
+#include <vcl/msgbox.hxx>
+
+#include <rtl/math.hxx>
+#include <svtools/acceleratorexecute.hxx>
+
+#define DRGPIX 2 // Drag MinMove in Pixel
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+bool lcl_GrowAndShiftLogic(
+ RelativePosition & rInOutRelPos,
+ RelativeSize & rInOutRelSize,
+ const awt::Size & rRefSize,
+ double fGrowLogicX,
+ double fGrowLogicY )
+{
+ if( rRefSize.Width == 0 ||
+ rRefSize.Height == 0 )
+ return false;
+
+ double fRelativeGrowX = fGrowLogicX / rRefSize.Width;
+ double fRelativeGrowY = fGrowLogicY / rRefSize.Height;
+
+ return ::chart::RelativePositionHelper::centerGrow(
+ rInOutRelPos, rInOutRelSize,
+ fRelativeGrowX, fRelativeGrowY,
+ /* bCheck = */ true );
+}
+
+bool lcl_MoveObjectLogic(
+ RelativePosition & rInOutRelPos,
+ RelativeSize & rObjectSize,
+ const awt::Size & rRefSize,
+ double fShiftLogicX,
+ double fShiftLogicY )
+{
+ if( rRefSize.Width == 0 ||
+ rRefSize.Height == 0 )
+ return false;
+
+ double fRelativeShiftX = fShiftLogicX / rRefSize.Width;
+ double fRelativeShiftY = fShiftLogicY / rRefSize.Height;
+
+ return ::chart::RelativePositionHelper::moveObject(
+ rInOutRelPos, rObjectSize,
+ fRelativeShiftX, fRelativeShiftY,
+ /* bCheck = */ true );
+}
+
+void lcl_insertMenuCommand(
+ const uno::Reference< awt::XPopupMenu > & xMenu,
+ const uno::Reference< awt::XMenuExtended > & xMenuEx,
+ sal_Int16 nId, const ::rtl::OUString & rCommand )
+{
+ static ::rtl::OUString aEmptyString;
+ xMenu->insertItem( nId, aEmptyString, 0, -1 );
+ xMenuEx->setCommand( nId, rCommand );
+}
+
+OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
+{
+ OUString aDispatchCommand( C2U(".uno:FormatSelection") );
+
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
+
+ switch(eObjectType)
+ {
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ aDispatchCommand = C2U(".uno:FormatWall");
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ aDispatchCommand = C2U(".uno:FormatFloor");
+ break;
+ case OBJECTTYPE_PAGE:
+ aDispatchCommand = C2U(".uno:FormatChartArea");
+ break;
+ case OBJECTTYPE_LEGEND:
+ aDispatchCommand = C2U(".uno:FormatLegend");
+ break;
+ case OBJECTTYPE_TITLE:
+ aDispatchCommand = C2U(".uno:FormatTitle");
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ aDispatchCommand = C2U(".uno:FormatDataSeries");
+ break;
+ case OBJECTTYPE_AXIS:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ aDispatchCommand = C2U(".uno:FormatAxis");
+ break;
+ case OBJECTTYPE_GRID:
+ aDispatchCommand = C2U(".uno:FormatMajorGrid");
+ break;
+ case OBJECTTYPE_SUBGRID:
+ aDispatchCommand = C2U(".uno:FormatMinorGrid");
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ aDispatchCommand = C2U(".uno:FormatDataLabels");
+ break;
+ case OBJECTTYPE_DATA_SERIES:
+ aDispatchCommand = C2U(".uno:FormatDataSeries");
+ break;
+ case OBJECTTYPE_DATA_LABEL:
+ aDispatchCommand = C2U(".uno:FormatDataLabel");
+ break;
+ case OBJECTTYPE_DATA_POINT:
+ aDispatchCommand = C2U(".uno:FormatDataPoint");
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ aDispatchCommand = C2U(".uno:FormatMeanValue");
+ break;
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ aDispatchCommand = C2U(".uno:FormatYErrorBars");
+ break;
+ case OBJECTTYPE_DATA_CURVE:
+ aDispatchCommand = C2U(".uno:FormatTrendline");
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ aDispatchCommand = C2U(".uno:FormatTrendlineEquation");
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ aDispatchCommand = C2U(".uno:FormatSelection");
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ aDispatchCommand = C2U(".uno:FormatStockLoss");
+ break;
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ aDispatchCommand = C2U(".uno:FormatStockGain");
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ break;
+ }
+ return aDispatchCommand;
+}
+
+} // anonymous namespace
+
+const short HITPIX=2; //hit-tolerance in pixel
+
+//-----------------------------------------------------------------
+// awt::XWindow
+//-----------------------------------------------------------------
+ void SAL_CALL ChartController
+::setPosSize( sal_Int32 X, sal_Int32 Y
+ , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+ Window* pWindow = m_pChartWindow;
+
+ if(xWindow.is() && pWindow)
+ {
+ Size aLogicSize = pWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) );
+
+ bool bIsEmbedded = true;
+ //todo: for standalone chart: detect wether we are standalone
+ if( bIsEmbedded )
+ {
+ //change map mode to fit new size
+ awt::Size aModelPageSize = ChartModelHelper::getPageSize( getModel() );
+ sal_Int32 nScaleXNumerator = aLogicSize.Width();
+ sal_Int32 nScaleXDenominator = aModelPageSize.Width;
+ sal_Int32 nScaleYNumerator = aLogicSize.Height();
+ sal_Int32 nScaleYDenominator = aModelPageSize.Height;
+ MapMode aNewMapMode( MAP_100TH_MM, Point(0,0)
+ , Fraction(nScaleXNumerator,nScaleXDenominator)
+ , Fraction(nScaleYNumerator,nScaleYDenominator) );
+ pWindow->SetMapMode(aNewMapMode);
+ pWindow->SetPosSizePixel( X, Y, Width, Height, 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() )
+ {
+ uno::Sequence< beans::PropertyValue > aZoomFactors(4);
+ aZoomFactors[0].Name = C2U("ScaleXNumerator");
+ aZoomFactors[0].Value = uno::makeAny( nScaleXNumerator );
+ aZoomFactors[1].Name = C2U("ScaleXDenominator");
+ aZoomFactors[1].Value = uno::makeAny( nScaleXDenominator );
+ aZoomFactors[2].Name = C2U("ScaleYNumerator");
+ aZoomFactors[2].Value = uno::makeAny( nScaleYNumerator );
+ aZoomFactors[3].Name = C2U("ScaleYDenominator");
+ aZoomFactors[3].Value = uno::makeAny( nScaleYDenominator );
+ xProp->setPropertyValue( C2U("ZoomFactors"), uno::makeAny( 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)
+ {
+ Rectangle aRect(Point(0,0), pWindow->GetOutputSize());
+ m_pDrawViewWrapper->SetWorkArea( aRect );
+ }
+ }
+ else
+ {
+ //change visarea
+ ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() );
+ pWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
+ }
+ pWindow->Invalidate();
+ }
+}
+
+ awt::Rectangle SAL_CALL ChartController
+::getPosSize()
+ throw (uno::RuntimeException)
+{
+ //@todo
+ awt::Rectangle aRet(0,0,0,0);
+
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+ if(xWindow.is())
+ aRet = xWindow->getPosSize();
+
+ return aRet;
+}
+
+ void SAL_CALL ChartController
+::setVisible( sal_Bool Visible )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->setVisible( Visible );
+}
+
+ void SAL_CALL ChartController
+::setEnable( sal_Bool Enable )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->setEnable( Enable );
+}
+
+ void SAL_CALL ChartController
+::setFocus() throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->setFocus();
+}
+
+ void SAL_CALL ChartController
+::addWindowListener( const uno::Reference<
+ awt::XWindowListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addWindowListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removeWindowListener( const uno::Reference<
+ awt::XWindowListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removeWindowListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::addFocusListener( const uno::Reference<
+ awt::XFocusListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addFocusListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removeFocusListener( const uno::Reference<
+ awt::XFocusListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removeFocusListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::addKeyListener( const uno::Reference<
+ awt::XKeyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addKeyListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removeKeyListener( const uno::Reference<
+ awt::XKeyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removeKeyListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::addMouseListener( const uno::Reference<
+ awt::XMouseListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addMouseListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removeMouseListener( const uno::Reference<
+ awt::XMouseListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removeMouseListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::addMouseMotionListener( const uno::Reference<
+ awt::XMouseMotionListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addMouseMotionListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removeMouseMotionListener( const uno::Reference<
+ awt::XMouseMotionListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removeMouseMotionListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::addPaintListener( const uno::Reference<
+ awt::XPaintListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->addPaintListener( xListener );
+}
+
+ void SAL_CALL ChartController
+::removePaintListener( const uno::Reference<
+ awt::XPaintListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ //@todo
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is())
+ xWindow->removePaintListener( xListener );
+}
+
+//-----------------------------------------------------------------
+// impl vcl window controller methods
+//-----------------------------------------------------------------
+void ChartController::PrePaint()
+{
+ // forward VCLs PrePaint window event to DrawingLayer
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+
+ if(pDrawViewWrapper)
+ {
+ pDrawViewWrapper->PrePaint();
+ }
+}
+
+void ChartController::execute_Paint( const Rectangle& rRect )
+{
+ try
+ {
+ uno::Reference< frame::XModel > xModel( getModel() );
+ //DBG_ASSERT( 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() )
+ {
+ awt::Size aResolution(1000,1000);
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( m_pChartWindow )
+ {
+ aResolution.Width = m_pChartWindow->GetSizePixel().Width();
+ aResolution.Height = m_pChartWindow->GetSizePixel().Height();
+ }
+ }
+ xProp->setPropertyValue( C2U("Resolution"), uno::makeAny( aResolution ));
+ }
+ //
+
+ uno::Reference< util::XUpdatable > xUpdatable( m_xChartView, uno::UNO_QUERY );
+ if( xUpdatable.is() )
+ xUpdatable->update();
+
+ Window* pWindow = m_pChartWindow;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(pDrawViewWrapper)
+ pDrawViewWrapper->CompleteRedraw(pWindow, Region(rRect) );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ catch( ... )
+ {
+ }
+}
+
+bool isDoubleClick( const MouseEvent& rMEvt )
+{
+ return rMEvt.GetClicks() == 2 && rMEvt.IsLeft() &&
+ !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void ChartController::startDoubleClickWaiting()
+{
+ m_bWaitingForDoubleClick = true;
+
+ ULONG nDblClkTime = 500;
+ if( m_pChartWindow )
+ {
+ const MouseSettings& rMSettings = m_pChartWindow->GetSettings().GetMouseSettings();
+ nDblClkTime = rMSettings.GetDoubleClickTime();
+ }
+ m_aDoubleClickTimer.SetTimeout( nDblClkTime );
+ m_aDoubleClickTimer.Start();
+}
+
+void ChartController::stopDoubleClickWaiting()
+{
+ m_aDoubleClickTimer.Stop();
+ m_bWaitingForDoubleClick = false;
+}
+
+IMPL_LINK( ChartController, DoubleClickWaitingHdl, void*, EMPTYARG )
+{
+ m_bWaitingForDoubleClick = false;
+
+ if( !m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
+ {
+ this->impl_selectObjectAndNotiy();
+ if( m_pChartWindow )
+ {
+ Window::PointerState aPointerState( m_pChartWindow->GetPointerState() );
+ MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/,
+ 0/*nMode*/, static_cast< USHORT >( aPointerState.mnState )/*nButtons*/,
+ 0/*nModifier*/ );
+ impl_SetMousePointer( aMouseEvent );
+ }
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ m_bWaitingForMouseUp = true;
+
+ if( isDoubleClick(rMEvt) )
+ stopDoubleClickWaiting();
+ else
+ startDoubleClickWaiting();
+
+ m_aSelection.remindSelectionBeforeMouseDown();
+
+ Window* pWindow = m_pChartWindow;
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper )
+ return;
+
+ Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel());
+
+ if ( MOUSE_LEFT == rMEvt.GetButtons() )
+ {
+ pWindow->GrabFocus();
+ pWindow->CaptureMouse();
+ }
+
+ if( pDrawViewWrapper->IsTextEdit() )
+ {
+ SdrViewEvent aVEvt;
+ if ( pDrawViewWrapper->IsTextEditHit( aMPos, HITPIX ) ||
+ // #i12587# support for shapes in chart
+ ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt ) == SDRHIT_MARKEDOBJECT ) )
+ {
+ pDrawViewWrapper->MouseButtonDown(rMEvt,m_pChartWindow);
+ return;
+ }
+ else
+ {
+ this->EndTextEdit();
+ }
+ }
+
+ //abort running action
+ if( pDrawViewWrapper->IsAction() )
+ {
+ if( rMEvt.IsRight() )
+ pDrawViewWrapper->BckAction();
+ return;
+ }
+
+ if( isDoubleClick(rMEvt) ) //do not change selection if double click
+ return;//double click is handled further in mousebutton up
+
+ SdrHdl* pHitSelectionHdl = 0;
+ //switch from move to resize if handle is hit on a resizeable object
+ if( m_aSelection.isResizeableObjectSelected() )
+ pHitSelectionHdl = pDrawViewWrapper->PickHandle( aMPos );
+ //only change selection if no selection handles are hit
+ if( !pHitSelectionHdl )
+ {
+ // #i12587# support for shapes in chart
+ if ( m_eDrawMode == CHARTDRAW_INSERT &&
+ ( !pDrawViewWrapper->IsMarkedHit( aMPos ) || !m_aSelection.isDragableObjectSelected() ) )
+ {
+ if ( m_aSelection.hasSelection() )
+ {
+ m_aSelection.clearSelection();
+ }
+ if ( !pDrawViewWrapper->IsAction() )
+ {
+ if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CAPTION )
+ {
+ Size aCaptionSize( 2268, 1134 );
+ pDrawViewWrapper->BegCreateCaptionObj( aMPos, aCaptionSize );
+ }
+ else
+ {
+ pDrawViewWrapper->BegCreateObj( aMPos);
+ }
+ SdrObject* pObj = pDrawViewWrapper->GetCreateObj();
+ DrawCommandDispatch* pDrawCommandDispatch = m_aDispatchContainer.getDrawCommandDispatch();
+ if ( pObj && m_pDrawModelWrapper && pDrawCommandDispatch )
+ {
+ SfxItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
+ pDrawCommandDispatch->setAttributes( pObj );
+ pDrawCommandDispatch->setLineEnds( aSet );
+ pObj->SetMergedItemSet( aSet );
+ }
+ }
+ impl_SetMousePointer( rMEvt );
+ return;
+ }
+
+ m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper
+ , rMEvt.IsRight(), m_bWaitingForDoubleClick );
+
+ if( !m_aSelection.isRotateableObjectSelected( getModel() ) )
+ {
+ m_eDragMode = SDRDRAG_MOVE;
+ pDrawViewWrapper->SetDragMode(m_eDragMode);
+ }
+
+ m_aSelection.applySelection(pDrawViewWrapper);
+ }
+ if( m_aSelection.isDragableObjectSelected()
+ && !rMEvt.IsRight() )
+ {
+ //start drag
+ USHORT nDrgLog = (USHORT)pWindow->PixelToLogic(Size(DRGPIX,0)).Width();
+ SdrDragMethod* pDragMethod = NULL;
+
+ //change selection to 3D scene if rotate mode
+ SdrDragMode eDragMode = pDrawViewWrapper->GetDragMode();
+ if( SDRDRAG_ROTATE==eDragMode )
+ {
+ E3dScene* pScene = SelectionHelper::getSceneToRotate( pDrawViewWrapper->getNamedSdrObject( m_aSelection.getSelectedCID() ) );
+ if( pScene )
+ {
+ DragMethod_RotateDiagram::RotationDirection eRotationDirection(DragMethod_RotateDiagram::ROTATIONDIRECTION_FREE);
+ if(pHitSelectionHdl)
+ {
+ SdrHdlKind eKind = pHitSelectionHdl->GetKind();
+ if( eKind==HDL_UPPER || eKind==HDL_LOWER )
+ eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_X;
+ else if( eKind==HDL_LEFT || eKind==HDL_RIGHT )
+ eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Y;
+ else if( eKind==HDL_UPLFT || eKind==HDL_UPRGT || eKind==HDL_LWLFT || eKind==HDL_LWRGT )
+ eRotationDirection = DragMethod_RotateDiagram::ROTATIONDIRECTION_Z;
+ }
+ pDragMethod = new DragMethod_RotateDiagram( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel(), eRotationDirection );
+ }
+ }
+ else
+ {
+ rtl::OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ) );
+ if( aDragMethodServiceName.equals( ObjectIdentifier::getPieSegmentDragMethodServiceName() ) )
+ pDragMethod = new DragMethod_PieSegment( *pDrawViewWrapper, m_aSelection.getSelectedCID(), getModel() );
+ }
+ pDrawViewWrapper->SdrView::BegDragObj(aMPos, NULL, pHitSelectionHdl, nDrgLog, pDragMethod);
+ }
+
+ impl_SetMousePointer( rMEvt );
+}
+
+void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ Window* pWindow = m_pChartWindow;
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper)
+ return;
+
+ if( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( m_pDrawViewWrapper->MouseMove(rMEvt,m_pChartWindow) )
+ return;
+ }
+
+ if(pDrawViewWrapper->IsAction())
+ {
+ pDrawViewWrapper->MovAction( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ }
+
+ //?? pDrawViewWrapper->GetPageView()->DragPoly();
+
+ impl_SetMousePointer( rMEvt );
+}
+void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
+{
+}
+
+//-----------------
+
+void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
+{
+ ControllerLockGuard aCLGuard( getModel() );
+ bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
+ m_bWaitingForMouseUp = false;
+ bool bNotifySelectionChange = false;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+
+ Window* pWindow = m_pChartWindow;
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper)
+ return;
+
+ Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel());
+
+ if(pDrawViewWrapper->IsTextEdit())
+ {
+ if( pDrawViewWrapper->MouseButtonUp(rMEvt,m_pChartWindow) )
+ return;
+ }
+
+ // #i12587# support for shapes in chart
+ if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() )
+ {
+ pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND );
+ impl_switchDiagramPositioningToExcludingPositioning();
+ if ( pDrawViewWrapper->AreObjectsMarked() )
+ {
+ if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT )
+ {
+ executeDispatch_EditText();
+ }
+ else
+ {
+ SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
+ if ( pObj )
+ {
+ uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
+ if ( xShape.is() )
+ {
+ m_aSelection.setSelection( xShape );
+ m_aSelection.applySelection( pDrawViewWrapper );
+ }
+ }
+ }
+ }
+ else
+ {
+ m_aSelection.adaptSelectionToNewPos( aMPos, pDrawViewWrapper, rMEvt.IsRight(), m_bWaitingForDoubleClick );
+ m_aSelection.applySelection( pDrawViewWrapper );
+ setDrawMode( CHARTDRAW_SELECT );
+ }
+ }
+ else if ( pDrawViewWrapper->IsDragObj() )
+ {
+ bool bDraggingDone = false;
+ SdrDragMethod* pDragMethod = pDrawViewWrapper->SdrView::GetDragMethod();
+ bool bIsMoveOnly = pDragMethod ? pDragMethod->getMoveOnly() : false;
+ DragMethod_Base* pChartDragMethod = dynamic_cast< DragMethod_Base* >(pDragMethod);
+ if( pChartDragMethod )
+ {
+ UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(),
+ m_xUndoManager, getModel() );
+
+ if( pDrawViewWrapper->EndDragObj(false) )
+ {
+ bDraggingDone = true;
+ aUndoGuard.commitAction();
+ }
+ }
+
+ if( !bDraggingDone && pDrawViewWrapper->EndDragObj(false) )
+ {
+ try
+ {
+ //end move or size
+ SdrObject* pObj = pDrawViewWrapper->getSelectedObject();
+ if( pObj )
+ {
+ Rectangle aObjectRect = pObj->GetSnapRect();
+ awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) );
+ Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height );
+
+ const E3dObject* pE3dObject = dynamic_cast< const E3dObject*>( pObj );
+ if( pE3dObject )
+ aObjectRect = pE3dObject->GetScene()->GetSnapRect();
+
+ ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
+ if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() )
+ eActionType = ActionDescriptionProvider::RESIZE;
+
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ eActionType,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ))),
+ m_xUndoManager, getModel() );
+ bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
+ , getModel()
+ , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
+ , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
+ if( bChanged )
+ {
+ bDraggingDone = true;
+ aUndoGuard.commitAction();
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ //all wanted model changes will take effect
+ //and all unwanted view modifications are cleaned
+ }
+
+ if( !bDraggingDone ) //mouse wasn't moved while dragging
+ {
+ bool bClickedTwiceOnDragableObject = SelectionHelper::isDragableObjectHitTwice( aMPos, m_aSelection.getSelectedCID(), *pDrawViewWrapper );
+ bool bIsRotateable = m_aSelection.isRotateableObjectSelected( getModel() );
+
+ //toggel between move and rotate
+ if( bIsRotateable && bClickedTwiceOnDragableObject && SDRDRAG_MOVE==m_eDragMode )
+ m_eDragMode=SDRDRAG_ROTATE;
+ else
+ m_eDragMode=SDRDRAG_MOVE;
+
+ pDrawViewWrapper->SetDragMode(m_eDragMode);
+
+ if( !m_bWaitingForDoubleClick && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() )
+ {
+ this->impl_selectObjectAndNotiy();
+ }
+ }
+ else
+ m_aSelection.resetPossibleSelectionAfterSingleClickWasEnsured();
+ }
+ else if( isDoubleClick(rMEvt) && !bMouseUpWithoutMouseDown /*#i106966#*/ )
+ {
+ Point aMousePixel = rMEvt.GetPosPixel();
+ execute_DoubleClick( &aMousePixel );
+ }
+
+ //@todo ForcePointer(&rMEvt);
+ pWindow->ReleaseMouse();
+
+ if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
+ bNotifySelectionChange = true;
+ }
+
+ impl_SetMousePointer( rMEvt );
+
+ if(bNotifySelectionChange)
+ impl_notifySelectionChangeListeners();
+}
+
+void ChartController::execute_DoubleClick( const Point* pMousePixel )
+{
+ bool bEditText = false;
+ if ( m_aSelection.hasSelection() )
+ {
+ ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
+ if ( aCID.getLength() )
+ {
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
+ if ( OBJECTTYPE_TITLE == eObjectType )
+ {
+ bEditText = true;
+ }
+ }
+ else
+ {
+ // #i12587# support for shapes in chart
+ SdrObject* pObj = DrawViewWrapper::getSdrObject( m_aSelection.getSelectedAdditionalShape() );
+ if ( pObj && pObj->ISA( SdrTextObj ) )
+ {
+ bEditText = true;
+ }
+ }
+ }
+
+ if ( bEditText )
+ {
+ executeDispatch_EditText( pMousePixel );
+ }
+ else
+ {
+ executeDispatch_ObjectProperties();
+ }
+}
+
+void ChartController::execute_Resize()
+{
+ m_pChartWindow->Invalidate();
+}
+void ChartController::execute_Activate()
+{
+ ///// pDrawViewWrapper->SetEditMode(TRUE);
+}
+void ChartController::execute_Deactivate()
+{
+ /*
+ pDrawViewWrapper->SetEditMode(FALSE);
+ this->ReleaseMouse();
+ */
+}
+void ChartController::execute_GetFocus()
+{
+}
+void ChartController::execute_LoseFocus()
+{
+ //this->ReleaseMouse();
+}
+
+void ChartController::execute_Command( const CommandEvent& rCEvt )
+{
+ Window* pWindow = m_pChartWindow;
+
+ bool bIsAction = false;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper)
+ return;
+ bIsAction = m_pDrawViewWrapper->IsAction();
+ }
+
+ // pop-up menu
+ if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
+ {
+ m_pChartWindow->ReleaseMouse();
+
+ if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
+ impl_notifySelectionChangeListeners();
+
+ if ( isShapeContext() )
+ {
+ // #i12587# support for shapes in chart
+ PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ?
+ RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) );
+ ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
+ Point aPos( rCEvt.GetMousePosPixel() );
+ if( !rCEvt.IsMouseEvent() )
+ {
+ aPos = m_pChartWindow->GetPointerState().maPos;
+ }
+ aContextMenuHelper.completeAndExecute( aPos, aContextMenu );
+ }
+ else
+ {
+ // todo: the context menu should be specified by an xml file in uiconfig
+ uno::Reference< awt::XPopupMenu > xPopupMenu(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
+ uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY );
+ if( xPopupMenu.is() && xMenuEx.is())
+ {
+ sal_Int16 nUniqueId = 1;
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
+ Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( getModel() );
+
+ OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand );
+
+ //some commands for dataseries and points:
+ //-----
+ if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType );
+ 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, true );
+ 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;
+
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ if( aAttributedDataPointIndexList.hasElements() )
+ {
+ if( bIsPoint )
+ {
+ ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
+ ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
+ if( aIt != aIndices.end())
+ bSelectedPointIsFormatted = true;
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
+ }
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
+ }
+ }
+ }
+
+ //const sal_Int32 nIdBeforeFormat = nUniqueId;
+ if( bIsPoint )
+ {
+ if( bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") );
+ if( !bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") );
+ else
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") );
+ if( bSelectedPointIsFormatted )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint"));
+
+ xPopupMenu->insertSeparator( -1 );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") );
+ }
+
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
+ if( xChartTypeProp.is() )
+ {
+ bool bJapaneseStyle = false;
+ xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle;
+
+ if( bJapaneseStyle )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if( bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") );
+ if( xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") );
+
+ //if( nIdBeforeFormat != nUniqueId )
+ xPopupMenu->insertSeparator( -1 );
+
+ //const sal_Int32 nIdBeforeInsert = nUniqueId;
+
+ if( !bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") );
+ if( !xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") );
+ else if( !bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
+ if( !xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") );
+ if( !bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") );
+
+ //if( nIdBeforeInsert != nUniqueId )
+ // xPopupMenu->insertSeparator( -1 );
+
+ //const sal_Int32 nIdBeforeDelete = nUniqueId;
+
+ if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") );
+ if( xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") );
+
+ if( bHasFormattedDataPointsOtherThanSelected )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints"));
+
+ //if( nIdBeforeDelete != nUniqueId )
+ xPopupMenu->insertSeparator( -1 );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow"));
+ uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
+ uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY );
+ if( xArrangePopupMenu.is() && xArrangeMenuEx.is())
+ {
+ sal_Int16 nSubId = nUniqueId + 1;
+ lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") );
+ lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") );
+ xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
+ nUniqueId = nSubId;
+ }
+ ++nUniqueId;
+ }
+ else if( OBJECTTYPE_DATA_CURVE == eObjectType )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
+ }
+ else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
+ }
+
+ //some commands for axes: and grids
+ //-----
+ else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType )
+ {
+ 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() ).getLength()>0;
+
+ if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") );
+ if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") );
+ if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") );
+
+ xPopupMenu->insertSeparator( -1 );
+
+ if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") );
+ if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") );
+ if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") );
+ if( !bHasTitle )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") );
+
+ if( bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") );
+ if( bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") );
+ if( bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") );
+ }
+ }
+
+ if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
+ else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog"));
+
+ if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType
+ || OBJECTTYPE_DIAGRAM_WALL == eObjectType
+ || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType
+ || OBJECTTYPE_UNKNOWN == eObjectType )
+ {
+ if( OBJECTTYPE_UNKNOWN != eObjectType )
+ xPopupMenu->insertSeparator( -1 );
+ bool bHasLegend = LegendHelper::hasLegend( xDiagram );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") );
+ if( !bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") );
+ if( bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") );
+ }
+ //-----
+
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D"));
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste"));
+
+ ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
+ Point aPos( rCEvt.GetMousePosPixel() );
+ if( !rCEvt.IsMouseEvent() )
+ aPos = m_pChartWindow->GetPointerState().maPos;
+ aContextMenuHelper.completeAndExecute( aPos, xPopupMenu );
+ }
+ }
+ }
+ else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) )
+ {
+ //#i84417# enable editing with IME
+ if( m_pDrawViewWrapper )
+ m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
+ }
+}
+
+bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
+{
+ bool bReturn=false;
+
+ Window* pWindow = m_pChartWindow;
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper)
+ return bReturn;
+
+ // handle accelerators
+ if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() && m_xCC->getServiceManager().is() )
+ {
+ m_apAccelExecute.reset( ::svt::AcceleratorExecute::createAcceleratorHelper());
+ OSL_ASSERT( m_apAccelExecute.get());
+ if( m_apAccelExecute.get() )
+ m_apAccelExecute->init(
+ uno::Reference< lang::XMultiServiceFactory >( m_xCC->getServiceManager(), uno::UNO_QUERY ), m_xFrame );
+ }
+
+ KeyCode aKeyCode( rKEvt.GetKeyCode());
+ sal_uInt16 nCode = aKeyCode.GetCode();
+// bool bShift = aKeyCode.IsShift();
+ bool bAlternate = aKeyCode.IsMod2();
+
+ if( m_apAccelExecute.get() )
+ bReturn = m_apAccelExecute->execute( aKeyCode );
+ if( bReturn )
+ return bReturn;
+
+ if( pDrawViewWrapper->IsTextEdit() )
+ {
+ if( pDrawViewWrapper->KeyInput(rKEvt,pWindow) )
+ {
+ bReturn = true;
+ if( nCode == KEY_ESCAPE )
+ {
+ this->EndTextEdit();
+ }
+ }
+ }
+
+ //if( m_pDrawViewWrapper->IsAction() );
+
+ // keyboard accessibility
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
+ if( ! bReturn )
+ {
+ // Natvigation (Tab/F3/Home/End)
+ uno::Reference< XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+ ObjectKeyNavigation aObjNav( m_aSelection.getSelectedOID(), xChartDoc, ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
+ awt::KeyEvent aKeyEvent( ::svt::AcceleratorExecute::st_VCLKey2AWTKey( aKeyCode ));
+ bReturn = aObjNav.handleKeyEvent( aKeyEvent );
+ if( bReturn )
+ {
+ ObjectIdentifier aNewOID = aObjNav.getCurrentSelection();
+ uno::Any aNewSelection;
+ if ( aNewOID.isValid() && !ObjectHierarchy::isRootNode( aNewOID ) )
+ {
+ aNewSelection = aNewOID.getAny();
+ }
+ if ( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), getModel() ) )
+ {
+ m_eDragMode = SDRDRAG_MOVE;
+ }
+ bReturn = select( aNewSelection );
+ }
+ }
+
+ // Position and Size (+/-/arrow-keys) or pie segment dragging
+ if( ! bReturn )
+ {
+ // pie segment dragging
+ // note: could also be done for data series
+ if( eObjectType == OBJECTTYPE_DATA_POINT &&
+ ObjectIdentifier::getDragMethodServiceName( m_aSelection.getSelectedCID() ).equals(
+ ObjectIdentifier::getPieSegmentDragMethodServiceName()))
+ {
+ bool bDrag = false;
+ bool bDragInside = false;
+ if( nCode == KEY_ADD ||
+ nCode == KEY_SUBTRACT )
+ {
+ bDrag = true;
+ bDragInside = ( nCode == KEY_SUBTRACT );
+ }
+ else if(
+ nCode == KEY_LEFT ||
+ nCode == KEY_RIGHT ||
+ nCode == KEY_UP ||
+ nCode == KEY_DOWN )
+ {
+ bDrag = true;
+ rtl::OUString aParameter( ObjectIdentifier::getDragParameterString( m_aSelection.getSelectedCID() ));
+ sal_Int32 nOffsetPercentDummy( 0 );
+ awt::Point aMinimumPosition( 0, 0 );
+ awt::Point aMaximumPosition( 0, 0 );
+ ObjectIdentifier::parsePieSegmentDragParameterString(
+ aParameter, nOffsetPercentDummy, aMinimumPosition, aMaximumPosition );
+ aMaximumPosition.Y -= aMinimumPosition.Y;
+ aMaximumPosition.X -= aMinimumPosition.X;
+
+ bDragInside =
+ (nCode == KEY_RIGHT && (aMaximumPosition.X < 0)) ||
+ (nCode == KEY_LEFT && (aMaximumPosition.X > 0)) ||
+ (nCode == KEY_DOWN && (aMaximumPosition.Y < 0)) ||
+ (nCode == KEY_UP && (aMaximumPosition.Y > 0));
+ }
+
+ if( bDrag )
+ {
+ double fAmount = bAlternate ? 0.01 : 0.05;
+ if( bDragInside )
+ fAmount *= -1.0;
+
+ bReturn = impl_DragDataPoint( m_aSelection.getSelectedCID(), fAmount );
+ }
+ }
+ else
+ {
+ // size
+ if( nCode == KEY_ADD ||
+ nCode == KEY_SUBTRACT )
+ {
+ if( eObjectType == OBJECTTYPE_DIAGRAM )
+ {
+ // default 1 mm in each direction
+ double fGrowAmountX = 200.0;
+ double fGrowAmountY = 200.0;
+ if( bAlternate && pWindow )
+ {
+ // together with Alt-key: 1 px in each direction
+ Size aPixelSize = pWindow->PixelToLogic( Size( 2, 2 ));
+ fGrowAmountX = static_cast< double >( aPixelSize.Width());
+ fGrowAmountY = static_cast< double >( aPixelSize.Height());
+ }
+ if( nCode == KEY_SUBTRACT )
+ {
+ fGrowAmountX = -fGrowAmountX;
+ fGrowAmountY = -fGrowAmountY;
+ }
+ bReturn = impl_moveOrResizeObject(
+ m_aSelection.getSelectedCID(), CENTERED_RESIZE_OBJECT, fGrowAmountX, fGrowAmountY );
+ }
+ }
+ // position
+ else if( nCode == KEY_LEFT ||
+ nCode == KEY_RIGHT ||
+ nCode == KEY_UP ||
+ nCode == KEY_DOWN )
+ {
+ if( m_aSelection.isDragableObjectSelected() )
+ {
+ // default 1 mm
+ double fShiftAmountX = 100.0;
+ double fShiftAmountY = 100.0;
+ if( bAlternate && pWindow )
+ {
+ // together with Alt-key: 1 px
+ Size aPixelSize = pWindow->PixelToLogic( Size( 1, 1 ));
+ fShiftAmountX = static_cast< double >( aPixelSize.Width());
+ fShiftAmountY = static_cast< double >( aPixelSize.Height());
+ }
+ switch( nCode )
+ {
+ case KEY_LEFT:
+ fShiftAmountX = -fShiftAmountX;
+ fShiftAmountY = 0.0;
+ break;
+ case KEY_RIGHT:
+ fShiftAmountY = 0.0;
+ break;
+ case KEY_UP:
+ fShiftAmountX = 0.0;
+ fShiftAmountY = -fShiftAmountY;
+ break;
+ case KEY_DOWN:
+ fShiftAmountX = 0.0;
+ break;
+ }
+ if( m_aSelection.getSelectedCID().getLength() )
+ {
+ //move chart objects
+ bReturn = impl_moveOrResizeObject(
+ m_aSelection.getSelectedCID(), MOVE_OBJECT, fShiftAmountX, fShiftAmountY );
+ }
+ else
+ {
+ //move additional shapes
+ uno::Reference< drawing::XShape > xShape( m_aSelection.getSelectedAdditionalShape() );
+ if( xShape.is() )
+ {
+ 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 );
+ if( aPos.X + aSize.Width > aPageSize.Width )
+ aPos.X = aPageSize.Width - aSize.Width;
+ if( aPos.X < 0 )
+ aPos.X = 0;
+ if( aPos.Y + aSize.Height > aPageSize.Height )
+ aPos.Y = aPageSize.Height - aSize.Height;
+ if( aPos.Y < 0 )
+ aPos.Y = 0;
+
+ xShape->setPosition( aPos );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // text edit
+ if( ! bReturn &&
+ nCode == KEY_F2 )
+ {
+ if( OBJECTTYPE_TITLE == eObjectType )
+ {
+ executeDispatch_EditText();
+ bReturn = true;
+ }
+ }
+
+ // deactivate inplace mode (this code should be unnecessary, but
+ // unfortunately is not)
+ if( ! bReturn &&
+ nCode == KEY_ESCAPE )
+ {
+ uno::Reference< frame::XDispatchHelper > xDispatchHelper(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.frame.DispatchHelper"), m_xCC ), uno::UNO_QUERY );
+ if( xDispatchHelper.is())
+ {
+ uno::Sequence< beans::PropertyValue > aArgs;
+ xDispatchHelper->executeDispatch(
+ uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
+ C2U(".uno:TerminateInplaceActivation"),
+ C2U("_parent"),
+ frame::FrameSearchFlag::PARENT,
+ aArgs );
+ bReturn = true;
+ }
+ }
+
+ if( ! bReturn &&
+ (nCode == KEY_DELETE || nCode == KEY_BACKSPACE ))
+ {
+ bReturn = executeDispatch_Delete();
+ if( ! bReturn )
+ {
+ InfoBox( m_pChartWindow, String(SchResId( STR_ACTION_NOTPOSSIBLE ))).Execute();
+ }
+ }
+
+ /* old chart:
+ // Ctrl-Shift-R: Repaint
+ if (!bReturn && GetWindow())
+ {
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if (aKeyCode.IsMod1() && aKeyCode.IsShift()
+ && aKeyCode.GetCode() == KEY_R)
+ {
+ // 3D-Kontext wieder zerstoeren
+ GetWindow()->Invalidate();
+ bReturn = TRUE;
+ }
+ }
+ */
+ return bReturn;
+}
+
+bool ChartController::requestQuickHelp(
+ ::Point aAtLogicPosition,
+ bool bIsBalloonHelp,
+ ::rtl::OUString & rOutQuickHelpText,
+ awt::Rectangle & rOutEqualRect )
+{
+ uno::Reference< frame::XModel > xChartModel;
+ if( m_aModel.is())
+ xChartModel.set( getModel() );
+ if( !xChartModel.is())
+ return false;
+
+ // help text
+ ::rtl::OUString aCID;
+ if( m_pDrawViewWrapper )
+ {
+ aCID = SelectionHelper::getHitObjectCID(
+ aAtLogicPosition, *m_pDrawViewWrapper );
+ }
+ bool bResult( aCID.getLength());
+
+ if( bResult )
+ {
+ // get help text
+ rOutQuickHelpText = ObjectNameProvider::getHelpText( aCID, xChartModel, bIsBalloonHelp /* bVerbose */ );
+
+ // set rectangle
+ ExplicitValueProvider * pValueProvider(
+ ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
+ if( pValueProvider )
+ rOutEqualRect = pValueProvider->getRectangleOfObject( aCID, true );
+ }
+
+ return bResult;
+}
+
+//-----------------------------------------------------------------
+// XSelectionSupplier (optional interface)
+//-----------------------------------------------------------------
+ sal_Bool SAL_CALL ChartController
+::select( const uno::Any& rSelection )
+ throw( lang::IllegalArgumentException )
+{
+ bool bSuccess = false;
+
+ if ( rSelection.hasValue() )
+ {
+ const uno::Type& rType = rSelection.getValueType();
+ if ( rType == ::getCppuType( static_cast< const ::rtl::OUString* >( 0 ) ) )
+ {
+ ::rtl::OUString aNewCID;
+ if ( ( rSelection >>= aNewCID ) && m_aSelection.setSelection( aNewCID ) )
+ {
+ bSuccess = true;
+ }
+ }
+ else if ( rType == ::getCppuType( static_cast< const uno::Reference< drawing::XShape >* >( 0 ) ) )
+ {
+ uno::Reference< drawing::XShape > xShape;
+ if ( ( rSelection >>= xShape ) && m_aSelection.setSelection( xShape ) )
+ {
+ bSuccess = true;
+ }
+ }
+ }
+ else
+ {
+ if ( m_aSelection.hasSelection() )
+ {
+ m_aSelection.clearSelection();
+ bSuccess = true;
+ }
+ }
+
+ if ( bSuccess )
+ {
+ this->impl_selectObjectAndNotiy();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+ uno::Any SAL_CALL ChartController
+::getSelection() throw(uno::RuntimeException)
+{
+ uno::Any aReturn;
+ if ( m_aSelection.hasSelection() )
+ {
+ ::rtl::OUString aCID( m_aSelection.getSelectedCID() );
+ if ( aCID.getLength() )
+ {
+ aReturn = uno::makeAny( aCID );
+ }
+ else
+ {
+ // #i12587# support for shapes in chart
+ aReturn = uno::makeAny( m_aSelection.getSelectedAdditionalShape() );
+ }
+ }
+ return aReturn;
+}
+
+ void SAL_CALL ChartController
+::addSelectionChangeListener( const uno::Reference<
+ view::XSelectionChangeListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ 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( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
+}
+
+ void SAL_CALL ChartController
+::removeSelectionChangeListener( const uno::Reference<
+ view::XSelectionChangeListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ if( impl_isDisposedOrSuspended() ) //@todo? allow removing of listeners in suspend mode?
+ return; //behave passive if already disposed or suspended
+
+ //--remove listener
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0), xListener );
+}
+
+ void ChartController
+::impl_notifySelectionChangeListeners()
+{
+ ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
+ .getContainer( ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+}
+
+void ChartController::impl_selectObjectAndNotiy()
+{
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if( pDrawViewWrapper )
+ {
+ pDrawViewWrapper->SetDragMode( m_eDragMode );
+ m_aSelection.applySelection( m_pDrawViewWrapper );
+ }
+ impl_notifySelectionChangeListeners();
+}
+
+bool ChartController::impl_moveOrResizeObject(
+ const ::rtl::OUString & rCID,
+ eMoveOrResizeType eType,
+ double fAmountLogicX,
+ double fAmountLogicY )
+{
+ bool bResult = false;
+ bool bNeedShift = true;
+ bool bNeedResize = ( eType == CENTERED_RESIZE_OBJECT );
+
+ uno::Reference< frame::XModel > xChartModel( getModel() );
+ uno::Reference< beans::XPropertySet > xObjProp(
+ ObjectIdentifier::getObjectPropertySet( rCID, xChartModel ));
+ if( xObjProp.is())
+ {
+ awt::Size aRefSize = ChartModelHelper::getPageSize( xChartModel );
+
+ chart2::RelativePosition aRelPos;
+ chart2::RelativeSize aRelSize;
+ bool bDeterminePos = !(xObjProp->getPropertyValue( C2U("RelativePosition")) >>= aRelPos);
+ bool bDetermineSize = !bNeedResize || !(xObjProp->getPropertyValue( C2U("RelativeSize")) >>= aRelSize);
+
+ if( ( bDeterminePos || bDetermineSize ) &&
+ ( aRefSize.Width > 0 && aRefSize.Height > 0 ) )
+ {
+ ExplicitValueProvider * pValueProvider(
+ ExplicitValueProvider::getExplicitValueProvider( m_xChartView ));
+ if( pValueProvider )
+ {
+ awt::Rectangle aRect( pValueProvider->getRectangleOfObject( rCID ));
+ double fWidth = static_cast< double >( aRefSize.Width );
+ double fHeight = static_cast< double >( aRefSize.Height );
+ if( bDetermineSize )
+ {
+ aRelSize.Primary = static_cast< double >( aRect.Width ) / fWidth;
+ aRelSize.Secondary = static_cast< double >( aRect.Height ) / fHeight;
+ }
+ if( bDeterminePos )
+ {
+ if( bNeedResize && aRelSize.Primary > 0.0 && aRelSize.Secondary > 0.0 )
+ {
+ aRelPos.Primary = (static_cast< double >( aRect.X ) / fWidth) +
+ (aRelSize.Primary / 2.0);
+ aRelPos.Secondary = (static_cast< double >( aRect.Y ) / fHeight) +
+ (aRelSize.Secondary / 2.0);
+ aRelPos.Anchor = drawing::Alignment_CENTER;
+ }
+ else
+ {
+ aRelPos.Primary = static_cast< double >( aRect.X ) / fWidth;
+ aRelPos.Secondary = static_cast< double >( aRect.Y ) / fHeight;
+ aRelPos.Anchor = drawing::Alignment_TOP_LEFT;
+ }
+ }
+ }
+ }
+
+ if( eType == CENTERED_RESIZE_OBJECT )
+ bResult = lcl_GrowAndShiftLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
+ else if( eType == MOVE_OBJECT )
+ bResult = lcl_MoveObjectLogic( aRelPos, aRelSize, aRefSize, fAmountLogicX, fAmountLogicY );
+
+ if( bResult )
+ {
+ ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::MOVE);
+ if( bNeedResize )
+ eActionType = ActionDescriptionProvider::RESIZE;
+
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
+ eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager, xChartModel );
+ {
+ ControllerLockGuard aCLGuard( xChartModel );
+ if( bNeedShift )
+ xObjProp->setPropertyValue( C2U("RelativePosition"), uno::makeAny( aRelPos ));
+ if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set
+ xObjProp->setPropertyValue( C2U("RelativeSize"), uno::makeAny( aRelSize ));
+ }
+ aUndoGuard.commitAction();
+ }
+ }
+ return bResult;
+}
+
+bool ChartController::impl_DragDataPoint( const ::rtl::OUString & 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() ));
+ if( xSeries.is())
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex( nDataPointIndex ));
+ double fOffset = 0.0;
+ if( xPointProp.is() &&
+ (xPointProp->getPropertyValue( C2U("Offset" )) >>= fOffset ) &&
+ (( fAdditionalOffset > 0.0 && fOffset < 1.0 ) || (fOffset > 0.0)) )
+ {
+ fOffset += fAdditionalOffset;
+ if( fOffset > 1.0 )
+ fOffset = 1.0;
+ else if( fOffset < 0.0 )
+ fOffset = 0.0;
+ xPointProp->setPropertyValue( C2U("Offset"), uno::makeAny( fOffset ));
+ bResult = true;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ Window* pWindow = m_pChartWindow;
+ if( m_pDrawViewWrapper && pWindow )
+ {
+ Point aMousePos( pWindow->PixelToLogic( rEvent.GetPosPixel()));
+ sal_uInt16 nModifier = rEvent.GetModifier();
+ BOOL bLeftDown = rEvent.IsLeft();
+
+ if ( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
+ {
+ pWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer(
+ aMousePos, pWindow, nModifier, bLeftDown ) );
+ return;
+ }
+ }
+ else if( m_pDrawViewWrapper->IsAction() )
+ {
+ return;//don't change pointer during running action
+ }
+
+ SdrHdl* pHitSelectionHdl = 0;
+ if( m_aSelection.isResizeableObjectSelected() )
+ pHitSelectionHdl = m_pDrawViewWrapper->PickHandle( aMousePos );
+
+ if( pHitSelectionHdl )
+ {
+
+ Pointer aPointer = m_pDrawViewWrapper->GetPreferedPointer(
+ aMousePos, pWindow, nModifier, bLeftDown );
+ bool bForceArrowPointer = false;
+
+ ObjectIdentifier aOID( m_aSelection.getSelectedOID() );
+
+ switch( aPointer.GetStyle())
+ {
+ case POINTER_NSIZE:
+ case POINTER_SSIZE:
+ case POINTER_WSIZE:
+ case POINTER_ESIZE:
+ case POINTER_NWSIZE:
+ case POINTER_NESIZE:
+ case POINTER_SWSIZE:
+ case POINTER_SESIZE:
+ if( ! m_aSelection.isResizeableObjectSelected() )
+ bForceArrowPointer = true;
+ break;
+ case POINTER_MOVE:
+ if ( !aOID.isDragableObject() )
+ bForceArrowPointer = true;
+ break;
+ case POINTER_MOVEPOINT:
+ case POINTER_MOVEBEZIERWEIGHT:
+ // there is no point-editing in a chart
+ // the POINTER_MOVEBEZIERWEIGHT appears in 3d data points
+ bForceArrowPointer = true;
+ break;
+ default:
+ break;
+ }
+
+ if( bForceArrowPointer )
+ pWindow->SetPointer( Pointer( POINTER_ARROW ));
+ else
+ pWindow->SetPointer( aPointer );
+ }
+ else
+ {
+ // #i12587# support for shapes in chart
+ if ( m_eDrawMode == CHARTDRAW_INSERT &&
+ ( !m_pDrawViewWrapper->IsMarkedHit( aMousePos ) || !m_aSelection.isDragableObjectSelected() ) )
+ {
+ PointerStyle ePointerStyle = POINTER_DRAW_RECT;
+ SdrObjKind eKind = static_cast< SdrObjKind >( m_pDrawViewWrapper->GetCurrentObjIdentifier() );
+ switch ( eKind )
+ {
+ case OBJ_LINE:
+ {
+ ePointerStyle = POINTER_DRAW_LINE;
+ }
+ break;
+ case OBJ_RECT:
+ case OBJ_CUSTOMSHAPE:
+ {
+ ePointerStyle = POINTER_DRAW_RECT;
+ }
+ break;
+ case OBJ_CIRC:
+ {
+ ePointerStyle = POINTER_DRAW_ELLIPSE;
+ }
+ break;
+ case OBJ_FREELINE:
+ {
+ ePointerStyle = POINTER_DRAW_POLYGON;
+ }
+ break;
+ case OBJ_TEXT:
+ {
+ ePointerStyle = POINTER_DRAW_TEXT;
+ }
+ break;
+ case OBJ_CAPTION:
+ {
+ ePointerStyle = POINTER_DRAW_CAPTION;
+ }
+ break;
+ default:
+ {
+ ePointerStyle = POINTER_DRAW_RECT;
+ }
+ break;
+ }
+ pWindow->SetPointer( Pointer( ePointerStyle ) );
+ return;
+ }
+
+ ::rtl::OUString aHitObjectCID(
+ SelectionHelper::getHitObjectCID(
+ aMousePos, *m_pDrawViewWrapper, true /*bGetDiagramInsteadOf_Wall*/ ));
+
+ if( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) )
+ {
+ pWindow->SetPointer( Pointer( POINTER_ARROW ));
+ return;
+ }
+ }
+
+ if( !aHitObjectCID.getLength() )
+ {
+ //additional shape was hit
+ pWindow->SetPointer( POINTER_MOVE );
+ }
+ else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
+ {
+ if( (m_eDragMode == SDRDRAG_ROTATE)
+ && SelectionHelper::isRotateableObject( aHitObjectCID
+ , getModel() ) )
+ pWindow->SetPointer( Pointer( POINTER_ROTATE ) );
+ else
+ {
+ ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID );
+ if( eHitObjectType == OBJECTTYPE_DATA_POINT )
+ {
+ if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID())
+ && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) )
+ {
+ pWindow->SetPointer( Pointer( POINTER_ARROW ));
+ return;
+ }
+ }
+ pWindow->SetPointer( POINTER_MOVE );
+ }
+ }
+ else
+ pWindow->SetPointer( Pointer( POINTER_ARROW ));
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx
new file mode 100644
index 000000000000..8749ca1bc062
--- /dev/null
+++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartDropTargetHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.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 <vector>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+::std::vector< OUString > lcl_getStringsFromByteSequence(
+ const Sequence< sal_Int8 > & aByteSequence )
+{
+ ::std::vector< OUString > aResult;
+ const sal_Int32 nLength = aByteSequence.getLength();
+ const sal_Char * pBytes( reinterpret_cast< const sal_Char* >( aByteSequence.getConstArray()));
+ sal_Int32 nStartPos = 0;
+ for( sal_Int32 nPos=0; nPos<nLength; ++nPos )
+ {
+ if( pBytes[nPos] == '\0' )
+ {
+ aResult.push_back( OUString( pBytes + nStartPos, (nPos - nStartPos), RTL_TEXTENCODING_ASCII_US ));
+ nStartPos = nPos + 1;
+ }
+ }
+ return aResult;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ChartDropTargetHelper::ChartDropTargetHelper(
+ const Reference< datatransfer::dnd::XDropTarget >& rxDropTarget,
+ const Reference< chart2::XChartDocument > & xChartDocument ) :
+ DropTargetHelper( rxDropTarget ),
+ m_xChartDocument( xChartDocument )
+{}
+
+ChartDropTargetHelper::~ChartDropTargetHelper()
+{}
+
+bool ChartDropTargetHelper::satisfiesPrerequisites() const
+{
+ return ( m_xChartDocument.is() &&
+ ! m_xChartDocument->hasInternalDataProvider());
+}
+
+sal_Int8 ChartDropTargetHelper::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nResult = DND_ACTION_NONE;
+
+ if( ( rEvt.mnAction == DND_ACTION_COPY ||
+ rEvt.mnAction == DND_ACTION_MOVE ) &&
+ satisfiesPrerequisites() &&
+ IsDropFormatSupported( SOT_FORMATSTR_ID_LINK ) )
+ {
+ // @todo: check if the data is suitable. Is this possible without XTransferable?
+ nResult = rEvt.mnAction;
+ }
+
+ return nResult;
+}
+
+sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nResult = DND_ACTION_NONE;
+
+ if( ( rEvt.mnAction == DND_ACTION_COPY ||
+ rEvt.mnAction == DND_ACTION_MOVE ) &&
+ rEvt.maDropEvent.Transferable.is() &&
+ satisfiesPrerequisites())
+ {
+ TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK ))
+ {
+ Sequence< sal_Int8 > aBytes;
+ if( aDataHelper.GetSequence( SOT_FORMATSTR_ID_LINK, aBytes ))
+ {
+ ::std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes ));
+ if( aStrings.size() >= 3 &&
+ aStrings[0].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "soffice" )))
+ {
+ OUString aDocName( aStrings[1] );
+ OUString aRangeString( aStrings[2] );
+ Reference< container::XChild > xChild( m_xChartDocument, uno::UNO_QUERY );
+ if( xChild.is())
+ {
+ Reference< frame::XModel > xParentModel( xChild->getParent(), uno::UNO_QUERY );
+ if( xParentModel.is() &&
+ m_xChartDocument.is())
+ {
+ bool bDataComesFromParent = true;
+ // @todo: get the title somehow and compare it to
+ // aDocName if successful (the document is the
+ // parent)
+ if( bDataComesFromParent )
+ {
+ Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
+ if( xDataProvider.is() &&
+ DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument ))
+ {
+ DiagramHelper::tTemplateWithServiceName aTempWithServ(
+ DiagramHelper::getTemplateForDiagram(
+ m_xChartDocument->getFirstDiagram(),
+ Reference< lang::XMultiServiceFactory >(
+ m_xChartDocument->getChartTypeManager(), uno::UNO_QUERY )));
+ if( aTempWithServ.first.is())
+ {
+ Reference< chart2::data::XDataSource > xDataSource(
+ DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument ));
+ Sequence< beans::PropertyValue > aArguments(
+ xDataProvider->detectArguments( xDataSource ));
+
+ OUString aOldRange;
+ beans::PropertyValue * pCellRange = 0;
+ for( sal_Int32 i=0; i<aArguments.getLength(); ++i )
+ {
+ if( aArguments[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CellRangeRepresentation")))
+ {
+ pCellRange = (aArguments.getArray() + i);
+ aArguments[i].Value >>= aOldRange;
+ break;
+ }
+ }
+ if( pCellRange )
+ {
+ // copy means add ranges, move means replace
+ if( rEvt.mnAction == DND_ACTION_COPY )
+ {
+ // @todo: using implcit knowledge that ranges can be
+ // merged with ";". This should be done more general
+ pCellRange->Value <<= (aOldRange + OUString( sal_Unicode(';')) + aRangeString );
+ }
+ // move means replace range
+ else
+ {
+ pCellRange->Value <<= aRangeString;
+ }
+
+ xDataSource.set( xDataProvider->createDataSource( aArguments ));
+ aTempWithServ.first->changeDiagramData(
+ m_xChartDocument->getFirstDiagram(),
+ xDataSource,
+ aArguments );
+
+ // always return copy state to avoid deletion of the
+ // dragged range
+ nResult = DND_ACTION_COPY;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return nResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.hxx b/chart2/source/controller/main/ChartDropTargetHelper.hxx
new file mode 100644
index 000000000000..2de9c0c72663
--- /dev/null
+++ b/chart2/source/controller/main/ChartDropTargetHelper.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CHARTDROPTARGETHELPER_HXX
+#define CHART2_CHARTDROPTARGETHELPER_HXX
+
+// for DropTargetHelper
+#include <svtools/transfer.hxx>
+
+namespace com { namespace sun { namespace star {
+namespace chart2 {
+ class XChartDocument;
+}
+}}}
+
+namespace chart
+{
+
+class ChartDropTargetHelper : public DropTargetHelper
+{
+public:
+ explicit ChartDropTargetHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >& rxDropTarget,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDocument );
+ virtual ~ChartDropTargetHelper();
+
+protected:
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+private:
+ // not available
+ ChartDropTargetHelper();
+
+ bool satisfiesPrerequisites() const;
+
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+};
+
+} // namespace chart
+
+// CHART2_CHARTDROPTARGETHELPER_HXX
+#endif
diff --git a/chart2/source/controller/main/ChartFrameloader.cxx b/chart2/source/controller/main/ChartFrameloader.cxx
new file mode 100644
index 000000000000..cab3816d5033
--- /dev/null
+++ b/chart2/source/controller/main/ChartFrameloader.cxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartFrameloader.hxx"
+#include "servicenames.hxx"
+#include "MediaDescriptorHelper.hxx"
+#include "macros.hxx"
+#include <comphelper/mediadescriptor.hxx>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+ChartFrameLoader::ChartFrameLoader(
+ uno::Reference<uno::XComponentContext> const & xContext)
+ : m_bCancelRequired( sal_False )
+{
+ m_xCC = xContext;
+ m_oCancelFinished.reset();
+}
+
+ChartFrameLoader::~ChartFrameLoader()
+{
+}
+
+ sal_Bool ChartFrameLoader
+::impl_checkCancel()
+{
+ if(m_bCancelRequired)
+ {
+ m_oCancelFinished.set();
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+
+APPHELPER_XSERVICEINFO_IMPL(ChartFrameLoader,CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > ChartFrameLoader
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_FRAMELOADER_SERVICE_NAME;
+ return aSNS;
+}
+
+//-----------------------------------------------------------------
+// frame::XFrameLoader
+//-----------------------------------------------------------------
+
+ sal_Bool SAL_CALL ChartFrameLoader
+::load( const uno::Sequence< beans::PropertyValue >& rMediaDescriptor
+ , const uno::Reference<frame::XFrame >& xFrame )
+ throw (uno::RuntimeException)
+{
+ //@todo ? need to add as terminate listener to desktop?
+
+ uno::Reference< frame::XModel > xModel;
+ bool bHaveLoadedModel = false;
+
+ comphelper::MediaDescriptor aMediaDescriptor(rMediaDescriptor);
+ {
+ comphelper::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( aMediaDescriptor.PROP_MODEL()));
+ if( aIt != aMediaDescriptor.end())
+ {
+ xModel.set( (*aIt).second.get< uno::Reference< frame::XModel > >());
+ bHaveLoadedModel = true;
+ }
+ }
+
+ //create and initialize the model
+ 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 );
+
+ if( impl_checkCancel() )
+ return sal_False;
+ }
+
+ //create the controller(+XWindow)
+ uno::Reference< frame::XController > xController = NULL;
+ uno::Reference< awt::XWindow > xComponentWindow = NULL;
+ {
+ xController = uno::Reference< frame::XController >(
+ 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 simultaniously provides the XWindow controller functionality
+ xComponentWindow =
+ uno::Reference< awt::XWindow >( xController, uno::UNO_QUERY );
+
+ if( impl_checkCancel() )
+ return sal_False;
+ }
+
+
+ //connect frame, controller and model one to each other:
+ if(xController.is()&&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);
+ }
+
+ // call initNew() or load() at XLoadable
+ if(!bHaveLoadedModel)
+ try
+ {
+ comphelper::MediaDescriptor::const_iterator aIt( aMediaDescriptor.find( aMediaDescriptor.PROP_URL()));
+ if( aIt != aMediaDescriptor.end())
+ {
+ ::rtl::OUString aURL( (*aIt).second.get< ::rtl::OUString >());
+ if( aURL.matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "private:factory/schart" )))
+ {
+ // create new file
+ uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY_THROW );
+ xLoadable->initNew();
+ }
+ 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( xComponentWindow.is() && aMDHelper.ISSET_FilterName && aMDHelper.FilterName.equals( C2U("StarChart 5.0")) )
+ {
+ awt::Rectangle aRect( xComponentWindow->getPosSize() );
+ sal_Int16 nFlags=0;
+ xComponentWindow->setPosSize( aRect.X, aRect.Y, aRect.Width, aRect.Height, nFlags );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return sal_True;
+}
+
+ void SAL_CALL ChartFrameLoader
+::cancel() throw (uno::RuntimeException)
+{
+ m_oCancelFinished.reset();
+ m_bCancelRequired = sal_True;
+ m_oCancelFinished.wait();
+ m_bCancelRequired = sal_False;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartFrameloader.hxx b/chart2/source/controller/main/ChartFrameloader.hxx
new file mode 100644
index 000000000000..8b6e1e0a3225
--- /dev/null
+++ b/chart2/source/controller/main/ChartFrameloader.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHARTFRAMELOADER_HXX
+#define _CHARTFRAMELOADER_HXX
+
+#include "ServiceMacros.hxx"
+#include <osl/conditn.hxx>
+#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ChartFrameLoader : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::frame::XSynchronousFrameLoader
+ , ::com::sun::star::lang::XServiceInfo
+ //comprehends XComponent (required interface)
+ // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
+ sal_Bool m_bCancelRequired;
+ ::osl::Condition m_oCancelFinished;
+
+private:
+ sal_Bool impl_checkCancel();
+ //no default constructor
+ ChartFrameLoader(){}
+public:
+ ChartFrameLoader(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext);
+ virtual ~ChartFrameLoader();
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XServiceInfo
+ //-----------------------------------------------------------------
+
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ChartFrameLoader)
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XFrameLoader
+ //-----------------------------------------------------------------
+
+ virtual sal_Bool SAL_CALL
+ load( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor
+ ,const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XFrame >& xFrame )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ cancel() throw (::com::sun::star::uno::RuntimeException);
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/main/ChartRenderer.cxx b/chart2/source/controller/main/ChartRenderer.cxx
new file mode 100644
index 000000000000..3419f7a53bec
--- /dev/null
+++ b/chart2/source/controller/main/ChartRenderer.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartRenderer.hxx"
+#include "servicenames.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "DrawViewWrapper.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <com/sun/star/util/XUpdatable.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using rtl::OUString;
+
+ChartRenderer::ChartRenderer( const Reference< frame::XModel >& xChartModel )
+ : m_xChartModel( uno::WeakReference< frame::XModel >(xChartModel) )
+{
+}
+
+ChartRenderer::~ChartRenderer()
+{
+}
+
+// ____ ChartPrettyPainter ___
+bool ChartRenderer::DoPaint(OutputDevice* pOutDev, const Rectangle& rLogicObjectRect /*in given output dev map units*/ ) const
+{
+ if(!pOutDev)
+ return false;
+
+ Reference<frame::XModel> xModel(m_xChartModel);
+ uno::Reference< lang::XMultiServiceFactory > xFact( xModel, uno::UNO_QUERY );
+ if( !xFact.is() )
+ return false;
+
+ //#i84323# ensure that the size the container has of the chart and size that chart has itself are the same
+ //maybe remove this workaround somewhere in future again
+ {
+ if( MAP_100TH_MM == pOutDev->GetMapMode().GetMapUnit() )//no problem for writer in issue #i84323#; but writer uses twips instead of 100thmm which causes small differences in size always when converting to 100thmm and back
+ {
+ awt::Size aChartSize( ChartModelHelper::getPageSize(xModel) );
+ awt::Size aContainerChartSize( rLogicObjectRect.GetWidth(), rLogicObjectRect.GetHeight() );
+ if( aContainerChartSize.Width != aChartSize.Width
+ || aContainerChartSize.Height != aChartSize.Height )
+ {
+ DBG_ERROR("chart size does not equal size assumed by the container");
+ //correct the state here on the fly -> let the container size win
+ ChartModelHelper::setPageSize( aContainerChartSize, xModel );
+ }
+ }
+ }
+
+ // get the chart view
+ Reference< lang::XUnoTunnel > xChartView( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+
+ try
+ {
+ //better performance for big data
+ uno::Reference< beans::XPropertySet > xProp( xChartView, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ awt::Size aResolution(1000,1000);
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ Rectangle aPixelRect( pOutDev->LogicToPixel( rLogicObjectRect ) );
+ aResolution.Width = aPixelRect.GetWidth();
+ aResolution.Height = aPixelRect.GetHeight();
+ }
+ xProp->setPropertyValue( C2U("Resolution"), uno::makeAny( aResolution ));
+ }
+ //
+
+ uno::Reference< util::XUpdatable > xUpdatable( xChartView, uno::UNO_QUERY );
+ if( xUpdatable.is() )
+ xUpdatable->update();
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( xChartView );
+ if( !pProvider )
+ return false;
+ ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper = pProvider->getDrawModelWrapper();
+ if( !pDrawModelWrapper.get() )
+ return false;
+ ::boost::shared_ptr< DrawViewWrapper > pDrawViewWrapper( new DrawViewWrapper(&pDrawModelWrapper->getSdrModel(),pOutDev,false) );
+ pDrawViewWrapper->attachParentReferenceDevice( xModel );
+
+ MapMode aOldMapMode( pOutDev->GetMapMode() );
+ Point aOldOrigin( aOldMapMode.GetOrigin() );
+ MapMode aMapMode( aOldMapMode );
+ Point aOldOriginMM( OutputDevice::LogicToLogic( aOldOrigin, aOldMapMode.GetMapUnit(), MAP_100TH_MM ) );
+ Point aObjectTopLeftMM( OutputDevice::LogicToLogic( rLogicObjectRect.TopLeft(), aOldMapMode.GetMapUnit(), MAP_100TH_MM ) );
+ aMapMode.SetOrigin( aOldOriginMM + aObjectTopLeftMM );
+ aMapMode.SetMapUnit( MAP_100TH_MM );
+ pOutDev->SetMapMode(aMapMode);
+
+ Rectangle aPaintRect( OutputDevice::LogicToLogic( rLogicObjectRect, aOldMapMode, aMapMode ) );
+ pDrawViewWrapper->CompleteRedraw(pOutDev, Region(aPaintRect) );
+
+ pOutDev->SetMapMode(aOldMapMode);
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ catch( ... )
+ {
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------
+// ____ XUnoTunnel ___
+::sal_Int64 SAL_CALL ChartRenderer::getSomething( const Sequence< ::sal_Int8 >& aIdentifier )
+ throw( uno::RuntimeException)
+{
+ if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory(
+ ChartPrettyPainter::getUnoTunnelId().getConstArray(),
+ aIdentifier.getConstArray(), 16 ) )
+ {
+ ChartPrettyPainter* pPaintableObject = this;
+ return reinterpret_cast<sal_Int64>(pPaintableObject);
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+
+APPHELPER_XSERVICEINFO_IMPL(ChartRenderer,CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME)
+
+Sequence< OUString > ChartRenderer::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aSNS;
+ return aSNS;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
new file mode 100644
index 000000000000..80041d4c3818
--- /dev/null
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartTransferable.hxx"
+
+#include <unotools/streamwrap.hxx>
+#include <vcl/graph.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unomodel.hxx>
+
+// header for class SdrView
+#include <svx/svdview.hxx>
+
+#define CHARTTRANSFER_OBJECTTYPE_DRAWMODEL 1
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing )
+ :m_pMarkedObjModel( NULL )
+ ,m_bDrawing( bDrawing )
+{
+ SdrExchangeView * pExchgView( new SdrView( pDrawModel ));
+ SdrPageView* pPv = pExchgView->ShowSdrPage( pDrawModel->GetPage( 0 ));
+ if( pSelectedObj )
+ pExchgView->MarkObj( pSelectedObj, pPv );
+ else
+ pExchgView->MarkAllObj( pPv );
+ Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( TRUE ));
+ m_xMetaFileGraphic.set( aGraphic.GetXGraphic());
+ if ( m_bDrawing )
+ {
+ m_pMarkedObjModel = ( pExchgView ? pExchgView->GetAllMarkedModel() : NULL );
+ }
+ delete pExchgView;
+}
+
+ChartTransferable::~ChartTransferable()
+{}
+
+void ChartTransferable::AddSupportedFormats()
+{
+ if ( m_bDrawing )
+ {
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+ }
+ AddFormat( SOT_FORMAT_GDIMETAFILE );
+ AddFormat( SOT_FORMAT_BITMAP );
+}
+
+sal_Bool ChartTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+{
+ sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
+ sal_Bool bResult = sal_False;
+
+ if( HasFormat( nFormat ))
+ {
+ if ( nFormat == SOT_FORMATSTR_ID_DRAWING )
+ {
+ bResult = SetObject( m_pMarkedObjModel, CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
+ }
+ else if ( nFormat == FORMAT_GDIMETAFILE )
+ {
+ Graphic aGraphic( m_xMetaFileGraphic );
+ bResult = SetGDIMetaFile( aGraphic.GetGDIMetaFile(), rFlavor );
+ }
+ else if( nFormat == FORMAT_BITMAP )
+ {
+ Graphic aGraphic( m_xMetaFileGraphic );
+ bResult = SetBitmap( aGraphic.GetBitmap(), rFlavor );
+ }
+ }
+
+ return bResult;
+}
+
+sal_Bool ChartTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ const datatransfer::DataFlavor& /* rFlavor */ )
+{
+ // called from SetObject, put data into stream
+
+ sal_Bool bRet = sal_False;
+ switch ( nUserObjectId )
+ {
+ case CHARTTRANSFER_OBJECTTYPE_DRAWMODEL:
+ {
+ SdrModel* pMarkedObjModel = reinterpret_cast< SdrModel* >( pUserObject );
+ if ( pMarkedObjModel )
+ {
+ rxOStm->SetBufferSize( 0xff00 );
+
+ // #108584#
+ // 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 = static_cast< const SvxFontHeightItem& >(
+ rItemPool.GetDefaultItem( EE_CHAR_FONTHEIGHT ) );
+ sal_uInt16 nCount = pMarkedObjModel->GetPageCount();
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ const SdrPage* pPage = pMarkedObjModel->GetPage( i );
+ SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ const SvxFontHeightItem& rItem = static_cast< const SvxFontHeightItem& >(
+ pObj->GetMergedItem( EE_CHAR_FONTHEIGHT ) );
+ if ( rItem.GetHeight() == rDefaultFontHeight.GetHeight() )
+ {
+ pObj->SetMergedItem( rDefaultFontHeight );
+ }
+ }
+ }
+
+ Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) );
+ if ( SvxDrawingLayerExport( pMarkedObjModel, xDocOut ) )
+ {
+ rxOStm->Commit();
+ }
+
+ bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+ }
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "ChartTransferable::WriteObject: unknown object id" );
+ }
+ break;
+ }
+ return bRet;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
new file mode 100644
index 000000000000..401f43c6d1ae
--- /dev/null
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CHARTTRANSFERABLE_HXX
+#define CHART2_CHARTTRANSFERABLE_HXX
+
+#include <svtools/transfer.hxx>
+
+namespace com { namespace sun { namespace star {
+namespace graphic {
+ class XGraphic;
+}
+}}}
+
+class SdrModel;
+class SdrObject;
+
+namespace chart
+{
+
+class ChartTransferable : public TransferableHelper
+{
+public:
+ explicit ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing = false );
+ virtual ~ChartTransferable();
+
+protected:
+
+ // implementation of TransferableHelper methods
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > m_xMetaFileGraphic;
+ SdrModel* m_pMarkedObjModel;
+ bool m_bDrawing;
+};
+
+} // namespace chart
+
+// CHART2_CHARTTRANSFERABLE_HXX
+#endif
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
new file mode 100644
index 000000000000..54add217fb76
--- /dev/null
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartWindow.hxx"
+#include "ChartController.hxx"
+#include "HelpIds.hrc"
+
+#include <vcl/help.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::Rectangle lcl_AWTRectToVCLRect( const ::com::sun::star::awt::Rectangle & rAWTRect )
+{
+ ::Rectangle aResult;
+ aResult.setX( rAWTRect.X );
+ aResult.setY( rAWTRect.Y );
+ aResult.setWidth( rAWTRect.Width );
+ aResult.setHeight( rAWTRect.Height );
+ return aResult;
+}
+} // anonymous namespace
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle )
+ : Window(pParent, nStyle)
+ , m_pWindowController( pWindowController )
+ , m_bInPaint(false)
+{
+ this->SetHelpId( HID_SCH_WIN_DOCUMENT );
+ this->SetMapMode( MapMode(MAP_100TH_MM) );
+ adjustHighContrastMode();
+ // chart does not depend on exact pixel painting => enable antialiased drawing
+ SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | GetAntialiasing() );
+ EnableRTL( FALSE );
+ if( pParent )
+ pParent->EnableRTL( FALSE );// #i96215# necessary for a correct position of the context menu in rtl mode
+}
+
+ChartWindow::~ChartWindow()
+{
+}
+
+void ChartWindow::clear()
+{
+ m_pWindowController=0;
+ this->ReleaseMouse();
+}
+
+void ChartWindow::PrePaint()
+{
+ // forward VCLs PrePaint window event to DrawingLayer
+ if( m_pWindowController )
+ {
+ m_pWindowController->PrePaint();
+ }
+}
+
+void ChartWindow::Paint( const Rectangle& rRect )
+{
+ m_bInPaint = true;
+ if( m_pWindowController )
+ m_pWindowController->execute_Paint( rRect );
+ else
+ Window::Paint( rRect );
+ m_bInPaint = false;
+}
+
+void ChartWindow::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_MouseButtonDown(rMEvt);
+ else
+ Window::MouseButtonDown(rMEvt);
+}
+
+void ChartWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_MouseMove( rMEvt );
+ else
+ Window::MouseMove( rMEvt );
+}
+
+void ChartWindow::Tracking( const TrackingEvent& rTEvt )
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_Tracking( rTEvt );
+ else
+ Window::Tracking( rTEvt );
+}
+
+void ChartWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_MouseButtonUp( rMEvt );
+ else
+ Window::MouseButtonUp( rMEvt );
+}
+
+void ChartWindow::Resize()
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_Resize();
+ else
+ Window::Resize();
+}
+
+void ChartWindow::Activate()
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_Activate();
+ else
+ Window::Activate();
+}
+void ChartWindow::Deactivate()
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_Deactivate();
+ else
+ Window::Deactivate();
+}
+void ChartWindow::GetFocus()
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_GetFocus();
+ else
+ Window::GetFocus();
+}
+void ChartWindow::LoseFocus()
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_LoseFocus();
+ else
+ Window::LoseFocus();
+}
+
+void ChartWindow::Command( const CommandEvent& rCEvt )
+{
+ if( m_pWindowController )
+ m_pWindowController->execute_Command( rCEvt );
+ else
+ Window::Command( rCEvt );
+}
+
+void ChartWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ if( m_pWindowController )
+ {
+ if( !m_pWindowController->execute_KeyInput(rKEvt) )
+ Window::KeyInput(rKEvt);
+ }
+ else
+ Window::KeyInput( rKEvt );
+}
+
+uno::Reference< accessibility::XAccessible > ChartWindow::CreateAccessible()
+{
+ if( m_pWindowController )
+ return m_pWindowController->CreateAccessible();
+ else
+ return Window::CreateAccessible();
+}
+
+void ChartWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ::Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ adjustHighContrastMode();
+ }
+}
+
+void ChartWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ bool bHelpHandled = false;
+ if( ( rHEvt.GetMode() & HELPMODE_QUICK ) &&
+ m_pWindowController )
+ {
+// Point aLogicHitPos = PixelToLogic( rHEvt.GetMousePosPixel()); // old chart: GetPointerPosPixel()
+ Point aLogicHitPos = PixelToLogic( GetPointerPosPixel());
+ ::rtl::OUString aQuickHelpText;
+ awt::Rectangle aHelpRect;
+ bool bIsBalloonHelp( Help::IsBalloonHelpEnabled() );
+ bHelpHandled = m_pWindowController->requestQuickHelp( aLogicHitPos, bIsBalloonHelp, aQuickHelpText, aHelpRect );
+
+ if( bHelpHandled )
+ {
+ if( bIsBalloonHelp )
+ Help::ShowBalloon(
+ this, rHEvt.GetMousePosPixel(), lcl_AWTRectToVCLRect( aHelpRect ), String( aQuickHelpText ));
+ else
+ Help::ShowQuickHelp(
+ this, lcl_AWTRectToVCLRect( aHelpRect ), String( aQuickHelpText ));
+ }
+ }
+
+ if( !bHelpHandled )
+ ::Window::RequestHelp( rHEvt );
+}
+
+void ChartWindow::adjustHighContrastMode()
+{
+ static const sal_Int32 nContrastMode =
+ DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL |
+ DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT;
+
+ bool bUseContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+ SetDrawMode( bUseContrast ? nContrastMode : DRAWMODE_DEFAULT );
+}
+
+void ChartWindow::ForceInvalidate()
+{
+ ::Window::Invalidate();
+}
+void ChartWindow::Invalidate( USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( nFlags );
+}
+void ChartWindow::Invalidate( const Rectangle& rRect, USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( rRect, nFlags );
+}
+void ChartWindow::Invalidate( const Region& rRegion, USHORT nFlags )
+{
+ if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
+ return;
+ ::Window::Invalidate( rRegion, nFlags );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
new file mode 100644
index 000000000000..2325d6be7803
--- /dev/null
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHARTWINDOW_HXX
+#define _CHARTWINDOW_HXX
+
+#include <vcl/window.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+
+class WindowController;
+
+//-----------------------------------------------------------------------------
+/** The ChartWindow collects events from the window and forwards them the to the controller
+thus the controller can perform appropriate actions
+*/
+
+class ChartWindow : public Window
+{
+public:
+ ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle );
+ virtual ~ChartWindow();
+
+ void clear();
+
+ //from base class Window:
+ virtual void PrePaint();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Resize();
+ virtual void Activate();
+ virtual void Deactivate();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ void ForceInvalidate();
+ virtual void Invalidate( USHORT nFlags = 0 );
+ virtual void Invalidate( const Rectangle& rRect, USHORT nFlags = 0 );
+ virtual void Invalidate( const Region& rRegion, USHORT nFlags = 0 );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+private:
+ WindowController* m_pWindowController;
+ bool m_bInPaint;
+
+ void adjustHighContrastMode();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx
new file mode 100644
index 000000000000..bd040fce8fff
--- /dev/null
+++ b/chart2/source/controller/main/CommandDispatch.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "CommandDispatch.hxx"
+#include "CommonFunctors.hxx"
+#include "macros.hxx"
+
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+template< class Map >
+ struct lcl_DisposeAndClearAndDeleteMapElement :
+ public ::std::unary_function< typename Map::value_type, void >
+ {
+ lcl_DisposeAndClearAndDeleteMapElement( const Reference< uno::XInterface > & xEventSource ) :
+ m_aEvent( xEventSource )
+ {}
+ void operator() ( typename Map::value_type & rElement )
+ {
+ if( rElement.second )
+ {
+ rElement.second->disposeAndClear( m_aEvent );
+ delete rElement.second;
+ }
+ }
+ private:
+ lang::EventObject m_aEvent;
+ };
+
+template< class Map >
+ void lcl_DisposeAndClearAndDeleteAllMapElements(
+ Map & rMap,
+ const Reference< uno::XInterface > & xEventSource )
+{
+ ::std::for_each( rMap.begin(), rMap.end(),
+ lcl_DisposeAndClearAndDeleteMapElement< Map >( xEventSource ));
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+CommandDispatch::CommandDispatch(
+ const Reference< uno::XComponentContext > & xContext ) :
+ impl::CommandDispatch_Base( m_aMutex ),
+ m_xContext( xContext )
+{
+}
+
+CommandDispatch::~CommandDispatch()
+{}
+
+void CommandDispatch::initialize()
+{}
+
+// ____ WeakComponentImplHelperBase ____
+/// is called when this is disposed
+void SAL_CALL CommandDispatch::disposing()
+{
+ lcl_DisposeAndClearAndDeleteAllMapElements( m_aListeners, static_cast< cppu::OWeakObject* >( this ));
+ m_aListeners.clear();
+}
+
+// ____ XDispatch ____
+void SAL_CALL CommandDispatch::dispatch( const util::URL& /* URL */, const Sequence< beans::PropertyValue >& /* Arguments */ )
+ throw (uno::RuntimeException)
+{}
+
+void SAL_CALL CommandDispatch::addStatusListener( const Reference< frame::XStatusListener >& Control, const util::URL& URL )
+ throw (uno::RuntimeException)
+{
+ 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 ::cppu::OInterfaceContainerHelper( m_aMutex )));
+ }
+ OSL_ASSERT( aIt != m_aListeners.end());
+
+ aIt->second->addInterface( Control );
+ fireStatusEvent( URL.Complete, Control );
+}
+
+void SAL_CALL CommandDispatch::removeStatusListener( const Reference< frame::XStatusListener >& Control, const util::URL& URL )
+ throw (uno::RuntimeException)
+{
+ tListenerMap::iterator aIt( m_aListeners.find( URL.Complete ));
+ if( aIt != m_aListeners.end())
+ (*aIt).second->removeInterface( Control );
+}
+
+// ____ XModifyListener ____
+void SAL_CALL CommandDispatch::modified( const lang::EventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+ fireAllStatusEvents( 0 );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL CommandDispatch::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{}
+
+void CommandDispatch::fireAllStatusEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener )
+{
+ fireStatusEvent( OUString(), xSingleListener );
+}
+
+void CommandDispatch::fireStatusEventForURL(
+ const OUString & rURL,
+ const uno::Any & rState,
+ bool bEnabled,
+ const Reference< frame::XStatusListener > & xSingleListener, /* = 0 */
+ const OUString & rFeatureDescriptor /* = OUString() */ )
+{
+ // prepare event to send
+ util::URL aURL;
+ aURL.Complete = rURL;
+ if( !m_xURLTransformer.is())
+ {
+ m_xURLTransformer.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.util.URLTransformer" ),
+ m_xContext ),
+ uno::UNO_QUERY );
+ }
+ if( m_xURLTransformer.is())
+ m_xURLTransformer->parseStrict( aURL );
+
+ frame::FeatureStateEvent aEventToSend(
+ static_cast< cppu::OWeakObject* >( this ), // Source
+ aURL, // FeatureURL
+ rFeatureDescriptor, // FeatureDescriptor
+ bEnabled, // IsEnabled
+ false, // Requery
+ rState // State
+ );
+
+ // send event either to single listener or all registered ones
+ if( xSingleListener.is())
+ xSingleListener->statusChanged( aEventToSend );
+ else
+ {
+ tListenerMap::iterator aIt( m_aListeners.find( aURL.Complete ));
+ if( aIt != m_aListeners.end())
+ {
+// ::cppu::OInterfaceContainerHelper * pCntHlp = rBHelper.getContainer(
+// ::getCppuType( reinterpret_cast< Reference< frame::XStatusListener > * >(0)));
+ if( aIt->second )
+ {
+ ::cppu::OInterfaceIteratorHelper 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 & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ }
+}
+
+
+
+} // namespace chart
diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/main/CommandDispatch.hxx
new file mode 100644
index 000000000000..08140786ac4e
--- /dev/null
+++ b/chart2/source/controller/main/CommandDispatch.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_COMMANDDISPATCH_HXX
+#define CHART2_COMMANDDISPATCH_HXX
+
+#include "MutexContainer.hxx"
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <vector>
+#include <map>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::frame::XDispatch,
+ ::com::sun::star::util::XModifyListener >
+ CommandDispatch_Base;
+}
+
+/** This is the base class for an XDispatch.
+ */
+class CommandDispatch :
+ public MutexContainer,
+ public impl::CommandDispatch_Base
+{
+public:
+ explicit CommandDispatch(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~CommandDispatch();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+protected:
+ /** sends a status event for a specific command to all registered listeners
+ or only the one given when set.
+
+ This method should be overloaded. The implementation should call
+ fireStatusEventForURL and pass the xSingleListener argument to this
+ method unchanged.
+
+ @param rURL
+ If empty, all available status events must be fired, otherwise only
+ the one for the given command.
+
+ @param xSingleListener
+ If set, the event is only sent to this listener rather than to all
+ registered ones. Whenever a listener adds itself, this method is
+ called with this parameter set to give an initial state.
+ */
+ virtual void fireStatusEvent(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener ) = 0;
+
+ /** calls fireStatusEvent( ::rtl::OUString, xSingleListener )
+ */
+ void fireAllStatusEvents(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
+
+ /** sends a status event for a specific command to all registered listeners
+ or only the one given when set.
+
+ @param xSingleListener
+ If set, the event is only sent to this listener rather than to all
+ registered ones. Whenever a listener adds itself, this method is
+ called with this parameter set to give an initial state.
+ */
+ void fireStatusEventForURL(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Any & rState,
+ bool bEnabled,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener =
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >(),
+ const ::rtl::OUString & rFeatureDescriptor = ::rtl::OUString() );
+
+ // ____ XDispatch ____
+ virtual void SAL_CALL dispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& Control,
+ const ::com::sun::star::util::URL& URL )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& Control,
+ const ::com::sun::star::util::URL& URL )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ /// is called when this is disposed
+ virtual void SAL_CALL disposing();
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+
+private:
+ typedef ::std::map< ::rtl::OUString, ::cppu::OInterfaceContainerHelper* >
+ tListenerMap;
+
+ tListenerMap m_aListeners;
+
+};
+
+} // namespace chart
+
+// CHART2_COMMANDDISPATCH_HXX
+#endif
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
new file mode 100644
index 000000000000..e0d689340760
--- /dev/null
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "CommandDispatchContainer.hxx"
+#include "UndoCommandDispatch.hxx"
+#include "StatusBarCommandDispatch.hxx"
+#include "DisposeHelper.hxx"
+#include "macros.hxx"
+#include "ChartController.hxx"
+#include "DrawCommandDispatch.hxx"
+#include "ShapeController.hxx"
+
+#include <comphelper/InlineContainer.hxx>
+
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+CommandDispatchContainer::CommandDispatchContainer(
+ const Reference< uno::XComponentContext > & xContext, ChartController* pController )
+ :m_xContext( xContext )
+ ,m_pChartController( pController )
+ ,m_pDrawCommandDispatch( NULL )
+ ,m_pShapeController( NULL )
+{
+ m_aContainerDocumentCommands =
+ ::comphelper::MakeSet< OUString >
+ ( C2U("AddDirect")) ( C2U("NewDoc")) ( C2U("Open"))
+ ( C2U("Save")) ( C2U("SaveAs")) ( C2U("SendMail"))
+ ( C2U("EditDoc")) ( C2U("ExportDirectToPDF")) ( C2U("PrintDefault"))
+ ;
+}
+
+void CommandDispatchContainer::setModel(
+ const Reference< frame::XModel > & xModel )
+{
+ // remove all existing dispatcher that base on the old model
+ m_aCachedDispatches.clear();
+ DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches );
+ m_aToBeDisposedDispatches.clear();
+ m_xModel = xModel;
+}
+
+// void CommandDispatchContainer::setUndoManager(
+// const Reference< chart2::XUndoManager > & xUndoManager )
+// {
+// m_xUndoManager = xUndoManager;
+// }
+
+void CommandDispatchContainer::setChartDispatch(
+ const Reference< frame::XDispatch > xChartDispatch,
+ const ::std::set< OUString > & rChartCommands )
+{
+ OSL_ENSURE(xChartDispatch.is(),"Invalid fall back dispatcher!");
+ m_xChartDispatcher.set( xChartDispatch );
+ m_aChartCommands = rChartCommands;
+ m_aToBeDisposedDispatches.push_back( m_xChartDispatcher );
+}
+
+Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
+ const util::URL & rURL )
+{
+ Reference< frame::XDispatch > xResult;
+ tDispatchMap::const_iterator aIt( m_aCachedDispatches.find( rURL.Complete ));
+ if( aIt != m_aCachedDispatches.end())
+ {
+ xResult.set( (*aIt).second );
+ }
+ else
+ {
+ uno::Reference< frame::XModel > xModel( m_xModel );
+
+ if( xModel.is() && (rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))
+ || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Redo" ))) )
+ {
+ CommandDispatch * pDispatch = new UndoCommandDispatch( m_xContext, xModel );
+ xResult.set( pDispatch );
+ pDispatch->initialize();
+ m_aCachedDispatches[ C2U(".uno:Undo") ].set( xResult );
+ m_aCachedDispatches[ C2U(".uno:Redo") ].set( xResult );
+ m_aToBeDisposedDispatches.push_back( xResult );
+ }
+ else if( xModel.is() && (rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Context" ))
+ || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ModifiedStatus" ))) )
+ {
+ Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY );
+ CommandDispatch * pDispatch = new StatusBarCommandDispatch( m_xContext, xModel, xSelSupp );
+ xResult.set( pDispatch );
+ pDispatch->initialize();
+ m_aCachedDispatches[ C2U(".uno:Context") ].set( xResult );
+ m_aCachedDispatches[ C2U(".uno:ModifiedStatus") ].set( xResult );
+ m_aToBeDisposedDispatches.push_back( xResult );
+ }
+ else if( xModel.is() &&
+ (m_aContainerDocumentCommands.find( rURL.Path ) != m_aContainerDocumentCommands.end()) )
+ {
+ xResult.set( getContainerDispatchForURL( xModel->getCurrentController(), rURL ));
+ // ToDo: can those dispatches be cached?
+ m_aCachedDispatches[ rURL.Complete ].set( xResult );
+ }
+ else if( m_xChartDispatcher.is() &&
+ (m_aChartCommands.find( rURL.Path ) != m_aChartCommands.end()) )
+ {
+ xResult.set( m_xChartDispatcher );
+ m_aCachedDispatches[ rURL.Complete ].set( xResult );
+ }
+ // #i12587# support for shapes in chart
+ // Note, that the chart dispatcher must be queried first, because
+ // the chart dispatcher is the default dispatcher for all context
+ // sensitive commands.
+ else if ( m_pDrawCommandDispatch && m_pDrawCommandDispatch->isFeatureSupported( rURL.Complete ) )
+ {
+ xResult.set( m_pDrawCommandDispatch );
+ m_aCachedDispatches[ rURL.Complete ].set( xResult );
+ }
+ else if ( m_pShapeController && m_pShapeController->isFeatureSupported( rURL.Complete ) )
+ {
+ xResult.set( m_pShapeController );
+ m_aCachedDispatches[ rURL.Complete ].set( xResult );
+ }
+ }
+
+ return xResult;
+}
+
+Sequence< Reference< frame::XDispatch > > CommandDispatchContainer::getDispatchesForURLs(
+ const Sequence< frame::DispatchDescriptor > & aDescriptors )
+{
+ sal_Int32 nCount = aDescriptors.getLength();
+ uno::Sequence< uno::Reference< frame::XDispatch > > aRet( nCount );
+
+ for( sal_Int32 nPos = 0; nPos < nCount; ++nPos )
+ {
+ if( aDescriptors[ nPos ].FrameName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("_self")))
+ aRet[ nPos ] = getDispatchForURL( aDescriptors[ nPos ].FeatureURL );
+ }
+ return aRet;
+}
+
+void CommandDispatchContainer::DisposeAndClear()
+{
+ m_aCachedDispatches.clear();
+ DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches );
+ m_aToBeDisposedDispatches.clear();
+ m_xChartDispatcher.clear();
+ m_aChartCommands.clear();
+ m_pChartController = NULL;
+ m_pDrawCommandDispatch = NULL;
+ m_pShapeController = NULL;
+}
+
+Reference< frame::XDispatch > CommandDispatchContainer::getContainerDispatchForURL(
+ const Reference< frame::XController > & xChartController,
+ const util::URL & rURL )
+{
+ Reference< frame::XDispatch > xResult;
+ if( xChartController.is())
+ {
+ Reference< frame::XFrame > xFrame( xChartController->getFrame());
+ if( xFrame.is())
+ {
+ Reference< frame::XDispatchProvider > xDispProv( xFrame->getCreator(), uno::UNO_QUERY );
+ if( xDispProv.is())
+ xResult.set( xDispProv->queryDispatch( rURL, C2U("_self"), 0 ));
+ }
+ }
+ return xResult;
+}
+
+void CommandDispatchContainer::setDrawCommandDispatch( DrawCommandDispatch* pDispatch )
+{
+ m_pDrawCommandDispatch = pDispatch;
+ m_aToBeDisposedDispatches.push_back( Reference< frame::XDispatch >( pDispatch ) );
+}
+
+void CommandDispatchContainer::setShapeController( ShapeController* pController )
+{
+ m_pShapeController = pController;
+ m_aToBeDisposedDispatches.push_back( Reference< frame::XDispatch >( pController ) );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx
new file mode 100644
index 000000000000..1c8769e0a6d9
--- /dev/null
+++ b/chart2/source/controller/main/CommandDispatchContainer.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_COMMANDDISPATCHCONTAINER_HXX
+#define CHART2_COMMANDDISPATCHCONTAINER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <set>
+#include <map>
+
+namespace chart
+{
+
+class ChartController;
+class DrawCommandDispatch;
+class ShapeController;
+
+/** @HTML
+
+ Helper class for implementing the <code>XDispatchProvider</code> interface
+ of the ChartController. This class handles all commands to queryDispatch and
+ queryDispatches in the following way:
+
+ <ul>
+ <li>Check if there is a cached <code>XDispatch</code> for a given command.
+ If so, use it.</li>
+ <li>Check if the command is handled by this class, e.g. Undo. If so,
+ return a corresponding <code>XDispatch</code> implementation, and cache
+ this implementation for later use</li>
+ <li>Otherwise send the command to the chart dispatch provider, if it
+ can handle this dispatch (determined by the list of commands given in
+ <code>setChartDispatch()</code>).</li>
+ </ul>
+
+ <p>The <code>XDispatch</code>Provider is designed to return different
+ <code>XDispatch</code> implementations for each command. This class here
+ decides which implementation to use for which command.</p>
+
+ <p>As most commands need much information of the controller and are
+ implemented there, the controller handles most of the commands itself (it
+ also implements <code>XDispatch</code>). Therefore it is set here as
+ chart dispatch.</p>
+ */
+class CommandDispatchContainer
+{
+public:
+ // note: the chart dispatcher should be removed when all commands are
+ // handled by other dispatchers. (Chart is currently the controller
+ // itself)
+ explicit CommandDispatchContainer(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ ChartController* pController );
+
+ void setModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+// void setUndoManager(
+// const ::com::sun::star::uno::Reference<
+// ::com::sun::star::chart2::XUndoManager > & xUndoManager );
+
+ /** Set a chart dispatcher that is used for all commands contained in
+ rChartCommands
+ */
+ void setChartDispatch(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > xChartDispatch,
+ const ::std::set< ::rtl::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
+ checked whether the command is one of the commands given via
+ the setChartDispatch() method. If so, call the chart dispatch.
+
+ <p>If all this fails, return an empty dispatch.</p>
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > getDispatchForURL(
+ const ::com::sun::star::util::URL & rURL );
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > > getDispatchesForURLs(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::frame::DispatchDescriptor > & aDescriptors );
+
+ void DisposeAndClear();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
+ getContainerDispatchForURL(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > & xChartController,
+ const ::com::sun::star::util::URL & rURL );
+
+ void setDrawCommandDispatch( DrawCommandDispatch* pDispatch );
+ DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; }
+ void setShapeController( ShapeController* pController );
+ ShapeController* getShapeController() { return m_pShapeController; }
+
+private:
+ typedef
+ ::std::map< ::rtl::OUString,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > >
+ tDispatchMap;
+
+ typedef
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > tDisposeVector;
+
+ mutable tDispatchMap m_aCachedDispatches;
+ mutable tDisposeVector m_aToBeDisposedDispatches;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xChartDispatcher;
+ ::std::set< ::rtl::OUString > m_aChartCommands;
+
+ ::std::set< ::rtl::OUString > m_aContainerDocumentCommands;
+
+ ChartController* m_pChartController;
+ DrawCommandDispatch* m_pDrawCommandDispatch;
+ ShapeController* m_pShapeController;
+};
+
+} // namespace chart
+
+// CHART2_COMMANDDISPATCHCONTAINER_HXX
+#endif
diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx
new file mode 100644
index 000000000000..bf0bc6e14eec
--- /dev/null
+++ b/chart2/source/controller/main/ConfigurationAccess.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ConfigurationAccess.hxx"
+#include "macros.hxx"
+
+// header for class SvtSysLocale
+#include <unotools/syslocale.hxx>
+// header for class ConfigItem
+#include <unotools/configitem.hxx>
+// header for rtl::Static
+#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 == MEASURE_METRIC );
+}
+}//end anonymous namespace
+
+// ----------------------------------------
+
+class CalcConfigItem : public ::utl::ConfigItem
+{
+public:
+ CalcConfigItem();
+ virtual ~CalcConfigItem();
+
+ FieldUnit getFieldUnit();
+ virtual void Commit();
+ virtual void Notify( const uno::Sequence<rtl::OUString>& aPropertyNames);
+};
+
+CalcConfigItem::CalcConfigItem()
+ : ConfigItem( ::rtl::OUString( C2U( "Office.Calc/Layout" )))
+{
+}
+
+CalcConfigItem::~CalcConfigItem()
+{
+}
+
+void CalcConfigItem::Commit() {}
+void CalcConfigItem::Notify( const uno::Sequence<rtl::OUString>& ) {}
+
+FieldUnit CalcConfigItem::getFieldUnit()
+{
+ FieldUnit eResult( FUNIT_CM );
+
+ uno::Sequence< ::rtl::OUString > aNames( 1 );
+ if( lcl_IsMetric() )
+ aNames[ 0 ] = ::rtl::OUString( C2U( "Other/MeasureUnit/Metric" ));
+ else
+ aNames[ 0 ] = ::rtl::OUString( C2U( "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
+//.............................................................................
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
new file mode 100644
index 000000000000..a01b80bfa22b
--- /dev/null
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ControllerCommandDispatch.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisHelper.hxx"
+#include "TitleHelper.hxx"
+#include "LegendHelper.hxx"
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "ChartTypeHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartController.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "StatisticsHelper.hxx"
+#include "ShapeController.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/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp>
+
+// only needed until #i68864# is fixed
+#include <com/sun/star/frame/XLayoutManager.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+bool lcl_isStatusBarVisible( const Reference< frame::XController > & xController )
+{
+ bool bIsStatusBarVisible = false;
+ // Status-Bar visible, workaround: this should not be necessary. @todo:
+ // remove when Issue #i68864# is fixed
+ if( xController.is())
+ {
+ Reference< beans::XPropertySet > xPropSet( xController->getFrame(), uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
+ xPropSet->getPropertyValue( C2U( "LayoutManager" ) ) >>= xLayoutManager;
+ if ( xLayoutManager.is() )
+ bIsStatusBarVisible = xLayoutManager->isElementVisible( C2U("private:resource/statusbar/statusbar"));
+ }
+ }
+ return bIsStatusBarVisible;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+// ----------------------------------------
+
+namespace impl
+{
+
+/// Constants for moving the series.
+enum EnumForward{
+ MOVE_SERIES_FORWARD = true,
+ MOVE_SERIES_BACKWARD = false
+};
+
+/** Represents the current state of the controller (needed for issue 63017).
+
+ You can set the state by calling update(). After this call the state is
+ preserved in this class until the next call to update().
+
+ This is useful, not to say necessary, for enabling and disabling of menu
+ entries (e.g. format>arrangement). As the status requests are sent very
+ frequently it would be impossible, from a performance point of view, to
+ query the current status every time directly at the model. So this class
+ serves as a cache for the state.
+*/
+struct ControllerState
+{
+ ControllerState();
+
+ void update( const Reference< frame::XController > & xController,
+ const Reference< frame::XModel > & xModel );
+
+ // -- State variables -------
+ bool bHasSelectedObject;
+ bool bIsPositionableObject;
+ bool bIsTextObject;
+ bool bIsDeleteableObjectSelected;
+ bool bIsFormateableObjectSelected;
+
+ // May the selected series be moved forward or backward (cf
+ // format>arrangement).
+ bool bMayMoveSeriesForward;
+ bool bMayMoveSeriesBackward;
+
+ // trendlines
+ bool bMayAddTrendline;
+ bool bMayAddTrendlineEquation;
+ bool bMayAddR2Value;
+ bool bMayAddMeanValue;
+ bool bMayAddYErrorBars;
+
+ bool bMayDeleteTrendline;
+ bool bMayDeleteTrendlineEquation;
+ bool bMayDeleteR2Value;
+ bool bMayDeleteMeanValue;
+ bool bMayDeleteYErrorBars;
+
+ bool bMayFormatTrendline;
+ bool bMayFormatTrendlineEquation;
+ bool bMayFormatMeanValue;
+ bool bMayFormatYErrorBars;
+};
+
+
+ControllerState::ControllerState() :
+ bHasSelectedObject( false ),
+ bIsPositionableObject( false ),
+ bIsTextObject(false),
+ bIsDeleteableObjectSelected(false),
+ bIsFormateableObjectSelected(false),
+ bMayMoveSeriesForward( false ),
+ bMayMoveSeriesBackward( false ),
+ bMayAddTrendline( false ),
+ bMayAddTrendlineEquation( false ),
+ bMayAddR2Value( false ),
+ bMayAddMeanValue( false ),
+ bMayAddYErrorBars( false ),
+ bMayDeleteTrendline( false ),
+ bMayDeleteTrendlineEquation( false ),
+ bMayDeleteR2Value( false ),
+ bMayDeleteMeanValue( false ),
+ bMayDeleteYErrorBars( false ),
+ bMayFormatTrendline( false ),
+ bMayFormatTrendlineEquation( false ),
+ bMayFormatMeanValue( false ),
+ bMayFormatYErrorBars( false )
+{}
+
+void ControllerState::update(
+ const Reference< frame::XController > & xController,
+ const Reference< frame::XModel > & xModel )
+{
+ Reference< view::XSelectionSupplier > xSelectionSupplier(
+ xController, uno::UNO_QUERY );
+
+ // Update ControllerState variables.
+ if( xSelectionSupplier.is())
+ {
+ uno::Any aSelObj( xSelectionSupplier->getSelection() );
+ ObjectIdentifier aSelOID( aSelObj );
+ OUString aSelObjCID( aSelOID.getObjectCID() );
+
+ bHasSelectedObject = aSelOID.isValid();
+
+ ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID ));
+
+ bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && aSelOID.isDragableObject();
+ bIsTextObject = OBJECTTYPE_TITLE == aObjectType;
+
+ uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+ bIsFormateableObjectSelected = bHasSelectedObject && aSelOID.isAutoGeneratedObject();
+ if( OBJECTTYPE_DIAGRAM==aObjectType || OBJECTTYPE_DIAGRAM_WALL==aObjectType || OBJECTTYPE_DIAGRAM_FLOOR==aObjectType )
+ bIsFormateableObjectSelected = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+
+ uno::Reference< chart2::XDataSeries > xGivenDataSeries(
+ ObjectIdentifier::getDataSeriesForCID(
+ aSelObjCID, xModel ) );
+
+ bIsDeleteableObjectSelected = ChartController::isObjectDeleteable( aSelObj );
+
+ bMayMoveSeriesForward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
+ ChartModelHelper::findDiagram( xModel ),
+ xGivenDataSeries,
+ MOVE_SERIES_FORWARD );
+
+ bMayMoveSeriesBackward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
+ ChartModelHelper::findDiagram( xModel ),
+ xGivenDataSeries,
+ MOVE_SERIES_BACKWARD );
+
+ bMayAddTrendline = false;
+ bMayAddTrendlineEquation = false;
+ bMayAddR2Value = false;
+ bMayAddMeanValue = false;
+ bMayAddYErrorBars = false;
+ bMayDeleteTrendline = false;
+ bMayDeleteTrendlineEquation = false;
+ bMayDeleteR2Value = false;
+ bMayDeleteMeanValue = false;
+ bMayDeleteYErrorBars = false;
+ bMayFormatTrendline = false;
+ bMayFormatTrendlineEquation = false;
+ bMayFormatMeanValue = false;
+ bMayFormatYErrorBars = false;
+ if( bHasSelectedObject )
+ {
+ if( xGivenDataSeries.is())
+ {
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ uno::Reference< chart2::XChartType > xFirstChartType(
+ DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram ));
+
+ // trend lines/mean value line
+ if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
+ && ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount ))
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ xGivenDataSeries, uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ uno::Reference< chart2::XRegressionCurve > xRegCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
+ bMayFormatTrendline = bMayDeleteTrendline = xRegCurve.is();
+ bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
+ bMayAddTrendline = ! bMayDeleteTrendline;
+ bMayAddMeanValue = ! bMayDeleteMeanValue;
+ bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
+ bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
+ }
+ }
+
+ // error bars
+ if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
+ && ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount ))
+ {
+ bMayFormatYErrorBars = bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries );
+ bMayAddYErrorBars = ! bMayDeleteYErrorBars;
+ }
+ }
+
+ if( aObjectType == OBJECTTYPE_DATA_AVERAGE_LINE )
+ bMayFormatMeanValue = true;
+
+ if( aObjectType == OBJECTTYPE_DATA_ERRORS_Y || aObjectType == OBJECTTYPE_DATA_ERRORS )
+ bMayFormatYErrorBars = true;
+
+ if( aObjectType == OBJECTTYPE_DATA_CURVE )
+ {
+ bMayFormatTrendline = true;
+ uno::Reference< chart2::XRegressionCurve > xRegCurve(
+ ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
+ bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
+ bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
+ }
+ else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ {
+ bMayFormatTrendlineEquation = true;
+ bool bHasR2Value = false;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
+ if( xEqProp.is())
+ xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient") ) >>= bHasR2Value;
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ bMayAddR2Value = !bHasR2Value;
+ bMayDeleteR2Value = bHasR2Value;
+ }
+ }
+ }
+}
+
+
+/** Represents the current state of the model.
+
+ You can set the state by calling update(). After this call the state is
+ preserved in this class until the next call to update().
+
+ This is useful, not to say necessary, for enabling and disabling of menu
+ entries and toolbar icons. As the status requests are sent very frequently
+ it would be impossible, from a performance point of view, to query the
+ current status every time directly at the model. So this class serves as a
+ cache for the state.
+ */
+struct ModelState
+{
+ ModelState();
+
+ void update( const Reference< frame::XModel > & xModel );
+
+ bool HasAnyAxis() const;
+ bool HasAnyGrid() const;
+ bool HasAnyTitle() const;
+
+ bool bIsReadOnly;
+ bool bIsThreeD;
+ bool bHasOwnData;
+
+ bool bHasMainTitle;
+ bool bHasSubTitle;
+ bool bHasXAxisTitle;
+ bool bHasYAxisTitle;
+ bool bHasZAxisTitle;
+ bool bHasSecondaryXAxisTitle;
+ bool bHasSecondaryYAxisTitle;
+
+ bool bHasXAxis;
+ bool bHasYAxis;
+ bool bHasZAxis;
+ bool bHasAAxis;
+ bool bHasBAxis;
+
+ bool bHasMainXGrid;
+ bool bHasMainYGrid;
+ bool bHasMainZGrid;
+ bool bHasHelpXGrid;
+ bool bHasHelpYGrid;
+ bool bHasHelpZGrid;
+
+ bool bHasAutoScaledText;
+ bool bHasLegend;
+ bool bHasWall;
+ bool bHasFloor;
+
+ bool bSupportsStatistics;
+ bool bSupportsAxes;
+};
+
+ModelState::ModelState() :
+ bIsReadOnly( true ),
+ bIsThreeD( false ),
+ bHasOwnData( false ),
+ bHasMainTitle( false ),
+ bHasSubTitle( false ),
+ bHasXAxisTitle( false ),
+ bHasYAxisTitle( false ),
+ bHasZAxisTitle( false ),
+ bHasSecondaryXAxisTitle( false ),
+ bHasSecondaryYAxisTitle( false ),
+ bHasXAxis( false ),
+ bHasYAxis( false ),
+ bHasZAxis( false ),
+ bHasAAxis( false ),
+ bHasBAxis( false ),
+ bHasMainXGrid( false ),
+ bHasMainYGrid( false ),
+ bHasMainZGrid( false ),
+ bHasHelpXGrid( false ),
+ bHasHelpYGrid( false ),
+ bHasHelpZGrid( false ),
+ bHasAutoScaledText( false ),
+ bHasLegend( false ),
+ bHasWall( false ),
+ bHasFloor( false ),
+ bSupportsStatistics( false ),
+ bSupportsAxes( false )
+
+{}
+
+void ModelState::update( const Reference< frame::XModel > & xModel )
+{
+ Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
+
+ bIsReadOnly = true;
+ Reference< frame::XStorable > xStorable( xModel, uno::UNO_QUERY );
+ if( xStorable.is())
+ bIsReadOnly = xStorable->isReadonly();
+
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+
+ uno::Reference< chart2::XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ bSupportsStatistics = ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount );
+ bSupportsAxes = ChartTypeHelper::isSupportingMainAxis( xFirstChartType, nDimensionCount, 0 );
+
+ bIsThreeD = (nDimensionCount == 3);
+ bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
+
+ bHasMainTitle = TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is();
+ bHasSubTitle = TitleHelper::getTitle( TitleHelper::SUB_TITLE, xModel ).is();
+ bHasXAxisTitle = TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, xModel ).is();
+ bHasYAxisTitle = TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, xModel ).is();
+ bHasZAxisTitle = TitleHelper::getTitle( TitleHelper::Z_AXIS_TITLE, xModel ).is();
+ bHasSecondaryXAxisTitle = TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xModel ).is();
+ bHasSecondaryYAxisTitle = TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xModel ).is();
+
+ bHasXAxis = bSupportsAxes && AxisHelper::getAxis( 0, true, xDiagram ).is();
+ bHasYAxis = bSupportsAxes && AxisHelper::getAxis( 1, true, xDiagram ).is();
+ bHasZAxis = bSupportsAxes && AxisHelper::getAxis( 2, true, xDiagram ).is();
+ bHasAAxis = bSupportsAxes && AxisHelper::getAxis( 0, false, xDiagram ).is();
+ bHasBAxis = bSupportsAxes && AxisHelper::getAxis( 1, false, xDiagram ).is();
+
+ bHasMainXGrid = bSupportsAxes && AxisHelper::isGridShown( 0, 0, true, xDiagram );
+ bHasMainYGrid = bSupportsAxes && AxisHelper::isGridShown( 1, 0, true, xDiagram );
+ bHasMainZGrid = bSupportsAxes && AxisHelper::isGridShown( 2, 0, true, xDiagram );
+ bHasHelpXGrid = bSupportsAxes && AxisHelper::isGridShown( 0, 0, false, xDiagram );
+ bHasHelpYGrid = bSupportsAxes && AxisHelper::isGridShown( 1, 0, false, xDiagram );
+ bHasHelpZGrid = bSupportsAxes && AxisHelper::isGridShown( 2, 0, false, xDiagram );
+
+ bHasAutoScaledText =
+ (ReferenceSizeProvider::getAutoResizeState( xChartDoc ) ==
+ ReferenceSizeProvider::AUTO_RESIZE_YES);
+
+ bHasLegend = LegendHelper::hasLegend( xDiagram );
+ bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ bHasFloor = bHasWall && bIsThreeD;
+}
+
+bool ModelState::HasAnyAxis() const
+{
+ return bHasXAxis || bHasYAxis || bHasZAxis || bHasAAxis || bHasBAxis;
+}
+
+bool ModelState::HasAnyGrid() const
+{
+ return bHasMainXGrid || bHasMainYGrid || bHasMainZGrid ||
+ bHasHelpXGrid || bHasHelpYGrid || bHasHelpZGrid;
+}
+
+bool ModelState::HasAnyTitle() const
+{
+ return bHasMainTitle || bHasSubTitle || bHasXAxisTitle || bHasYAxisTitle || bHasZAxisTitle || bHasSecondaryXAxisTitle || bHasSecondaryYAxisTitle;
+}
+
+} // namespace impl
+
+// ----------------------------------------
+DBG_NAME(ControllerCommandDispatch)
+
+ControllerCommandDispatch::ControllerCommandDispatch(
+ const Reference< uno::XComponentContext > & xContext,
+ ChartController* pController, CommandDispatchContainer* pContainer ) :
+ impl::ControllerCommandDispatch_Base( xContext ),
+ m_pChartController( pController ),
+ m_xController( Reference< frame::XController >( pController ) ),
+ m_xSelectionSupplier( Reference< view::XSelectionSupplier >( pController ) ),
+ m_xDispatch( Reference< frame::XDispatch >( pController ) ),
+ m_apModelState( new impl::ModelState() ),
+ m_apControllerState( new impl::ControllerState() ),
+ m_pDispatchContainer( pContainer )
+{
+ DBG_CTOR(ControllerCommandDispatch,NULL);
+}
+
+ControllerCommandDispatch::~ControllerCommandDispatch()
+{
+
+ DBG_DTOR(ControllerCommandDispatch,NULL);
+}
+
+void ControllerCommandDispatch::initialize()
+{
+ if( m_xController.is())
+ {
+ Reference< frame::XModel > xModel( m_xController->getModel());
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY );
+ OSL_ASSERT( xModifyBroadcaster.is());
+ if( xModifyBroadcaster.is())
+ xModifyBroadcaster->addModifyListener( this );
+
+ // Listen selection modifications (Arrangement feature - issue 63017).
+ if( m_xSelectionSupplier.is() )
+ m_xSelectionSupplier->addSelectionChangeListener( this );
+
+ if( m_apModelState.get() && xModel.is())
+ m_apModelState->update( xModel );
+
+ if( m_apControllerState.get() && xModel.is())
+ m_apControllerState->update( m_xController, xModel );
+
+ updateCommandAvailability();
+ }
+}
+
+void ControllerCommandDispatch::fireStatusEventForURLImpl(
+ const OUString & rURL,
+ const Reference< frame::XStatusListener > & xSingleListener )
+{
+ ::std::map< OUString, uno::Any >::const_iterator aArgIt( m_aCommandArguments.find( rURL ));
+ if( aArgIt != m_aCommandArguments.end())
+ fireStatusEventForURL( rURL, aArgIt->second, commandAvailable( rURL ), xSingleListener );
+ else
+ fireStatusEventForURL( rURL, uno::Any(), commandAvailable( rURL ), xSingleListener );
+}
+
+void ControllerCommandDispatch::updateCommandAvailability()
+{
+ bool bModelStateIsValid = ( m_apModelState.get() != 0 );
+ bool bControllerStateIsValid = ( m_apControllerState.get() != 0 );
+ // Model and controller states exist.
+ OSL_ASSERT( bModelStateIsValid );
+ OSL_ASSERT( bControllerStateIsValid );
+
+ // read-only
+ bool bIsWritable = bModelStateIsValid && (! m_apModelState->bIsReadOnly);
+ // paste is available
+ // @todo: determine correctly
+ bool bHasSuitableClipboardContent = true;
+
+ bool bShapeContext = ( m_pChartController ? m_pChartController->isShapeContext() : false );
+
+ bool bDisableDataTableDialog = false;
+ if ( m_xController.is() )
+ {
+ Reference< beans::XPropertySet > xProps( m_xController->getModel(), uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ try
+ {
+ xProps->getPropertyValue( C2U( "DisableDataTableDialog" ) ) >>= bDisableDataTableDialog;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ // edit commands
+ m_aCommandAvailability[ C2U(".uno:Cut")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsDeleteableObjectSelected;
+ m_aCommandAvailability[ C2U(".uno:Copy")] = bControllerStateIsValid && m_apControllerState->bHasSelectedObject;
+ m_aCommandAvailability[ C2U(".uno:Paste")] = bIsWritable && bHasSuitableClipboardContent;
+
+ // toolbar commands
+ m_aCommandAvailability[ C2U(".uno:ToggleGridHorizontal")] = bIsWritable;
+ m_aCommandArguments[ C2U(".uno:ToggleGridHorizontal")] = uno::makeAny( m_apModelState->bHasMainYGrid );
+
+ m_aCommandAvailability[ C2U(".uno:ToggleLegend")] = bIsWritable;
+ m_aCommandArguments[ C2U(".uno:ToggleLegend")] = uno::makeAny( m_apModelState->bHasLegend );
+
+ m_aCommandAvailability[ C2U(".uno:NewArrangement")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:Update")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DefaultColors")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:BarWidth")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:NumberOfLines")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:ArrangeRow")] =
+ bShapeContext || ( bIsWritable && bControllerStateIsValid && ( m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward ) );
+
+ // insert objects
+ m_aCommandAvailability[ C2U(".uno:InsertTitles")] = m_aCommandAvailability[ C2U(".uno:InsertMenuTitles")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertLegend")] = m_aCommandAvailability[ C2U(".uno:InsertMenuLegend")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteLegend")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertRemoveAxes")] = m_aCommandAvailability[ C2U(".uno:InsertMenuAxes")] = bIsWritable && m_apModelState->bSupportsAxes;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuGrids")] = bIsWritable && m_apModelState->bSupportsAxes;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuTrendlines")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuMeanValues")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuYErrorBars")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertSymbol")] = bIsWritable && m_apControllerState->bIsTextObject;
+
+ // format objects
+ bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected;
+ m_aCommandAvailability[ C2U(".uno:FormatSelection")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatAxis")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatTitle")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataSeries")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataPoint")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataLabels")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataLabel")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatYErrorBars;
+ m_aCommandAvailability[ C2U(".uno:FormatMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatMeanValue;
+ m_aCommandAvailability[ C2U(".uno:FormatTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendline;
+ m_aCommandAvailability[ C2U(".uno:FormatTrendlineEquation")] = bFormatObjectAvailable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendlineEquation;
+ m_aCommandAvailability[ C2U(".uno:FormatStockLoss")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatStockGain")] = bFormatObjectAvailable;
+
+ m_aCommandAvailability[ C2U(".uno:DiagramType")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:Legend")] = bIsWritable && m_apModelState->bHasLegend;
+ m_aCommandAvailability[ C2U(".uno:DiagramWall")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasWall;
+ m_aCommandAvailability[ C2U(".uno:DiagramArea")] = bIsWritable;
+
+ m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsPositionableObject;
+
+ // 3d commands
+ m_aCommandAvailability[ C2U(".uno:View3D")] = bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD;
+ m_aCommandAvailability[ C2U(".uno:DiagramFloor")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasFloor;
+
+ //some mor format commands with different ui text
+ m_aCommandAvailability[ C2U(".uno:FormatWall")] = m_aCommandAvailability[ C2U(".uno:DiagramWall")];
+ m_aCommandAvailability[ C2U(".uno:FormatFloor")] = m_aCommandAvailability[ C2U(".uno:DiagramFloor")];
+ m_aCommandAvailability[ C2U(".uno:FormatChartArea")] = m_aCommandAvailability[ C2U(".uno:DiagramArea")];
+ m_aCommandAvailability[ C2U(".uno:FormatLegend")] = m_aCommandAvailability[ C2U(".uno:Legend")];
+
+ // depending on own data
+ m_aCommandAvailability[ C2U(".uno:DataRanges")] = bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData);
+ m_aCommandAvailability[ C2U(".uno:DiagramData")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasOwnData && !bDisableDataTableDialog;
+
+ // titles
+ m_aCommandAvailability[ C2U(".uno:MainTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainTitle;
+ m_aCommandAvailability[ C2U(".uno:SubTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSubTitle;
+ m_aCommandAvailability[ C2U(".uno:XTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxisTitle;
+ m_aCommandAvailability[ C2U(".uno:YTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxisTitle;
+ m_aCommandAvailability[ C2U(".uno:ZTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxisTitle;
+ m_aCommandAvailability[ C2U(".uno:SecondaryXTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSecondaryXAxisTitle;
+ m_aCommandAvailability[ C2U(".uno:SecondaryYTitle")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasSecondaryYAxisTitle;
+ m_aCommandAvailability[ C2U(".uno:AllTitles")] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyTitle();
+
+ // text
+ m_aCommandAvailability[ C2U(".uno:ScaleText")] = bIsWritable && bModelStateIsValid ;
+ m_aCommandArguments[ C2U(".uno:ScaleText")] = uno::makeAny( m_apModelState->bHasAutoScaledText );
+
+ // axes
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisX")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxis;
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisY")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxis;
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisZ")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxis;
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisA")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasAAxis;
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisB")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasBAxis;
+ m_aCommandAvailability[ C2U(".uno:DiagramAxisAll")] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyAxis();
+
+ // grids
+ // note: x and y are swapped in the commands!
+ m_aCommandAvailability[ C2U(".uno:DiagramGridYMain")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainXGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridXMain")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainYGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridZMain")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasMainZGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridYHelp")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpXGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridXHelp")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpYGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridZHelp")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpZGrid;
+ m_aCommandAvailability[ C2U(".uno:DiagramGridAll")] = bIsWritable && bModelStateIsValid && m_apModelState->HasAnyGrid();
+
+ // series arrangement
+ m_aCommandAvailability[ C2U(".uno:Forward")] = ( bShapeContext ? isShapeControllerCommandAvailable( C2U( ".uno:Forward" ) ) :
+ ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward && !bDisableDataTableDialog ) );
+ m_aCommandAvailability[ C2U(".uno:Backward")] = ( bShapeContext ? isShapeControllerCommandAvailable( C2U( ".uno:Backward" ) ) :
+ ( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward && !bDisableDataTableDialog ) );
+
+ m_aCommandAvailability[ C2U(".uno:InsertDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertDataLabel")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddMeanValue;
+ m_aCommandAvailability[ C2U(".uno:InsertTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendline;
+ m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
+ m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquationAndR2")] = m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")];
+ m_aCommandAvailability[ C2U(".uno:InsertR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value;
+ m_aCommandAvailability[ C2U(".uno:DeleteR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value;
+
+ m_aCommandAvailability[ C2U(".uno:InsertYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars;
+
+ m_aCommandAvailability[ C2U(".uno:DeleteDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteDataLabel") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteTrendline") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline;
+ m_aCommandAvailability[ C2U(".uno:DeleteTrendlineEquation") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendlineEquation;
+ m_aCommandAvailability[ C2U(".uno:DeleteMeanValue") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue;
+ m_aCommandAvailability[ C2U(".uno:DeleteYErrorBars") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars;
+
+ m_aCommandAvailability[ C2U(".uno:ResetDataPoint") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:ResetAllDataPoints") ] = bIsWritable;
+
+ m_aCommandAvailability[ C2U(".uno:InsertAxis") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteAxis") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertAxisTitle") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:FormatMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:FormatMinorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMinorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteMinorGrid") ] = bIsWritable;
+}
+
+bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
+{
+ ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.find( rCommand ));
+ if( aIt != m_aCommandAvailability.end())
+ return aIt->second;
+ OSL_ENSURE( false, "commandAvailable: command not in availability map" );
+ return false;
+}
+
+bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const ::rtl::OUString& rCommand )
+{
+ ShapeController* pShapeController = ( m_pDispatchContainer ? m_pDispatchContainer->getShapeController() : NULL );
+ if ( pShapeController )
+ {
+ FeatureState aState( pShapeController->getState( rCommand ) );
+ return aState.bEnabled;
+ }
+ return false;
+}
+
+void ControllerCommandDispatch::fireStatusEvent(
+ const OUString & rURL,
+ const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
+{
+ bool bIsChartSelectorURL = rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:ChartElementSelector") );
+ if( rURL.getLength() == 0 || bIsChartSelectorURL )
+ {
+ uno::Any aArg;
+ aArg <<= m_xController;
+ fireStatusEventForURL( C2U(".uno:ChartElementSelector"), aArg, true, xSingleListener );
+ }
+
+ if( rURL.getLength() == 0 )
+ for( ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.begin());
+ aIt != m_aCommandAvailability.end(); ++aIt )
+ fireStatusEventForURLImpl( aIt->first, xSingleListener );
+ else if( !bIsChartSelectorURL )
+ fireStatusEventForURLImpl( rURL, xSingleListener );
+
+ // statusbar. Should be handled by base implementation
+ // @todo: remove if Issue 68864 is fixed
+ if( rURL.getLength() == 0 ||
+ rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:StatusBarVisible")))
+ {
+ bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xController ));
+ fireStatusEventForURL( C2U(".uno:StatusBarVisible"), uno::makeAny( bIsStatusBarVisible ), true, xSingleListener );
+ }
+}
+
+// ____ XDispatch ____
+void SAL_CALL ControllerCommandDispatch::dispatch(
+ const util::URL& URL,
+ const Sequence< beans::PropertyValue >& Arguments )
+ throw (uno::RuntimeException)
+{
+ if( commandAvailable( URL.Complete ))
+ m_xDispatch->dispatch( URL, Arguments );
+}
+
+// ____ WeakComponentImplHelperBase ____
+/// is called when this is disposed
+void SAL_CALL ControllerCommandDispatch::disposing()
+{
+ m_xController.clear();
+ m_xDispatch.clear();
+ m_xSelectionSupplier.clear();
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL ControllerCommandDispatch::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ m_xController.clear();
+ m_xDispatch.clear();
+ m_xSelectionSupplier.clear();
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ bool bUpdateCommandAvailability = false;
+
+ // Update the "ModelState" Struct.
+ if( m_apModelState.get() && m_xController.is())
+ {
+ m_apModelState->update( m_xController->getModel());
+ bUpdateCommandAvailability = true;
+ }
+
+ // Update the "ControllerState" Struct.
+ if( m_apControllerState.get() && m_xController.is())
+ {
+ m_apControllerState->update( m_xController, m_xController->getModel());
+ bUpdateCommandAvailability = true;
+ }
+
+ if( bUpdateCommandAvailability )
+ updateCommandAvailability();
+
+ CommandDispatch::modified( aEvent );
+}
+
+
+// ____ XSelectionChangeListener ____
+void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ // Update the "ControllerState" Struct.
+ if( m_apControllerState.get() && m_xController.is())
+ {
+ m_apControllerState->update( m_xController, m_xController->getModel());
+ updateCommandAvailability();
+ }
+
+ CommandDispatch::modified( aEvent );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx
new file mode 100644
index 000000000000..08d57a0d6cbf
--- /dev/null
+++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CONTROLLERCOMMANDDISPATCH_HXX
+#define CHART2_CONTROLLERCOMMANDDISPATCH_HXX
+
+#include "CommandDispatch.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include <memory>
+
+namespace chart
+{
+
+class ChartController;
+class CommandDispatchContainer;
+
+namespace impl
+{
+struct ModelState;
+struct ControllerState;
+
+// #i63017# : need to implement the XSelectionChangeListener in order
+// to update the ControllerState when the selection changes.
+typedef ::cppu::ImplInheritanceHelper1<
+ CommandDispatch,
+ ::com::sun::star::view::XSelectionChangeListener >
+ ControllerCommandDispatch_Base;
+}
+
+/** This class is a CommandDispatch that is responsible for all commands that
+ the ChartController supports.
+
+ This class determines which commands are currently available (via the model
+ state) and if an available command is called forwards it to the
+ ChartController.
+ */
+class ControllerCommandDispatch : public impl::ControllerCommandDispatch_Base
+{
+public:
+ explicit ControllerCommandDispatch(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ ChartController* pController, CommandDispatchContainer* pContainer );
+ virtual ~ControllerCommandDispatch();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+protected:
+ // ____ XDispatch ____
+ virtual void SAL_CALL dispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ /// is called when this is disposed
+ virtual void SAL_CALL disposing();
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void fireStatusEvent(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XSelectionChangeListener ____
+ virtual void SAL_CALL selectionChanged(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ void fireStatusEventForURLImpl(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
+
+ bool commandAvailable( const ::rtl::OUString & rCommand );
+ void updateCommandAvailability();
+
+ bool isShapeControllerCommandAvailable( const ::rtl::OUString& rCommand );
+
+ ChartController* m_pChartController;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController > m_xController;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDispatch > m_xDispatch;
+
+ ::std::auto_ptr< impl::ModelState > m_apModelState;
+ ::std::auto_ptr< impl::ControllerState > m_apControllerState;
+
+ mutable ::std::map< ::rtl::OUString, bool > m_aCommandAvailability;
+ mutable ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > m_aCommandArguments;
+
+ CommandDispatchContainer* m_pDispatchContainer;
+};
+
+} // namespace chart
+
+// CHART2_CONTROLLERCOMMANDDISPATCH_HXX
+#endif
diff --git a/chart2/source/controller/main/DragMethod_Base.cxx b/chart2/source/controller/main/DragMethod_Base.cxx
new file mode 100644
index 000000000000..11ba7b7b8016
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_Base.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DragMethod_Base.hxx"
+
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ObjectIdentifier.hxx"
+#include <rtl/math.hxx>
+//header for class SdrPageView
+#include <svx/svdpagv.hxx>
+#include <svx/ActionDescriptionProvider.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//.............................................................................
+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 rtl::OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel
+ , ActionDescriptionProvider::ActionType eActionType )
+ : SdrDragMethod( rDrawViewWrapper )
+ , m_rDrawViewWrapper(rDrawViewWrapper)
+ , m_aObjectCID(rObjectCID)
+ , m_eActionType( eActionType )
+ , m_xChartModel( WeakReference< frame::XModel >(xChartModel) )
+{
+ setMoveOnly(true);
+}
+DragMethod_Base::~DragMethod_Base()
+{
+}
+
+Reference< frame::XModel > DragMethod_Base::getChartModel() const
+{
+ return Reference< frame::XModel >( m_xChartModel );;
+}
+
+rtl::OUString DragMethod_Base::getUndoDescription() const
+{
+ return ActionDescriptionProvider::createDescription(
+ m_eActionType,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aObjectCID )));
+}
+void DragMethod_Base::TakeSdrDragComment(String& rStr) const
+{
+ rStr = String( getUndoDescription() );
+}
+Pointer DragMethod_Base::GetSdrDragPointer() const
+{
+ if( IsDraggingPoints() || IsDraggingGluePoints() )
+ return Pointer(POINTER_MOVEPOINT);
+ else
+ return Pointer(POINTER_MOVE);
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/DragMethod_Base.hxx b/chart2/source/controller/main/DragMethod_Base.hxx
new file mode 100644
index 000000000000..dfd5cfa20255
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_Base.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DRAGMETHOD_BASE_HXX
+#define CHART2_DRAGMETHOD_BASE_HXX
+
+#include "DrawViewWrapper.hxx"
+#include <svx/ActionDescriptionProvider.hxx>
+// header for class SdrDragMethod
+#include <svx/svddrgmt.hxx>
+
+// header for class WeakReference
+#include <cppuhelper/weakref.hxx>
+
+namespace chart
+{
+
+class DragMethod_Base : public SdrDragMethod
+{
+public:
+ DragMethod_Base( DrawViewWrapper& rDrawViewWrapper, const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel
+ , ActionDescriptionProvider::ActionType eActionType = ActionDescriptionProvider::MOVE );
+ virtual ~DragMethod_Base();
+
+ virtual rtl::OUString getUndoDescription() const;
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual Pointer GetSdrDragPointer() const;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getChartModel() const;
+
+protected:
+ DrawViewWrapper& m_rDrawViewWrapper;
+ rtl::OUString m_aObjectCID;
+ ActionDescriptionProvider::ActionType m_eActionType;
+
+private:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xChartModel;
+};
+
+} // namespace chart
+
+// CHART2_DRAGMETHOD_BASE_HXX
+#endif
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx
new file mode 100644
index 000000000000..5074147fa9e2
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DragMethod_PieSegment.hxx"
+
+#include "Strings.hrc"
+#include "ResId.hxx"
+#include "macros.hxx"
+#include "ObjectIdentifier.hxx"
+#include <rtl/math.hxx>
+#include <svx/svdpagv.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::basegfx::B2DVector;
+
+DragMethod_PieSegment::DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper
+ , const rtl::OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+ : DragMethod_Base( rDrawViewWrapper, rObjectCID, xChartModel )
+ , m_aStartVector(100.0,100.0)
+ , m_fInitialOffset(0.0)
+ , m_fAdditionalOffset(0.0)
+ , m_aDragDirection(1000.0,1000.0)
+ , m_fDragRange( 1.0 )
+{
+ rtl::OUString aParameter( ObjectIdentifier::getDragParameterString( m_aObjectCID ) );
+
+ sal_Int32 nOffsetPercent(0);
+ awt::Point aMinimumPosition(0,0);
+ awt::Point aMaximumPosition(0,0);
+
+ ObjectIdentifier::parsePieSegmentDragParameterString(
+ aParameter, nOffsetPercent, aMinimumPosition, aMaximumPosition );
+
+ m_fInitialOffset = nOffsetPercent / 100.0;
+ if( m_fInitialOffset < 0.0 )
+ m_fInitialOffset = 0.0;
+ if( m_fInitialOffset > 1.0 )
+ m_fInitialOffset = 1.0;
+ B2DVector aMinVector( aMinimumPosition.X, aMinimumPosition.Y );
+ B2DVector aMaxVector( aMaximumPosition.X, aMaximumPosition.Y );
+ m_aDragDirection = aMaxVector - aMinVector;
+ m_fDragRange = m_aDragDirection.scalar( m_aDragDirection );
+ if( ::rtl::math::approxEqual( m_fDragRange, 0.0 ) )
+ m_fDragRange = 1.0;
+}
+DragMethod_PieSegment::~DragMethod_PieSegment()
+{
+}
+void DragMethod_PieSegment::TakeSdrDragComment(String& rStr) const
+{
+ rStr = String( SchResId( STR_STATUS_PIE_SEGMENT_EXPLODED ) );
+ rStr.SearchAndReplaceAscii( "%PERCENTVALUE", String::CreateFromInt32( static_cast<sal_Int32>((m_fAdditionalOffset+m_fInitialOffset)*100.0) ));
+}
+bool DragMethod_PieSegment::BeginSdrDrag()
+{
+ Point aStart( DragStat().GetStart() );
+ m_aStartVector = B2DVector( aStart.X(), aStart.Y() );
+ Show();
+ return true;
+}
+void DragMethod_PieSegment::MoveSdrDrag(const Point& rPnt)
+{
+ if( DragStat().CheckMinMoved(rPnt) )
+ {
+ //calculate new offset
+ B2DVector aShiftVector(( B2DVector( rPnt.X(), rPnt.Y() ) - m_aStartVector ));
+ m_fAdditionalOffset = m_aDragDirection.scalar( aShiftVector )/m_fDragRange; // projection
+
+ if( m_fAdditionalOffset < -m_fInitialOffset )
+ m_fAdditionalOffset = -m_fInitialOffset;
+ else if( m_fAdditionalOffset > (1.0-m_fInitialOffset) )
+ m_fAdditionalOffset = 1.0 - m_fInitialOffset;
+
+ B2DVector aNewPosVector = m_aStartVector + (m_aDragDirection * m_fAdditionalOffset);
+ Point aNewPos = Point( (long)(aNewPosVector.getX()), (long)(aNewPosVector.getY()) );
+ if( aNewPos != DragStat().GetNow() )
+ {
+ Hide();
+ DragStat().NextMove( aNewPos );
+ Show();
+ }
+ }
+}
+bool DragMethod_PieSegment::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+
+ try
+ {
+ Reference< frame::XModel > xChartModel( this->getChartModel() );
+ if( xChartModel.is() )
+ {
+ Reference< beans::XPropertySet > xPointProperties(
+ ObjectIdentifier::getObjectPropertySet( m_aObjectCID, xChartModel ) );
+ if( xPointProperties.is() )
+ xPointProperties->setPropertyValue( C2U( "Offset" ), uno::makeAny( m_fAdditionalOffset+m_fInitialOffset ));
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return true;
+}
+basegfx::B2DHomMatrix DragMethod_PieSegment::getCurrentTransformation()
+{
+ basegfx::B2DHomMatrix aRetval;
+
+ aRetval.translate(DragStat().GetDX(), DragStat().GetDY());
+
+ return aRetval;
+}
+void DragMethod_PieSegment::createSdrDragEntries()
+{
+ SdrObject* pObj = m_rDrawViewWrapper.getSelectedObject();
+ SdrPageView* pPV = m_rDrawViewWrapper.GetPageView();
+
+ if( pObj && pPV )
+ {
+ const basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly());
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aNewPolyPolygon));
+ }
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.hxx b/chart2/source/controller/main/DragMethod_PieSegment.hxx
new file mode 100644
index 000000000000..f63af9be3cc4
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_PieSegment.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DRAGMETHOD_PIESEGMENT_HXX
+#define CHART2_DRAGMETHOD_PIESEGMENT_HXX
+
+#include "DragMethod_Base.hxx"
+#include <basegfx/vector/b2dvector.hxx>
+
+namespace chart
+{
+
+class DragMethod_PieSegment : public DragMethod_Base
+{
+public:
+ DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper, const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ virtual ~DragMethod_PieSegment();
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+
+protected:
+ virtual void createSdrDragEntries();
+
+private:
+ ::basegfx::B2DVector m_aStartVector;
+ double m_fInitialOffset;
+ double m_fAdditionalOffset;
+ ::basegfx::B2DVector m_aDragDirection;
+ double m_fDragRange;
+};
+
+} // namespace chart
+
+// CHART2_DRAGMETHOD_PIESEGMENT_HXX
+#endif
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
new file mode 100644
index 000000000000..944b44dd25bf
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DragMethod_RotateDiagram.hxx"
+
+#include "SelectionHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+// header for class E3dScene
+#include <svx/scene3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+
+#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+DragMethod_RotateDiagram::DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWrapper
+ , const rtl::OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel
+ , RotationDirection eRotationDirection )
+ : DragMethod_Base( rDrawViewWrapper, rObjectCID, xChartModel, ActionDescriptionProvider::ROTATE )
+ , m_pScene(0)
+ , m_aReferenceRect(100,100,100,100)
+ , m_aStartPos(0,0)
+ , m_aWireframePolyPolygon()
+ , m_fInitialXAngleRad(0.0)
+ , m_fInitialYAngleRad(0.0)
+ , m_fInitialZAngleRad(0.0)
+ , m_fAdditionalXAngleRad(0.0)
+ , m_fAdditionalYAngleRad(0.0)
+ , m_fAdditionalZAngleRad(0.0)
+ , m_nInitialHorizontalAngleDegree(0)
+ , m_nInitialVerticalAngleDegree(0)
+ , m_nAdditionalHorizontalAngleDegree(0)
+ , m_nAdditionalVerticalAngleDegree(0)
+ , m_eRotationDirection(eRotationDirection)
+ , m_bRightAngledAxes(sal_False)
+{
+ m_pScene = SelectionHelper::getSceneToRotate( rDrawViewWrapper.getNamedSdrObject( rObjectCID ) );
+ SdrObject* pObj = rDrawViewWrapper.getSelectedObject();
+ if(pObj && m_pScene)
+ {
+ m_aReferenceRect = pObj->GetLogicRect();
+ Rectangle aTemp = m_pScene->GetLogicRect();
+
+ m_aWireframePolyPolygon = m_pScene->CreateWireframe();
+
+ uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(this->getChartModel()) );
+ uno::Reference< beans::XPropertySet > xDiagramProperties( xDiagram, uno::UNO_QUERY );
+ if( xDiagramProperties.is() )
+ {
+ ThreeDHelper::getRotationFromDiagram( xDiagramProperties
+ , m_nInitialHorizontalAngleDegree, m_nInitialVerticalAngleDegree );
+
+ ThreeDHelper::getRotationAngleFromDiagram( xDiagramProperties
+ , m_fInitialXAngleRad, m_fInitialYAngleRad, m_fInitialZAngleRad );
+
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ xDiagramProperties->getPropertyValue(C2U( "RightAngledAxes" )) >>= m_bRightAngledAxes;
+ if(m_bRightAngledAxes)
+ {
+ if( m_eRotationDirection==ROTATIONDIRECTION_Z )
+ m_eRotationDirection=ROTATIONDIRECTION_FREE;
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( m_fInitialXAngleRad, m_fInitialYAngleRad );
+ }
+ }
+ }
+}
+DragMethod_RotateDiagram::~DragMethod_RotateDiagram()
+{
+}
+void DragMethod_RotateDiagram::TakeSdrDragComment(String& /*rStr*/) const
+{
+}
+bool DragMethod_RotateDiagram::BeginSdrDrag()
+{
+ m_aStartPos = DragStat().GetStart();
+ Show();
+ return true;
+}
+void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt)
+{
+ if( DragStat().CheckMinMoved(rPnt) )
+ {
+ Hide();
+
+ //calculate new angle
+ double fX = F_PI / 2.0 * (double)(rPnt.Y() - m_aStartPos.Y())
+ / (double)m_aReferenceRect.GetHeight();
+ double fY = F_PI * (double)(rPnt.X() - m_aStartPos.X())
+ / (double)m_aReferenceRect.GetWidth();
+
+ if( m_eRotationDirection != ROTATIONDIRECTION_Y )
+ m_fAdditionalYAngleRad = fY;
+ else
+ m_fAdditionalYAngleRad = 0.0;
+ if( m_eRotationDirection != ROTATIONDIRECTION_X )
+ m_fAdditionalXAngleRad = fX;
+ else
+ m_fAdditionalXAngleRad = 0.0;
+ m_fAdditionalZAngleRad = 0.0;
+
+ if( m_eRotationDirection == ROTATIONDIRECTION_Z )
+ {
+ m_fAdditionalXAngleRad = 0.0;
+ m_fAdditionalYAngleRad = 0.0;
+
+ double fCx = m_aReferenceRect.Center().X();
+ double fCy = m_aReferenceRect.Center().Y();
+
+ m_fAdditionalZAngleRad = atan((double)(fCx - m_aStartPos.X())/(m_aStartPos.Y()-fCy))
+ + atan((double)(fCx - rPnt.X())/(fCy-rPnt.Y()));
+ }
+
+ m_nAdditionalHorizontalAngleDegree = static_cast<sal_Int32>(m_fAdditionalXAngleRad*180.0/F_PI);
+ m_nAdditionalVerticalAngleDegree = -static_cast<sal_Int32>(m_fAdditionalYAngleRad*180.0/F_PI);
+
+ DragStat().NextMove(rPnt);
+ Show();
+ }
+}
+bool DragMethod_RotateDiagram::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+
+ if( m_bRightAngledAxes || m_eRotationDirection==ROTATIONDIRECTION_Z )
+ {
+ double fResultX = m_fInitialXAngleRad + m_fAdditionalXAngleRad;
+ double fResultY = m_fInitialYAngleRad + m_fAdditionalYAngleRad;
+ double fResultZ = m_fInitialZAngleRad + m_fAdditionalZAngleRad;
+
+ if(m_bRightAngledAxes)
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( fResultX, fResultY );
+
+ ThreeDHelper::setRotationAngleToDiagram( uno::Reference< beans::XPropertySet >( ChartModelHelper::findDiagram( this->getChartModel() ), uno::UNO_QUERY )
+ , fResultX, fResultY, fResultZ );
+ }
+ else
+ {
+ ThreeDHelper::setRotationToDiagram( ( uno::Reference< beans::XPropertySet >( ChartModelHelper::findDiagram( this->getChartModel() ), uno::UNO_QUERY ) )
+ , m_nInitialHorizontalAngleDegree+m_nAdditionalHorizontalAngleDegree, m_nInitialVerticalAngleDegree+m_nAdditionalVerticalAngleDegree );
+ }
+
+ return true;
+}
+void DragMethod_RotateDiagram::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager)
+{
+ ::basegfx::B3DHomMatrix aCurrentTransform;
+ aCurrentTransform.translate( -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0 );
+
+ double fResultX = m_fInitialXAngleRad + m_fAdditionalXAngleRad;
+ double fResultY = m_fInitialYAngleRad + m_fAdditionalYAngleRad;
+ double fResultZ = m_fInitialZAngleRad + m_fAdditionalZAngleRad;
+
+ if(!m_bRightAngledAxes)
+ {
+ if( m_eRotationDirection!=ROTATIONDIRECTION_Z )
+ {
+ ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
+ m_nInitialHorizontalAngleDegree+m_nAdditionalHorizontalAngleDegree, -(m_nInitialVerticalAngleDegree+m_nAdditionalVerticalAngleDegree)
+ , fResultX, fResultY, fResultZ );
+ }
+ aCurrentTransform.rotate( fResultX, fResultY, fResultZ );
+ }
+ else
+ {
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( fResultX, fResultY );
+ aCurrentTransform.shearXY(fResultY,-(fResultX));
+ }
+
+ if(m_aWireframePolyPolygon.count() && m_pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(m_pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
+ const basegfx::B3DHomMatrix aTransform(aWorldToView * aCurrentTransform);
+
+ // transform to relative scene coordinates
+ basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(m_aWireframePolyPolygon, aTransform));
+
+ // transform to 2D view coordinates
+ aPolyPolygon.transform(rVCScene.getObjectTransformation());
+
+ sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon);
+ rOverlayManager.add(*pNew);
+ addToOverlayObjectList(*pNew);
+ }
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.hxx b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
new file mode 100644
index 000000000000..b16e12fe5359
--- /dev/null
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DRAGMETHOD_ROTATEDIAGRAM_HXX
+#define CHART2_DRAGMETHOD_ROTATEDIAGRAM_HXX
+
+#include "DragMethod_Base.hxx"
+
+// header for class ::basegfx::B3DPolyPolygon
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+
+namespace chart
+{
+
+class DragMethod_RotateDiagram : public DragMethod_Base
+{
+public:
+ enum RotationDirection
+ {
+ ROTATIONDIRECTION_FREE,
+ ROTATIONDIRECTION_X,
+ ROTATIONDIRECTION_Y,
+ ROTATIONDIRECTION_Z
+ };
+
+ DragMethod_RotateDiagram( DrawViewWrapper& rDrawViewWrapper
+ , const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel
+ , RotationDirection eRotationDirection
+ );
+ virtual ~DragMethod_RotateDiagram();
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+
+ virtual void CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager);
+
+private:
+ E3dScene* m_pScene;
+
+ Rectangle m_aReferenceRect;
+ Point m_aStartPos;
+ basegfx::B3DPolyPolygon m_aWireframePolyPolygon;
+
+ double m_fInitialXAngleRad;
+ double m_fInitialYAngleRad;
+ double m_fInitialZAngleRad;
+
+ double m_fAdditionalXAngleRad;
+ double m_fAdditionalYAngleRad;
+ double m_fAdditionalZAngleRad;
+
+ sal_Int32 m_nInitialHorizontalAngleDegree;
+ sal_Int32 m_nInitialVerticalAngleDegree;
+
+ sal_Int32 m_nAdditionalHorizontalAngleDegree;
+ sal_Int32 m_nAdditionalVerticalAngleDegree;
+
+ RotationDirection m_eRotationDirection;
+ sal_Bool m_bRightAngledAxes;
+};
+
+} // namespace chart
+
+// CHART2_DRAGMETHOD_ROTATEDIAGRAM_HXX
+#endif
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
new file mode 100644
index 000000000000..aa28028c4861
--- /dev/null
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -0,0 +1,674 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DrawCommandDispatch.hxx"
+#include "DrawCommandDispatch.hrc"
+#include "ChartController.hxx"
+#include "DrawViewWrapper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "macros.hxx"
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/gallery.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xtable.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+
+//.............................................................................
+namespace
+{
+//.............................................................................
+
+ // comparing two PropertyValue instances
+ struct PropertyValueCompare : public ::std::binary_function< beans::PropertyValue, ::rtl::OUString, bool >
+ {
+ bool operator() ( const beans::PropertyValue& rPropValue, const ::rtl::OUString& rName ) const
+ {
+ return rPropValue.Name.equals( rName );
+ }
+ bool operator() ( const ::rtl::OUString& rName, const beans::PropertyValue& rPropValue ) const
+ {
+ return rName.equals( rPropValue.Name );
+ }
+ };
+
+//.............................................................................
+} // anonymous namespace
+//.............................................................................
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+DrawCommandDispatch::DrawCommandDispatch( const Reference< uno::XComponentContext >& rxContext,
+ ChartController* pController )
+ :FeatureCommandDispatchBase( rxContext )
+ ,m_pChartController( pController )
+{
+}
+
+DrawCommandDispatch::~DrawCommandDispatch()
+{
+}
+
+void DrawCommandDispatch::initialize()
+{
+ FeatureCommandDispatchBase::initialize();
+}
+
+bool DrawCommandDispatch::isFeatureSupported( const ::rtl::OUString& rCommandURL )
+{
+ sal_uInt16 nFeatureId = 0;
+ ::rtl::OUString aBaseCommand;
+ ::rtl::OUString aCustomShapeType;
+ return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
+}
+
+::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel& rModel )
+{
+ ::basegfx::B2DPolyPolygon aReturn;
+ XLineEndList* pLineEndList = rModel.GetLineEndList();
+ if ( pLineEndList )
+ {
+ String aName( SVX_RES( nResId ) );
+ long nCount = pLineEndList->Count();
+ for ( long nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nIndex );
+ if ( pEntry->GetName() == aName )
+ {
+ aReturn = pEntry->GetLineEnd();
+ break;
+ }
+ }
+ }
+ return aReturn;
+}
+
+void DrawCommandDispatch::setAttributes( SdrObject* pObj )
+{
+ if ( m_pChartController )
+ {
+ DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CUSTOMSHAPE )
+ {
+ sal_Bool bAttributesAppliedFromGallery = sal_False;
+ if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
+ {
+ ::std::vector< ::rtl::OUString > aObjList;
+ if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
+ {
+ for ( sal_uInt16 i = 0; i < aObjList.size(); ++i )
+ {
+ if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) )
+ {
+ FmFormModel aModel;
+ SfxItemPool& rPool = aModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) )
+ {
+ const SdrObject* pSourceObj = aModel.GetPage( 0 )->GetObj( 0 );
+ if ( pSourceObj )
+ {
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+ // end
+ 0, 0);
+ aDest.Set( rSource );
+ pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
+ }
+ bAttributesAppliedFromGallery = sal_True;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bAttributesAppliedFromGallery )
+ {
+ pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, 0 ) );
+ pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ ( dynamic_cast< SdrObjCustomShape* >( pObj ) )->MergeDefaultAttributes( &m_aCustomShapeType );
+ }
+ }
+ }
+}
+
+void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
+{
+ if ( m_nFeatureId == COMMAND_ID_LINE_ARROW_END && m_pChartController )
+ {
+ DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawModelWrapper && pDrawViewWrapper )
+ {
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDrawModelWrapper->getSdrModel() ) );
+ if ( !aArrow.count() )
+ {
+ ::basegfx::B2DPolygon aNewArrow;
+ aNewArrow.append( ::basegfx::B2DPoint( 10.0, 0.0 ) );
+ aNewArrow.append( ::basegfx::B2DPoint( 0.0, 30.0) );
+ aNewArrow.append( ::basegfx::B2DPoint( 20.0, 30.0 ) );
+ aNewArrow.setClosed( true );
+ aArrow.append( aNewArrow );
+ }
+
+ SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() );
+ pDrawViewWrapper->GetAttributes( aSet );
+
+ long nWidth = 300; // (1/100th mm)
+ if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ long nValue = ( ( const XLineWidthItem& ) aSet.Get( XATTR_LINEWIDTH ) ).GetValue();
+ if ( nValue > 0 )
+ {
+ nWidth = nValue * 3;
+ }
+ }
+
+ rAttr.Put( XLineEndItem( SVX_RESSTR( RID_SVXSTR_ARROW ), aArrow ) );
+ rAttr.Put( XLineEndWidthItem( nWidth ) );
+ }
+ }
+}
+
+// WeakComponentImplHelperBase
+void DrawCommandDispatch::disposing()
+{
+}
+
+// XEventListener
+void DrawCommandDispatch::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+}
+
+FeatureState DrawCommandDispatch::getState( const ::rtl::OUString& rCommand )
+{
+ FeatureState aReturn;
+ aReturn.bEnabled = false;
+ aReturn.aState <<= false;
+
+ sal_uInt16 nFeatureId = 0;
+ ::rtl::OUString aBaseCommand;
+ ::rtl::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:
+ {
+ aReturn.bEnabled = true;
+ aReturn.aState <<= false;
+ }
+ break;
+ default:
+ {
+ aReturn.bEnabled = false;
+ aReturn.aState <<= false;
+ }
+ break;
+ }
+ }
+
+ return aReturn;
+}
+
+void DrawCommandDispatch::execute( const ::rtl::OUString& rCommand, const Sequence< beans::PropertyValue>& rArgs )
+{
+ (void)rArgs;
+
+ ChartDrawMode eDrawMode = CHARTDRAW_SELECT;
+ SdrObjKind eKind = OBJ_NONE;
+ bool bCreate = false;
+
+ sal_uInt16 nFeatureId = 0;
+ ::rtl::OUString aBaseCommand;
+ ::rtl::OUString aCustomShapeType;
+ if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
+ {
+ m_nFeatureId = nFeatureId;
+ m_aCustomShapeType = aCustomShapeType;
+
+ switch ( nFeatureId )
+ {
+ case COMMAND_ID_OBJECT_SELECT:
+ {
+ eDrawMode = CHARTDRAW_SELECT;
+ eKind = OBJ_NONE;
+ }
+ break;
+ case COMMAND_ID_DRAW_LINE:
+ case COMMAND_ID_LINE_ARROW_END:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_LINE;
+ }
+ break;
+ case COMMAND_ID_DRAW_RECT:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_RECT;
+ }
+ break;
+ case COMMAND_ID_DRAW_ELLIPSE:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_CIRC;
+ }
+ break;
+ case COMMAND_ID_DRAW_FREELINE_NOFILL:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_FREELINE;
+ }
+ break;
+ case COMMAND_ID_DRAW_TEXT:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_TEXT;
+ bCreate = true;
+ }
+ break;
+ case COMMAND_ID_DRAW_CAPTION:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_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:
+ {
+ eDrawMode = CHARTDRAW_INSERT;
+ eKind = OBJ_CUSTOMSHAPE;
+ }
+ break;
+ default:
+ {
+ eDrawMode = CHARTDRAW_SELECT;
+ eKind = OBJ_NONE;
+ }
+ break;
+ }
+
+ if ( m_pChartController )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_pChartController->setDrawMode( eDrawMode );
+ setInsertObj( sal::static_int_cast< USHORT >( eKind ) );
+ if ( bCreate )
+ {
+ pDrawViewWrapper->SetCreateMode();
+ }
+
+ const ::rtl::OUString sKeyModifier( C2U( "KeyModifier" ) );
+ const beans::PropertyValue* pIter = rArgs.getConstArray();
+ const beans::PropertyValue* pEnd = pIter + rArgs.getLength();
+ const beans::PropertyValue* pKeyModifier = ::std::find_if(
+ pIter, pEnd, ::std::bind2nd( PropertyValueCompare(), boost::cref( sKeyModifier ) ) );
+ sal_Int16 nKeyModifier = 0;
+ if ( pKeyModifier && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1 )
+ {
+ if ( eDrawMode == CHARTDRAW_INSERT )
+ {
+ SdrObject* pObj = createDefaultObject( nFeatureId );
+ if ( pObj )
+ {
+ SdrPageView* pPageView = pDrawViewWrapper->GetSdrPageView();
+ pDrawViewWrapper->InsertObjectAtView( pObj, *pPageView );
+ Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
+ if ( xShape.is() )
+ {
+ m_pChartController->m_aSelection.setSelection( xShape );
+ m_pChartController->m_aSelection.applySelection( pDrawViewWrapper );
+ }
+ if ( nFeatureId == SID_DRAW_TEXT )
+ {
+ m_pChartController->StartTextEdit();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+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 );
+}
+
+void DrawCommandDispatch::setInsertObj( USHORT eObj )
+{
+ DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
+ if ( pDrawViewWrapper )
+ {
+ pDrawViewWrapper->SetCurrentObj( eObj /*, Inventor */);
+ }
+}
+
+SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
+{
+ SdrObject* pObj = NULL;
+ DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
+ DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : NULL );
+
+ if ( pDrawViewWrapper && pDrawModelWrapper )
+ {
+ Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
+ SdrPage* pPage = GetSdrPageFromXDrawPage( xDrawPage );
+ if ( pPage )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ pObj = SdrObjFactory::MakeNewObject( pDrawViewWrapper->GetCurrentObjInventor(),
+ pDrawViewWrapper->GetCurrentObjIdentifier(), pPage );
+ if ( pObj )
+ {
+ long nDefaultObjectSizeWidth = 4000;
+ long nDefaultObjectSizeHeight = 2500;
+ Size aObjectSize( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight );
+ Rectangle aPageRect( Rectangle( Point( 0, 0 ), pPage->GetSize() ) );
+ Point aObjectPos = aPageRect.Center();
+ aObjectPos.X() -= aObjectSize.Width() / 2;
+ aObjectPos.Y() -= aObjectSize.Height() / 2;
+ Rectangle aRect( aObjectPos, aObjectSize );
+
+ switch ( nID )
+ {
+ case COMMAND_ID_DRAW_LINE:
+ case COMMAND_ID_LINE_ARROW_END:
+ {
+ if ( pObj->ISA( SdrPathObj ) )
+ {
+ Point aStart = aRect.TopLeft();
+ Point aEnd = aRect.BottomRight();
+ sal_Int32 nYMiddle( ( aRect.Top() + aRect.Bottom() ) / 2 );
+ basegfx::B2DPolygon aPoly;
+ aPoly.append( basegfx::B2DPoint( aStart.X(), nYMiddle ) );
+ aPoly.append( basegfx::B2DPoint( aEnd.X(), nYMiddle ) );
+ ( dynamic_cast< SdrPathObj* >( pObj ) )->SetPathPoly( basegfx::B2DPolyPolygon( aPoly ) );
+ SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
+ setLineEnds( aSet );
+ pObj->SetMergedItemSet( aSet );
+ }
+ }
+ break;
+ case COMMAND_ID_DRAW_FREELINE_NOFILL:
+ {
+ if ( pObj->ISA( SdrPathObj ) )
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ aInnerPoly.append( basegfx::B2DPoint( aRect.Left(), aRect.Bottom() ) );
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint( aRect.Left(), aRect.Top() ),
+ basegfx::B2DPoint( aRect.Center().X(), aRect.Top() ),
+ basegfx::B2DPoint( aRect.Center().X(), aRect.Center().Y() ) );
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint( aRect.Center().X(), aRect.Bottom() ),
+ basegfx::B2DPoint( aRect.Right(), aRect.Bottom() ),
+ basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
+ basegfx::B2DPolyPolygon aPoly;
+ aPoly.append( aInnerPoly );
+ ( dynamic_cast< SdrPathObj* >( pObj ) )->SetPathPoly( aPoly );
+ }
+ }
+ break;
+ case COMMAND_ID_DRAW_TEXT:
+ case COMMAND_ID_DRAW_TEXT_VERTICAL:
+ {
+ if ( pObj->ISA( SdrTextObj ) )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if ( pTextObj )
+ {
+ pTextObj->SetLogicRect( aRect );
+ BOOL bVertical = ( nID == SID_DRAW_TEXT_VERTICAL );
+ pTextObj->SetVerticalWriting( bVertical );
+ if ( bVertical )
+ {
+ SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
+ aSet.Put( SdrTextAutoGrowWidthItem( TRUE ) );
+ aSet.Put( SdrTextAutoGrowHeightItem( FALSE ) );
+ aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_TOP ) );
+ aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) );
+ pTextObj->SetMergedItemSet( aSet );
+ }
+ }
+ }
+ }
+ break;
+ case COMMAND_ID_DRAW_CAPTION:
+ case COMMAND_ID_DRAW_CAPTION_VERTICAL:
+ {
+ if ( pObj->ISA( SdrCaptionObj ) )
+ {
+ sal_Bool bIsVertical( SID_DRAW_CAPTION_VERTICAL == nID );
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
+ if ( pTextObj )
+ {
+ pTextObj->SetVerticalWriting( bIsVertical );
+ }
+ if ( bIsVertical )
+ {
+ SfxItemSet aSet( pObj->GetMergedItemSet() );
+ aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) );
+ pObj->SetMergedItemSet( aSet );
+ }
+ SdrCaptionObj* pCaptionObj = dynamic_cast< SdrCaptionObj* >( pObj );
+ if ( pCaptionObj )
+ {
+ pCaptionObj->SetLogicRect( aRect );
+ pCaptionObj->SetTailPos(
+ aRect.TopLeft() - Point( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ) );
+ }
+ }
+ }
+ break;
+ default:
+ {
+ pObj->SetLogicRect( aRect );
+ SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
+ setAttributes( pObj );
+ pObj->SetMergedItemSet( aSet );
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return pObj;
+}
+
+bool DrawCommandDispatch::parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId,
+ ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType )
+{
+ bool bFound = true;
+ sal_uInt16 nFeatureId = 0;
+ ::rtl::OUString aBaseCommand;
+ ::rtl::OUString aType;
+
+ sal_Int32 nIndex = 1;
+ ::rtl::OUString aToken = rCommandURL.getToken( 0, '.', nIndex );
+ if ( nIndex == -1 || !aToken.getLength() )
+ {
+ aBaseCommand = rCommandURL;
+ SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand );
+ if ( aIter != m_aSupportedFeatures.end() )
+ {
+ nFeatureId = aIter->second.nFeatureId;
+
+ switch ( nFeatureId )
+ {
+ case COMMAND_ID_DRAWTBX_CS_BASIC:
+ {
+ aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "diamond" ) );
+ }
+ break;
+ case COMMAND_ID_DRAWTBX_CS_SYMBOL:
+ {
+ aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "smiley" ) );
+ }
+ break;
+ case COMMAND_ID_DRAWTBX_CS_ARROW:
+ {
+ aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "left-right-arrow" ) );
+ }
+ break;
+ case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
+ {
+ aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flowchart-internal-storage" ) );
+ }
+ break;
+ case COMMAND_ID_DRAWTBX_CS_CALLOUT:
+ {
+ aType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "round-rectangular-callout" ) );
+ }
+ break;
+ case COMMAND_ID_DRAWTBX_CS_STAR:
+ {
+ aType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "star5" ) );
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+ else
+ {
+ bFound = false;
+ }
+ }
+ else
+ {
+ aBaseCommand = rCommandURL.copy( 0, nIndex - 1 );
+ SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand );
+ if ( aIter != m_aSupportedFeatures.end() )
+ {
+ nFeatureId = aIter->second.nFeatureId;
+ aType = rCommandURL.getToken( 0, '.', nIndex );
+ }
+ else
+ {
+ bFound = false;
+ }
+ }
+
+ *pnFeatureId = nFeatureId;
+ *pBaseCommand = aBaseCommand;
+ *pCustomShapeType = aType;
+
+ return bFound;
+}
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/DrawCommandDispatch.hrc b/chart2/source/controller/main/DrawCommandDispatch.hrc
new file mode 100644
index 000000000000..4e31fafaaf63
--- /dev/null
+++ b/chart2/source/controller/main/DrawCommandDispatch.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#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
+
+// CHART_DRAWCOMMANDDISPATCH_HRC
+#endif
diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx
new file mode 100644
index 000000000000..38c886e29abb
--- /dev/null
+++ b/chart2/source/controller/main/DrawCommandDispatch.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DRAWCOMMANDDISPATCH_HXX
+#define CHART2_DRAWCOMMANDDISPATCH_HXX
+
+#include "FeatureCommandDispatchBase.hxx"
+
+#include <tools/solar.h>
+
+class SfxItemSet;
+class SdrObject;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ChartController;
+
+/** This is a CommandDispatch implementation for drawing objects.
+ */
+class DrawCommandDispatch: public FeatureCommandDispatchBase
+{
+public:
+ DrawCommandDispatch( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rxContext, ChartController* pController );
+ virtual ~DrawCommandDispatch();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+ virtual bool isFeatureSupported( const ::rtl::OUString& rCommandURL );
+
+ void setAttributes( SdrObject* pObj );
+ void setLineEnds( SfxItemSet& rAttr );
+
+protected:
+ // WeakComponentImplHelperBase
+ virtual void SAL_CALL disposing();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // state of a feature
+ virtual FeatureState getState( const ::rtl::OUString& rCommand );
+
+ // execute a feature
+ virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs );
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures();
+
+private:
+ void setInsertObj( USHORT eObj );
+ SdrObject* createDefaultObject( const sal_uInt16 nID );
+
+ bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType );
+
+ ChartController* m_pChartController;
+ ::rtl::OUString m_aCustomShapeType;
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+// CHART2_DRAWCOMMANDDISPATCH_HXX
+#endif
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
new file mode 100644
index 000000000000..3b41fd1b6b66
--- /dev/null
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ElementSelector.hxx"
+#include "macros.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ObjectHierarchy.hxx"
+#include "servicenames.hxx"
+#include <chartview/ExplicitValueProvider.hxx>
+#include "DrawViewWrapper.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/frame/XControlNotificationListener.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+namespace chart
+{
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ElementSelectorToolbarController" ));
+}
+
+//------------------------------------------------------------------------------
+
+SelectorListBox::SelectorListBox( Window* pParent, WinBits nStyle )
+ : ListBox( pParent, nStyle )
+ , m_bReleaseFocus( true )
+{
+}
+
+SelectorListBox::~SelectorListBox()
+{
+}
+
+void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tOID & rParent, std::vector< ListBoxEntryData >& rEntries
+ , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
+ ObjectHierarchy::tChildContainer::const_iterator aIt( aChildren.begin());
+ while( aIt != aChildren.end() )
+ {
+ ObjectHierarchy::tOID aOID = *aIt;
+ ::rtl::OUString aCID = aOID.getObjectCID();
+ ListBoxEntryData aEntry;
+ aEntry.OID = aOID;
+ aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc );
+ aEntry.nHierarchyDepth = nHierarchyDepth;
+ rEntries.push_back(aEntry);
+ lcl_addObjectsToList( rHierarchy, aOID, rEntries, nHierarchyDepth+1, xChartDoc );
+ ++aIt;
+ }
+}
+
+void SelectorListBox::SetChartController( const Reference< frame::XController >& xChartController )
+{
+ m_xChartController = xChartController;
+}
+
+void SelectorListBox::UpdateChartElementsListAndSelection()
+{
+ Clear();
+ m_aEntries.clear();
+
+ Reference< frame::XController > xChartController( m_xChartController );
+ if( xChartController.is() )
+ {
+ Reference< view::XSelectionSupplier > xSelectionSupplier( xChartController, uno::UNO_QUERY);
+ ObjectHierarchy::tOID aSelectedOID;
+ rtl::OUString aSelectedCID;
+ if( xSelectionSupplier.is() )
+ {
+ aSelectedOID = ObjectIdentifier( xSelectionSupplier->getSelection() );
+ aSelectedCID = aSelectedOID.getObjectCID();
+ }
+
+ Reference< chart2::XChartDocument > xChartDoc( xChartController->getModel(), uno::UNO_QUERY );
+ 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 );
+ if( xFact.is() )
+ xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
+ ExplicitValueProvider* pExplicitValueProvider = 0;//ExplicitValueProvider::getExplicitValueProvider(xChartView); dies erzeugt alle sichtbaren datenpinkte, das ist zu viel
+ ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
+ lcl_addObjectsToList( aHierarchy, aHierarchy.getRootNodeOID(), m_aEntries, 0, xChartDoc );
+
+ std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() );
+ if( bAddSelectionToList )
+ {
+ if ( aSelectedOID.isAutoGeneratedObject() )
+ {
+ rtl::OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
+ for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
+ {
+ if( aIt->OID.getObjectCID().match( aSeriesCID ) )
+ {
+ ListBoxEntryData aEntry;
+ aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
+ aEntry.OID = aSelectedOID;
+ ++aIt;
+ if( aIt != m_aEntries.end() )
+ m_aEntries.insert(aIt, aEntry);
+ else
+ m_aEntries.push_back( aEntry );
+ break;
+ }
+ }
+ }
+ else if ( aSelectedOID.isAdditionalShape() )
+ {
+ ListBoxEntryData aEntry;
+ SdrObject* pSelectedObj = DrawViewWrapper::getSdrObject( aSelectedOID.getAdditionalShape() );
+ ::rtl::OUString aName( pSelectedObj ? pSelectedObj->GetName() : String() );
+ aEntry.UIName = ( aName.getLength() > 0 ? aName : ::rtl::OUString( String( SchResId( STR_OBJECT_SHAPE ) ) ) );
+ aEntry.OID = aSelectedOID;
+ m_aEntries.push_back( aEntry );
+ }
+ }
+
+ USHORT nEntryPosToSelect = 0; bool bSelectionFound = false;
+ aIt = m_aEntries.begin();
+ for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN )
+ {
+ InsertEntry( aIt->UIName );
+ if ( !bSelectionFound && aSelectedOID == aIt->OID )
+ {
+ nEntryPosToSelect = nN;
+ bSelectionFound = true;
+ }
+ }
+
+ if( bSelectionFound )
+ SelectEntryPos(nEntryPosToSelect);
+
+ USHORT nEntryCount = GetEntryCount();
+ if( nEntryCount > 100 )
+ nEntryCount = 100;
+ SetDropDownLineCount( nEntryCount );
+ }
+ SaveValue();//remind current selection pos
+}
+
+void SelectorListBox::ReleaseFocus_Impl()
+{
+ if ( !m_bReleaseFocus )
+ {
+ m_bReleaseFocus = true;
+ return;
+ }
+
+ Reference< frame::XController > xController( m_xChartController );
+ Reference< frame::XFrame > xFrame( xController->getFrame() );
+ if ( xFrame.is() && xFrame->getContainerWindow().is() )
+ xFrame->getContainerWindow()->setFocus();
+}
+
+void SelectorListBox::Select()
+{
+ ListBox::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ USHORT nPos = GetSelectEntryPos();
+ if( nPos < m_aEntries.size() )
+ {
+ ObjectHierarchy::tOID aOID = m_aEntries[nPos].OID;
+ Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY );
+ if( xSelectionSupplier.is() )
+ xSelectionSupplier->select( aOID.getAny() );
+ }
+ ReleaseFocus_Impl();
+ }
+}
+
+long SelectorListBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ m_bReleaseFocus = false;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SelectEntryPos( GetSavedValue() ); //restore saved selection
+ ReleaseFocus_Impl();
+ break;
+ }
+ }
+ else if ( EVENT_LOSEFOCUS == rNEvt.GetType() )
+ {
+ if ( !HasFocus() )
+ SelectEntryPos( GetSavedValue() );
+ }
+
+ return nHandled ? nHandled : ListBox::Notify( rNEvt );
+}
+
+Reference< ::com::sun::star::accessibility::XAccessible > SelectorListBox::CreateAccessible()
+{
+ UpdateChartElementsListAndSelection();
+ return ListBox::CreateAccessible();
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ElementSelectorToolbarController, lcl_aServiceName );
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > ElementSelectorToolbarController::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices(1);
+ aServices[ 0 ] = C2U( "com.sun.star.frame.ToolbarController" );
+ return aServices;
+}
+// -----------------------------------------------------------------------------
+ElementSelectorToolbarController::ElementSelectorToolbarController( const uno::Reference< uno::XComponentContext > & xContext )
+ : m_xCC( xContext )
+{
+}
+// -----------------------------------------------------------------------------
+ElementSelectorToolbarController::~ElementSelectorToolbarController()
+{
+}
+// -----------------------------------------------------------------------------
+// XInterface
+Any SAL_CALL ElementSelectorToolbarController::queryInterface( const Type& _rType ) throw (RuntimeException)
+{
+ Any aReturn = ToolboxController::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ElementSelectorToolbarController_BASE::queryInterface(_rType);
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::release() throw ()
+{
+ ToolboxController::release();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::initialize( const Sequence< Any >& rArguments ) throw (Exception, RuntimeException)
+{
+ ToolboxController::initialize(rArguments);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException )
+{
+ if( m_apSelectorListBox.get() )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if( rEvent.FeatureURL.Path.equalsAscii( "ChartElementSelector" ) )
+ {
+ Reference< frame::XController > xChartController;
+ rEvent.State >>= xChartController;
+ m_apSelectorListBox->SetChartController( xChartController );
+ m_apSelectorListBox->UpdateChartElementsListAndSelection();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::createItemWindow( const uno::Reference< awt::XWindow >& xParent )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< awt::XWindow > xItemWindow;
+ if( !m_apSelectorListBox.get() )
+ {
+ Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ if( pParent )
+ {
+ m_apSelectorListBox = ::std::auto_ptr< SelectorListBox >( new SelectorListBox( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) );
+ ::Size aLogicalSize( 95, 160 );
+ ::Size aPixelSize = m_apSelectorListBox->LogicToPixel( aLogicalSize, MAP_APPFONT );
+ m_apSelectorListBox->SetSizePixel( aPixelSize );
+ m_apSelectorListBox->SetDropDownLineCount( 5 );
+ }
+ }
+ if( m_apSelectorListBox.get() )
+ xItemWindow = VCLUnoHelper::GetInterface( m_apSelectorListBox.get() );
+ return xItemWindow;
+}
+
+//..........................................................................
+} // chart2
+//..........................................................................
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
new file mode 100644
index 000000000000..d85415d614e2
--- /dev/null
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_ELEMENTSELECTOR_HXX
+#define _CHART_ELEMENTSELECTOR_HXX
+
+#include "ServiceMacros.hxx"
+#include "ObjectHierarchy.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <svtools/toolboxcontroller.hxx>
+
+#include <vcl/lstbox.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+struct ListBoxEntryData
+{
+ rtl::OUString UIName;
+ ObjectHierarchy::tOID OID;
+ sal_Int32 nHierarchyDepth;
+
+ ListBoxEntryData() : nHierarchyDepth(0)
+ {
+ }
+};
+
+class SelectorListBox : public ListBox
+{
+ public:
+ SelectorListBox( Window* pParent, WinBits nStyle );
+ virtual ~SelectorListBox();
+
+ virtual void Select();
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ void ReleaseFocus_Impl();
+
+ void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
+ void UpdateChartElementsListAndSelection();
+
+ private:
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XController > m_xChartController;
+
+ ::std::vector< ListBoxEntryData > m_aEntries;
+
+ bool m_bReleaseFocus;
+};
+
+// ------------------------------------------------------------------
+// ------------------------------------------------------------------
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
+
+class ElementSelectorToolbarController : public ::svt::ToolboxController
+ , ElementSelectorToolbarController_BASE
+{
+public:
+ ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~ElementSelectorToolbarController();
+
+ // XServiceInfo
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController)
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ // XToolbarController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //no default constructor
+ ElementSelectorToolbarController(){}
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
+ ::std::auto_ptr< SelectorListBox > m_apSelectorListBox;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx
new file mode 100644
index 000000000000..39b4e1d4a171
--- /dev/null
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "FeatureCommandDispatchBase.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace chart
+{
+
+FeatureCommandDispatchBase::FeatureCommandDispatchBase( const Reference< uno::XComponentContext >& rxContext )
+ :CommandDispatch( rxContext )
+ ,m_nFeatureId( 0 )
+{
+}
+
+FeatureCommandDispatchBase::~FeatureCommandDispatchBase()
+{
+}
+
+void FeatureCommandDispatchBase::initialize()
+{
+ CommandDispatch::initialize();
+ fillSupportedFeatures();
+}
+
+bool FeatureCommandDispatchBase::isFeatureSupported( const ::rtl::OUString& rCommandURL )
+{
+ SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommandURL );
+ if ( aIter != m_aSupportedFeatures.end() )
+ {
+ return true;
+ }
+ return false;
+}
+
+void FeatureCommandDispatchBase::fireStatusEvent( const ::rtl::OUString& rURL,
+ const Reference< frame::XStatusListener >& xSingleListener /* = 0 */ )
+{
+ if ( rURL.getLength() == 0 )
+ {
+ SupportedFeatures::const_iterator aEnd( m_aSupportedFeatures.end() );
+ for ( SupportedFeatures::const_iterator aIter( m_aSupportedFeatures.begin() ); aIter != aEnd; ++aIter )
+ {
+ FeatureState aFeatureState( getState( aIter->first ) );
+ fireStatusEventForURL( aIter->first, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
+ }
+ }
+ else
+ {
+ FeatureState aFeatureState( getState( rURL ) );
+ fireStatusEventForURL( rURL, aFeatureState.aState, aFeatureState.bEnabled, xSingleListener );
+ }
+}
+
+// XDispatch
+void FeatureCommandDispatchBase::dispatch( const util::URL& URL,
+ const Sequence< beans::PropertyValue >& Arguments )
+ throw (uno::RuntimeException)
+{
+ ::rtl::OUString aCommand( URL.Complete );
+ if ( getState( aCommand ).bEnabled )
+ {
+ execute( aCommand, Arguments );
+ }
+}
+
+void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL,
+ sal_uInt16 nId, sal_Int16 nGroup )
+{
+ ControllerFeature aFeature;
+ aFeature.Command = ::rtl::OUString::createFromAscii( pAsciiCommandURL );
+ aFeature.nFeatureId = nId;
+ aFeature.GroupId = nGroup;
+
+ m_aSupportedFeatures[ aFeature.Command ] = aFeature;
+}
+
+void FeatureCommandDispatchBase::fillSupportedFeatures()
+{
+ describeSupportedFeatures();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
new file mode 100644
index 000000000000..b3e2a568d3b9
--- /dev/null
+++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_FEATURECOMMANDDISPATCHBASE_HXX
+#define CHART2_FEATURECOMMANDDISPATCHBASE_HXX
+
+#include "CommandDispatch.hxx"
+
+#include <com/sun/star/frame/CommandGroup.hpp>
+#include <com/sun/star/frame/DispatchInformation.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+namespace chart
+{
+
+struct ControllerFeature: public ::com::sun::star::frame::DispatchInformation
+{
+ sal_uInt16 nFeatureId;
+};
+
+typedef ::std::map< ::rtl::OUString,
+ ControllerFeature,
+ ::std::less< ::rtl::OUString > > SupportedFeatures;
+
+struct FeatureState
+{
+ bool bEnabled;
+ ::com::sun::star::uno::Any aState;
+
+ FeatureState() : bEnabled( false ) { }
+};
+
+/** This is a base class for CommandDispatch implementations with feature support.
+ */
+class FeatureCommandDispatchBase: public CommandDispatch
+{
+public:
+ FeatureCommandDispatchBase( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rxContext );
+ virtual ~FeatureCommandDispatchBase();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+ virtual bool isFeatureSupported( const ::rtl::OUString& rCommandURL );
+
+protected:
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void fireStatusEvent( const ::rtl::OUString& rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xSingleListener );
+
+ // state of a feature
+ virtual FeatureState getState( const ::rtl::OUString& rCommand ) = 0;
+
+ // execute a feature
+ virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ) = 0;
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures() = 0;
+
+ /** describes a feature supported by the controller
+
+ Must not be called outside <member>describeSupportedFeatures</member>.
+
+ @param pAsciiCommandURL
+ the URL of the feature command
+ @param nId
+ the id of the feature. Later references to this feature usually happen by id, not by
+ URL.
+ @param nGroup
+ the command group of the feature. This is important for configuring the controller UI
+ by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>.
+ */
+ void implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL, sal_uInt16 nId,
+ sal_Int16 nGroup = ::com::sun::star::frame::CommandGroup::INTERNAL );
+
+ mutable SupportedFeatures m_aSupportedFeatures;
+
+ sal_uInt16 m_nFeatureId;
+
+private:
+ void fillSupportedFeatures();
+};
+
+} // namespace chart
+
+// CHART2_FEATURECOMMANDDISPATCHBASE_HXX
+#endif
diff --git a/chart2/source/controller/main/ImplUndoManager.cxx b/chart2/source/controller/main/ImplUndoManager.cxx
new file mode 100644
index 000000000000..57e8e7315334
--- /dev/null
+++ b/chart2/source/controller/main/ImplUndoManager.cxx
@@ -0,0 +1,505 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ImplUndoManager.hxx"
+#include "DisposeHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ControllerLockGuard.hxx"
+#include "PropertyHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+#include <boost/bind.hpp>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::chart::XComplexDescriptionAccess;
+
+namespace chart
+{
+namespace impl
+{
+
+void ImplApplyDataToModel(
+ Reference< frame::XModel > & xInOutModelToChange,
+ const Reference< chart2::XInternalDataProvider > & xData )
+{
+ Reference< chart2::XChartDocument > xDoc( xInOutModelToChange, uno::UNO_QUERY );
+ OSL_ASSERT( xDoc.is() && xDoc->hasInternalDataProvider());
+
+ // copy data from stored internal data provider
+ if( xDoc.is() && xDoc->hasInternalDataProvider())
+ {
+ Reference< XComplexDescriptionAccess > xCurrentData( xDoc->getDataProvider(), uno::UNO_QUERY );
+ Reference< XComplexDescriptionAccess > xSavedData( xData, uno::UNO_QUERY );
+ if( xCurrentData.is() && xSavedData.is())
+ {
+ xCurrentData->setData( xSavedData->getData());
+ xCurrentData->setComplexRowDescriptions( xSavedData->getComplexRowDescriptions());
+ xCurrentData->setComplexColumnDescriptions( xSavedData->getComplexColumnDescriptions());
+ }
+ }
+}
+
+// ----------------------------------------
+
+UndoElement::UndoElement(
+ const OUString & rActionString,
+ const Reference< frame::XModel > & xModel ) :
+ m_aActionString( rActionString )
+{
+ initialize( xModel );
+}
+
+UndoElement::UndoElement(
+ const Reference< frame::XModel > & xModel )
+{
+ initialize( xModel );
+}
+
+UndoElement::UndoElement( const UndoElement & rOther ) :
+ m_aActionString( rOther.m_aActionString )
+{
+ initialize( rOther.m_xModel );
+}
+
+UndoElement::~UndoElement()
+{}
+
+void UndoElement::initialize( const Reference< frame::XModel > & xModel )
+{
+ if ( xModel.is() )
+ {
+ m_xModel.set( UndoElement::cloneModel( xModel ) );
+ }
+}
+
+void UndoElement::dispose()
+{
+ Reference< lang::XComponent > xComp( m_xModel, uno::UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ m_xModel.set( 0 );
+}
+
+void UndoElement::applyToModel(
+ Reference< frame::XModel > & xInOutModelToChange )
+{
+ UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel );
+}
+
+UndoElement * UndoElement::createFromModel(
+ const Reference< frame::XModel > & xModel )
+{
+ return new UndoElement( getActionString(), xModel );
+}
+
+void UndoElement::setActionString( const ::rtl::OUString & rActionString )
+{
+ m_aActionString = rActionString;
+}
+
+OUString UndoElement::getActionString() const
+{
+ return m_aActionString;
+}
+
+// static
+Reference< frame::XModel > UndoElement::cloneModel( const Reference< frame::XModel > & xModel )
+{
+ Reference< frame::XModel > xResult;
+ uno::Reference< util::XCloneable > xCloneable( xModel, uno::UNO_QUERY );
+ OSL_ENSURE( xCloneable.is(), "Cannot clone model" );
+ if( xCloneable.is())
+ xResult.set( xCloneable->createClone(), uno::UNO_QUERY );
+
+ return xResult;
+}
+
+// static
+void UndoElement::applyModelContentToModel(
+ Reference< frame::XModel > & xInOutModelToChange,
+ const Reference< frame::XModel > & xModelToCopyFrom,
+ const Reference< chart2::XInternalDataProvider > & xData /* = 0 */ )
+{
+
+ if( xModelToCopyFrom.is() && xInOutModelToChange.is())
+ {
+ try
+ {
+ // /-- loccked controllers of destination
+ ControllerLockGuard aLockedControllers( xInOutModelToChange );
+ Reference< chart2::XChartDocument > xSource( xModelToCopyFrom, uno::UNO_QUERY_THROW );
+ Reference< chart2::XChartDocument > xDestination( xInOutModelToChange, uno::UNO_QUERY_THROW );
+
+ // propagate the correct flag for plotting of hidden values to the data provider and all used sequences
+ ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( xModelToCopyFrom ) , xInOutModelToChange );
+
+ // diagram
+ xDestination->setFirstDiagram( xSource->getFirstDiagram());
+
+ // main title
+ Reference< chart2::XTitled > xDestinationTitled( xDestination, uno::UNO_QUERY_THROW );
+ Reference< chart2::XTitled > xSourceTitled( xSource, uno::UNO_QUERY_THROW );
+ xDestinationTitled->setTitleObject( xSourceTitled->getTitleObject());
+
+ // page background
+ comphelper::copyProperties(
+ xSource->getPageBackground(),
+ xDestination->getPageBackground() );
+
+ // apply data (not applied in standard Undo)
+ if( xData.is())
+ ImplApplyDataToModel( xInOutModelToChange, xData );
+
+ // register all sequences at the internal data provider to get adapted
+ // indexes when columns are added/removed
+ if( xDestination->hasInternalDataProvider())
+ {
+ Reference< chart2::XInternalDataProvider > xNewDataProvider( xDestination->getDataProvider(), uno::UNO_QUERY );
+ Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xInOutModelToChange ));
+ if( xUsedData.is() && xNewDataProvider.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences());
+ for( sal_Int32 i=0; i<aData.getLength(); ++i )
+ {
+ xNewDataProvider->registerDataSequenceForChanges( aData[i]->getValues());
+ xNewDataProvider->registerDataSequenceForChanges( aData[i]->getLabel());
+ }
+ }
+ }
+
+ // restore modify status
+ Reference< util::XModifiable > xSourceMod( xSource, uno::UNO_QUERY );
+ Reference< util::XModifiable > xDestMod( xDestination, uno::UNO_QUERY );
+ if( xSourceMod.is() && xDestMod.is() &&
+ ! xSourceMod->isModified() )
+ {
+ xDestMod->setModified( sal_False );
+ }
+ // \-- loccked controllers of destination
+ }
+ catch( uno::Exception & )
+ {
+ }
+ }
+}
+
+// ----------------------------------------
+
+UndoElementWithData::UndoElementWithData(
+ const OUString & rActionString,
+ const Reference< frame::XModel > & xModel ) :
+ UndoElement( rActionString, xModel )
+{
+ initializeData();
+}
+
+UndoElementWithData::UndoElementWithData(
+ const Reference< frame::XModel > & xModel ) :
+ UndoElement( xModel )
+{
+ initializeData();
+}
+
+
+UndoElementWithData::UndoElementWithData(
+ const UndoElementWithData & rOther ) :
+ UndoElement( rOther )
+{
+ initializeData();
+}
+
+UndoElementWithData::~UndoElementWithData()
+{}
+
+void UndoElementWithData::initializeData()
+{
+ try
+ {
+ Reference< chart2::XChartDocument > xChartDoc( m_xModel, uno::UNO_QUERY_THROW );
+ OSL_ASSERT( xChartDoc->hasInternalDataProvider());
+ if( xChartDoc->hasInternalDataProvider())
+ {
+ Reference< util::XCloneable > xCloneable( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ OSL_ENSURE( xCloneable.is(), "Cannot clone data" );
+ if( xCloneable.is())
+ m_xData.set( xCloneable->createClone(), uno::UNO_QUERY );
+ }
+ }
+ catch( uno::Exception & )
+ {
+ }
+}
+
+void UndoElementWithData::dispose()
+{
+ UndoElement::dispose();
+ m_xData.set( 0 );
+}
+
+void UndoElementWithData::applyToModel(
+ Reference< frame::XModel > & xInOutModelToChange )
+{
+ UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel, m_xData );
+}
+
+UndoElement * UndoElementWithData::createFromModel(
+ const Reference< frame::XModel > & xModel )
+{
+ return new UndoElementWithData( getActionString(), xModel );
+}
+
+// ========================================
+
+// ----------------------------------------
+
+UndoElementWithSelection::UndoElementWithSelection(
+ const OUString & rActionString,
+ const Reference< frame::XModel > & xModel ) :
+ UndoElement( rActionString, xModel )
+{
+ initialize( xModel );
+}
+
+UndoElementWithSelection::UndoElementWithSelection(
+ const Reference< frame::XModel > & xModel ) :
+ UndoElement( xModel )
+{
+ initialize( xModel );
+}
+
+UndoElementWithSelection::UndoElementWithSelection(
+ const UndoElementWithSelection & rOther ) :
+ UndoElement( rOther )
+{
+ initialize( rOther.m_xModel );
+}
+
+UndoElementWithSelection::~UndoElementWithSelection()
+{}
+
+void UndoElementWithSelection::initialize( const Reference< frame::XModel > & xModel )
+{
+ try
+ {
+ uno::Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY );
+ OSL_ASSERT( xSelSupp.is() );
+
+ if( xSelSupp.is() )
+ m_aSelection = xSelSupp->getSelection();
+ }
+ catch( const uno::Exception & )
+ {
+ }
+}
+
+void UndoElementWithSelection::dispose()
+{
+ UndoElement::dispose();
+ m_aSelection.clear();
+}
+
+void UndoElementWithSelection::applyToModel(
+ Reference< frame::XModel > & xInOutModelToChange )
+{
+ UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel );
+ Reference< view::XSelectionSupplier > xCurrentSelectionSuppl( xInOutModelToChange->getCurrentController(), uno::UNO_QUERY );
+ OSL_ASSERT( xCurrentSelectionSuppl.is() );
+
+ if( xCurrentSelectionSuppl.is())
+ xCurrentSelectionSuppl->select( m_aSelection );
+}
+
+UndoElement * UndoElementWithSelection::createFromModel(
+ const Reference< frame::XModel > & xModel )
+{
+ return new UndoElementWithSelection( getActionString(), xModel );
+}
+
+// ----------------------------------------
+
+ShapeUndoElement::ShapeUndoElement( const OUString& rActionString, SdrUndoAction* pAction )
+ :UndoElement( rActionString, Reference< frame::XModel >() )
+ ,m_pAction( pAction )
+{
+}
+
+ShapeUndoElement::ShapeUndoElement( const ShapeUndoElement& rOther )
+ :UndoElement( rOther )
+ ,m_pAction( rOther.m_pAction )
+{
+}
+
+ShapeUndoElement::~ShapeUndoElement()
+{
+}
+
+SdrUndoAction* ShapeUndoElement::getSdrUndoAction()
+{
+ return m_pAction;
+}
+
+// ========================================
+
+UndoStack::UndoStack() :
+ m_nSizeLimit( 1000 )
+{
+}
+
+UndoStack::~UndoStack()
+{
+ disposeAndClear();
+}
+
+void UndoStack::pop()
+{
+ if( ! empty())
+ {
+ top()->dispose();
+ delete top();
+ m_aStack.pop_back();
+ }
+}
+
+void UndoStack::push( UndoElement * pElement )
+{
+ m_aStack.push_back( pElement );
+ applyLimitation();
+}
+
+UndoElement * UndoStack::top() const
+{
+ return m_aStack.back();
+}
+
+OUString UndoStack::topUndoString() const
+{
+ if( ! empty())
+ return top()->getActionString();
+ return OUString();
+}
+
+Sequence< OUString > UndoStack::getUndoStrings() const
+{
+ sal_Int32 nSize( static_cast< sal_Int32 >( m_aStack.size()));
+ Sequence< OUString > aResult( nSize );
+ for( sal_Int32 i=0; i<nSize; ++i )
+ aResult[i] = m_aStack[i]->getActionString();
+ return aResult;
+}
+
+bool UndoStack::empty() const
+{
+ return m_aStack.empty();
+}
+
+void UndoStack::disposeAndClear()
+{
+ ::std::for_each( m_aStack.begin(), m_aStack.end(), ::boost::mem_fn( & UndoElement::dispose ));
+ ::std::for_each( m_aStack.begin(), m_aStack.end(), CommonFunctors::DeletePtr< UndoElement >() );
+ m_aStack.clear();
+}
+
+void UndoStack::limitSize( sal_Int32 nMaxSize )
+{
+ m_nSizeLimit = nMaxSize;
+ applyLimitation();
+}
+
+void UndoStack::applyLimitation()
+{
+ if( m_aStack.size() > static_cast< sal_uInt32 >( m_nSizeLimit ))
+ {
+ tUndoStackType::iterator aBegin( m_aStack.begin());
+ tUndoStackType::iterator aEnd( aBegin + (m_aStack.size() - m_nSizeLimit));
+ // dispose and remove all undo elements that are over the limit
+ ::std::for_each( aBegin, aEnd, ::boost::mem_fn( & UndoElement::dispose ));
+ ::std::for_each( aBegin, aEnd, CommonFunctors::DeletePtr< UndoElement >() );
+ m_aStack.erase( aBegin, aEnd );
+ }
+}
+
+// ================================================================================
+
+namespace
+{
+static const OUString aUndoStepsPropName( RTL_CONSTASCII_USTRINGPARAM("Steps"));
+} // anonymous namespace
+
+UndoStepsConfigItem::UndoStepsConfigItem( ConfigItemListener & rListener ) :
+ ::utl::ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Undo"))),
+ m_rListener( rListener )
+{
+ EnableNotification( Sequence< OUString >( & aUndoStepsPropName, 1 ));
+}
+
+UndoStepsConfigItem::~UndoStepsConfigItem()
+{
+}
+
+void UndoStepsConfigItem::Notify( const Sequence< OUString > & aPropertyNames )
+{
+ for( sal_Int32 nIdx=0; nIdx<aPropertyNames.getLength(); ++nIdx )
+ {
+ if( aPropertyNames[nIdx].equals( aUndoStepsPropName ))
+ m_rListener.notify( aPropertyNames[nIdx] );
+ }
+}
+
+void UndoStepsConfigItem::Commit()
+{
+}
+
+// mtehod is not const, because GetProperties is not const
+sal_Int32 UndoStepsConfigItem::getUndoSteps()
+{
+ sal_Int32 nSteps = -1;
+ Sequence< uno::Any > aValues(
+ GetProperties( Sequence< OUString >( & aUndoStepsPropName, 1 )));
+ if( aValues.getLength())
+ aValues[0] >>= nSteps;
+ return nSteps;
+}
+
+} // namespace impl
+} // namespace chart
diff --git a/chart2/source/controller/main/ImplUndoManager.hxx b/chart2/source/controller/main/ImplUndoManager.hxx
new file mode 100644
index 000000000000..4dde0bc65719
--- /dev/null
+++ b/chart2/source/controller/main/ImplUndoManager.hxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_IMPLUNDOMANAGER_HXX
+#define CHART2_IMPLUNDOMANAGER_HXX
+
+#include "ConfigItemListener.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ustring.hxx>
+#include <unotools/configitem.hxx>
+
+#include <utility>
+#include <deque>
+
+
+class SdrUndoAction;
+
+namespace com { namespace sun { namespace star {
+namespace chart2 {
+ class XInternalDataProvider;
+}
+}}}
+
+
+namespace chart
+{
+namespace impl
+{
+
+class UndoElement
+{
+public:
+ UndoElement( const ::rtl::OUString & rActionString,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElement( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElement( const UndoElement & rOther );
+ virtual ~UndoElement();
+
+ virtual void dispose();
+ virtual UndoElement * createFromModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ virtual void applyToModel(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xInOutModelToChange );
+
+ void setActionString( const ::rtl::OUString & rActionString );
+ ::rtl::OUString getActionString() const;
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > cloneModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel );
+
+ static void applyModelContentToModel(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xInOutModelToChange,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModelToCopyFrom,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > & xData = 0 );
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+
+private:
+ void initialize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ ::rtl::OUString m_aActionString;
+};
+
+class UndoElementWithData : public UndoElement
+{
+public:
+ UndoElementWithData( const ::rtl::OUString & rActionString,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElementWithData( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElementWithData( const UndoElementWithData & rOther );
+ virtual ~UndoElementWithData();
+
+ virtual void dispose();
+ virtual UndoElement * createFromModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ virtual void applyToModel(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xInOutModelToChange );
+
+private:
+ void initializeData();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XInternalDataProvider > m_xData;
+};
+
+class UndoElementWithSelection : public UndoElement
+{
+public:
+ UndoElementWithSelection( const ::rtl::OUString & rActionString,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElementWithSelection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ UndoElementWithSelection( const UndoElementWithSelection & rOther );
+ virtual ~UndoElementWithSelection();
+
+ virtual void dispose();
+ virtual UndoElement * createFromModel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ virtual void applyToModel(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xInOutModelToChange );
+
+private:
+ void initialize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ ::com::sun::star::uno::Any m_aSelection;
+};
+
+class ShapeUndoElement : public UndoElement
+{
+public:
+ ShapeUndoElement( const ::rtl::OUString& rActionString, SdrUndoAction* pAction );
+ ShapeUndoElement( const ShapeUndoElement& rOther );
+ virtual ~ShapeUndoElement();
+
+ SdrUndoAction* getSdrUndoAction();
+
+private:
+ SdrUndoAction* m_pAction;
+};
+
+/** Note that all models that are put into this container are at some point
+ disposed of inside this class. (At least in the destructor). That means
+ the models retrieved here should never be used, but instead their content
+ should be copied to a living model.
+ */
+class UndoStack
+{
+public:
+ UndoStack();
+ // disposes of all models left in the stack
+ ~UndoStack();
+
+ // removes he last undo action and disposes of the model
+ void pop();
+ void push( UndoElement * rElement );
+
+ // precondition: !empty()
+ UndoElement * top() const;
+ ::rtl::OUString topUndoString() const;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getUndoStrings() const;
+
+ bool empty() const;
+ void disposeAndClear();
+
+ // removes all actions that have been inserted more than nMaxSize steps ago.
+ // The models of those actions are disposed of
+ void limitSize( sal_Int32 nMaxSize );
+
+private:
+ void applyLimitation();
+
+ typedef ::std::deque< UndoElement * > tUndoStackType;
+
+ tUndoStackType m_aStack;
+ sal_Int32 m_nSizeLimit;
+};
+
+// ----------------------------------------
+
+class UndoStepsConfigItem : public ::utl::ConfigItem
+{
+public:
+ explicit UndoStepsConfigItem( ConfigItemListener & rListener );
+ virtual ~UndoStepsConfigItem();
+
+ sal_Int32 getUndoSteps();
+
+protected:
+ // ____ ::utl::ConfigItem ____
+ virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString > & aPropertyNames );
+ virtual void Commit();
+
+private:
+ ConfigItemListener & m_rListener;
+};
+
+
+} // namespace impl
+} // namespace chart
+
+// CHART2_IMPLUNDOMANAGER_HXX
+#endif
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
new file mode 100644
index 000000000000..fe73d15500f5
--- /dev/null
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -0,0 +1,862 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "AxisHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "ChartTypeHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "LegendHelper.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+
+#include <map>
+#include <algorithm>
+
+#include <com/sun/star/chart2/XTitled.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/chart/ErrorBarStyle.hpp>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/awt/Key.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+struct lcl_ObjectToOID : public ::std::unary_function< Reference< uno::XInterface >, ::chart::ObjectIdentifier >
+{
+ explicit lcl_ObjectToOID( const Reference< chart2::XChartDocument > & xChartDoc ) :
+ m_xModel( xChartDoc, uno::UNO_QUERY )
+ {}
+
+ ::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 )
+{
+ if( xShapes.is())
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ for( sal_Int32 i=0; i<nCount; ++i)
+ {
+ Reference< beans::XPropertySet > xShapeProp( xShapes->getByIndex( i ), uno::UNO_QUERY );
+ if( xShapeProp.is())
+ {
+ Reference< beans::XPropertySetInfo > xInfo( xShapeProp->getPropertySetInfo());
+ OUString aName;
+ if( xInfo.is() &&
+ xInfo->hasPropertyByName( C2U("Name")) &&
+ (xShapeProp->getPropertyValue( C2U("Name")) >>= aName ) &&
+ aName.getLength() > 0 &&
+ ::chart::ObjectIdentifier::isCID( aName ))
+ {
+ rOutChildren.push_back( ::chart::ObjectIdentifier( aName ) );
+ }
+ Reference< container::XIndexAccess > xNewShapes( xShapeProp, uno::UNO_QUERY );
+ if( xNewShapes.is())
+ lcl_getChildOIDs( rOutChildren, xNewShapes );
+ }
+ }
+ }
+}
+
+void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const Reference< frame::XModel >& xChartModel )
+{
+ Reference< XTitled > xAxisTitled( xAxis, uno::UNO_QUERY );
+ if( xAxisTitled.is())
+ {
+ Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject());
+ if( xAxisTitle.is())
+ rContainer.push_back(
+ ::chart::ObjectIdentifier( ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xChartModel ) ) );
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+namespace impl
+{
+
+class ImplObjectHierarchy
+{
+public:
+ explicit ImplObjectHierarchy(
+ const Reference< XChartDocument >& xChartDocument,
+ ExplicitValueProvider* pExplicitValueProvider,
+ bool bFlattenDiagram, bool bOrderingForElementSelector );
+
+ bool hasChildren( const ObjectHierarchy::tOID& rParent );
+ ObjectHierarchy::tChildContainer getChildren( const ObjectHierarchy::tOID& rParent );
+ ObjectHierarchy::tChildContainer getSiblings( const ObjectHierarchy::tOID& rNode );
+
+ ObjectHierarchy::tOID getParent( const ObjectHierarchy::tOID& 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 );
+ 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 );
+
+ ObjectHierarchy::tOID getParentImpl(
+ const ObjectHierarchy::tOID& rParentOID,
+ const ObjectHierarchy::tOID& rOID );
+
+ typedef ::std::map< ObjectHierarchy::tOID, 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 = 0;
+}
+
+void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartDocument )
+{
+ m_aChildMap = tChildMap();//clear tree
+
+ if( !xChartDocument.is() )
+ return;
+
+ //@todo: change ObjectIdentifier to take an XChartDocument rather than XModel
+ Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY );
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) );
+ ObjectHierarchy::tOID aDiaOID;
+ if( xDiagram.is() )
+ aDiaOID = ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xModel ) );
+ ObjectHierarchy::tChildContainer aTopLevelContainer;
+
+ // First Level
+
+ // Chart Area
+ if( m_bOrderingForElementSelector )
+ {
+ aTopLevelContainer.push_back( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
+ if( xDiagram.is() )
+ {
+ aTopLevelContainer.push_back( aDiaOID );
+ createWallAndFloor( aTopLevelContainer, xDiagram );
+ createLegendTree( aTopLevelContainer, xChartDocument, xDiagram );
+ }
+ }
+
+ // Main Title
+ Reference< XTitled > xDocTitled( xChartDocument, uno::UNO_QUERY );
+ if( xDocTitled.is())
+ {
+ Reference< XTitle > xMainTitle( xDocTitled->getTitleObject());
+ if( xMainTitle.is())
+ aTopLevelContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xMainTitle, xModel ) ) );
+ }
+
+ 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.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xSubTitle, xModel ) ) );
+ }
+
+ if( !m_bOrderingForElementSelector )
+ {
+ // Axis Titles. Note: These are interpreted of being top level
+ Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ lcl_addAxisTitle( aAxes[i], aTopLevelContainer, xModel );
+
+ // Diagram
+ aTopLevelContainer.push_back( aDiaOID );
+ }
+
+ if( m_bFlattenDiagram )
+ createDiagramTree( aTopLevelContainer, xChartDocument, xDiagram );
+ else
+ {
+ ObjectHierarchy::tChildContainer aSubContainer;
+ createDiagramTree( aSubContainer, xChartDocument, xDiagram );
+ if( !aSubContainer.empty() )
+ m_aChildMap[ aDiaOID ] = aSubContainer;
+ }
+
+ if( !m_bOrderingForElementSelector )
+ createLegendTree( aTopLevelContainer, xChartDocument, xDiagram );
+ }
+
+ // #i12587# support for shapes in chart
+ if ( !m_bOrderingForElementSelector )
+ {
+ createAdditionalShapesTree( aTopLevelContainer );
+ }
+
+ // Chart Area
+ if( !m_bOrderingForElementSelector )
+ aTopLevelContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
+
+ if( ! aTopLevelContainer.empty())
+ m_aChildMap[ ObjectHierarchy::getRootNodeOID() ] = aTopLevelContainer;
+}
+
+void ImplObjectHierarchy::createLegendTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
+{
+ if( xDiagram.is() && LegendHelper::hasLegend( xDiagram ) )
+ {
+ ObjectHierarchy::tOID aLegendOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram->getLegend(), Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) ) ) );
+ rContainer.push_back( aLegendOID );
+
+ // 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;
+ lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
+
+ m_aChildMap[ aLegendOID ] = aLegendEntryOIDs;
+ }
+ }
+}
+
+void ImplObjectHierarchy::createAxesTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
+{
+ Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 );
+ if( bSupportsAxesGrids )
+ {
+ Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) );
+ if( !m_bOrderingForElementSelector )
+ ::std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(),
+ ::std::back_inserter( rContainer ),
+ lcl_ObjectToOID( xChartDoc ));
+
+ // get all axes, also invisible ones
+ aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ false );
+ // Grids
+ Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+ for( sal_Int32 nA=0; nA<aAxes.getLength(); ++nA )
+ {
+ Reference< XAxis > xAxis( aAxes[nA] );
+ if(!xAxis.is())
+ continue;
+
+ sal_Int32 nCooSysIndex = 0;
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
+ if( nAxisIndex>0 && !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, nDimensionIndex ) )
+ continue;
+
+ if( m_bOrderingForElementSelector )
+ {
+ // axis
+ if( AxisHelper::isAxisVisible( xAxis ) )
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel ) ) );
+
+ // axis title
+ lcl_addAxisTitle( aAxes[nA], rContainer, xChartModel );
+ }
+
+ Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
+ if( AxisHelper::isGridVisible( xGridProperties ) )
+ {
+ //main grid
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel ) ) ) );
+ }
+
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );;
+ sal_Int32 nSubGrid = 0;
+ for( nSubGrid = 0; nSubGrid < aSubGrids.getLength(); ++nSubGrid )
+ {
+ Reference< beans::XPropertySet > xSubGridProperties( aSubGrids[nSubGrid] );
+ if( AxisHelper::isGridVisible( xSubGridProperties ) )
+ {
+ //sub grid
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGrid ) ) ) );
+ }
+ }
+ }
+ }
+}
+
+void ImplObjectHierarchy::createWallAndFloor(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XDiagram > & xDiagram )
+{
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ bool bIsThreeD = ( nDimensionCount == 3 );
+ bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ if( bHasWall && bIsThreeD )
+ {
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) ) );
+
+ Reference< beans::XPropertySet > xFloor( xDiagram->getFloor());
+ if( xFloor.is())
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, rtl::OUString() ) ) );
+ }
+
+}
+
+void ImplObjectHierarchy::createDiagramTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
+{
+ if( !m_bOrderingForElementSelector )
+ {
+ createDataSeriesTree( rContainer, xDiagram );
+ createAxesTree( rContainer, xChartDoc, xDiagram );
+ createWallAndFloor( rContainer, xDiagram );
+ }
+ else
+ {
+ createAxesTree( rContainer, xChartDoc, xDiagram );
+ createDataSeriesTree( rContainer, xDiagram );
+ }
+}
+
+void ImplObjectHierarchy::createDataSeriesTree(
+ ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
+ const Reference< XDiagram > & xDiagram )
+{
+ Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+
+ try
+ {
+ sal_Int32 nDiagramIndex = 0;
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++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 )
+ {
+ Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] );
+ Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
+ const sal_Int32 nNumberOfSeries =
+ ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength());
+
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; ++nSeriesIdx )
+ {
+ OUString aSeriesParticle(
+ ObjectIdentifier::createParticleForSeries(
+ nDiagramIndex, nCooSysIdx, nCTIdx, nSeriesIdx ));
+ ObjectHierarchy::tOID aSeriesOID(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticle( aSeriesParticle ) ) );
+ rOutDiagramSubContainer.push_back( aSeriesOID );
+
+ ObjectHierarchy::tChildContainer aSeriesSubContainer;
+
+ Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
+
+ // data lablels
+ if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
+ {
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle ) ) );
+ }
+
+ // Statistics
+ if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) )
+ {
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves());
+ for( sal_Int32 nCurveIdx=0; nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+ {
+ bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) ) );
+ if( RegressionCurveHelper::hasEquation( aCurves[nCurveIdx] ) )
+ {
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) ) );
+ }
+ }
+ Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xErrorBarProp;
+ if( xSeriesProp.is() &&
+ (xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) &&
+ ( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ) )
+ {
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS, OUString(), aSeriesParticle ) ) );
+ }
+ }
+ }
+ }
+
+ // Data Points
+ // 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 );
+ lcl_getChildOIDs( aSeriesSubContainer, xSeriesShapeContainer );
+ }
+
+ if( ! aSeriesSubContainer.empty())
+ m_aChildMap[ aSeriesOID ] = aSeriesSubContainer;
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ImplObjectHierarchy::createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer )
+{
+ try
+ {
+ if ( m_pExplicitValueProvider )
+ {
+ Reference< drawing::XDrawPage > xDrawPage( m_pExplicitValueProvider->getDrawModelWrapper()->getMainDrawPage() );
+ Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
+ sal_Int32 nCount = xDrawPageShapes->getCount();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< drawing::XShape > xShape;
+ if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ {
+ if ( xShape.is() && xShape != xChartRoot )
+ {
+ rContainer.push_back( ObjectIdentifier( xShape ) );
+ }
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+bool ImplObjectHierarchy::hasChildren( const ObjectHierarchy::tOID& rParent )
+{
+ if ( rParent.isValid() )
+ {
+ tChildMap::const_iterator aIt( m_aChildMap.find( rParent ));
+ if( aIt != m_aChildMap.end())
+ return ! (aIt->second.empty());
+ }
+ return false;
+}
+
+ObjectHierarchy::tChildContainer ImplObjectHierarchy::getChildren( const ObjectHierarchy::tOID& rParent )
+{
+ if ( rParent.isValid() )
+ {
+ tChildMap::const_iterator aIt( m_aChildMap.find( rParent ));
+ if( aIt != m_aChildMap.end())
+ return aIt->second;
+ }
+ return ObjectHierarchy::tChildContainer();
+}
+
+ObjectHierarchy::tChildContainer ImplObjectHierarchy::getSiblings( const ObjectHierarchy::tOID& rNode )
+{
+ if ( rNode.isValid() && !ObjectHierarchy::isRootNode( rNode ) )
+ {
+ for( tChildMap::const_iterator aIt( m_aChildMap.begin());
+ aIt != m_aChildMap.end(); ++aIt )
+ {
+ ObjectHierarchy::tChildContainer::const_iterator aElemIt(
+ ::std::find( aIt->second.begin(), aIt->second.end(), rNode ));
+ if( aElemIt != aIt->second.end())
+ return aIt->second;
+ }
+ }
+ return ObjectHierarchy::tChildContainer();
+}
+
+ObjectHierarchy::tOID ImplObjectHierarchy::getParentImpl(
+ const ObjectHierarchy::tOID & rParentOID,
+ const ObjectHierarchy::tOID & rOID )
+{
+ // search children
+ ObjectHierarchy::tChildContainer aChildren( getChildren( rParentOID ));
+ ObjectHierarchy::tChildContainer::const_iterator aIt(
+ ::std::find( aChildren.begin(), aChildren.end(), rOID ));
+ // recursion end
+ if( aIt != aChildren.end())
+ return rParentOID;
+
+ for( aIt = aChildren.begin(); aIt != aChildren.end(); ++aIt )
+ {
+ // recursion
+ ObjectHierarchy::tOID aTempParent( getParentImpl( *aIt, rOID ));
+ if ( aTempParent.isValid() )
+ {
+ // exit on success
+ return aTempParent;
+ }
+ }
+
+ // exit on fail
+ return ObjectHierarchy::tOID();
+}
+
+ObjectHierarchy::tOID ImplObjectHierarchy::getParent(
+ const ObjectHierarchy::tOID & rOID )
+{
+ return getParentImpl( ObjectHierarchy::getRootNodeOID(), rOID );
+}
+
+} // namespace impl
+
+
+ObjectHierarchy::ObjectHierarchy(
+ const Reference< XChartDocument > & xChartDocument,
+ ExplicitValueProvider * pExplicitValueProvider /* = 0 */,
+ bool bFlattenDiagram /* = false */,
+ bool bOrderingForElementSelector /* = false */) :
+ m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram, bOrderingForElementSelector ))
+{}
+
+ObjectHierarchy::~ObjectHierarchy()
+{}
+
+// static
+ObjectHierarchy::tOID ObjectHierarchy::getRootNodeOID()
+{
+ return ObjectIdentifier( C2U( "ROOT" ) );
+}
+
+// static
+bool ObjectHierarchy::isRootNode( const ObjectHierarchy::tOID& rOID )
+{
+ return ( rOID == ObjectHierarchy::getRootNodeOID() );
+}
+
+ObjectHierarchy::tChildContainer ObjectHierarchy::getTopLevelChildren() const
+{
+ return m_apImpl->getChildren( ObjectHierarchy::getRootNodeOID());
+}
+
+bool ObjectHierarchy::hasChildren( const tOID& rParent ) const
+{
+ return m_apImpl->hasChildren( rParent );
+}
+
+ObjectHierarchy::tChildContainer ObjectHierarchy::getChildren(
+ const ObjectHierarchy::tOID& rParent ) const
+{
+ if ( rParent.isValid() )
+ return m_apImpl->getChildren( rParent );
+
+ return ObjectHierarchy::tChildContainer();
+}
+
+ObjectHierarchy::tChildContainer ObjectHierarchy::getSiblings(
+ const ObjectHierarchy::tOID& rNode ) const
+{
+ if ( rNode.isValid() && !isRootNode( rNode ) )
+ return m_apImpl->getSiblings( rNode );
+
+ return ObjectHierarchy::tChildContainer();
+}
+
+ObjectHierarchy::tOID ObjectHierarchy::getParent(
+ const ObjectHierarchy::tOID& rNode ) const
+{
+ return m_apImpl->getParent( rNode );
+}
+
+sal_Int32 ObjectHierarchy::getIndexInParent(
+ const ObjectHierarchy::tOID& rNode ) const
+{
+ tOID aParentOID( m_apImpl->getParent( rNode ));
+ tChildContainer aChildren( m_apImpl->getChildren( aParentOID ) );
+ tChildContainer::const_iterator aIt( aChildren.begin() );
+ for( sal_Int32 nIndex = 0; aIt != aChildren.end(); ++nIndex, ++aIt )
+ {
+ if ( *aIt == rNode )
+ return nIndex;
+ }
+ return -1;
+}
+
+// ================================================================================
+
+ObjectKeyNavigation::ObjectKeyNavigation(
+ const ObjectHierarchy::tOID & rCurrentOID,
+ const Reference< chart2::XChartDocument > & xChartDocument,
+ ExplicitValueProvider * pExplicitValueProvider /* = 0 */ ) :
+ m_aCurrentOID( rCurrentOID ),
+ m_xChartDocument( xChartDocument ),
+ m_pExplicitValueProvider( pExplicitValueProvider ),
+ m_bStepDownInDiagram( true )
+{
+ if ( !m_aCurrentOID.isValid() )
+ {
+ setCurrentSelection( ObjectHierarchy::getRootNodeOID() );
+ }
+}
+
+bool ObjectKeyNavigation::handleKeyEvent(
+ const awt::KeyEvent & rEvent )
+{
+ bool bResult = false;
+
+ switch( rEvent.KeyCode )
+ {
+ case awt::Key::TAB:
+ if( rEvent.Modifiers & awt::KeyModifier::SHIFT )
+ bResult = previous();
+ else
+ bResult = next();
+ break;
+ case awt::Key::HOME:
+ bResult = first();
+ break;
+ case awt::Key::END:
+ bResult = last();
+ break;
+ case awt::Key::F3:
+ if( rEvent.Modifiers & awt::KeyModifier::SHIFT )
+ bResult = up();
+ else
+ bResult = down();
+ break;
+ case awt::Key::ESCAPE:
+ setCurrentSelection( ObjectIdentifier() );
+ bResult = true;
+ break;
+ default:
+ bResult = false;
+ break;
+ }
+ return bResult;
+}
+
+void ObjectKeyNavigation::setCurrentSelection( const ObjectHierarchy::tOID& rOID )
+{
+ m_aCurrentOID = rOID;
+}
+
+ObjectHierarchy::tOID ObjectKeyNavigation::getCurrentSelection() const
+{
+ return m_aCurrentOID;
+}
+
+bool ObjectKeyNavigation::first()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) );
+ bool bResult = !aSiblings.empty();
+ if( bResult )
+ setCurrentSelection( aSiblings.front());
+ else
+ bResult = veryFirst();
+ return bResult;
+}
+
+bool ObjectKeyNavigation::last()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) );
+ bool bResult = !aSiblings.empty();
+ if( bResult )
+ setCurrentSelection( aSiblings.back());
+ else
+ bResult = veryLast();
+ return bResult;
+}
+
+bool ObjectKeyNavigation::next()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection() ) );
+ bool bResult = !aSiblings.empty();
+ if( bResult )
+ {
+ ObjectHierarchy::tChildContainer::const_iterator aIt(
+ ::std::find( aSiblings.begin(), aSiblings.end(), getCurrentSelection()));
+ OSL_ASSERT( aIt != aSiblings.end());
+ if( ++aIt == aSiblings.end())
+ aIt = aSiblings.begin();
+ setCurrentSelection( *aIt );
+ }
+ else
+ bResult = veryFirst();
+
+ return bResult;
+}
+
+bool ObjectKeyNavigation::previous()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aSiblings( aHierarchy.getSiblings( getCurrentSelection()));
+ bool bResult = !aSiblings.empty();
+ if( bResult )
+ {
+ ObjectHierarchy::tChildContainer::const_iterator aIt(
+ ::std::find( aSiblings.begin(), aSiblings.end(), getCurrentSelection()));
+ OSL_ASSERT( aIt != aSiblings.end());
+ if( aIt == aSiblings.begin())
+ aIt = aSiblings.end();
+ --aIt;
+ setCurrentSelection( *aIt );
+ }
+ else
+ bResult = veryLast();
+ return bResult;
+}
+
+bool ObjectKeyNavigation::up()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ bool bResult = !ObjectHierarchy::isRootNode( getCurrentSelection());
+ if( bResult )
+ setCurrentSelection( aHierarchy.getParent( getCurrentSelection()));
+ return bResult;
+}
+
+bool ObjectKeyNavigation::down()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ bool bResult = aHierarchy.hasChildren( getCurrentSelection());
+ if( bResult )
+ {
+ ObjectHierarchy::tChildContainer aChildren = aHierarchy.getChildren( getCurrentSelection());
+ OSL_ASSERT( !aChildren.empty());
+ setCurrentSelection( aChildren.front());
+ }
+ return bResult;
+}
+
+bool ObjectKeyNavigation::veryFirst()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aChildren( aHierarchy.getTopLevelChildren());
+ bool bResult = !aChildren.empty();
+ if( bResult )
+ setCurrentSelection( aChildren.front());
+ return bResult;
+}
+
+bool ObjectKeyNavigation::veryLast()
+{
+ ObjectHierarchy aHierarchy( m_xChartDocument, m_pExplicitValueProvider, m_bStepDownInDiagram );
+ ObjectHierarchy::tChildContainer aChildren( aHierarchy.getTopLevelChildren());
+ bool bResult = !aChildren.empty();
+ if( bResult )
+ setCurrentSelection( aChildren.back());
+ return bResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx
new file mode 100644
index 000000000000..f0ce3eaaa04e
--- /dev/null
+++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "PositionAndSizeHelper.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+#include "chartview/ExplicitValueProvider.hxx"
+
+// header for class Rectangle
+#include <tools/gen.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
+ , const uno::Reference< beans::XPropertySet >& xObjectProp
+ , const awt::Rectangle& rNewPositionAndSize
+ , const awt::Rectangle& rPageRectangle
+ )
+{
+ if(!xObjectProp.is())
+ return false;
+ Rectangle aObjectRect( Point(rNewPositionAndSize.X,rNewPositionAndSize.Y), Size(rNewPositionAndSize.Width,rNewPositionAndSize.Height) );
+ Rectangle aPageRect( Point(rPageRectangle.X,rPageRectangle.Y), Size(rPageRectangle.Width,rPageRectangle.Height) );
+
+ if( OBJECTTYPE_TITLE==eObjectType )
+ {
+ //@todo decide wether x is primary or secondary
+ chart2::RelativePosition aRelativePosition;
+ 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());
+ xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+ else if( OBJECTTYPE_DATA_CURVE_EQUATION==eObjectType )
+ {
+ //@todo decide wether x is primary or secondary
+ chart2::RelativePosition aRelativePosition;
+ 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());
+ xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+ else if(OBJECTTYPE_LEGEND==eObjectType)
+ {
+ LegendPosition ePos = LegendPosition_LINE_END;
+ xObjectProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos;
+ chart2::RelativePosition aRelativePosition;
+ Point aAnchor = aObjectRect.TopLeft();
+
+ switch( ePos )
+ {
+ case LegendPosition_LINE_START:
+ {
+ //@todo language dependent positions ...
+ aRelativePosition.Anchor = drawing::Alignment_LEFT;
+ aAnchor = aObjectRect.LeftCenter();
+ }
+ break;
+ case LegendPosition_LINE_END:
+ {
+ //@todo language dependent positions ...
+ aRelativePosition.Anchor = drawing::Alignment_RIGHT;
+ aAnchor = aObjectRect.RightCenter();
+ }
+ break;
+ case LegendPosition_PAGE_START:
+ {
+ //@todo language dependent positions ...
+ aRelativePosition.Anchor = drawing::Alignment_TOP;
+ aAnchor = aObjectRect.TopCenter();
+ }
+ break;
+ case LegendPosition_PAGE_END:
+ //@todo language dependent positions ...
+ {
+ aRelativePosition.Anchor = drawing::Alignment_BOTTOM;
+ aAnchor = aObjectRect.BottomCenter();
+ }
+ break;
+ case LegendPosition_CUSTOM:
+ {
+ //@todo language dependent positions ...
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ }
+ break;
+ case LegendPosition_MAKE_FIXED_SIZE:
+ OSL_ASSERT( false );
+ break;
+ }
+ aRelativePosition.Primary =
+ static_cast< double >( aAnchor.X()) /
+ static_cast< double >( aPageRect.getWidth() );
+ aRelativePosition.Secondary =
+ static_cast< double >( aAnchor.Y()) /
+ static_cast< double >( aPageRect.getHeight());
+
+ xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+ else if(OBJECTTYPE_DIAGRAM==eObjectType || OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType)
+ {
+ //@todo decide wether x is primary or secondary
+
+ //set position:
+ chart2::RelativePosition aRelativePosition;
+ 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());
+ xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(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());
+ xObjectProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) );
+ }
+ else
+ return false;
+ return true;
+}
+
+bool PositionAndSizeHelper::moveObject( const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel
+ , const awt::Rectangle& rNewPositionAndSize
+ , const awt::Rectangle& rPageRectangle
+ )
+{
+ ControllerLockGuard aLockedControllers( xChartModel );
+
+ awt::Rectangle aNewPositionAndSize( rNewPositionAndSize );
+
+ uno::Reference< beans::XPropertySet > xObjectProp = ObjectIdentifier::getObjectPropertySet( rObjectCID, xChartModel );
+ ObjectType eObjectType( ObjectIdentifier::getObjectType( rObjectCID ) );
+ if(OBJECTTYPE_DIAGRAM==eObjectType || OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType)
+ {
+ xObjectProp = uno::Reference< beans::XPropertySet >( ObjectIdentifier::getDiagramForCID( rObjectCID, xChartModel ), uno::UNO_QUERY );
+ if(!xObjectProp.is())
+ return false;
+ }
+ return moveObject( eObjectType, xObjectProp, aNewPositionAndSize, rPageRectangle );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx
new file mode 100644
index 000000000000..567a36473a5b
--- /dev/null
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -0,0 +1,685 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "SelectionHelper.hxx"
+#include "ObjectIdentifier.hxx"
+//for C2U
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+
+// header for class SdrObjList
+#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
+#include "svx/obj3d.hxx"
+// header for class SdrPathObj
+#include <svx/svdopath.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+namespace
+{
+
+rtl::OUString lcl_getObjectName( SdrObject* pObj )
+{
+ if(pObj)
+ return pObj->GetName();
+ return rtl::OUString();
+}
+
+void impl_selectObject( SdrObject* pObjectToSelect, DrawViewWrapper& rDrawViewWrapper )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ if(pObjectToSelect)
+ {
+ SelectionHelper aSelectionHelper( pObjectToSelect );
+ SdrObject* pMarkObj = aSelectionHelper.getObjectToMark();
+ rDrawViewWrapper.setMarkHandleProvider(&aSelectionHelper);
+ rDrawViewWrapper.MarkObject(pMarkObj);
+ rDrawViewWrapper.setMarkHandleProvider(NULL);
+ }
+}
+
+}//anonymous namespace
+
+bool Selection::hasSelection()
+{
+ return m_aSelectedOID.isValid();
+}
+
+rtl::OUString Selection::getSelectedCID()
+{
+ return m_aSelectedOID.getObjectCID();
+}
+
+uno::Reference< drawing::XShape > Selection::getSelectedAdditionalShape()
+{
+ return m_aSelectedOID.getAdditionalShape();
+}
+
+ObjectIdentifier Selection::getSelectedOID() const
+{
+ return m_aSelectedOID;
+}
+
+bool Selection::setSelection( const ::rtl::OUString& rCID )
+{
+ if ( !rCID.equals( m_aSelectedOID.getObjectCID() ) )
+ {
+ m_aSelectedOID = ObjectIdentifier( rCID );
+ return true;
+ }
+ return false;
+}
+
+bool Selection::setSelection( const uno::Reference< drawing::XShape >& xShape )
+{
+ if ( !( xShape == m_aSelectedOID.getAdditionalShape() ) )
+ {
+ clearSelection();
+ m_aSelectedOID = ObjectIdentifier( xShape );
+ return true;
+ }
+ return false;
+}
+
+void Selection::clearSelection()
+{
+ m_aSelectedOID = ObjectIdentifier();
+ m_aSelectedOID_beforeMouseDown = ObjectIdentifier();
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = ObjectIdentifier();
+}
+
+bool Selection::maybeSwitchSelectionAfterSingleClickWasEnsured()
+{
+ if ( m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing.isValid()
+ && m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing != m_aSelectedOID )
+ {
+ m_aSelectedOID = m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = ObjectIdentifier();
+ return true;
+ }
+ return false;
+}
+
+void Selection::resetPossibleSelectionAfterSingleClickWasEnsured()
+{
+ if ( m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing.isValid() )
+ {
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = ObjectIdentifier();
+ }
+}
+
+void Selection::remindSelectionBeforeMouseDown()
+{
+ m_aSelectedOID_beforeMouseDown = m_aSelectedOID;
+}
+
+bool Selection::isSelectionDifferentFromBeforeMouseDown()
+{
+ return ( m_aSelectedOID != m_aSelectedOID_beforeMouseDown );
+}
+
+void Selection::applySelection( DrawViewWrapper* pDrawViewWrapper )
+{
+ if( pDrawViewWrapper )
+ {
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ pDrawViewWrapper->UnmarkAll();
+ }
+ SdrObject* pObjectToSelect = 0;
+ if ( m_aSelectedOID.isAutoGeneratedObject() )
+ {
+ pObjectToSelect = pDrawViewWrapper->getNamedSdrObject( m_aSelectedOID.getObjectCID() );
+ }
+ else if( m_aSelectedOID.isAdditionalShape() )
+ {
+ pObjectToSelect = DrawViewWrapper::getSdrObject( m_aSelectedOID.getAdditionalShape() );
+ }
+
+ impl_selectObject( pObjectToSelect, *pDrawViewWrapper );
+ }
+}
+
+void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
+ , bool bIsRightMouse, bool bWaitingForDoubleClick )
+{
+ if( pDrawViewWrapper )
+ {
+ //do not toggel multiclick selection if right clicked on the selected object or waiting for double click
+ bool bAllowMultiClickSelectionChange = !bIsRightMouse && !bWaitingForDoubleClick;
+
+ ObjectIdentifier aLastSelectedObject( m_aSelectedOID );
+
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ //bAllowMultiClickSelectionChange==true -> a second click on the same object can lead to a changed selection (e.g. series -> single data point)
+
+ //get object to select:
+ SdrObject* pNewObj = 0;
+ {
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = ObjectIdentifier();
+
+ //the search for the object to select starts with the hit object deepest in the grouping hierarchy (a leaf in the tree)
+ //further we travel along the grouping hierarchy from child to parent
+ pNewObj = pDrawViewWrapper->getHitObject(rMousePos);
+ m_aSelectedOID = ObjectIdentifier( lcl_getObjectName( pNewObj ) );//name of pNewObj
+
+ //ignore handle only objects for hit test
+ while( pNewObj && m_aSelectedOID.getObjectCID().match( C2U( "HandlesOnly" ) ) )
+ {
+ pNewObj->SetMarkProtect(true);
+ pNewObj = pDrawViewWrapper->getHitObject(rMousePos);
+ m_aSelectedOID = ObjectIdentifier( lcl_getObjectName( pNewObj ) );
+ }
+
+ //accept only named objects while searching for the object to select
+ //this call may change m_aSelectedOID
+ if ( SelectionHelper::findNamedParent( pNewObj, m_aSelectedOID, true ) )
+ {
+ //if the so far found object is a multi click object further steps are necessary
+ while( ObjectIdentifier::isMultiClickObject( m_aSelectedOID.getObjectCID() ) )
+ {
+ bool bSameObjectAsLastSelected = ( aLastSelectedObject == m_aSelectedOID );
+ if( bSameObjectAsLastSelected )
+ {
+ //if the same child is clicked again don't go up further
+ break;
+ }
+ if ( ObjectIdentifier::areSiblings( aLastSelectedObject.getObjectCID(), m_aSelectedOID.getObjectCID() ) )
+ {
+ //if a sibling of the last selected object is clicked don't go up further
+ break;
+ }
+ SdrObject* pLastChild = pNewObj;
+ ObjectIdentifier aLastChild = m_aSelectedOID;
+ if ( !SelectionHelper::findNamedParent( pNewObj, m_aSelectedOID, false ) )
+ {
+ //take the one found so far
+ break;
+ }
+ //if the last selected object is found don't go up further
+ //but take the last child if selection change is allowed
+ if ( aLastSelectedObject == m_aSelectedOID )
+ {
+ if( bAllowMultiClickSelectionChange )
+ {
+ pNewObj = pLastChild;
+ m_aSelectedOID = aLastChild;
+ }
+ else
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = aLastChild;
+
+ break;
+ }
+ }
+
+ DBG_ASSERT( pNewObj && m_aSelectedOID.isValid(), "somehow lost selected object" );
+ }
+ else
+ {
+ //maybe an additional shape was hit
+ if ( pNewObj )
+ {
+ m_aSelectedOID = ObjectIdentifier( uno::Reference< drawing::XShape >( pNewObj->getUnoShape(), uno::UNO_QUERY ) );
+ }
+ else
+ {
+ m_aSelectedOID = ObjectIdentifier();
+ }
+ }
+
+ if ( !m_aSelectedOID.isAdditionalShape() )
+ {
+ rtl::OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) );//@todo read CID from model
+
+ if ( !m_aSelectedOID.isAutoGeneratedObject() )
+ {
+ m_aSelectedOID = ObjectIdentifier( aPageCID );
+ }
+
+ //check wether the diagram was hit but not selected (e.g. because it has no filling):
+ rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model
+ if ( m_aSelectedOID.getObjectCID().equals( aPageCID ) || m_aSelectedOID.getObjectCID().equals( aWallCID ) || !m_aSelectedOID.isAutoGeneratedObject() )
+ {
+ rtl::OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) );
+ //todo: if more than one diagram is available in future do chack the list of all diagrams here
+ SdrObject* pDiagram = pDrawViewWrapper->getNamedSdrObject( aDiagramCID );
+ if( pDiagram )
+ {
+ if( pDrawViewWrapper->IsObjectHit( pDiagram, rMousePos ) )
+ {
+ m_aSelectedOID = ObjectIdentifier( aDiagramCID );
+ pNewObj = pDiagram;
+ }
+ }
+ }
+ }
+ }
+
+ if ( bIsRightMouse && m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing.isValid() )
+ {
+ m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing = ObjectIdentifier();
+ }
+ }
+}
+
+bool Selection::isResizeableObjectSelected()
+{
+ ObjectType eObjectType = m_aSelectedOID.getObjectType();
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_SHAPE:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+bool Selection::isRotateableObjectSelected( const uno::Reference< frame::XModel >& xChartModel )
+{
+ return SelectionHelper::isRotateableObject( m_aSelectedOID.getObjectCID(), xChartModel );
+}
+
+bool Selection::isDragableObjectSelected()
+{
+ return m_aSelectedOID.isDragableObject();
+}
+
+bool Selection::isAdditionalShapeSelected() const
+{
+ return m_aSelectedOID.isAdditionalShape();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject
+ , rtl::OUString& rOutName
+ , bool bGivenObjectMayBeResult )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ //find the deepest named group
+ SdrObject* pObj = pInOutObject;
+ rtl::OUString aName;
+ if( bGivenObjectMayBeResult )
+ aName = lcl_getObjectName( pObj );
+
+ while( pObj && !ObjectIdentifier::isCID( aName ) )
+ {
+ SdrObjList* pObjList = pObj->GetObjList();
+ if( !pObjList )
+ return false;;
+ SdrObject* pOwner = pObjList->GetOwnerObj();
+ if( !pOwner )
+ return false;
+ pObj = pOwner;
+ aName = lcl_getObjectName( pObj );
+ }
+
+ if(!pObj)
+ return false;
+ if(!aName.getLength())
+ return false;
+
+ pInOutObject = pObj;
+ rOutName = aName;
+ return true;
+}
+
+//static
+bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject
+ , ObjectIdentifier& rOutObject
+ , bool bGivenObjectMayBeResult )
+{
+ rtl::OUString aName;
+ if ( findNamedParent( pInOutObject, aName, bGivenObjectMayBeResult ) )
+ {
+ rOutObject = ObjectIdentifier( aName );
+ return true;
+ }
+ return false;
+}
+
+//static
+bool SelectionHelper::isDragableObjectHitTwice( const Point& rMPos
+ , const rtl::OUString& rNameOfSelectedObject
+ , const DrawViewWrapper& rDrawViewWrapper )
+{
+ if(!rNameOfSelectedObject.getLength())
+ return false;
+ if( !ObjectIdentifier::isDragableObject(rNameOfSelectedObject) )
+ return false;
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SdrObject* pObj = rDrawViewWrapper.getNamedSdrObject( rNameOfSelectedObject );
+ if( !rDrawViewWrapper.IsObjectHit( pObj, rMPos ) )
+ return false;
+ return true;
+}
+
+// static
+::rtl::OUString SelectionHelper::getHitObjectCID(
+ const Point& rMPos,
+ DrawViewWrapper& rDrawViewWrapper,
+ bool bGetDiagramInsteadOf_Wall )
+{
+ // //- solar mutex
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ rtl::OUString aRet;
+
+ SdrObject* pNewObj = rDrawViewWrapper.getHitObject(rMPos);
+ aRet = lcl_getObjectName( pNewObj );//name of pNewObj
+
+ //ignore handle only objects for hit test
+ while( pNewObj && aRet.match(C2U("HandlesOnly")) )
+ {
+ pNewObj->SetMarkProtect(true);
+ pNewObj = rDrawViewWrapper.getHitObject(rMPos);
+ aRet = lcl_getObjectName( pNewObj );
+ }
+
+ //accept only named objects while searching for the object to select
+ if( !findNamedParent( pNewObj, aRet, true ) )
+ {
+ aRet = ::rtl::OUString();
+ }
+
+ rtl::OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) );//@todo read CID from model
+ //get page when nothing was hit
+ if( aRet.getLength() == 0 && !pNewObj )
+ {
+ aRet = aPageCID;
+ }
+
+ //get diagram instead wall or page if hit inside diagram
+ if( aRet.getLength() != 0 )
+ {
+ if( aRet.equals( aPageCID ) )
+ {
+ rtl::OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) );
+ //todo: if more than one diagram is available in future do chack the list of all diagrams here
+ SdrObject* pDiagram = rDrawViewWrapper.getNamedSdrObject( aDiagramCID );
+ if( pDiagram )
+ {
+ if( rDrawViewWrapper.IsObjectHit( pDiagram, rMPos ) )
+ {
+ aRet = aDiagramCID;
+ }
+ }
+ }
+ else if( bGetDiagramInsteadOf_Wall )
+ {
+ rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model
+
+ if( aRet.equals( aWallCID ) )
+ {
+ rtl::OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) );
+ aRet = aDiagramCID;
+ }
+ }
+ }
+
+ return aRet;
+ // \\- solar mutex
+}
+
+//static
+bool SelectionHelper::isRotateableObject( const ::rtl::OUString& rCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ if( !ObjectIdentifier::isRotateableObject( rCID ) )
+ return false;
+
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( ChartModelHelper::findDiagram( xChartModel ) );
+
+ if( nDimensionCount == 3 )
+ return true;
+ return false;
+}
+
+SelectionHelper::SelectionHelper( SdrObject* pSelectedObj )
+ : m_pSelectedObj( pSelectedObj )
+{
+
+}
+SelectionHelper::~SelectionHelper()
+{
+}
+
+//virtual
+bool SelectionHelper::getFrameDragSingles()
+{
+ bool bFrameDragSingles = true;//true == green == surrounding handles
+ if( m_pSelectedObj && m_pSelectedObj->ISA(E3dObject) )
+ bFrameDragSingles = false;
+ return bFrameDragSingles;
+}
+
+//static
+SdrObject* SelectionHelper::getMarkHandlesObject( SdrObject* pObj )
+{
+ if(!pObj)
+ return 0;
+ rtl::OUString aName( lcl_getObjectName( pObj ) );
+ if( aName.match(C2U("MarkHandles")) || aName.match(C2U("HandlesOnly")) )
+ return pObj;
+ if( aName.getLength() )//dont't get the markhandles of a different object
+ return 0;
+
+ //search for a child with name "MarkHandles" or "HandlesOnly"
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SdrObjList* pSubList = pObj->GetSubList();
+ if(pSubList)
+ {
+ SdrObjListIter aIterator(*pSubList, IM_FLAT);
+ while (aIterator.IsMore())
+ {
+ SdrObject* pMarkHandles = SelectionHelper::getMarkHandlesObject( aIterator.Next() );
+ if( pMarkHandles )
+ return pMarkHandles;
+ }
+ }
+ return 0;
+}
+
+SdrObject* SelectionHelper::getObjectToMark()
+{
+ //return the selected object itself
+ //or a specific other object if that exsists
+ SdrObject* pObj = m_pSelectedObj;
+ m_pMarkObj = pObj;
+
+ //search for a child with name "MarkHandles" or "HandlesOnly"
+ if(pObj)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SdrObjList* pSubList = pObj->GetSubList();
+ if(pSubList)
+ {
+ SdrObjListIter aIterator(*pSubList, IM_FLAT);
+ while (aIterator.IsMore())
+ {
+ SdrObject* pMarkHandles = SelectionHelper::getMarkHandlesObject( aIterator.Next() );
+ if( pMarkHandles )
+ {
+ m_pMarkObj = pMarkHandles;
+ break;
+ }
+ }
+ }
+ }
+ return m_pMarkObj;
+}
+
+//static
+E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj )
+{
+ //search wether the object or one of its children is a 3D object
+ //if so, return the accessory 3DScene
+
+ E3dObject* pRotateable = 0;
+
+ if(pObj)
+ {
+ pRotateable = dynamic_cast<E3dObject*>(pObj);
+ if( !pRotateable )
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SdrObjList* pSubList = pObj->GetSubList();
+ if(pSubList)
+ {
+ SdrObjListIter aIterator(*pSubList, IM_DEEPWITHGROUPS);
+ while( aIterator.IsMore() && !pRotateable )
+ {
+ SdrObject* pSubObj = aIterator.Next();
+ pRotateable = dynamic_cast<E3dObject*>(pSubObj);
+ }
+ }
+ }
+ }
+
+ E3dScene* pScene = 0;
+ if(pRotateable)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ pScene = pRotateable->GetScene();
+ }
+ return pScene;
+
+}
+
+//virtual
+bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ //@todo -> more flexible handle creation
+ //2 scenarios possible:
+ //1. add an additional invisible shape as a child to the selected object
+ //this child needs to be named somehow and handles need to be generated therefrom ...
+ //or 2. offer a central service per view where renderer and so can register for handle creation for a special shape
+ //.. or 3. feature from drawinglayer to create handles for each shape ... (bad performance ... ?) ?
+
+ //scenario 1 is now used:
+ //if a child with name MarkHandles exsists
+ //this child is marked instead of the logical selected object
+
+/*
+ //if a special mark object was found
+ //that object should be used for marking only
+ if( m_pMarkObj != m_pSelectedObj)
+ return false;
+*/
+ //if a special mark object was found
+ //that object should be used to create handles from
+ if( m_pMarkObj && m_pMarkObj != m_pSelectedObj)
+ {
+ rHdlList.Clear();
+ if( m_pMarkObj->ISA(SdrPathObj) )
+ {
+ //if th object is a polygon
+ //from each point a handle is generated
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon = ((SdrPathObj*)m_pMarkObj)->GetPathPoly();
+ for( sal_uInt32 nN = 0L; nN < rPolyPolygon.count(); nN++)
+ {
+ const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nN));
+ for( sal_uInt32 nM = 0L; nM < aPolygon.count(); nM++)
+ {
+ const ::basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(nM));
+ SdrHdl* pHdl = new SdrHdl(Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY())), HDL_POLY);
+ rHdlList.AddHdl(pHdl);
+ }
+ }
+ return true;
+ }
+ else
+ return false; //use the special MarkObject for marking
+ }
+
+ //@todo:
+ //add and document good marking defaults ...
+
+ rHdlList.Clear();
+
+ SdrObject* pObj = m_pSelectedObj;
+ if(!pObj)
+ return false;
+ SdrObjList* pSubList = pObj->GetSubList();
+ if( !pSubList )//no group object !pObj->IsGroupObject()
+ return false;
+
+ rtl::OUString aName( lcl_getObjectName( pObj ) );
+ ObjectType eObjectType( ObjectIdentifier::getObjectType( aName ) );
+ if( OBJECTTYPE_DATA_POINT == eObjectType
+ || OBJECTTYPE_DATA_LABEL == eObjectType
+ || OBJECTTYPE_LEGEND_ENTRY == eObjectType
+ || OBJECTTYPE_AXIS_UNITLABEL == eObjectType )
+ {
+ return false;
+ }
+
+ SdrObjListIter aIterator(*pSubList, IM_FLAT);
+
+ while (aIterator.IsMore())
+ {
+ SdrObject* pSubObj = aIterator.Next();
+ if( OBJECTTYPE_DATA_SERIES == eObjectType )
+ {
+ rtl::OUString aSubName( lcl_getObjectName( pSubObj ) );
+ ObjectType eSubObjectType( ObjectIdentifier::getObjectType( aSubName ) );
+ if( eSubObjectType!=OBJECTTYPE_DATA_POINT )
+ return false;
+ }
+
+ Point aPos = pSubObj->GetCurrentBoundRect().Center();
+ SdrHdl* pHdl = new SdrHdl(aPos,HDL_POLY);
+ rHdlList.AddHdl(pHdl);
+ }
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/SelectionHelper.hxx b/chart2/source/controller/main/SelectionHelper.hxx
new file mode 100644
index 000000000000..b3516e2326a4
--- /dev/null
+++ b/chart2/source/controller/main/SelectionHelper.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SELECTIONHELPER_HXX
+#define _CHART2_SELECTIONHELPER_HXX
+
+#include "DrawViewWrapper.hxx"
+#include "ObjectIdentifier.hxx"
+
+class SdrObject;
+// header for enum SdrDragMode
+#include <svx/svdtypes.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ObjectIdentifier;
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class Selection
+{
+public: //methods
+ bool hasSelection();
+
+ rtl::OUString getSelectedCID();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > getSelectedAdditionalShape();
+ ObjectIdentifier getSelectedOID() const;
+
+ bool isResizeableObjectSelected();
+ bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ bool isDragableObjectSelected();
+
+ bool isAdditionalShapeSelected() const;
+
+ //returns true if selection has changed
+ bool setSelection( const ::rtl::OUString& rCID );
+ bool setSelection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ void clearSelection();
+
+ //returns true if the selection has changed
+ bool maybeSwitchSelectionAfterSingleClickWasEnsured();
+ void resetPossibleSelectionAfterSingleClickWasEnsured();
+
+ void remindSelectionBeforeMouseDown();
+ bool isSelectionDifferentFromBeforeMouseDown();
+
+ void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
+ , bool bIsRightMouse, bool bWaitingForDoubleClick );
+
+ void applySelection( DrawViewWrapper* pDrawViewWrapper );
+
+private: //member
+ //the selection could be given by a CID or by a shape
+ //if m_aSelectedObjectCID is not empty this indicates the selection
+ //the content of m_xSelectedShape is ignored in that case
+ //the strings are used for autogenerated chart specific objects
+ //the shape reference is used for additional shapes
+ ObjectIdentifier m_aSelectedOID; //only single object selection so far
+ ObjectIdentifier m_aSelectedOID_beforeMouseDown;
+ ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
+};
+
+class SelectionHelper : public MarkHandleProvider
+{
+public:
+ static bool findNamedParent( SdrObject*& pInOutObject
+ , rtl::OUString& rOutName
+ , bool bGivenObjectMayBeResult );
+ static bool findNamedParent( SdrObject*& pInOutObject
+ , ObjectIdentifier& rOutObject
+ , bool bGivenObjectMayBeResult );
+ static SdrObject* getMarkHandlesObject( SdrObject* pObj );
+ static E3dScene* getSceneToRotate( SdrObject* pObj );
+ static bool isDragableObjectHitTwice( const Point& rMPos
+ , const rtl::OUString& rNameOfSelectedObject
+ , const DrawViewWrapper& rDrawViewWrapper );
+
+ static ::rtl::OUString getHitObjectCID(
+ const Point& rMPos,
+ DrawViewWrapper& rDrawViewWrapper,
+ bool bGetDiagramInsteadOf_Wall=false );
+
+ static bool isRotateableObject( const ::rtl::OUString& rCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+
+ SelectionHelper( SdrObject* pSelectedObj );
+ virtual ~SelectionHelper();
+
+
+ //MarkHandleProvider:
+ virtual bool getMarkHandles( SdrHdlList& rHdlList );
+ virtual bool getFrameDragSingles();
+
+ SdrObject* getObjectToMark();//sets also internally the mark object
+ //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
+
+private:
+ SdrObject* m_pSelectedObj;//hit and logically selected object
+ SdrObject* m_pMarkObj;//object that is marked instead to have more pretty handles
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
new file mode 100644
index 000000000000..b6adf9bf7477
--- /dev/null
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -0,0 +1,738 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ShapeController.hxx"
+#include "ShapeController.hrc"
+#include "ChartController.hxx"
+#include "ChartWindow.hxx"
+#include "ViewElementListProvider.hxx"
+#include "dlg_ShapeFont.hxx"
+#include "dlg_ShapeParagraph.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/frame/XStorable.hpp>
+
+#include <vos/mutex.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/brkitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/drawitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/spltitem.hxx>
+#include <svx/svxdlg.hxx>
+#include <editeng/widwitem.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+ShapeController::ShapeController( const Reference< uno::XComponentContext >& rxContext,
+ ChartController* pController )
+ :FeatureCommandDispatchBase( rxContext )
+ ,m_pChartController( pController )
+{
+}
+
+ShapeController::~ShapeController()
+{
+}
+
+void ShapeController::initialize()
+{
+ FeatureCommandDispatchBase::initialize();
+}
+
+// WeakComponentImplHelperBase
+void ShapeController::disposing()
+{
+}
+
+// XEventListener
+void ShapeController::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+}
+
+FeatureState ShapeController::getState( const ::rtl::OUString& rCommand )
+{
+ FeatureState aReturn;
+ aReturn.bEnabled = false;
+ aReturn.aState <<= false;
+
+ bool bWritable = false;
+ if ( m_pChartController )
+ {
+ Reference< frame::XStorable > xStorable( m_pChartController->getModel(), uno::UNO_QUERY );
+ if ( xStorable.is() )
+ {
+ bWritable = !xStorable->isReadonly();
+ }
+ }
+
+ SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommand );
+ if ( aIter != m_aSupportedFeatures.end() )
+ {
+ sal_uInt16 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:
+ {
+ aReturn.bEnabled = bWritable;
+ aReturn.aState <<= false;
+ }
+ break;
+ case COMMAND_ID_BRING_TO_FRONT:
+ case COMMAND_ID_FORWARD:
+ {
+ aReturn.bEnabled = ( bWritable && isForwardPossible() );
+ aReturn.aState <<= false;
+ }
+ break;
+ case COMMAND_ID_BACKWARD:
+ case COMMAND_ID_SEND_TO_BACK:
+ {
+
+ aReturn.bEnabled = ( bWritable && isBackwardPossible() );
+ aReturn.aState <<= false;
+ }
+ break;
+ case COMMAND_ID_FONT_DIALOG:
+ case COMMAND_ID_PARAGRAPH_DIALOG:
+ {
+ aReturn.bEnabled = bWritable;
+ aReturn.aState <<= false;
+ }
+ break;
+ default:
+ {
+ aReturn.bEnabled = false;
+ aReturn.aState <<= false;
+ }
+ break;
+ }
+ }
+
+ return aReturn;
+}
+
+void ShapeController::execute( const ::rtl::OUString& rCommand, const Sequence< beans::PropertyValue>& rArgs )
+{
+ (void)rArgs;
+
+ SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommand );
+ if ( aIter != m_aSupportedFeatures.end() )
+ {
+ sal_uInt16 nFeatureId = aIter->second.nFeatureId;
+ switch ( nFeatureId )
+ {
+ case COMMAND_ID_FORMAT_LINE:
+ {
+ executeDispatch_FormatLine();
+ }
+ break;
+ case COMMAND_ID_FORMAT_AREA:
+ {
+ executeDispatch_FormatArea();
+ }
+ break;
+ case COMMAND_ID_TEXT_ATTRIBUTES:
+ {
+ executeDispatch_TextAttributes();
+ }
+ break;
+ case COMMAND_ID_TRANSFORM_DIALOG:
+ {
+ executeDispatch_TransformDialog();
+ }
+ break;
+ case COMMAND_ID_OBJECT_TITLE_DESCRIPTION:
+ {
+ executeDispatch_ObjectTitleDescription();
+ }
+ break;
+ case COMMAND_ID_RENAME_OBJECT:
+ {
+ executeDispatch_RenameObject();
+ }
+ break;
+ case COMMAND_ID_BRING_TO_FRONT:
+ case COMMAND_ID_FORWARD:
+ case COMMAND_ID_BACKWARD:
+ case COMMAND_ID_SEND_TO_BACK:
+ {
+ executeDispatch_ChangeZOrder( nFeatureId );
+ }
+ break;
+ case COMMAND_ID_FONT_DIALOG:
+ {
+ executeDispatch_FontDialog();
+ }
+ break;
+ case COMMAND_ID_PARAGRAPH_DIALOG:
+ {
+ executeDispatch_ParagraphDialog();
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+}
+
+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 );
+}
+
+IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxNameDialog*, pDialog )
+{
+ String aName;
+ if ( pDialog )
+ {
+ pDialog->GetName( aName );
+ }
+ if ( aName.Len() )
+ {
+ DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
+ if ( pDrawViewWrapper && pDrawViewWrapper->getNamedSdrObject( aName ) )
+ {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+void ShapeController::executeDispatch_FormatLine()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
+ BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ }
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
+ pFact->CreateSvxLineTabDialog( pParent, &aAttr, &pDrawModelWrapper->getSdrModel(),
+ pSelectedObj, bHasMarked ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE );
+ }
+ else
+ {
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_FormatArea()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
+ {
+ SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
+ BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ }
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< AbstractSvxAreaTabDialog > pDlg(
+ pFact->CreateSvxAreaTabDialog( pParent, &aAttr, &pDrawModelWrapper->getSdrModel(),
+ pDrawViewWrapper ) );
+ if ( pDlg.get() )
+ {
+ SfxItemPool& rItemPool = pDrawViewWrapper->GetModel()->GetItemPool();
+ SfxItemSet aSet( rItemPool, rItemPool.GetFirstWhich(), rItemPool.GetLastWhich() );
+ const SvxColorTableItem* pColorItem = static_cast< const SvxColorTableItem* >( aSet.GetItem( SID_COLOR_TABLE ) );
+ if ( pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable() )
+ {
+ pDlg->DontDeleteColorTable();
+ }
+ if ( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE );
+ }
+ else
+ {
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_TextAttributes()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawViewWrapper )
+ {
+ SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
+ BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ }
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
+ pFact->CreateTextTabDialog( pParent, &aAttr, pDrawViewWrapper ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ if ( bHasMarked )
+ {
+ pDrawViewWrapper->SetAttributes( *pOutAttr );
+ }
+ else
+ {
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_TransformDialog()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawViewWrapper )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ if ( pSelectedObj && pSelectedObj->GetObjIdentifier() == OBJ_CAPTION )
+ {
+ // item set for caption
+ SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
+ pDrawViewWrapper->GetAttributes( aAttr );
+ // item set for position and size
+ SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
+ pFact->CreateCaptionDialog( pParent, pDrawViewWrapper ) );
+ if ( pDlg.get() )
+ {
+ const USHORT* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
+ SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
+ aCombAttr.Put( aAttr );
+ aCombAttr.Put( aGeoAttr );
+ pDlg->SetInputSet( &aCombAttr );
+ if ( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ pDrawViewWrapper->SetAttributes( *pOutAttr );
+ pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr );
+ }
+ }
+ }
+ }
+ else
+ {
+ SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< SfxAbstractTabDialog > pDlg(
+ pFact->CreateSvxTransformTabDialog( pParent, &aGeoAttr, pDrawViewWrapper ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr );
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_ObjectTitleDescription()
+{
+ if ( m_pChartController )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper && pDrawViewWrapper->GetMarkedObjectCount() == 1 )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ if ( pSelectedObj )
+ {
+ String aTitle( pSelectedObj->GetTitle() );
+ String aDescription( pSelectedObj->GetDescription() );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< AbstractSvxObjectTitleDescDialog > pDlg(
+ pFact->CreateSvxObjectTitleDescDialog( NULL, aTitle, aDescription ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ pDlg->GetTitle( aTitle );
+ pDlg->GetDescription( aDescription );
+ pSelectedObj->SetTitle( aTitle );
+ pSelectedObj->SetDescription( aDescription );
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_RenameObject()
+{
+ if ( m_pChartController )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper && pDrawViewWrapper->GetMarkedObjectCount() == 1 )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ if ( pSelectedObj )
+ {
+ String aName( pSelectedObj->GetName() );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::boost::scoped_ptr< AbstractSvxObjectNameDialog > pDlg(
+ pFact->CreateSvxObjectNameDialog( NULL, aName ) );
+ pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ pDlg->GetName( aName );
+ if ( aName != pSelectedObj->GetName() )
+ {
+ pSelectedObj->SetName( aName );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
+{
+ DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
+ if ( pDrawViewWrapper )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ switch ( nId )
+ {
+ case COMMAND_ID_BRING_TO_FRONT:
+ {
+ if ( isForwardPossible() )
+ {
+ pDrawViewWrapper->PutMarkedToTop();
+ }
+ }
+ break;
+ case COMMAND_ID_FORWARD:
+ {
+ if ( isForwardPossible() )
+ {
+ pDrawViewWrapper->MovMarkedToTop();
+ }
+ }
+ break;
+ case COMMAND_ID_BACKWARD:
+ {
+ if ( isBackwardPossible() )
+ {
+ pDrawViewWrapper->MovMarkedToBtm();
+ }
+ }
+ break;
+ case COMMAND_ID_SEND_TO_BACK:
+ {
+ if ( isBackwardPossible() )
+ {
+ SdrObject* pFirstObj = getFirstAdditionalShape();
+ pDrawViewWrapper->PutMarkedBehindObj( pFirstObj );
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+}
+
+void ShapeController::executeDispatch_FontDialog()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
+ {
+ SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
+ pDrawViewWrapper->GetAttributes( aAttr );
+ ViewElementListProvider aViewElementListProvider( pDrawModelWrapper );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ ::boost::scoped_ptr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ pDrawViewWrapper->SetAttributes( *pOutAttr );
+ }
+ }
+ }
+}
+
+void ShapeController::executeDispatch_ParagraphDialog()
+{
+ if ( m_pChartController )
+ {
+ Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow );
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pParent && pDrawViewWrapper )
+ {
+ SfxItemPool& rPool = pDrawViewWrapper->GetModel()->GetItemPool();
+ SfxItemSet aAttr( rPool );
+ pDrawViewWrapper->GetAttributes( aAttr );
+
+ SfxItemSet aNewAttr( rPool,
+ EE_ITEMS_START, EE_ITEMS_END,
+ SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
+ SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
+ SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
+ SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
+ SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
+ 0 );
+ aNewAttr.Put( aAttr );
+ aNewAttr.Put( SvxHyphenZoneItem( sal_False, SID_ATTR_PARA_HYPHENZONE ) );
+ aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
+ aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT) );
+ aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
+ aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ ::boost::scoped_ptr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) );
+ if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
+ {
+ const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
+ pDrawViewWrapper->SetAttributes( *pOutAttr );
+ }
+ }
+ }
+}
+
+SdrObject* ShapeController::getFirstAdditionalShape()
+{
+ SdrObject* pFirstObj = NULL;
+
+ try
+ {
+ DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : NULL );
+ if ( pDrawModelWrapper )
+ {
+ Reference< drawing::XShape > xFirstShape;
+ Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
+ Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
+ sal_Int32 nCount = xDrawPageShapes->getCount();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< drawing::XShape > xShape;
+ if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ {
+ if ( xShape.is() && xShape != xChartRoot )
+ {
+ xFirstShape = xShape;
+ break;
+ }
+ }
+ }
+ if ( xFirstShape.is() )
+ {
+ pFirstObj = DrawViewWrapper::getSdrObject( xFirstShape );
+ }
+ }
+ }
+ catch ( uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return pFirstObj;
+}
+
+SdrObject* ShapeController::getLastAdditionalShape()
+{
+ SdrObject* pLastObj = NULL;
+
+ try
+ {
+ DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : NULL );
+ if ( pDrawModelWrapper )
+ {
+ Reference< drawing::XShape > xLastShape;
+ Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
+ Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
+ Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
+ sal_Int32 nCount = xDrawPageShapes->getCount();
+ for ( sal_Int32 i = nCount - 1; i >= 0; --i )
+ {
+ Reference< drawing::XShape > xShape;
+ if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
+ {
+ if ( xShape.is() && xShape != xChartRoot )
+ {
+ xLastShape = xShape;
+ break;
+ }
+ }
+ }
+ if ( xLastShape.is() )
+ {
+ pLastObj = DrawViewWrapper::getSdrObject( xLastShape );
+ }
+ }
+ }
+ catch ( uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return pLastObj;
+}
+
+bool ShapeController::isBackwardPossible()
+{
+ if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ SdrObject* pFirstObj = getFirstAdditionalShape();
+ if ( pSelectedObj && pFirstObj && pSelectedObj != pFirstObj )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool ShapeController::isForwardPossible()
+{
+ if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ SdrObject* pLastObj = getLastAdditionalShape();
+ if ( pSelectedObj && pLastObj && pSelectedObj != pLastObj )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ShapeController.hxx b/chart2/source/controller/main/ShapeController.hxx
new file mode 100644
index 000000000000..aea01d6c478d
--- /dev/null
+++ b/chart2/source/controller/main/ShapeController.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_SHAPECONTROLLER_HXX
+#define CHART2_SHAPECONTROLLER_HXX
+
+#include "FeatureCommandDispatchBase.hxx"
+#include <tools/link.hxx>
+
+class AbstractSvxNameDialog;
+class SdrObject;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ChartController;
+
+/** This is a CommandDispatch implementation for shapes.
+ */
+class ShapeController: public FeatureCommandDispatchBase
+{
+ friend class ControllerCommandDispatch;
+
+public:
+ ShapeController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& rxContext, ChartController* pController );
+ virtual ~ShapeController();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+protected:
+ // WeakComponentImplHelperBase
+ virtual void SAL_CALL disposing();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // state of a feature
+ virtual FeatureState getState( const ::rtl::OUString& rCommand );
+
+ // execute a feature
+ virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs );
+
+ // all the features which should be handled by this class
+ virtual void describeSupportedFeatures();
+
+private:
+ DECL_LINK( CheckNameHdl, AbstractSvxNameDialog* );
+
+ void executeDispatch_FormatLine();
+ void executeDispatch_FormatArea();
+ void executeDispatch_TextAttributes();
+ void executeDispatch_TransformDialog();
+ void executeDispatch_ObjectTitleDescription();
+ void executeDispatch_RenameObject();
+ void executeDispatch_ChangeZOrder( sal_uInt16 nId );
+ void executeDispatch_FontDialog();
+ void executeDispatch_ParagraphDialog();
+
+ SdrObject* getFirstAdditionalShape();
+ SdrObject* getLastAdditionalShape();
+ bool isBackwardPossible();
+ bool isForwardPossible();
+
+ ChartController* m_pChartController;
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+// CHART2_SHAPECONTROLLER_HXX
+#endif
diff --git a/chart2/source/controller/main/ShapeToolbarController.cxx b/chart2/source/controller/main/ShapeToolbarController.cxx
new file mode 100644
index 000000000000..9c6ed747e1d5
--- /dev/null
+++ b/chart2/source/controller/main/ShapeToolbarController.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ShapeToolbarController.hxx"
+
+#include <vos/mutex.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/svxids.hrc>
+#include <svx/tbxcustomshapes.hxx>
+
+
+using namespace com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+::rtl::OUString ShapeToolbarController::getImplementationName() throw (uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+::rtl::OUString ShapeToolbarController::getImplementationName_Static() throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ShapeToolbarController" ) );
+}
+
+Sequence< ::rtl::OUString > ShapeToolbarController::getSupportedServiceNames_Static() throw (uno::RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ShapeToolbarController" ) );
+ return aSupported;
+}
+
+::sal_Bool ShapeToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
+{
+ return ::comphelper::existsValue( ServiceName, getSupportedServiceNames_Static() );
+}
+
+Sequence< ::rtl::OUString> ShapeToolbarController::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+
+Reference< uno::XInterface > ShapeToolbarController::create( const Reference< uno::XComponentContext >& xContext )
+{
+ return *( new ShapeToolbarController( Reference< lang::XMultiServiceFactory >( xContext->getServiceManager(), uno::UNO_QUERY ) ) );
+}
+
+ShapeToolbarController::ShapeToolbarController( const Reference< lang::XMultiServiceFactory >& rxFact )
+ :m_pToolbarController( NULL )
+ ,m_nToolBoxId( 1 )
+ ,m_nSlotId( 0 )
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ m_xServiceManager = rxFact;
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+ShapeToolbarController::~ShapeToolbarController()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+uno::Any ShapeToolbarController::queryInterface( const uno::Type& rType ) throw (uno::RuntimeException)
+{
+ uno::Any aReturn = ToolboxController::queryInterface( rType );
+ if ( !aReturn.hasValue() )
+ {
+ aReturn = ShapeToolbarController_Base::queryInterface( rType );
+ }
+ return aReturn;
+}
+
+void ShapeToolbarController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void ShapeToolbarController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// ::com::sun::star::lang::XInitialization
+void ShapeToolbarController::initialize( const Sequence< uno::Any >& rArguments ) throw (uno::Exception, uno::RuntimeException)
+{
+ ToolboxController::initialize( rArguments );
+ ::vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if ( pToolBox )
+ {
+ const USHORT nCount = pToolBox->GetItemCount();
+ for ( USHORT nPos = 0; nPos < nCount; ++nPos )
+ {
+ const USHORT nItemId = pToolBox->GetItemId( nPos );
+ if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
+ {
+ m_nToolBoxId = nItemId;
+ break;
+ }
+ }
+ if ( m_aCommandURL.equalsAscii( ".uno:BasicShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BasicShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_BASIC;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox ) );
+ }
+ else if ( m_aCommandURL.equalsAscii( ".uno:SymbolShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SymbolShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_SYMBOL;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox ) );
+ }
+ else if ( m_aCommandURL.equalsAscii( ".uno:ArrowShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ArrowShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_ARROW;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox) );
+ }
+ else if ( m_aCommandURL.equalsAscii( ".uno:FlowChartShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FlowChartShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_FLOWCHART;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox ) );
+ }
+ else if ( m_aCommandURL.equalsAscii( ".uno:CalloutShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CalloutShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_CALLOUT;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox ) );
+ }
+ else if ( m_aCommandURL.equalsAscii( ".uno:StarShapes" ) )
+ {
+ m_aStates.insert( TCommandState::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StarShapes" ) ), sal_True ) );
+ m_nSlotId = SID_DRAWTBX_CS_STAR;
+ m_pToolbarController = TToolbarHelper::createFromQuery( new SvxTbxCtlCustomShapes( m_nSlotId, m_nToolBoxId, *pToolBox ) );
+ }
+
+ for ( TCommandState::iterator aIter( m_aStates.begin() ); aIter != m_aStates.end(); ++aIter )
+ {
+ addStatusListener( aIter->first );
+ }
+
+ if ( m_pToolbarController.is() )
+ {
+ m_pToolbarController->initialize( rArguments );
+ }
+
+ // check if paste special is allowed, when not don't add DROPDOWN
+ pToolBox->SetItemBits( m_nToolBoxId, pToolBox->GetItemBits( m_nToolBoxId ) | TIB_DROPDOWN );
+ }
+}
+
+// ::com::sun::star::frame::XStatusListener
+void ShapeToolbarController::statusChanged( const frame::FeatureStateEvent& Event ) throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ TCommandState::iterator aFind = m_aStates.find( Event.FeatureURL.Complete );
+ if ( aFind != m_aStates.end() )
+ {
+ aFind->second = Event.IsEnabled;
+ if ( m_pToolbarController.is() )
+ {
+ sal_Bool bCheckmark = sal_False;
+ ToolBox& rTb = m_pToolbarController->GetToolBox();
+
+ for ( USHORT i = 0; i < rTb.GetItemCount(); ++i )
+ {
+ USHORT nId = rTb.GetItemId( i );
+ if ( nId == 0 )
+ {
+ continue;
+ }
+ ::rtl::OUString aCmd = rTb.GetItemCommand( nId );
+ if ( aCmd == Event.FeatureURL.Complete )
+ {
+ rTb.EnableItem( nId, Event.IsEnabled );
+ if ( Event.State >>= bCheckmark )
+ {
+ rTb.CheckItem( nId, bCheckmark );
+ }
+ else
+ {
+ ::rtl::OUString aItemText;
+ if ( Event.State >>= aItemText )
+ {
+ rTb.SetItemText( nId, aItemText );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+// ::com::sun::star::frame::XToolbarController
+Reference< awt::XWindow > ShapeToolbarController::createPopupWindow() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< awt::XWindow > xRet;
+ if ( m_pToolbarController.is() )
+ {
+ xRet = m_pToolbarController.getRef()->createPopupWindow();
+ }
+
+ return xRet;
+}
+
+// ::com::sun::star::frame::XSubToolbarController
+::sal_Bool ShapeToolbarController::opensSubToolbar() throw (uno::RuntimeException)
+{
+ return ( m_nSlotId == SID_DRAWTBX_CS_BASIC ||
+ m_nSlotId == SID_DRAWTBX_CS_SYMBOL ||
+ m_nSlotId == SID_DRAWTBX_CS_ARROW ||
+ m_nSlotId == SID_DRAWTBX_CS_FLOWCHART ||
+ m_nSlotId == SID_DRAWTBX_CS_CALLOUT ||
+ m_nSlotId == SID_DRAWTBX_CS_STAR );
+}
+
+::rtl::OUString ShapeToolbarController::getSubToolbarName() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< frame::XSubToolbarController > xSub( m_pToolbarController.getRef(), uno::UNO_QUERY );
+ if ( xSub.is() )
+ {
+ return xSub->getSubToolbarName();
+ }
+ return ::rtl::OUString();
+}
+
+void ShapeToolbarController::functionSelected( const ::rtl::OUString& rCommand ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ uno::Reference< frame::XSubToolbarController > xSub( m_pToolbarController.getRef(), uno::UNO_QUERY );
+ if ( xSub.is() )
+ {
+ m_aCommandURL = rCommand;
+ xSub->functionSelected( rCommand );
+ }
+}
+
+void ShapeToolbarController::updateImage() throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ uno::Reference< frame::XSubToolbarController > xSub( m_pToolbarController.getRef(), uno::UNO_QUERY );
+ if ( xSub.is() )
+ {
+ xSub->updateImage();
+ }
+}
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/main/ShapeToolbarController.hxx b/chart2/source/controller/main/ShapeToolbarController.hxx
new file mode 100644
index 000000000000..544cac7f9831
--- /dev/null
+++ b/chart2/source/controller/main/ShapeToolbarController.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_SHAPETOOLBARCONTROLLER_HXX
+#define CHART2_SHAPETOOLBARCONTROLLER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/implementationreference.hxx>
+#include <comphelper/stl_types.hxx>
+#include <svtools/toolboxcontroller.hxx>
+
+class SfxToolBoxControl;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+typedef ::cppu::ImplHelper2 < ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::frame::XSubToolbarController> ShapeToolbarController_Base;
+
+typedef ::comphelper::ImplementationReference< SfxToolBoxControl, ::com::sun::star::frame::XToolbarController > TToolbarHelper;
+
+class ShapeToolbarController : public ::svt::ToolboxController
+ ,public ShapeToolbarController_Base
+{
+ DECLARE_STL_USTRINGACCESS_MAP( sal_Bool, TCommandState );
+ TCommandState m_aStates;
+ TToolbarHelper m_pToolbarController;
+ sal_uInt16 m_nToolBoxId;
+ sal_uInt16 m_nSlotId;
+ ShapeToolbarController( const ShapeToolbarController& );
+ void operator =( const ShapeToolbarController& );
+
+public:
+ ShapeToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFact );
+ virtual ~ShapeToolbarController();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // needed by registration
+ static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XToolbarController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XSubToolbarController
+ virtual ::sal_Bool SAL_CALL opensSubToolbar() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSubToolbarName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException);
+};
+
+//.............................................................................
+} // namespace chart
+//.............................................................................
+
+#endif //CHART2_SHAPETOOLBARCONTROLLER_HXX
+
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.cxx b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
new file mode 100644
index 000000000000..d80d37eff7da
--- /dev/null
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "StatusBarCommandDispatch.hxx"
+#include "ObjectNameProvider.hxx"
+#include "macros.hxx"
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+// #ifndef _VOS_MUTEX_HXX_
+// #include <vos/mutex.hxx>
+// #endif
+// #ifndef _SV_SVAPP_HXX
+// #include <vcl/svapp.hxx>
+// #endif
+
+// for ressource strings STR_UNDO and STR_REDO
+#include <sfx2/sfx.hrc>
+
+#include "ResId.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+StatusBarCommandDispatch::StatusBarCommandDispatch(
+ const Reference< uno::XComponentContext > & xContext,
+ const Reference< frame::XModel > & xModel,
+ const Reference< view::XSelectionSupplier > & xSelSupp ) :
+ impl::StatusBarCommandDispatch_Base( xContext ),
+ m_xModifiable( xModel, uno::UNO_QUERY ),
+ m_xSelectionSupplier( xSelSupp ),
+ m_bIsModified( false )
+{}
+
+StatusBarCommandDispatch::~StatusBarCommandDispatch()
+{}
+
+void StatusBarCommandDispatch::initialize()
+{
+ if( m_xModifiable.is())
+ {
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( m_xModifiable, uno::UNO_QUERY );
+ OSL_ASSERT( xModifyBroadcaster.is());
+ if( xModifyBroadcaster.is())
+ xModifyBroadcaster->addModifyListener( this );
+ }
+
+ if( m_xSelectionSupplier.is())
+ {
+ m_xSelectionSupplier->addSelectionChangeListener( this );
+ }
+}
+
+void StatusBarCommandDispatch::fireStatusEvent(
+ const OUString & rURL,
+ const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
+{
+ bool bFireAll(rURL.getLength() == 0);
+ bool bFireContext( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Context")));
+ bool bFireModified( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:ModifiedStatus")));
+
+ if( bFireContext )
+ {
+ uno::Any aArg;
+ Reference< chart2::XChartDocument > xDoc( m_xModifiable, uno::UNO_QUERY );
+ aArg <<= ObjectNameProvider::getSelectedObjectText( m_aSelectedOID.getObjectCID(), xDoc );
+ fireStatusEventForURL( C2U(".uno:Context"), aArg, true, xSingleListener );
+ }
+ if( bFireModified )
+ {
+ uno::Any aArg;
+ if( m_bIsModified )
+ aArg <<= C2U("*");
+ fireStatusEventForURL( C2U(".uno:ModifiedStatus"), aArg, true, xSingleListener );
+ }
+}
+
+// ____ XDispatch ____
+void SAL_CALL StatusBarCommandDispatch::dispatch(
+ const util::URL& /* URL */,
+ const Sequence< beans::PropertyValue >& /* Arguments */ )
+ throw (uno::RuntimeException)
+{
+ // nothing to do here
+}
+
+// ____ WeakComponentImplHelperBase ____
+/// is called when this is disposed
+void SAL_CALL StatusBarCommandDispatch::disposing()
+{
+ m_xModifiable.clear();
+ m_xSelectionSupplier.clear();
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL StatusBarCommandDispatch::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ m_xModifiable.clear();
+ m_xSelectionSupplier.clear();
+}
+
+// ____ XModifyListener ____
+void SAL_CALL StatusBarCommandDispatch::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ if( m_xModifiable.is())
+ m_bIsModified = m_xModifiable->isModified();
+
+ CommandDispatch::modified( aEvent );
+}
+
+// ____ XSelectionChangeListener ____
+void SAL_CALL StatusBarCommandDispatch::selectionChanged( const lang::EventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+ if( m_xSelectionSupplier.is())
+ m_aSelectedOID = ObjectIdentifier( m_xSelectionSupplier->getSelection() );
+ else
+ m_aSelectedOID = ObjectIdentifier();
+ fireAllStatusEvents( 0 );
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.hxx b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
new file mode 100644
index 000000000000..c84f81f83258
--- /dev/null
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_STATUSBARCOMMANDDISPATCH_HXX
+#define CHART2_STATUSBARCOMMANDDISPATCH_HXX
+
+#include "CommandDispatch.hxx"
+#include "ObjectIdentifier.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+
+namespace chart
+{
+
+/** This is a CommandDispatch implementation for all commands the status bar offers
+
+ This class reads the information needed from the XModel passed here.
+ */
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper1<
+ CommandDispatch,
+ ::com::sun::star::view::XSelectionChangeListener >
+ StatusBarCommandDispatch_Base;
+}
+
+class StatusBarCommandDispatch : public impl::StatusBarCommandDispatch_Base
+{
+public:
+ explicit StatusBarCommandDispatch(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::view::XSelectionSupplier > & xSelSupp );
+ virtual ~StatusBarCommandDispatch();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+protected:
+ // ____ XDispatch ____
+ virtual void SAL_CALL dispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ /// is called when this is disposed
+ virtual void SAL_CALL disposing();
+
+ // ____ XModifyListener (override from CommandDispatch) ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void fireStatusEvent(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
+
+ // ____ XSelectionChangeListener ____
+ virtual void SAL_CALL selectionChanged(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifiable > m_xModifiable;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
+ bool m_bIsModified;
+ ObjectIdentifier m_aSelectedOID;
+};
+
+} // namespace chart
+
+// CHART2_STATUSBARCOMMANDDISPATCH_HXX
+#endif
diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx
new file mode 100644
index 000000000000..eb3d00a2723a
--- /dev/null
+++ b/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UndoCommandDispatch.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/chart2/XUndoSupplier.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+// for ressource strings STR_UNDO and STR_REDO
+#include <sfx2/sfx.hrc>
+
+#include "ResId.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+UndoCommandDispatch::UndoCommandDispatch(
+ const Reference< uno::XComponentContext > & xContext,
+ const Reference< frame::XModel > & xModel ) :
+ CommandDispatch( xContext ),
+ m_xModel( xModel )
+{
+ Reference< chart2::XUndoSupplier > xUndoSupplier( xModel, uno::UNO_QUERY );
+ OSL_ASSERT( xUndoSupplier.is());
+ if( xUndoSupplier.is())
+ m_xUndoManager.set( xUndoSupplier->getUndoManager());
+}
+
+UndoCommandDispatch::~UndoCommandDispatch()
+{}
+
+void UndoCommandDispatch::initialize()
+{
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY );
+ if( xBroadcaster.is() )
+ {
+ xBroadcaster->addModifyListener( this );
+ }
+}
+
+void UndoCommandDispatch::fireStatusEvent(
+ const OUString & rURL,
+ const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
+{
+ if( m_xUndoManager.is() )
+ {
+ bool bFireAll = (rURL.getLength() == 0);
+ uno::Any aUndoState, aRedoState;
+ if( m_xUndoManager->undoPossible())
+ {
+ // using assignment for broken gcc 3.3
+ OUString aUndo = OUString( String( SchResId( STR_UNDO )));
+ aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString());
+ }
+ if( m_xUndoManager->redoPossible())
+ {
+ // using assignment for broken gcc 3.3
+ OUString aRedo = OUString( String( SchResId( STR_REDO )));
+ aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoString());
+ }
+
+ if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Undo")))
+ fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->undoPossible(), xSingleListener );
+ if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Redo")))
+ fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->redoPossible(), xSingleListener );
+ }
+}
+
+// ____ XDispatch ____
+void SAL_CALL UndoCommandDispatch::dispatch(
+ const util::URL& URL,
+ const Sequence< beans::PropertyValue >& /* Arguments */ )
+ throw (uno::RuntimeException)
+{
+ if( m_xUndoManager.is() )
+ {
+ // why is it necessary to lock the solar mutex here?
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" )))
+ m_xUndoManager->undo( m_xModel );
+ else
+ m_xUndoManager->redo( m_xModel );
+ // \--
+ }
+}
+
+// ____ WeakComponentImplHelperBase ____
+/// is called when this is disposed
+void SAL_CALL UndoCommandDispatch::disposing()
+{
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY );
+ if( xBroadcaster.is() )
+ {
+ xBroadcaster->removeModifyListener( this );
+ }
+
+ m_xUndoManager.clear();
+ m_xModel.clear();
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL UndoCommandDispatch::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ m_xUndoManager.clear();
+ m_xModel.clear();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx
new file mode 100644
index 000000000000..28fb813f63de
--- /dev/null
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_UNDOCOMMANDDISPATCH_HXX
+#define CHART2_UNDOCOMMANDDISPATCH_HXX
+
+#include "CommandDispatch.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+
+namespace chart
+{
+
+/** This is a CommandDispatch implementation for Undo and Redo.
+
+ You need to pass an UndoManager to this class that is then used for Undo and
+ Redo. The changes are applied to the given XModel.
+ */
+class UndoCommandDispatch : public CommandDispatch
+{
+public:
+ explicit UndoCommandDispatch(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoCommandDispatch();
+
+ // late initialisation, especially for adding as listener
+ virtual void initialize();
+
+protected:
+ // ____ XDispatch ____
+ virtual void SAL_CALL dispatch(
+ const ::com::sun::star::util::URL& URL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ /// is called when this is disposed
+ virtual void SAL_CALL disposing();
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void fireStatusEvent(
+ const ::rtl::OUString & rURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
+};
+
+} // namespace chart
+
+// CHART2_UNDOCOMMANDDISPATCH_HXX
+#endif
diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx
new file mode 100644
index 000000000000..8513b6ba9093
--- /dev/null
+++ b/chart2/source/controller/main/UndoGuard.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UndoGuard.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+UndoGuard_Base::UndoGuard_Base( const OUString& rUndoString
+ , const uno::Reference< chart2::XUndoManager > & xUndoManager
+ , const uno::Reference< frame::XModel > & xModel )
+ : m_xModel( xModel )
+ , m_xUndoManager( xUndoManager )
+ , m_aUndoString( rUndoString )
+ , m_bActionPosted( false )
+{
+}
+
+UndoGuard_Base::~UndoGuard_Base()
+{
+}
+
+void UndoGuard_Base::commitAction()
+{
+ if( !m_bActionPosted && m_xUndoManager.is() )
+ m_xUndoManager->postAction( m_aUndoString );
+ m_bActionPosted = true;
+}
+
+//-----------------------------------------------------------------------------
+
+UndoGuard::UndoGuard( const OUString& rUndoString
+ , const uno::Reference< chart2::XUndoManager > & xUndoManager
+ , const uno::Reference< frame::XModel > & xModel )
+ : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+{
+ if( m_xUndoManager.is() )
+ m_xUndoManager->preAction( m_xModel );
+}
+
+UndoGuard::~UndoGuard()
+{
+ if( !m_bActionPosted && m_xUndoManager.is() )
+ m_xUndoManager->cancelAction();
+}
+
+//-----------------------------------------------------------------------------
+
+UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& rUndoString
+ , const uno::Reference< chart2::XUndoManager > & xUndoManager
+ , const uno::Reference< frame::XModel > & xModel )
+ : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+{
+ if( m_xUndoManager.is() )
+ m_xUndoManager->preAction( m_xModel );
+}
+
+UndoLiveUpdateGuard::~UndoLiveUpdateGuard()
+{
+ if( !m_bActionPosted && m_xUndoManager.is() )
+ m_xUndoManager->cancelActionWithUndo( m_xModel );
+}
+
+//-----------------------------------------------------------------------------
+
+UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData( const OUString& rUndoString
+ , const uno::Reference< chart2::XUndoManager > & xUndoManager
+ , const uno::Reference< frame::XModel > & xModel )
+ : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+{
+ if( m_xUndoManager.is() )
+ {
+ Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0] = beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("WithData")), -1, uno::Any(),
+ beans::PropertyState_DIRECT_VALUE );
+ m_xUndoManager->preActionWithArguments( m_xModel, aArgs );
+ }
+}
+
+UndoLiveUpdateGuardWithData::~UndoLiveUpdateGuardWithData()
+{
+ if( !m_bActionPosted && m_xUndoManager.is() )
+ m_xUndoManager->cancelActionWithUndo( m_xModel );
+}
+
+//-----------------------------------------------------------------------------
+
+UndoGuardWithSelection::UndoGuardWithSelection( const rtl::OUString& rUndoString
+ , const uno::Reference< chart2::XUndoManager > & xUndoManager
+ , const uno::Reference< frame::XModel > & xModel )
+ : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+{
+ if( m_xUndoManager.is() )
+ {
+ Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0] = beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("WithSelection")), -1, uno::Any(),
+ beans::PropertyState_DIRECT_VALUE );
+ m_xUndoManager->preActionWithArguments( m_xModel, aArgs );
+ }
+}
+
+UndoGuardWithSelection::~UndoGuardWithSelection()
+{
+ if( !m_bActionPosted && m_xUndoManager.is() )
+ m_xUndoManager->cancelAction();
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/UndoManager.cxx b/chart2/source/controller/main/UndoManager.cxx
new file mode 100644
index 000000000000..21e27922b1c8
--- /dev/null
+++ b/chart2/source/controller/main/UndoManager.cxx
@@ -0,0 +1,440 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UndoManager.hxx"
+#include "ImplUndoManager.hxx"
+#include "DisposeHelper.hxx"
+#include "MutexContainer.hxx"
+#include "macros.hxx"
+#include "ChartViewHelper.hxx"
+
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+#include <unotools/configitem.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <rtl/uuid.h>
+#include <svx/svdundo.hxx>
+
+#include <functional>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper1<
+ util::XModifyBroadcaster >
+ ModifyBroadcaster_Base;
+
+class ModifyBroadcaster :
+ public ::chart::MutexContainer,
+ public ModifyBroadcaster_Base
+{
+public:
+ ModifyBroadcaster();
+
+ void fireEvent();
+
+protected:
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener( const Reference< util::XModifyListener >& xListener )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const Reference< util::XModifyListener >& xListener )
+ throw (uno::RuntimeException);
+};
+
+ModifyBroadcaster::ModifyBroadcaster() :
+ ModifyBroadcaster_Base( m_aMutex )
+{}
+
+void SAL_CALL ModifyBroadcaster::addModifyListener(
+ const Reference< util::XModifyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ rBHelper.addListener( ::getCppuType( & xListener ), xListener);
+}
+
+void SAL_CALL ModifyBroadcaster::removeModifyListener(
+ const Reference< util::XModifyListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ rBHelper.removeListener( ::getCppuType( & xListener ), xListener );
+}
+
+void ModifyBroadcaster::fireEvent()
+{
+ ::cppu::OInterfaceContainerHelper* pIC = rBHelper.getContainer(
+ ::getCppuType((const uno::Reference< util::XModifyListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+}
+
+} // namespace impl
+
+UndoManager::UndoManager() :
+ impl::UndoManager_Base( m_aMutex ),
+ m_apUndoStack( new impl::UndoStack()),
+ m_apRedoStack( new impl::UndoStack()),
+ m_pLastRemeberedUndoElement( 0 ),
+ m_nMaxNumberOfUndos( 100 ),
+ m_pModifyBroadcaster( 0 )
+{}
+
+UndoManager::~UndoManager()
+{
+ DisposeHelper::Dispose( m_xModifyBroadcaster );
+ m_apUndoStack->disposeAndClear();
+ m_apRedoStack->disposeAndClear();
+
+ delete m_pLastRemeberedUndoElement;
+ m_pLastRemeberedUndoElement = 0;
+}
+
+void UndoManager::addShapeUndoAction( SdrUndoAction* pAction )
+{
+ if ( !pAction )
+ {
+ return;
+ }
+
+ impl::ShapeUndoElement* pShapeUndoElement = new impl::ShapeUndoElement( pAction->GetComment(), pAction );
+ if ( pShapeUndoElement )
+ {
+ m_apUndoStack->push( pShapeUndoElement );
+ m_apRedoStack->disposeAndClear();
+ if ( !m_apUndoStepsConfigItem.get() )
+ {
+ retrieveConfigUndoSteps();
+ }
+ fireModifyEvent();
+ }
+}
+
+void UndoManager::impl_undoRedo(
+ Reference< frame::XModel > & xCurrentModel,
+ impl::UndoStack * pStackToRemoveFrom,
+ impl::UndoStack * pStackToAddTo,
+ bool bUndo )
+{
+ if( pStackToRemoveFrom && ! pStackToRemoveFrom->empty() )
+ {
+ // get model from undo/redo
+ impl::UndoElement * pTop( pStackToRemoveFrom->top());
+ if( pTop )
+ {
+ impl::ShapeUndoElement* pShapeUndoElement = dynamic_cast< impl::ShapeUndoElement* >( pTop );
+ if ( pShapeUndoElement )
+ {
+ impl::ShapeUndoElement* pNewShapeUndoElement = new impl::ShapeUndoElement( *pShapeUndoElement );
+ pStackToAddTo->push( pNewShapeUndoElement );
+ SdrUndoAction* pAction = pNewShapeUndoElement->getSdrUndoAction();
+ if ( pAction )
+ {
+ if ( bUndo )
+ {
+ pAction->Undo();
+ }
+ else
+ {
+ pAction->Redo();
+ }
+ }
+ }
+ else
+ {
+ // put a clone of current model into redo/undo stack with the same
+ // action string as the undo/redo
+ pStackToAddTo->push( pTop->createFromModel( xCurrentModel ));
+ // change current model by properties of the model from undo
+ pTop->applyToModel( xCurrentModel );
+ }
+ // remove the top undo element
+ pStackToRemoveFrom->pop(), pTop = 0;
+ ChartViewHelper::setViewToDirtyState( xCurrentModel );
+ fireModifyEvent();
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "Can't Undo/Redo" );
+ }
+}
+
+void UndoManager::fireModifyEvent()
+{
+ if( m_xModifyBroadcaster.is())
+ m_pModifyBroadcaster->fireEvent();
+}
+
+
+// ____ ConfigItemListener ____
+void UndoManager::notify( const ::rtl::OUString & rPropertyName )
+{
+ OSL_ENSURE( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Steps" )),
+ "Unwanted config property change Notified" );
+ if( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Steps" )))
+ retrieveConfigUndoSteps();
+}
+
+void UndoManager::retrieveConfigUndoSteps()
+{
+ if( ! m_apUndoStepsConfigItem.get())
+ m_apUndoStepsConfigItem.reset( new impl::UndoStepsConfigItem( *this ));
+ m_nMaxNumberOfUndos = m_apUndoStepsConfigItem->getUndoSteps();
+ m_apUndoStack->limitSize( m_nMaxNumberOfUndos );
+ m_apRedoStack->limitSize( m_nMaxNumberOfUndos );
+
+ // a list of available undo steps could shrink here
+ fireModifyEvent();
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL UndoManager::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ if( ! m_xModifyBroadcaster.is())
+ {
+ m_pModifyBroadcaster = new impl::ModifyBroadcaster();
+ m_xModifyBroadcaster.set( static_cast< cppu::OWeakObject* >( m_pModifyBroadcaster ), uno::UNO_QUERY );
+ }
+ m_xModifyBroadcaster->addModifyListener( aListener );
+}
+
+void SAL_CALL UndoManager::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ if( ! m_xModifyBroadcaster.is())
+ {
+ m_pModifyBroadcaster = new impl::ModifyBroadcaster();
+ m_xModifyBroadcaster.set( static_cast< cppu::OWeakObject* >( m_pModifyBroadcaster ), uno::UNO_QUERY );
+ }
+ m_xModifyBroadcaster->removeModifyListener( aListener );
+}
+
+// ____ chart2::XUndoManager ____
+void SAL_CALL UndoManager::preAction( const Reference< frame::XModel >& xModelBeforeChange )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( ! m_pLastRemeberedUndoElement, "Looks like postAction or cancelAction call was missing" );
+ m_pLastRemeberedUndoElement = new impl::UndoElement( xModelBeforeChange );
+}
+
+void SAL_CALL UndoManager::preActionWithArguments(
+ const Reference< frame::XModel >& xModelBeforeChange,
+ const Sequence< beans::PropertyValue >& aArguments )
+ throw (uno::RuntimeException)
+{
+ bool bActionHandled( false );
+ OSL_ENSURE( ! m_pLastRemeberedUndoElement, "Looks like postAction or cancelAction call was missing" );
+ if( aArguments.getLength() > 0 )
+ {
+ OSL_ENSURE( aArguments.getLength() == 1, "More than one argument is not supported yet" );
+ if( aArguments[0].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("WithData")))
+ {
+ m_pLastRemeberedUndoElement = new impl::UndoElementWithData( xModelBeforeChange );
+ bActionHandled = true;
+ }
+ else if( aArguments[0].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("WithSelection")))
+ {
+ m_pLastRemeberedUndoElement = new impl::UndoElementWithSelection( xModelBeforeChange );
+ bActionHandled = true;
+ }
+ }
+
+ if( !bActionHandled )
+ preAction( xModelBeforeChange );
+}
+
+void SAL_CALL UndoManager::postAction( const OUString& aUndoText )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( m_pLastRemeberedUndoElement, "Looks like preAction call was missing" );
+ if( m_pLastRemeberedUndoElement )
+ {
+ m_pLastRemeberedUndoElement->setActionString( aUndoText );
+ m_apUndoStack->push( m_pLastRemeberedUndoElement );
+ m_pLastRemeberedUndoElement = 0;
+
+ // redo no longer possible
+ m_apRedoStack->disposeAndClear();
+
+ // it suffices to get the number of undo steps from config after the
+ // first time postAction has been called
+ if( ! m_apUndoStepsConfigItem.get())
+ retrieveConfigUndoSteps();
+
+ fireModifyEvent();
+ }
+}
+
+void SAL_CALL UndoManager::cancelAction()
+ throw (uno::RuntimeException)
+{
+ delete m_pLastRemeberedUndoElement;
+ m_pLastRemeberedUndoElement = 0;
+}
+
+void SAL_CALL UndoManager::cancelActionWithUndo( Reference< frame::XModel >& xModelToRestore )
+ throw (uno::RuntimeException)
+{
+ if( m_pLastRemeberedUndoElement )
+ {
+ m_pLastRemeberedUndoElement->applyToModel( xModelToRestore );
+ cancelAction();
+ }
+}
+
+void SAL_CALL UndoManager::undo( Reference< frame::XModel >& xCurrentModel )
+ throw (uno::RuntimeException)
+{
+ OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get());
+ impl_undoRedo( xCurrentModel, m_apUndoStack.get(), m_apRedoStack.get(), true );
+}
+
+void SAL_CALL UndoManager::redo( Reference< frame::XModel >& xCurrentModel )
+ throw (uno::RuntimeException)
+{
+ OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get());
+ impl_undoRedo( xCurrentModel, m_apRedoStack.get(), m_apUndoStack.get(), false );
+}
+
+::sal_Bool SAL_CALL UndoManager::undoPossible()
+ throw (uno::RuntimeException)
+{
+ return ! m_apUndoStack->empty();
+}
+
+::sal_Bool SAL_CALL UndoManager::redoPossible()
+ throw (uno::RuntimeException)
+{
+ return ! m_apRedoStack->empty();
+}
+
+OUString SAL_CALL UndoManager::getCurrentUndoString()
+ throw (uno::RuntimeException)
+{
+ return m_apUndoStack->topUndoString();
+}
+
+OUString SAL_CALL UndoManager::getCurrentRedoString()
+ throw (uno::RuntimeException)
+{
+ return m_apRedoStack->topUndoString();
+}
+
+Sequence< OUString > SAL_CALL UndoManager::getAllUndoStrings()
+ throw (uno::RuntimeException)
+{
+ return m_apUndoStack->getUndoStrings();
+}
+
+Sequence< OUString > SAL_CALL UndoManager::getAllRedoStrings()
+ throw (uno::RuntimeException)
+{
+ return m_apRedoStack->getUndoStrings();
+}
+
+// ____ XUndoHelper ____
+Reference< frame::XModel > SAL_CALL UndoManager::getModelCloneForUndo(
+ const Reference< frame::XModel >& xModelBeforeChange )
+ throw (uno::RuntimeException)
+{
+ return impl::UndoElement::cloneModel( xModelBeforeChange );
+}
+
+void SAL_CALL UndoManager::applyModelContent(
+ Reference< frame::XModel >& xModelToChange,
+ const Reference< frame::XModel >& xModelToCopyFrom )
+ throw (uno::RuntimeException)
+{
+ impl::UndoElement::applyModelContentToModel( xModelToChange, xModelToCopyFrom );
+}
+
+// ____ XUnoTunnel ____
+sal_Int64 UndoManager::getSomething( const Sequence< sal_Int8 >& rId )
+ throw (uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
+ }
+ return 0;
+}
+
+// static
+const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 >* pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// static
+UndoManager* UndoManager::getImplementation( const Reference< uno::XInterface > xObj )
+{
+ UndoManager* pRet = NULL;
+ Reference< lang::XUnoTunnel > xUT( xObj, uno::UNO_QUERY );
+ if ( xUT.is() )
+ {
+ pRet = reinterpret_cast< UndoManager* >( sal::static_int_cast< sal_IntPtr >( xUT->getSomething( getUnoTunnelId() ) ) );
+ }
+ return pRet;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/main/_serviceregistration_controller.cxx b/chart2/source/controller/main/_serviceregistration_controller.cxx
new file mode 100644
index 000000000000..0371f50f9996
--- /dev/null
+++ b/chart2/source/controller/main/_serviceregistration_controller.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartController.hxx"
+#include "ChartFrameloader.hxx"
+#include "dlg_CreationWizard_UNO.hxx"
+#include "dlg_ChartType_UNO.hxx"
+#include "ChartDocumentWrapper.hxx"
+#include "AccessibleChartView.hxx"
+#include "ElementSelector.hxx"
+#include "ShapeToolbarController.hxx"
+#include <cppuhelper/implementationentry.hxx>
+
+static struct ::cppu::ImplementationEntry g_entries_chart2_controller[] =
+{
+ {
+ ::chart::ChartController::create
+ , ::chart::ChartController::getImplementationName_Static
+ , ::chart::ChartController::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ChartFrameLoader::create
+ , ::chart::ChartFrameLoader::getImplementationName_Static
+ , ::chart::ChartFrameLoader::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::CreationWizardUnoDlg::create
+ , ::chart::CreationWizardUnoDlg::getImplementationName_Static
+ , ::chart::CreationWizardUnoDlg::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ChartTypeUnoDlg::Create
+ , ::chart::ChartTypeUnoDlg::getImplementationName_Static
+ , ::chart::ChartTypeUnoDlg::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::wrapper::ChartDocumentWrapper::create
+ , ::chart::wrapper::ChartDocumentWrapper::getImplementationName_Static
+ , ::chart::wrapper::ChartDocumentWrapper::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ElementSelectorToolbarController::create
+ , ::chart::ElementSelectorToolbarController::getImplementationName_Static
+ , ::chart::ElementSelectorToolbarController::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ShapeToolbarController::create
+ , ::chart::ShapeToolbarController::getImplementationName_Static
+ , ::chart::ShapeToolbarController::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey , g_entries_chart2_controller );
+}
+}
+//=========================================================================
diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk
new file mode 100644
index 000000000000..729276d5bd0e
--- /dev/null
+++ b/chart2/source/controller/main/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcontroller
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES = \
+ $(SLO)$/ConfigurationAccess.obj \
+ $(SLO)$/ElementSelector.obj \
+ $(SLO)$/SelectionHelper.obj \
+ $(SLO)$/PositionAndSizeHelper.obj \
+ $(SLO)$/ChartWindow.obj \
+ $(SLO)$/ChartController.obj \
+ $(SLO)$/ChartController_EditData.obj \
+ $(SLO)$/ChartController_Window.obj \
+ $(SLO)$/ChartController_Properties.obj \
+ $(SLO)$/ChartController_Insert.obj \
+ $(SLO)$/ChartController_TextEdit.obj \
+ $(SLO)$/ChartController_Position.obj \
+ $(SLO)$/ChartController_Tools.obj \
+ $(SLO)$/ChartFrameloader.obj \
+ $(SLO)$/ChartRenderer.obj \
+ $(SLO)$/CommandDispatchContainer.obj \
+ $(SLO)$/CommandDispatch.obj \
+ $(SLO)$/ControllerCommandDispatch.obj \
+ $(SLO)$/UndoCommandDispatch.obj \
+ $(SLO)$/DragMethod_Base.obj \
+ $(SLO)$/DragMethod_RotateDiagram.obj \
+ $(SLO)$/DragMethod_PieSegment.obj \
+ $(SLO)$/ObjectHierarchy.obj \
+ $(SLO)$/_serviceregistration_controller.obj \
+ $(SLO)$/ChartDropTargetHelper.obj \
+ $(SLO)$/StatusBarCommandDispatch.obj \
+ $(SLO)$/ChartTransferable.obj \
+ $(SLO)$/FeatureCommandDispatchBase.obj \
+ $(SLO)$/DrawCommandDispatch.obj \
+ $(SLO)$/ShapeController.obj \
+ $(SLO)$/ShapeToolbarController.obj \
+ $(SLO)$/ImplUndoManager.obj \
+ $(SLO)$/UndoManager.obj \
+ $(SLO)$/UndoGuard.obj
+
+# $(SLO)$/CommonConverters.obj \
+# $(SLO)$/Scaling.obj \
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk
new file mode 100644
index 000000000000..fbc888f38c3f
--- /dev/null
+++ b/chart2/source/controller/makefile.mk
@@ -0,0 +1,136 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..
+PRJNAME= chart2
+TARGET= chartcontroller
+
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- export library -------------------------------------------------
+
+#You can use several library macros of this form to build libraries that
+#do not consist of all object files in a directory or to merge different libraries.
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+LIB1FILES= \
+ $(SLB)$/chcontroller.lib \
+ $(SLB)$/chcdrawinglayer.lib \
+ $(SLB)$/chcitemsetwrapper.lib \
+ $(SLB)$/chcdialogs.lib \
+ $(SLB)$/chchartapiwrapper.lib \
+ $(SLB)$/chcaccessibility.lib
+
+#--------
+
+#Indicates the filename of the shared library.
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+
+#indicates dependencies:
+.IF "$(COM)" == "MSC"
+SHL1DEPN = \
+ $(LB)$/icharttools.lib \
+ $(LB)$/ichartview.lib
+.ELSE
+SHL1DEPN =
+.ENDIF
+
+#Specifies an import library to create. For Win32 only.
+SHL1IMPLIB= i$(TARGET)
+
+#Specifies libraries from the same module to put into the shared library.
+#was created above
+SHL1LIBS= $(LIB1TARGET)
+
+#Links import libraries.
+
+SHL1STDLIBS= $(CHARTTOOLS) \
+ $(CHARTVIEW) \
+ $(EDITENGLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
+ $(BASEGFXLIB) \
+ $(SALLIB) \
+ $(SVLLIB) \
+ $(SVTOOLLIB) \
+ $(SVXCORELIB) \
+ $(SVXLIB) \
+ $(TKLIB) \
+ $(TOOLSLIB) \
+ $(VCLLIB) \
+ $(SFXLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB)
+
+#--------exports
+
+#specifies the exported symbols for Windows only:
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
+
+#--------definition file
+
+#name of the definition file:
+DEF1NAME= $(SHL1TARGET)
+
+# --- Resources ---------------------------------------------------------------
+
+# sfx.srs is needed for the strings for UNDO and REDO in the UndoCommandDispatch
+RESLIB1LIST=\
+ $(SRS)$/chcdialogs.srs \
+ $(SRS)$/chcmenus.srs \
+ $(SOLARCOMMONRESDIR)$/sfx.srs
+
+RESLIB1NAME= $(TARGET)
+RESLIB1IMAGES=$(PRJ)$/res
+RESLIB1SRSFILES=$(RESLIB1LIST)
+RESLIB1DEPN=$(RESLIB1LIST)
+
+#RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+#RESLIB1DEPN= SRCFILES
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+ALLTAR : $(MISC)/chartcontroller.component
+
+$(MISC)/chartcontroller.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt chartcontroller.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt chartcontroller.component
diff --git a/chart2/source/controller/menus/ShapeContextMenu.src b/chart2/source/controller/menus/ShapeContextMenu.src
new file mode 100644
index 000000000000..79e424707807
--- /dev/null
+++ b/chart2/source/controller/menus/ShapeContextMenu.src
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "MenuResIds.hrc"
+#include "ShapeController.hrc"
+
+
+Menu RID_CONTEXTMENU_SHAPE
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = COMMAND_ID_FORMAT_LINE;
+ Command = ".uno:FormatLine";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_FORMAT_AREA;
+ Command = ".uno:FormatArea";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_TEXT_ATTRIBUTES;
+ Command = ".uno:TextAttributes";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_TRANSFORM_DIALOG;
+ Command = ".uno:TransformDialog";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_OBJECT_TITLE_DESCRIPTION;
+ Command = ".uno:ObjectTitleDescription";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_RENAME_OBJECT;
+ Command = ".uno:RenameObject";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_ARRANGE_ROW;
+ Command = ".uno:ArrangeRow";
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = COMMAND_ID_BRING_TO_FRONT;
+ Command = ".uno:BringToFront";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_FORWARD;
+ Command = ".uno:Forward";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_BACKWARD;
+ Command = ".uno:Backward";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_SEND_TO_BACK;
+ Command = ".uno:SendToBack";
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_CUT;
+ Command = ".uno:Cut";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_COPY;
+ Command = ".uno:Copy";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_PASTE;
+ Command = ".uno:Paste";
+ };
+ };
+};
diff --git a/chart2/source/controller/menus/ShapeEditContextMenu.src b/chart2/source/controller/menus/ShapeEditContextMenu.src
new file mode 100644
index 000000000000..60f5d4eab5af
--- /dev/null
+++ b/chart2/source/controller/menus/ShapeEditContextMenu.src
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "MenuResIds.hrc"
+#include "ShapeController.hrc"
+
+
+Menu RID_CONTEXTMENU_SHAPEEDIT
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = COMMAND_ID_FONT_DIALOG;
+ Command = ".uno:FontDialog";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_PARAGRAPH_DIALOG;
+ Command = ".uno:ParagraphDialog";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_CUT;
+ Command = ".uno:Cut";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_COPY;
+ Command = ".uno:Copy";
+ };
+ MenuItem
+ {
+ Identifier = COMMAND_ID_PASTE;
+ Command = ".uno:Paste";
+ };
+ };
+};
diff --git a/chart2/source/controller/menus/makefile.mk b/chart2/source/controller/menus/makefile.mk
new file mode 100644
index 000000000000..f97548963e38
--- /dev/null
+++ b/chart2/source/controller/menus/makefile.mk
@@ -0,0 +1,63 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcmenus
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# i26518 the gcc-3.0.4 requires to enhance the template-depth
+# this seems to be a compiler issue, so we recommend not to use 3.0.x anymore
+.IF "$(COM)"=="GCC"
+ CFLAGS+=-ftemplate-depth-128
+.ENDIF
+
+# --- Resources ---------------------------------------------------------------
+
+SRC1FILES= \
+ ShapeContextMenu.src \
+ ShapeEditContextMenu.src
+
+SRS1NAME=$(TARGET)
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+#dependencies:
+
+$(SRS)$/chcmenus.srs: \
+ ..$/inc$/MenuResIds.hrc
+
+#$(SRS)$/$(TARGET).srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
new file mode 100644
index 000000000000..75e69436a784
--- /dev/null
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TOOLS_AXISHELPER_HXX
+#define _CHART2_TOOLS_AXISHELPER_HXX
+
+#include "charttoolsdllapi.hxx"
+#include "ReferenceSizeProvider.hxx"
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
+
+ static ::com::sun::star::chart2::ScaleData createDefaultScale();
+
+ static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData );
+
+ static bool isLogarithmic( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling >& xScaling );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider = 0 );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ createAxis(
+ sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext
+ , ReferenceSizeProvider * pRefSizeProvider = 0 );
+
+ static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider = 0 );
+
+ static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
+ static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+ static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static sal_Bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+ static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+
+ static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+
+ static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram);
+
+ SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
+ static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
+ getCoordinateSystemByIndex(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , sal_Int32 nIndex );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
+ getCoordinateSystemOfAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ getCrossingMainAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >
+ getParallelAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ getGridProperties( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex //0: Primary axies, 1: secondary axis
+ , sal_Int32 nSubGridIndex = -1 //-1: Main Grid; 0: First SubGrid etc
+ );
+
+ static sal_Int32 getDimensionIndexOfAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static bool getIndicesForAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
+
+ static bool getIndicesForAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
+
+ /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
+ </TRUE> are returned
+ */
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > >
+ getAllAxesOfDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , bool bOnlyVisible = false );
+
+ /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
+ </TRUE> are returned
+ */
+ SAL_DLLPRIVATE static std::vector<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > >
+ getAllAxesOfCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , bool bOnlyVisible = false );
+
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > >
+ getAllGrids( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static void getAxisOrGridPossibilities( ::com::sun::star::uno::Sequence< sal_Bool >& rPossibilityList
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
+
+ static void getAxisOrGridExcistence( ::com::sun::star::uno::Sequence< sal_Bool >& rExcistenceList
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
+
+ static bool changeVisibilityOfGrids( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
+ , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
+ , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
+ static bool changeVisibilityOfAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
+ , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
+ , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider = 0 );
+
+ static bool shouldAxisBeDisplayed( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+ static bool isSecondaryYAxisNeeded( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ getChartTypeByIndex( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys, sal_Int32 nIndex );
+
+ static void setRTLAxisLayout( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ getFirstChartTypeWithSeriesAttachedToAxisIndex( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
+
+ static bool isAxisPositioningEnabled();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/AxisIndexDefines.hxx b/chart2/source/inc/AxisIndexDefines.hxx
new file mode 100644
index 000000000000..d994f8a85ea4
--- /dev/null
+++ b/chart2/source/inc/AxisIndexDefines.hxx
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_AXISINDEX_HXX
+#define CHART2_AXISINDEX_HXX
+
+namespace chart
+{
+
+const sal_Int32 MAIN_AXIS_INDEX = 0;
+const sal_Int32 SECONDARY_AXIS_INDEX = 1;
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx
new file mode 100644
index 000000000000..384841261073
--- /dev/null
+++ b/chart2/source/inc/BaseGFXHelper.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_BASEGFXHELPER_HXX
+#define CHART2_BASEGFXHELPER_HXX
+
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/range/b2irectangle.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/range/b3drange.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+namespace BaseGFXHelper
+{
+
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DRange getBoundVolume( const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPoly );
+
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle(
+ const com::sun::star::awt::Point& rPosition,
+ const com::sun::star::awt::Size& rSize );
+
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::awt::Point B2IRectangleToAWTPoint(
+ const ::basegfx::B2IRectangle& rB2IRectangle );
+
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::awt::Size B2IRectangleToAWTSize(
+ const ::basegfx::B2IRectangle& rB2IRectangle );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+com::sun::star::awt::Rectangle B2IRectangleToAWTRectangle(
+ const ::basegfx::B2IRectangle& rB2IRectangle );
+
+::basegfx::B3DVector Direction3DToB3DVector(
+ const com::sun::star::drawing::Direction3D& rDirection );
+
+com::sun::star::drawing::Direction3D B3DVectorToDirection3D(
+ const ::basegfx::B3DVector& rB3DVector );
+
+::basegfx::B3DVector Position3DToB3DVector(
+ const com::sun::star::drawing::Position3D& rPosition );
+
+com::sun::star::drawing::Position3D B3DVectorToPosition3D(
+ const ::basegfx::B3DVector& rB3DVector );
+
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(
+ const ::com::sun::star::drawing::HomogenMatrix & rHomogenMatrix );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+::com::sun::star::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(
+ const ::basegfx::B3DHomMatrix & rB3DMatrix );
+
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetRotationFromMatrix(
+ const ::basegfx::B3DHomMatrix & rB3DMatrix );
+
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetScaleFromMatrix(
+ const ::basegfx::B3DHomMatrix & rB3DMatrix );
+
+void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix );
+
+OOO_DLLPUBLIC_CHARTTOOLS double Deg2Rad( double fDegrees );
+OOO_DLLPUBLIC_CHARTTOOLS double Rad2Deg( double fRadians );
+
+} // namespace BaseGFXHelper
+} // namespace chart
+
+// CHART2_BASEGFXHELPER_HXX
+#endif
diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx
new file mode 100644
index 000000000000..2ad418939945
--- /dev/null
+++ b/chart2/source/inc/CachedDataSequence.hxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_CACHEDDATASEQUENCE_HXX
+#define _CHART_CACHEDDATASEQUENCE_HXX
+
+// helper classes
+#include <cppuhelper/compbase7.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include "ServiceMacros.hxx"
+
+// interfaces and types
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#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 <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <vector>
+
+// ____________________
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper7<
+ ::com::sun::star::chart2::data::XDataSequence,
+ ::com::sun::star::chart2::data::XNumericalDataSequence,
+ ::com::sun::star::chart2::data::XTextualDataSequence,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo >
+ CachedDataSequence_Base;
+}
+
+class CachedDataSequence :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
+ public impl::CachedDataSequence_Base
+{
+public:
+ /** constructs an empty sequence
+ */
+ CachedDataSequence();
+
+ explicit CachedDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+ /** creates a sequence and initializes it with the given string. This is
+ especially useful for labels, which only have one element.
+ */
+ explicit CachedDataSequence( const ::rtl::OUString & rSingleText );
+
+ /// Copy CTOR
+ explicit CachedDataSequence( const CachedDataSequence & rSource );
+
+ virtual ~CachedDataSequence();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( CachedDataSequence )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ XPropertySet ____
+ /// @see ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @see ::comphelper::OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ /// @see ::comphelper::OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+
+ // ____ XDataSequence ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel(
+ ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XNumericalDataSequence ____
+ /// @see ::com::sun::star::chart::data::XNumericalDataSequence
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTextualDataSequence ____
+ /// @see ::com::sun::star::chart::data::XTextualDataSequence
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XInitialization:
+ virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
+
+ // <properties>
+ sal_Int32 m_nNumberFormatKey;
+ ::rtl::OUString m_sRole;
+ // </properties>
+
+ enum DataType
+ {
+ NUMERICAL,
+ TEXTUAL,
+ MIXED
+ };
+
+ /** This method registers all properties. It should be called by all
+ constructors.
+ */
+ void registerProperties();
+
+private:
+ /** is used by interface method getNumericalData().
+ */
+ ::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const;
+ /** is used by interface method getTextualData().
+ */
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > Impl_getTextualData() const;
+ /** is used by interface method getData().
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Impl_getMixedData() const;
+
+private:
+ enum DataType m_eCurrentDataType;
+
+ ::com::sun::star::uno::Sequence< double > m_aNumericalSequence;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTextualSequence;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any > m_aMixedSequence;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
+ m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+
+// _CHART_CACHEDDATASEQUENCE_HXX
+#endif
diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx
new file mode 100644
index 000000000000..0742435e9bfe
--- /dev/null
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARACTERPROPERTIES_HXX
+#define CHART_CHARACTERPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements services
+// com.sun.star.style.CharacterProperties
+// com.sun.star.style.CharacterPropertiesAsian
+// com.sun.star.style.CharacterPropertiesComplex
+class OOO_DLLPUBLIC_CHARTTOOLS CharacterProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // com.sun.star.style.CharacterProperties
+ PROP_CHAR_FONT_NAME = FAST_PROPERTY_ID_START_CHAR_PROP, // ?
+ PROP_CHAR_FONT_STYLE_NAME,
+ PROP_CHAR_FONT_FAMILY,
+ PROP_CHAR_FONT_CHAR_SET,
+ PROP_CHAR_FONT_PITCH,
+ PROP_CHAR_COLOR,
+// PROP_CHAR_BACKGROUND_COLOR,
+//-- PROP_CHAR_BACKGROUND_TRANSPARENCY, alpah channnel in COLOR
+ PROP_CHAR_ESCAPEMENT,
+ PROP_CHAR_CHAR_HEIGHT,
+ PROP_CHAR_UNDERLINE,
+ PROP_CHAR_UNDERLINE_COLOR,
+ PROP_CHAR_UNDERLINE_HAS_COLOR,
+ PROP_CHAR_WEIGHT,
+ PROP_CHAR_POSTURE,
+ PROP_CHAR_AUTO_KERNING,
+ PROP_CHAR_KERNING,
+// PROP_CHAR_CASE_MAPPING,
+// PROP_CHAR_ROTATION,
+//-- PROP_CHAR_ROTATION_IS_FIT_TO_LINE,
+// PROP_CHAR_SCALE_WIDTH,
+ PROP_CHAR_ESCAPEMENT_HEIGHT,
+
+// PROP_CHAR_CROSSED_OUT,
+ PROP_CHAR_STRIKE_OUT,
+ PROP_CHAR_WORD_MODE,
+// PROP_CHAR_FLASH,
+ PROP_CHAR_LOCALE,
+//-- PROP_CHAR_KEEP_TOGETHER,
+//-- PROP_CHAR_NO_LINE_BREAK,
+ PROP_CHAR_SHADOWED,
+ PROP_CHAR_CONTOURED,
+ PROP_CHAR_RELIEF,
+//-- PROP_CHAR_COMBINE_IS_ON,
+//-- PROP_CHAR_COMBINE_PREFIX,
+//-- PROP_CHAR_COMBINE_SUFFIX,
+
+ PROP_CHAR_EMPHASIS,
+// PROP_CHAR_RUBY_TEXT,
+// PROP_CHAR_RUBY_ADJUST,
+// PROP_CHAR_RUBY_STYLE_NAME,
+// PROP_CHAR_RUBY_IS_ABOVE,
+// PROP_CHAR_INHIBIT_HYPHENATION,
+
+ // Asian (com.sun.star.style.CharacterPropertiesAsian)
+ PROP_CHAR_ASIAN_FONT_NAME,
+ PROP_CHAR_ASIAN_FONT_STYLE_NAME,
+ PROP_CHAR_ASIAN_FONT_FAMILY,
+ PROP_CHAR_ASIAN_CHAR_SET,
+ PROP_CHAR_ASIAN_FONT_PITCH,
+ PROP_CHAR_ASIAN_CHAR_HEIGHT,
+ PROP_CHAR_ASIAN_WEIGHT,
+ PROP_CHAR_ASIAN_POSTURE,
+ PROP_CHAR_ASIAN_LOCALE,
+//-- PROP_CHAR_ASIAN_USE_SCRIPT_TYPE_DISTANCE,
+//-- PROP_CHAR_ASIAN_USE_FORBIDDEN_RULES,
+//-- PROP_CHAR_ASIAN_HANGING_PUNCTUATION_ALLOWED,
+
+ // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
+ PROP_CHAR_COMPLEX_FONT_NAME,
+ PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
+ PROP_CHAR_COMPLEX_FONT_FAMILY,
+ PROP_CHAR_COMPLEX_CHAR_SET,
+ PROP_CHAR_COMPLEX_FONT_PITCH,
+ PROP_CHAR_COMPLEX_CHAR_HEIGHT,
+ PROP_CHAR_COMPLEX_WEIGHT,
+ PROP_CHAR_COMPLEX_POSTURE,
+ PROP_CHAR_COMPLEX_LOCALE,
+ PROP_PARA_IS_CHARACTER_DISTANCE,
+
+ PROP_WRITING_MODE,
+
+ // don't use
+ FAST_PROPERTY_ID_END_CHAR_PROP
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+ static bool IsCharacterPropertyHandle( sal_Int32 nHandle );
+
+ static ::com::sun::star::awt::FontDescriptor createFontDescriptorFromPropertySet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > & xMultiPropSet );
+
+private:
+ // not implemented
+ CharacterProperties();
+};
+
+} // namespace chart
+
+// CHART_CHARACTERPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/ChartDebugTrace.hxx b/chart2/source/inc/ChartDebugTrace.hxx
new file mode 100644
index 000000000000..d31267f9cfc4
--- /dev/null
+++ b/chart2/source/inc/ChartDebugTrace.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CHARTDEBUGTRACE_HXX
+#define CHART2_CHARTDEBUGTRACE_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include "charttoolsdllapi.hxx"
+
+#define CHART_TRACE_OSL_DEBUG_LEVEL 2
+
+namespace chart
+{
+namespace debug
+{
+
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+/** Does several OSL_TRACEs that show information about the given chart document
+ (e.g. the chart-type manager, diagrams etc.)
+
+ If OSL_DEBUG_LEVEL is less than CHART_TRACE_OSL_DEBUG_LEVEL this
+ function does nothing.
+ */
+OOO_DLLPUBLIC_CHARTTOOLS void ChartDebugTraceDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xDoc,
+ int nIndent = 0 );
+
+/** Does several OSL_TRACEs that show information about the given diagram
+ (e.g. coordinate systems, data series etc.)
+
+ If OSL_DEBUG_LEVEL is less than CHART_TRACE_OSL_DEBUG_LEVEL this
+ function does nothing.
+ */
+OOO_DLLPUBLIC_CHARTTOOLS void ChartDebugTraceDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ int nIndent = 0 );
+#endif
+
+} // namespace debug
+} // namespace chart
+
+// CHART2_CHARTDEBUGTRACE_HXX
+#endif
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
new file mode 100644
index 000000000000..fb087abf15fd
--- /dev/null
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_CONTROLLER_CHARTMODELHELPER_HXX
+#define _CHART2_CONTROLLER_CHARTMODELHELPER_HXX
+
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > createRangeHighlighter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier >& xSelectionSupplier );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, bool bConnectToModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >
+ findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >
+ findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
+ getFirstCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+
+ SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > getDataSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+ static ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > getDataSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ getChartTypeOfSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries );
+
+ static ::com::sun::star::awt::Size getDefaultPageSize();
+
+ static ::com::sun::star::awt::Size getPageSize(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static void setPageSize( const ::com::sun::star::awt::Size& rSize
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static void triggerRangeHighlighting( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static bool isIncludeHiddenCells( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static bool setIncludeHiddenCells( bool bIncludeHiddenCells, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
new file mode 100644
index 000000000000..729cfc86bc52
--- /dev/null
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CHARTTYPEHELPER_HXX
+#define _CHART2_CHARTTYPEHELPER_HXX
+
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper
+{
+public:
+ static sal_Bool isSupportingGeometryProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingStatisticProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingRegressionProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingMainAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+ static sal_Bool isSupportingSecondaryAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+ static sal_Bool isSupportingAreaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingSymbolProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingOverlapAndGapWidthProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingBarConnectors( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static sal_Bool isSupportingRightAngledAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool isSupportingAxisSideBySide( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount );
+ static bool isSupportingStartingAngle( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ //starting value for bars or baseline for areas for example
+ static bool isSupportingBaseValue( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool shiftTicksAtXAxisPerDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool isSupportingAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+
+ //returns sequence of ::com::sun::star::chart::DataLabelPlacement
+ static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedLabelPlacements(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+ //returns sequence of ::com::sun::star::chart::MissingValueTreatment
+ static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+
+ SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultSimpleLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultRealisticLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries );
+ SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static sal_Int32 //one of ::com::sun::star::chart2::AxisType
+ getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
+ , sal_Int32 nDimensionIndex );
+
+ static rtl::OUString getRoleOfSequenceForYAxisNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static rtl::OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool isSupportingOnlyDeepStackingFor3D( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/ChartViewHelper.hxx b/chart2/source/inc/ChartViewHelper.hxx
new file mode 100644
index 000000000000..772841418e45
--- /dev/null
+++ b/chart2/source/inc/ChartViewHelper.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_CONTROLLER_CHARTVIEWHELPER_HXX
+#define _CHART2_CONTROLLER_CHARTVIEWHELPER_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper
+{
+public:
+ static void setViewToDirtyState( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx
new file mode 100644
index 000000000000..6747bd614d84
--- /dev/null
+++ b/chart2/source/inc/CloneHelper.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CLONEHELPER_HXX
+#define CHART2_CLONEHELPER_HXX
+
+#include <com/sun/star/util/XCloneable.hpp>
+
+#include <map>
+#include <functional>
+#include <algorithm>
+
+namespace chart
+{
+namespace CloneHelper
+{
+
+/// functor that clones a UNO-Reference
+template< class Interface >
+ struct CreateRefClone : public ::std::unary_function< Interface, Interface >
+{
+ Interface operator() ( const Interface & xOther )
+ {
+ Interface xResult;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >
+ xCloneable( xOther, ::com::sun::star::uno::UNO_QUERY );
+ if( xCloneable.is())
+ xResult.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY );
+
+ return xResult;
+ }
+};
+
+/// functor that clones a map element with a UNO-Reference as value
+template< typename Key, class Interface >
+ struct CreateRefWithKeyClone : public ::std::unary_function<
+ ::std::pair< Key, Interface >,
+ ::std::pair< Key, Interface > >
+{
+ ::std::pair< Key, Interface > operator() (
+ const ::std::pair< Key, Interface > & rOther )
+ {
+ Interface xResult;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >
+ xCloneable( rOther.second, ::com::sun::star::uno::UNO_QUERY );
+ if( xCloneable.is())
+ xResult.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY );
+
+ return ::std::make_pair< Key, Interface >( rOther.first, xResult );
+ }
+};
+
+/// clones a vector of UNO-References
+template< class Interface >
+ void CloneRefVector(
+ const ::std::vector< Interface > & rSource,
+ ::std::vector< Interface > & rDestination )
+{
+ ::std::transform( rSource.begin(), rSource.end(),
+ ::std::back_inserter( rDestination ),
+ CreateRefClone< Interface >());
+}
+
+template< typename Key, class Interface >
+ void CloneRefPairVector(
+ const ::std::vector< ::std::pair< Key, Interface > > & rSource,
+ ::std::vector< ::std::pair< Key, Interface > > & rDestination )
+{
+ ::std::transform( rSource.begin(), rSource.end(),
+ ::std::back_inserter( rDestination ),
+ CreateRefWithKeyClone< Key, Interface >());
+}
+
+/// clones a map of elements with a UNO-Reference as value
+template< typename Key, class Interface >
+ void CloneRefMap(
+ const ::std::map< Key, Interface > & rSource,
+ ::std::map< Key, Interface > & rDestination )
+{
+ ::std::transform( rSource.begin(), rSource.end(),
+ ::std::inserter( rDestination, rDestination.begin() ),
+ CreateRefWithKeyClone< const Key, Interface >());
+}
+
+/// clones a UNO-sequence of UNO-References
+template< class Interface >
+ void CloneRefSequence(
+ const ::com::sun::star::uno::Sequence< Interface > & rSource,
+ ::com::sun::star::uno::Sequence< Interface > & rDestination )
+{
+ rDestination.realloc( rSource.getLength());
+ ::std::transform( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(),
+ rDestination.getArray(),
+ CreateRefClone< Interface >());
+}
+
+} // namespace CloneHelper
+} // namespace chart
+
+// CHART2_CLONEHELPER_HXX
+#endif
diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx
new file mode 100644
index 000000000000..af49918a1154
--- /dev/null
+++ b/chart2/source/inc/ColorPerPointHelper.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_COLORPERPOINTHELPER_HXX
+#define _CHART2_COLORPERPOINTHELPER_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS ColorPerPointHelper
+{
+public:
+ static bool hasPointOwnColor(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xDataSeriesProperties
+ , sal_Int32 nPointIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance
+ );
+
+ // returns true if AttributedDataPoints contains nPointIndex and the
+ // property Color is DEFAULT
+ SAL_DLLPRIVATE static bool hasPointOwnProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSeriesProperties
+ , sal_Int32 nPointIndex );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx
new file mode 100644
index 000000000000..1ce032b3af69
--- /dev/null
+++ b/chart2/source/inc/CommonConverters.hxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __CHART_COMMON_CONVERTERS_HXX
+#define __CHART_COMMON_CONVERTERS_HXX
+
+#include <tools/poly.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+#include <algorithm>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+diverse methods for class conversions; e.g. ::basegfx::B3DHomMatrix to HomogenMatrix
+and operations e.g drawing::Position3D + drawing::Direction3D
+*/
+
+//-----------------------------------------------------------------------------
+/** ::basegfx::B3DHomMatrix -> HomogenMatrix
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix
+ B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM );
+
+//-----------------------------------------------------------------------------
+/** HomogenMatrix -> ::basegfx::B3DHomMatrix
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const com::sun::star::drawing::HomogenMatrix& rHM );
+
+//-----------------------------------------------------------------------------
+/** ::basegfx::B3DHomMatrix -> B2DHomMatrix
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM );
+
+//-----------------------------------------------------------------------------
+/** B2DHomMatrix <-> HomogenMatrix3
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix3
+ B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM );
+
+//-----------------------------------------------------------------------------
+/** Position3D -> B3DPoint
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const com::sun::star::drawing::Position3D& rPosition );
+
+//-----------------------------------------------------------------------------
+/** B3DVector -> Direction3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector);
+
+//-----------------------------------------------------------------------------
+/** B3DPoint -> Position3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint);
+
+//-----------------------------------------------------------------------------
+/** Direction3D -> B3DVector
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const com::sun::star::drawing::Direction3D& rDirection);
+
+//-----------------------------------------------------------------------------
+/** PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+void AddPointToPoly( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly
+ , const com::sun::star::drawing::Position3D& rPos
+ , sal_Int32 nSequenceIndex=0 );
+
+//-----------------------------------------------------------------------------
+/** get a single Point from a Polygon
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly(
+ const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon
+ , sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 );
+
+//-----------------------------------------------------------------------------
+OOO_DLLPUBLIC_CHARTTOOLS
+void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet
+ , const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
+//-----------------------------------------------------------------------------
+/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+void appendPoly( com::sun::star::drawing::PolyPolygonShape3D& rRet
+ , const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
+
+//-----------------------------------------------------------------------------
+/** PolyPolygonBezierCoords -> PolyPolygonShape3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+com::sun::star::drawing::PolyPolygonShape3D BezierToPoly(
+ const com::sun::star::drawing::PolyPolygonBezierCoords& rBezier );
+
+//-----------------------------------------------------------------------------
+/** PolyPolygonShape3D -> drawing::PointSequenceSequence (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+com::sun::star::drawing::PointSequenceSequence PolyToPointSequence(
+ const com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon );
+
+//-----------------------------------------------------------------------------
+/** drawing::PointSequenceSequence + drawing::PointSequenceSequence
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+void appendPointSequence( com::sun::star::drawing::PointSequenceSequence& rTarget
+ , com::sun::star::drawing::PointSequenceSequence& rAdd );
+
+//-----------------------------------------------------------------------------
+/** Position3D + Direction3D == Position3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
+ operator+( const com::sun::star::drawing::Position3D& rPos
+ , const com::sun::star::drawing::Direction3D& rDirection);
+
+//-----------------------------------------------------------------------------
+/** Position3D - Position3D == Direction3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D
+ operator-( const com::sun::star::drawing::Position3D& rPos1
+ , const com::sun::star::drawing::Position3D& rPos2);
+
+//-----------------------------------------------------------------------------
+/** Position3D == Position3D ?
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+bool operator==( const com::sun::star::drawing::Position3D& rPos1
+ , const com::sun::star::drawing::Position3D& rPos2);
+
+//-----------------------------------------------------------------------------
+/** awt::Rect --> awt::Point (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point ToPoint( const com::sun::star::awt::Rectangle& rRectangle );
+
+//-----------------------------------------------------------------------------
+/** awt::Rect --> awt::Size (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size ToSize( const com::sun::star::awt::Rectangle& rRectangle );
+
+//-----------------------------------------------------------------------------
+/** Position3D --> awt::Point (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point Position3DToAWTPoint( const com::sun::star::drawing::Position3D& rPos );
+
+//-----------------------------------------------------------------------------
+/** Direction3D --> awt::Size (2D)
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size Direction3DToAWTSize( const com::sun::star::drawing::Direction3D& rDirection );
+
+//-----------------------------------------------------------------------------
+/** B3DPoint -> Sequence<double>
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint );
+
+//-----------------------------------------------------------------------------
+/** Sequence<double> -> drawing::Position3D
+*/
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D
+ SequenceToPosition3D( const com::sun::star::uno::Sequence< double >& rSeq );
+
+//-----------------------------------------------------------------------------
+/** drawing::Position3D -> Sequence<double>
+*/
+
+OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double >
+ Position3DToSequence( const com::sun::star::drawing::Position3D& rPosition );
+
+//-----------------------------------------------------------------------------
+/** chart2::XDataSequence -> uno::Sequence< double >
+*/
+
+OOO_DLLPUBLIC_CHARTTOOLS
+::com::sun::star::uno::Sequence< double > DataSequenceToDoubleSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xDataSequence );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+::com::sun::star::uno::Sequence< rtl::OUString > DataSequenceToStringSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xDataSequence );
+
+//-----------------------------------------------------------------------------
+/** uno::Sequence< uno::Sequence< T > > -> uno::Sequence< T >
+ */
+template< typename T >
+::com::sun::star::uno::Sequence< T >
+ FlattenSequence( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< T > > & aSeqSeq )
+{
+ sal_Int32 nOuter, nInner, nCount = 0,
+ nResultSize = 0;
+ const sal_Int32 nOuterSize = aSeqSeq.getLength();
+ for( nOuter=0; nOuter<nOuterSize; ++nOuter )
+ nResultSize += aSeqSeq[nOuter].getLength();
+ ::com::sun::star::uno::Sequence< T > aResult( nResultSize );
+
+ for( nOuter=0; nOuter<nOuterSize; ++nOuter )
+ {
+ const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength();
+ for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount )
+ aResult[nCount] = aSeqSeq[nOuter][nInner];
+ }
+ return aResult;
+}
+
+template< typename T >
+ ::std::vector< T >
+ FlattenVector( const ::std::vector< ::std::vector< T > > & rVecVec )
+{
+ typedef ::std::vector< T > tFlatVec;
+ typedef ::std::vector< tFlatVec > tVecVec;
+
+ tFlatVec aResult;
+ typename tVecVec::const_iterator aOuterEnd( rVecVec.end());
+ for( typename tVecVec::const_iterator aOuterIt( rVecVec.begin()); aOuterIt != aOuterEnd; ++aOuterIt )
+ ::std::copy( aOuterIt->begin(), aOuterIt->end(), back_inserter( aResult ));
+ return aResult;
+}
+
+OOO_DLLPUBLIC_CHARTTOOLS
+sal_Bool hasDoubleValue( const ::com::sun::star::uno::Any& rAny );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+sal_Bool hasLongOrShortValue( const ::com::sun::star::uno::Any& rAny );
+OOO_DLLPUBLIC_CHARTTOOLS
+sal_Int16 getShortForLongAlso( const ::com::sun::star::uno::Any& rAny );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+bool replaceParamterInString( rtl::OUString & rInOutResourceString,
+ const rtl::OUString & rParamToReplace,
+ const rtl::OUString & rReplaceWith );
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx
new file mode 100644
index 000000000000..13435741e63e
--- /dev/null
+++ b/chart2/source/inc/CommonFunctors.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_COMMONFUNCTORS_HXX
+#define CHART2_COMMONFUNCTORS_HXX
+
+#include <algorithm>
+#include <functional>
+#include <rtl/math.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+namespace CommonFunctors
+{
+
+/** unary function to convert any type T into a ::com::sun::star::uno::Any.
+
+ <p>uno::makeAny is an inline function. Thus is cannot be taken directly
+ (via mem_fun_ptr)</p>
+*/
+template< typename T >
+ struct makeAny : public ::std::unary_function< T, ::com::sun::star::uno::Any >
+{
+ ::com::sun::star::uno::Any operator() ( const T & aVal )
+ {
+ return ::com::sun::star::uno::makeAny( aVal );
+ }
+};
+
+/** unary function to convert ::com::sun::star::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 : public ::std::unary_function< ::com::sun::star::uno::Any, double >
+{
+ double operator() ( const ::com::sun::star::uno::Any & rAny )
+ {
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ ::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() );
+ if( eClass == ::com::sun::star::uno::TypeClass_STRING )
+ {
+ rtl_math_ConversionStatus eConversionStatus;
+ fResult = ::rtl::math::stringToDouble(
+ * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ),
+ sal_Char( '.' ), sal_Char( ',' ),
+ & eConversionStatus, NULL );
+
+ if( eConversionStatus != rtl_math_ConversionStatus_Ok )
+ ::rtl::math::setNan( & fResult );
+ }
+ else if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE )
+ {
+ fResult = * reinterpret_cast< const double * >( rAny.getValue() );
+ }
+
+ return fResult;
+ }
+};
+
+/** unary function to convert ::com::sun::star::uno::Any into an
+ ::rtl::OUString.
+*/
+struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString : public ::std::unary_function< ::com::sun::star::uno::Any, ::rtl::OUString >
+{
+ ::rtl::OUString operator() ( const ::com::sun::star::uno::Any & rAny )
+ {
+ ::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() );
+ if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE )
+ {
+ const double* pDouble = reinterpret_cast< const double * >( rAny.getValue() );
+ if( ::rtl::math::isNan(*pDouble) )
+ return ::rtl::OUString();
+ return ::rtl::math::doubleToUString(
+ * pDouble,
+ rtl_math_StringFormat_Automatic,
+ -1, // use maximum decimal places available
+ sal_Char( '.' ), // decimal separator
+ false // do not erase trailing zeros
+ );
+ }
+ else if( eClass == ::com::sun::star::uno::TypeClass_STRING )
+ {
+ return * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() );
+ }
+
+ return ::rtl::OUString();
+ }
+};
+
+/** unary function to convert an ::rtl::OUString into a double number.
+
+ <p>For conversion rtl::math::StringToDouble is used.</p>
+ */
+struct OOO_DLLPUBLIC_CHARTTOOLS OUStringToDouble : public ::std::unary_function< ::rtl::OUString, double >
+{
+ double operator() ( const ::rtl::OUString & rStr )
+ {
+ rtl_math_ConversionStatus eConversionStatus;
+ double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus, NULL );
+
+ if( eConversionStatus != rtl_math_ConversionStatus_Ok )
+ ::rtl::math::setNan( & fResult );
+
+ return fResult;
+ }
+};
+
+/** unary function to convert a double number into an ::rtl::OUString.
+
+ <p>For conversion rtl::math::DoubleToOUString is used.</p>
+ */
+struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString : public ::std::unary_function< double, ::rtl::OUString >
+{
+ ::rtl::OUString operator() ( double fNumber )
+ {
+ return ::rtl::math::doubleToUString(
+ fNumber,
+ rtl_math_StringFormat_Automatic,
+ -1, // use maximum number of decimal places
+ static_cast< sal_Char >( '.' ),
+ false // do not erase trailing zeros
+ );
+ }
+};
+
+// ================================================================================
+
+/** can be used to find an element with a specific first element in e.g. a
+ vector of pairs (for searching keys in maps you will of course use map::find)
+ */
+template< typename First, typename Second >
+ class FirstOfPairEquals : public ::std::unary_function< ::std::pair< First, Second >, bool >
+{
+public:
+ FirstOfPairEquals( const First & aVal )
+ : m_aValueToCompareWith( aVal )
+ {}
+ bool operator() ( const ::std::pair< First, Second > & rElem )
+ {
+ return rElem.first == m_aValueToCompareWith;
+ }
+
+private:
+ First m_aValueToCompareWith;
+};
+
+/** can be used to find a certain value in a map
+
+ ::std::find_if( aMap.begin(), aMap.end(),
+ SecondOfPairEquals< string, int >( 42 ));
+ */
+template< typename Key, typename Value >
+ class SecondOfPairEquals : public ::std::unary_function< ::std::pair< Key, Value >, bool >
+{
+public:
+ SecondOfPairEquals( const Value & aVal )
+ : m_aValueToCompareWith( aVal )
+ {}
+ bool operator() ( const ::std::pair< Key, Value > & rMapElem )
+ {
+ return rMapElem.second == m_aValueToCompareWith;
+ }
+
+private:
+ Value m_aValueToCompareWith;
+};
+
+/** Searches for data in a given map, i.e. not for the key but for the data
+ pointed to by the keys.
+
+ To find a key (value) you can use rMap.find( rValue )
+ */
+template< class MapType >
+ inline typename MapType::const_iterator
+ findValueInMap( const MapType & rMap, const typename MapType::mapped_type & rData )
+{
+ return ::std::find_if( rMap.begin(), rMap.end(),
+ ::std::compose1( ::std::bind2nd(
+ ::std::equal_to< typename MapType::mapped_type >(),
+ rData ),
+ ::std::select2nd< typename MapType::value_type >()));
+}
+
+/** Functor that deletes the object behind the given pointer by calling the
+ delete operator
+ */
+template< typename T >
+ struct DeletePtr : public ::std::unary_function< T *, void >
+{
+ void operator() ( T * pObj )
+ { delete pObj; }
+};
+
+} // namespace CommonFunctors
+} // namespace chart
+
+// CHART2_COMMONFUNCTORS_HXX
+#endif
diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx
new file mode 100644
index 000000000000..56d13f8971c1
--- /dev/null
+++ b/chart2/source/inc/ConfigColorScheme.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CONFIG_COLOR_SCHEME_HXX
+#define CHART2_CONFIG_COLOR_SCHEME_HXX
+
+#include "ServiceMacros.hxx"
+#include "ConfigItemListener.hxx"
+#include "charttoolsdllapi.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/XColorScheme.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <memory>
+
+
+namespace chart
+{
+
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+namespace impl
+{
+class ChartConfigItem;
+}
+
+class ConfigColorScheme :
+ public ConfigItemListener,
+ public ::cppu::WeakImplHelper2<
+ ::com::sun::star::chart2::XColorScheme,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit ConfigColorScheme(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ SAL_DLLPRIVATE virtual ~ConfigColorScheme();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XColorScheme ____
+ SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ConfigItemListener ____
+ SAL_DLLPRIVATE virtual void notify( const ::rtl::OUString & rPropertyName );
+
+private:
+ SAL_DLLPRIVATE void retrieveConfigColors();
+
+ // member variables
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::std::auto_ptr< impl::ChartConfigItem > m_apChartConfigItem;
+ mutable ::com::sun::star::uno::Sequence< sal_Int64 > m_aColorSequence;
+ mutable sal_Int32 m_nNumberOfColors;
+ bool m_bNeedsUpdate;
+};
+
+} // namespace chart
+
+// CHART2_CONFIG_COLOR_SCHEME_HXX
+#endif
diff --git a/chart2/source/inc/ConfigItemListener.hxx b/chart2/source/inc/ConfigItemListener.hxx
new file mode 100644
index 000000000000..9ddde49908c2
--- /dev/null
+++ b/chart2/source/inc/ConfigItemListener.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CONFIGITEMLISTENER_HXX
+#define CHART2_CONFIGITEMLISTENER_HXX
+
+#include <rtl/ustring.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS ConfigItemListener
+{
+public:
+ virtual void notify( const ::rtl::OUString & rPropertyName ) = 0;
+};
+
+} // namespace chart
+
+// CHART2_CONFIGITEMLISTENER_HXX
+#endif
diff --git a/chart2/source/inc/ContainerHelper.hxx b/chart2/source/inc/ContainerHelper.hxx
new file mode 100644
index 000000000000..4c6d10d6b1f0
--- /dev/null
+++ b/chart2/source/inc/ContainerHelper.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CONTAINERHELPER_HXX
+#define CHART2_CONTAINERHELPER_HXX
+
+#include <vector>
+#include <set>
+#include <map>
+
+#include <algorithm>
+#include <functional>
+
+namespace chart
+{
+namespace ContainerHelper
+{
+
+/** converts a standard container into a sequence of the same type
+
+ input: standard container
+ output: css::uno::Sequence< container::value_type >
+
+ example:
+
+ ::std::vector< sal_Int32 > aVector;
+ Sequence< sal_Int32 > aSequence( ContainerHelper::ContainerToSequence( aVector ));
+ */
+template< class Container >
+ ::com::sun::star::uno::Sequence< typename Container::value_type >
+ ContainerToSequence( const Container & rCont )
+{
+ ::com::sun::star::uno::Sequence< typename Container::value_type > aResult( rCont.size());
+ ::std::copy( rCont.begin(), rCont.end(), aResult.getArray());
+ return aResult;
+}
+
+/** converts a UNO sequence into a standard "Sequence" container. For
+ convenience see the methods SequenceToVector, etc. below.
+
+ input: uno::Sequence
+ output: a standard container of the same value type implementing the Concept
+ of a Sequence (vector, deque, list, slist)
+
+ example:
+
+ Sequence< sal_Int32 > aSequence;
+ ::std::vector< sal_Int32 > aVector(
+ ContainerToSequence::SequenceToSTLSequenceContainer< ::std::vector< sal_Int32 > >( aSequence );
+*/
+template< class Container >
+ Container
+ SequenceToSTLSequenceContainer( const ::com::sun::star::uno::Sequence< typename Container::value_type > & rSeq )
+{
+ Container aResult( rSeq.getLength());
+ ::std::copy( rSeq.getConstArray(), rSeq.getConstArray() + rSeq.getLength(),
+ aResult.begin() );
+ return aResult;
+}
+
+/** converts a UNO sequence into a standard container. For convenience see the
+ methods SequenceToVector, etc. below. (In contrast to
+ SequenceToSTLSequenceContainer this works for all standard containers)
+
+ input: uno::Sequence
+ output: a standard container that has an insert( iterator, key ) method (all
+ standard containers)
+ note: for containers implementing the Concept of a Sequence (vector, deque,
+ list, slist) use SequenceToSTLSequenceContainer for better speed
+
+ example:
+
+ Sequence< sal_Int32 > aSequence;
+ ::std::set< sal_Int32 > aVector(
+ ContainerToSequence::SequenceToSTLContainer< ::std::set< sal_Int32 > >( aSequence );
+*/
+template< class Container >
+ Container
+ SequenceToSTLContainer( const ::com::sun::star::uno::Sequence< typename Container::value_type > & rSeq )
+{
+ Container aResult;
+ ::std::copy( rSeq.getConstArray(), rSeq.getConstArray() + rSeq.getLength(),
+ ::std::inserter< Container >( aResult, aResult.begin()));
+ return aResult;
+}
+
+// concrete container methods for convenience
+
+/** converts a UNO sequence into a standard vector of same value type
+
+ example:
+
+ Sequence< sal_Int32 > aSequence;
+ ::std::vector< sal_Int32 > aVector( ContainerHelper::SequenceToVector( aSequence ));
+ */
+template< typename T >
+ ::std::vector< T >
+ SequenceToVector( const ::com::sun::star::uno::Sequence< T > & rSeq )
+{
+ return SequenceToSTLSequenceContainer< ::std::vector< T > >( rSeq );
+}
+
+/** converts a UNO sequence into a standard set of same value type
+
+ example:
+
+ Sequence< sal_Int32 > aSequence;
+ ::std::set< sal_Int32 > aVector( ContainerHelper::SequenceToSet( aSequence ));
+ */
+template< typename T >
+ ::std::set< T >
+ SequenceToSet( const ::com::sun::star::uno::Sequence< T > & rSeq )
+{
+ return SequenceToSTLContainer< ::std::set< T > >( rSeq );
+}
+
+// ----------------------------------------
+
+/** converts the keys of a Pair Associative Container into a UNO sequence
+
+ example:
+
+ ::std::multimap< sal_Int32, ::rtl::OUString > aMyMultiMap;
+ uno::Sequence< sal_Int32 > aMyKeys( ContainerHelper::MapKeysToSequence( aMyMultiMap ));
+ // note: aMyKeys may contain duplicate keys here
+ */
+template< class Map >
+::com::sun::star::uno::Sequence< typename Map::key_type > MapKeysToSequence(
+ const Map & rCont )
+{
+ ::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size());
+ ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
+ ::std::select1st< typename Map::value_type >());
+ return aResult;
+}
+
+/** converts the values of a Pair Associative Container into a UNO sequence
+
+ example:
+
+ ::std::map< sal_Int32, ::rtl::OUString > aMyMultiMap;
+ uno::Sequence< ::rtl::OUString > aMyValues( ContainerHelper::MapValuesToSequence( aMyMultiMap ));
+ */
+template< class Map >
+::com::sun::star::uno::Sequence< typename Map::mapped_type > MapValuesToSequence(
+ const Map & rCont )
+{
+ ::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size());
+ ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
+ ::std::select2nd< typename Map::value_type >());
+ return aResult;
+}
+
+} // namespace ContainerHelper
+} // namespace chart
+
+// CHART2_CONTAINERHELPER_HXX
+#endif
diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx
new file mode 100644
index 000000000000..69044d4a2b3f
--- /dev/null
+++ b/chart2/source/inc/ControllerLockGuard.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_CONTROLLERLOCKGUARD_HXX
+#define CHART2_CONTROLLERLOCKGUARD_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include "charttoolsdllapi.hxx"
+
+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 ControllerLockGuard
+{
+public:
+ explicit ControllerLockGuard(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ ~ControllerLockGuard();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+};
+
+/** This helper class can be used to pass a locking mechanism to other objects
+ without exposing the full XModel to it.
+
+ Use the ControllerLockHelperGuard to lock/unlock the model during a block of
+ instructions.
+ */
+class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelper
+{
+public:
+ explicit ControllerLockHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ ~ControllerLockHelper();
+
+ SAL_DLLPRIVATE void lockControllers();
+ SAL_DLLPRIVATE void unlockControllers();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+};
+
+/** This guard calls lockControllers at the given ControllerLockHelper 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 ControllerLockHelperGuard
+{
+public:
+ explicit ControllerLockHelperGuard( ControllerLockHelper & rHelper );
+ ~ControllerLockHelperGuard();
+
+private:
+ ControllerLockHelper & m_rHelper;
+};
+
+} // namespace chart
+
+// CHART2_CONTROLLERLOCKGUARD_HXX
+#endif
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
new file mode 100644
index 000000000000..640d5cd70dec
--- /dev/null
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATASERIESHELPER_HXX
+#define CHART2_DATASERIESHELPER_HXX
+
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+
+#include "StackMode.hxx"
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+#include <functional>
+#include <hash_set>
+
+namespace chart
+{
+
+namespace DataSeriesHelper
+{
+
+::rtl::OUString GetRole(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::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
+ is returned. If no sequence matches, an empty reference is returned.
+
+ @param aSource
+ The data source containing all data sequences to be searched through.
+
+ @param aRole
+ The role that is to be filtered out.
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getDataSequenceByRole( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xSource,
+ ::rtl::OUString aRole,
+ bool bMatchPrefix = false );
+
+/** Retrieves all data sequences in the given data source that match the given
+ role.
+
+ @param aSource
+ The data source containing all data sequences to be searched through.
+
+ @param aRole
+ The role that is to be filtered out.
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::std::vector<
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >
+ getAllDataSequencesByRole( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > & aDataSequences,
+ ::rtl::OUString aRole,
+ bool bMatchPrefix = false );
+
+/** 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource >
+ getDataSource( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::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 ::rtl::OUString getDataSeriesLabel(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::rtl::OUString & rLabelSequenceRole );
+
+/** Get the label of a labeled sequence including neccessary automatic generation
+ */
+OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString getLabelForLabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xLabeledSeq );
+
+OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > & aSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ StackMode eStackMode );
+
+OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries );
+
+/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex
+OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ sal_Int32 nDimensionIndex,
+ sal_Int32 nAxisIndex = -1 );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >
+ getCoordinateSystemOfSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeOfSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType );
+
+OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
+ bool bSymbolsOn, sal_Int32 nSeriesIndex );
+
+OOO_DLLPUBLIC_CHARTTOOLS void switchLinesOnOrOff(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
+ bool bLinesOn );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+void makeLinesThickOrThin( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProperties, bool bThick );
+
+OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rPropertyValue );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rPropertyValue );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool areAllSeriesAttachedToSameAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType,
+ sal_Int32 & rOutAxisIndex );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS
+sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex );
+
+OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPointPropertySet );
+
+OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPointPropertySet );
+
+} // namespace DataSeriesHelper
+} // namespace chart
+
+// CHART2_DATASERIESHELPER_HXX
+#endif
diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx
new file mode 100644
index 000000000000..3dd6ff72d330
--- /dev/null
+++ b/chart2/source/inc/DataSource.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DATASOURCE_HXX
+#define CHART2_DATASOURCE_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class DataSource : public
+ ::cppu::WeakImplHelper3<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::chart2::data::XDataSource,
+ ::com::sun::star::chart2::data::XDataSink >
+{
+public:
+ explicit DataSource(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit DataSource(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > & rSequences );
+
+ virtual ~DataSource();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( DataSource )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XDataSource ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL
+ getDataSequences()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSink ____
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > >
+ m_aDataSeq;
+};
+
+} // namespace chart
+
+// CHART2_DATASOURCE_HXX
+#endif
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
new file mode 100644
index 000000000000..06888fe858d6
--- /dev/null
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_DATASOURCEHELPER_HXX
+#define _CHART2_DATASOURCEHELPER_HXX
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >
+ createDataSource( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > & rSequences );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createCachedDataSequence();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createCachedDataSequence( const ::rtl::OUString & rSingleText );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xLabels );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > createArguments(
+ bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
+
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > createArguments(
+ const ::rtl::OUString & rRangeRepresentation,
+ const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping,
+ bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
+
+ SAL_DLLPRIVATE static void readArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments
+ , ::rtl::OUString & rRangeRepresentation, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
+ , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >
+ pressUsedDataIntoRectangularFormat( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc,
+ bool bWithCategories = true );
+
+ static void addRangeRepresentationsFromLabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence
+ , ::std::vector< ::rtl::OUString >& rOutRangeRepresentations );
+
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xChartModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > getUsedData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > getUsedData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+
+ static bool detectRangeSegmentation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , ::rtl::OUString& rOutRangeString
+ , ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
+ , bool& rOutUseColumns
+ , bool& rOutFirstCellAsLabel
+ , bool& rOutHasCategories );
+
+ static void setRangeSegmentation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
+ , bool bUseColumns
+ , bool bFirstCellAsLabel
+ , bool bUseCategories );
+
+ /** Returns true, if all arguments necessary for getting all data by a
+ rectangular region are returned by detectArguments at the given
+ document's data provider.
+
+ Currently, this is: CellRangeRepresentation, DataRowSource,
+ HasCategories and FirstCellAsLabel.
+ */
+ static bool allArgumentsForRectRangeDetected(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromLabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
+
+ SAL_DLLPRIVATE static ::rtl::OUString getRangeFromValues(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
+
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xSource );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
new file mode 100644
index 000000000000..c7cda6189680
--- /dev/null
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DIAGRAMHELPER_HXX
+#define CHART2_DIAGRAMHELPER_HXX
+
+#include "StackMode.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/InterpretedData.hpp>
+#include <com/sun/star/chart2/StackingDirection.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <utility>
+#include <vector>
+
+
+namespace chart
+{
+
+enum DiagramPositioningMode
+{
+ DiagramPositioningMode_AUTO,
+ DiagramPositioningMode_EXCLUDING,
+ DiagramPositioningMode_INCLUDING
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper
+{
+public:
+ typedef ::std::pair<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeTemplate >,
+ ::rtl::OUString >
+ tTemplateWithServiceName;
+
+ /** tries to find a template in the chart-type manager that matches the
+ given diagram.
+
+ @param rPreferredTemplateName
+ Check this template first. This may speed up searching, if the
+ caller assumes a certain template as most likely to be the one that
+ matches.
+
+ @return
+ A pair containing a template with the correct properties set as
+ first entry and the service name of the templateas second entry. If
+ no template was found both elements are empty.
+ */
+ static tTemplateWithServiceName
+ getTemplateForDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xChartTypeManager,
+ const ::rtl::OUString & rPreferredTemplateName = ::rtl::OUString());
+
+ /** 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ bool bVertical = true );
+
+ /** 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ bool& rbOutFoundResult, bool& rbOutAmbiguousResult );
+
+ static StackMode getStackMode(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ bool& rbFound, bool& rbAmbiguous
+ );
+
+ /** @param bOnlyAtFirstChartType
+ If </TRUE>, 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ StackMode eStackMode,
+ bool bOnlyAtFirstChartType = true
+ );
+
+ /** 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.
+
+ @param xCorrespondingCoordinateSystem
+ The coordinate system in which the given chart type xChartType is
+ located. (This is needed for determining percent stacking. If
+ omitted, the result will just indicate "not stacked", "stacked" or
+ "ambiguous")
+ */
+ static StackMode getStackModeFromChartType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xChartType,
+ bool& rbFound, bool& rbAmbiguous,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem =
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >()
+ );
+
+ /** 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Int32 nNewDimensionCount );
+
+ /** Replaces all occurences of xCooSysToReplace in the tree with
+ xReplacement in the diagram's tree
+ */
+ SAL_DLLPRIVATE static void replaceCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xCooSysToReplace,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xReplacement );
+
+ static bool isSeriesAttachedToMainAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xDataSeries );
+
+ static bool attachSeriesToAxis( bool bMainAxis,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ bool bAdaptAxes=true );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > getAttachedAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ getChartTypeOfSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+ static ::std::vector<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > >
+ getDataSeriesFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ /** return all data series in this diagram grouped by chart-types
+ */
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > >
+ getDataSeriesGroups(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static bool isCategoryDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static void setCategoriesToDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >& xCategories,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ bool bSetAxisType = false, // when this flag is true ...
+ bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getCategoriesFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static ::com::sun::star::uno::Sequence< rtl::OUString >
+ getExplicitSimpleCategories(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< rtl::OUString >
+ generateAutomaticCategoriesFromCooSys(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > & xCooSys );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >
+ getChartTypeByIndex( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram, sal_Int32 nIndex );
+
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >
+ getChartTypesFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ SAL_DLLPRIVATE static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xFirstType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::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 </TRUE> if the series can be moved.
+ *
+ */
+ static bool isSeriesMoveable(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::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 </TRUE> if the series was moved successfully.
+ *
+ */
+ static bool moveSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
+ bool bForward );
+
+ static bool isSupportingFloorAndWall( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static bool isPieOrDonutChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static sal_Int32 getGeometry3D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ bool& rbFound, bool& rbAmbiguous );
+
+ static void setGeometry3D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Int32 nNewGeometry );
+
+ //returns integer from constant group ::com::sun::star::chart::MissingValueTreatment
+ static sal_Int32 getCorrectedMissingValueTreatment(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static DiagramPositioningMode getDiagramPositioningMode( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static bool setDiagramPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
+ const ::com::sun::star::awt::Rectangle& rPosRect /*100th mm*/ );
+
+ static ::com::sun::star::awt::Rectangle getDiagramRectangleFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+
+ static bool switchDiagramPositioningToExcludingPositioning( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , bool bResetModifiedState //set model back to unchanged if it was unchanged before
+ , bool bConvertAlsoFromAutoPositioning );
+
+private:
+ // not implemented
+ DiagramHelper();
+
+};
+
+} // namespace chart
+
+// CHART2_DIAGRAMHELPER_HXX
+#endif
diff --git a/chart2/source/inc/DisposeHelper.hxx b/chart2/source/inc/DisposeHelper.hxx
new file mode 100644
index 000000000000..7e8932f17581
--- /dev/null
+++ b/chart2/source/inc/DisposeHelper.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_DISPOSEHELPER_HXX
+#define CHART2_DISPOSEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <functional>
+#include <algorithm>
+#include <utility>
+
+namespace chart
+{
+namespace DisposeHelper
+{
+
+template< class T >
+ void Dispose( const T & xIntf )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp(
+ xIntf, ::com::sun::star::uno::UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+}
+
+template< class Intf >
+ void DisposeAndClear( ::com::sun::star::uno::Reference< Intf > & rIntf )
+{
+ Dispose< ::com::sun::star::uno::Reference< Intf > >( rIntf );
+ rIntf.set( 0 );
+}
+
+template< class T >
+ struct DisposeFunctor : public ::std::unary_function< T, void >
+{
+ void operator() ( const T & xIntf )
+ {
+ Dispose< T >( xIntf );
+ }
+};
+
+template< typename T >
+ struct DisposeFirstOfPairFunctor : public ::std::unary_function< T, void >
+{
+ void operator() ( const T & rElem )
+ {
+ Dispose< typename T::first_type >( rElem.first );
+ }
+};
+
+template< typename T >
+ struct DisposeSecondOfPairFunctor : public ::std::unary_function< T, void >
+{
+ void operator() ( const T & rElem )
+ {
+ Dispose< typename T::second_type >( rElem.second );
+ }
+};
+
+template< class Container >
+ void DisposeAllElements( Container & rContainer )
+{
+ ::std::for_each( rContainer.begin(), rContainer.end(), DisposeFunctor< typename Container::value_type >());
+}
+
+template< class Map >
+ void DisposeAllMapElements( Map & rContainer )
+{
+ ::std::for_each( rContainer.begin(), rContainer.end(), DisposeSecondOfPairFunctor< typename Map::value_type >());
+}
+
+} // namespace DisposeHelper
+} // namespace chart
+
+// CHART2_DISPOSEHELPER_HXX
+#endif
diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx
new file mode 100644
index 000000000000..f4d2b457acc4
--- /dev/null
+++ b/chart2/source/inc/ErrorBar.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_ERRORBAR_HXX
+#define CHART2_ERRORBAR_HXX
+
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "charttoolsdllapi.hxx"
+
+#include <cppuhelper/implbase6.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <com/sun/star/uno/XComponentContext.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/container/XChild.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+
+namespace chart
+{
+
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createErrorBar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper6<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::chart2::data::XDataSource,
+ ::com::sun::star::chart2::data::XDataSink >
+ ErrorBar_Base;
+}
+
+class ErrorBar :
+ public MutexContainer,
+ public impl::ErrorBar_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit ErrorBar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~ErrorBar();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ErrorBar )
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ ErrorBar( const ErrorBar & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ using OPropertySet::disposing;
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSink ____
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSource ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChild ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent )
+ throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ typedef ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
+ tDataSequenceContainer m_aDataSequences;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
+};
+
+} // namespace chart
+
+// CHART2_ERRORBAR_HXX
+#endif
diff --git a/chart2/source/inc/EventListenerHelper.hxx b/chart2/source/inc/EventListenerHelper.hxx
new file mode 100644
index 000000000000..79840a2bd2e4
--- /dev/null
+++ b/chart2/source/inc/EventListenerHelper.hxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_EVENTLISTENERHELPER_HXX
+#define CHART2_EVENTLISTENERHELPER_HXX
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <list>
+#include <algorithm>
+#include <functional>
+#include <utility>
+
+namespace chart
+{
+namespace EventListenerHelper
+{
+
+namespace impl
+{
+
+template< class InterfaceRef >
+struct addListenerFunctor : public ::std::unary_function< InterfaceRef, void >
+{
+ explicit addListenerFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const InterfaceRef & xObject )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->addEventListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener;
+};
+
+template< class InterfaceRef >
+struct removeListenerFunctor : public ::std::unary_function< InterfaceRef, void >
+{
+ explicit removeListenerFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const InterfaceRef & xObject )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->removeEventListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener;
+};
+
+template< class Pair >
+struct addListenerToMappedElementFunctor : public ::std::unary_function< Pair, void >
+{
+ explicit addListenerToMappedElementFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const Pair & aPair )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->addEventListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener;
+};
+
+template< class Pair >
+struct removeListenerFromMappedElementFunctor : public ::std::unary_function< Pair, void >
+{
+ explicit removeListenerFromMappedElementFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const Pair & aPair )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->removeEventListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener;
+};
+
+} // namespace impl
+
+// --------------------------------------------------------------------------------
+
+template< class InterfaceRef >
+void addListener(
+ const InterfaceRef & xObject,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ {
+ impl::addListenerFunctor< InterfaceRef > aFunctor( xListener );
+ aFunctor( xObject );
+ }
+}
+
+template< class Container >
+void addListenerToAllElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::addListenerFunctor< typename Container::value_type >( xListener ));
+}
+
+template< class Container >
+void addListenerToAllMapElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::addListenerToMappedElementFunctor< typename Container::value_type >( xListener ));
+}
+
+template< typename T >
+void addListenerToAllSequenceElements(
+ const ::com::sun::star::uno::Sequence< T > & rSequence,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(),
+ impl::addListenerFunctor< T >( xListener ));
+}
+
+template< class InterfaceRef >
+void removeListener(
+ const InterfaceRef & xObject,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ {
+ impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener );
+ aFunctor( xObject );
+ }
+}
+
+template< class Container >
+void removeListenerFromAllElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::removeListenerFunctor< typename Container::value_type >( xListener ));
+}
+
+template< class Container >
+void removeListenerFromAllMapElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::removeListenerFromMappedElementFunctor< typename Container::value_type >( xListener ));
+}
+
+template< typename T >
+void removeListenerFromAllSequenceElements(
+ const ::com::sun::star::uno::Sequence< T > & rSequence,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(),
+ impl::removeListenerFunctor< T >( xListener ));
+}
+
+} // namespace EventListenerHelper
+} // namespace chart
+
+// CHART2_EVENTLISTENERHELPER_HXX
+#endif
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
new file mode 100644
index 000000000000..18d54eb6e2ad
--- /dev/null
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
+#define CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
+
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+namespace chart
+{
+
+struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
+{
+ rtl::OUString Text;
+ sal_Int32 Count;
+
+ ComplexCategory( const rtl::OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
+ {}
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider
+{
+public:
+ virtual ~SplitCategoriesProvider();
+
+ virtual sal_Int32 getLevelCount() const = 0;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
+{
+public:
+ ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ );
+ virtual ~ExplicitCategoriesProvider();
+
+ void init();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getSimpleCategories();
+ ::std::vector< ComplexCategory > getCategoriesByLevel( sal_Int32 nLevel );
+
+ static ::rtl::OUString getCategoryByIndex(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , sal_Int32 nIndex );
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getExplicitSimpleCategories(
+ const SplitCategoriesProvider& rSplitCategoriesProvider );
+
+ bool hasComplexCategories() const;
+ sal_Int32 getCategoryLevelCount() const;
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList();
+
+private: //member
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
+ ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats;
+ bool volatile m_bDirty;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
+};
+
+} // namespace chart
+
+// CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
+#endif
diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..91c3034ea79c
--- /dev/null
+++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
+#define CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
+
+#include "RegressionCurveCalculator.hxx"
+
+namespace chart
+{
+
+class ExponentialRegressionCurveCalculator :
+ public RegressionCurveCalculator
+{
+public:
+ ExponentialRegressionCurveCalculator();
+ virtual ~ExponentialRegressionCurveCalculator();
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const;
+
+private:
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // formula is: f(x) = m_fSlope ^ x + m_fIntercept
+ double m_fSlope;
+ double m_fIntercept;
+};
+
+} // namespace chart
+
+// CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/FastPropertyIdRanges.hxx b/chart2/source/inc/FastPropertyIdRanges.hxx
new file mode 100644
index 000000000000..d0651d60f923
--- /dev/null
+++ b/chart2/source/inc/FastPropertyIdRanges.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_FASTPROPERTYIDRANGES_HXX
+#define CHART_FASTPROPERTYIDRANGES_HXX
+
+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_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,
+ FAST_PROPERTY_ID_START_CHART_SPLINE_PROP = FAST_PROPERTY_ID_START + 15000,
+ FAST_PROPERTY_ID_START_CHART_STOCK_PROP = FAST_PROPERTY_ID_START + 16000,
+ FAST_PROPERTY_ID_START_CHART_AUTOPOSITION_PROP = FAST_PROPERTY_ID_START + 17000,
+ FAST_PROPERTY_ID_START_SCALE_TEXT_PROP = FAST_PROPERTY_ID_START + 18000
+};
+
+} // namespace chart
+
+// CHART_FASTPROPERTYIDRANGES_HXX
+#endif
diff --git a/chart2/source/inc/FillProperties.hxx b/chart2/source/inc/FillProperties.hxx
new file mode 100644
index 000000000000..f9fa970828a2
--- /dev/null
+++ b/chart2/source/inc/FillProperties.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_FILLPROPERTIES_HXX
+#define CHART_FILLPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements service FillProperties
+class OOO_DLLPUBLIC_CHARTTOOLS FillProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // com.sun.star.drawing.FillProperties
+ // com.sun.star.drawing.FillProperties
+ PROP_FILL_STYLE = FAST_PROPERTY_ID_START_FILL_PROP
+ , PROP_FILL_COLOR
+ , PROP_FILL_TRANSPARENCE
+ , PROP_FILL_TRANSPARENCE_GRADIENT_NAME
+// , PROP_FILL_TRANSPARENCE_GRADIENT //optional
+ , PROP_FILL_GRADIENT_NAME
+ , PROP_FILL_GRADIENT_STEPCOUNT
+// , PROP_FILL_GRADIENT //optional
+ , PROP_FILL_HATCH_NAME
+// , PROP_FILL_HATCH //optional
+ //------------------------
+ // bitmap properties start
+ , PROP_FILL_BITMAP_NAME
+// , PROP_FILL_BITMAP //optional
+// , PROP_FILL_BITMAP_URL //optional
+ , PROP_FILL_BITMAP_OFFSETX
+ , PROP_FILL_BITMAP_OFFSETY
+ , PROP_FILL_BITMAP_POSITION_OFFSETX
+ , PROP_FILL_BITMAP_POSITION_OFFSETY
+ , PROP_FILL_BITMAP_RECTANGLEPOINT
+ , PROP_FILL_BITMAP_LOGICALSIZE
+ , PROP_FILL_BITMAP_SIZEX
+ , PROP_FILL_BITMAP_SIZEY
+ , PROP_FILL_BITMAP_MODE
+ // bitmap properties end
+ //------------------------
+ , PROP_FILL_BACKGROUND
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+private:
+ // not implemented
+ FillProperties();
+};
+
+} // namespace chart
+
+// CHART_FILLPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx
new file mode 100644
index 000000000000..a0e69011f77d
--- /dev/null
+++ b/chart2/source/inc/FormattedStringHelper.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TOOLS_FORMATTEDSTRINGHELPER_HXX
+#define _CHART2_TOOLS_FORMATTEDSTRINGHELPER_HXX
+
+#include <com/sun/star/chart2/XFormattedString.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class OOO_DLLPUBLIC_CHARTTOOLS FormattedStringHelper
+{
+public:
+ static ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > >
+ createFormattedStringSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext
+ , const ::rtl::OUString & rString
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xTextProperties ) throw();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx
new file mode 100755
index 000000000000..6b6590cffdac
--- /dev/null
+++ b/chart2/source/inc/InternalData.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_INTERNALDATA_HXX
+#define CHART2_INTERNALDATA_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <valarray>
+
+namespace chart
+{
+
+class InternalData
+{
+public:
+ InternalData();
+
+ void createDefaultData();
+
+ void setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > > & rDataInRows );
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > > getData() const;
+
+ ::com::sun::star::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const;
+ ::com::sun::star::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const;
+
+ 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< ::rtl::OUString >& rComplexLabel );
+ void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel );
+
+ ::std::vector< ::rtl::OUString > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
+ ::std::vector< ::rtl::OUString > getComplexRowLabel( sal_Int32 nRowIndex ) const;
+
+ void swapRowWithNext( sal_Int32 nRowIndex );
+ void swapColumnWithNext( sal_Int32 nColumnIndex );
+
+ void insertColumn( sal_Int32 nAfterIndex );
+ void insertRow( sal_Int32 nAfterIndex );
+ void deleteColumn( sal_Int32 nAtIndex );
+ void deleteRow( sal_Int32 nAtIndex );
+
+ /// @return the index of the newly appended column
+ sal_Int32 appendColumn();
+ /// @return the index of the newly appended row
+ sal_Int32 appendRow();
+
+ sal_Int32 getRowCount() const;
+ sal_Int32 getColumnCount() const;
+
+ typedef ::std::valarray< double > tDataType;
+ typedef ::std::vector< ::std::vector< ::rtl::OUString > > tVecVecString; //inner index is hierarchical level
+
+ void setComplexRowLabels( const tVecVecString& rNewRowLabels );
+ tVecVecString getComplexRowLabels() const;
+ void setComplexColumnLabels( const tVecVecString& rNewColumnLabels );
+ tVecVecString getComplexColumnLabels() const;
+
+#if OSL_DEBUG_LEVEL > 2
+ void traceData() const;
+#endif
+
+private: //methods
+ /** resizes the data if at least one of the given dimensions is larger than
+ before. The data is never becoming smaller only larger.
+
+ @return </TRUE>, if the data was enlarged
+ */
+ bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount );
+
+private:
+ sal_Int32 m_nColumnCount;
+ sal_Int32 m_nRowCount;
+
+ tDataType m_aData;
+ tVecVecString m_aRowLabels;//outer index is row index, inner index is category level
+ tVecVecString m_aColumnLabels;//outer index is column index
+};
+
+#endif
+
+} // namespace chart
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
new file mode 100644
index 000000000000..f5e12f87f505
--- /dev/null
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_INTERNALDATAPROVIDER_HXX
+#define CHART2_INTERNALDATAPROVIDER_HXX
+
+#include "InternalData.hxx"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <cppuhelper/implbase6.hxx>
+#include "ServiceMacros.hxx"
+
+#include "CachedDataSequence.hxx"
+
+#include <map>
+#include <memory>
+
+namespace chart
+{
+
+namespace impl
+{
+
+typedef ::cppu::WeakImplHelper6<
+ ::com::sun::star::chart2::XInternalDataProvider,
+ ::com::sun::star::chart2::data::XRangeXMLConversion,
+ ::com::sun::star::chart::XComplexDescriptionAccess,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo >
+ InternalDataProvider_Base;
+}
+
+/** Data provider that handles data internally. This is used for charts with
+ their own data.
+
+ <p>The format for single ranges is "categories|label n|n" where n is a
+ non-negative number. Meaning return all categories, the label of sequence n,
+ or the data of sequence n.</p>
+
+ <p>The format for a complete range is "all". (Do we need more than
+ that?)</p>
+ */
+class InternalDataProvider :
+ public impl::InternalDataProvider_Base
+{
+public:
+ explicit InternalDataProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _xContext);
+ explicit InternalDataProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc, bool bConnectToModel );
+ explicit InternalDataProvider( const InternalDataProvider & rOther );
+ virtual ~InternalDataProvider();
+
+ void createDefaultData();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(InternalDataProvider)
+
+ // ____ XInternalDataProvider ____
+ virtual ::sal_Bool SAL_CALL hasDataByRangeRepresentation( const ::rtl::OUString& aRange )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
+ getDataByRangeRepresentation( const ::rtl::OUString& aRange )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataByRangeRepresentation(
+ const ::rtl::OUString& aRange,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aNewData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendSequence()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL registerDataSequenceForChanges(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSeq )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataProvider (base of XInternalDataProvider) ____
+ virtual ::sal_Bool SAL_CALL createDataSourcePossible(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(
+ const ::rtl::OUString& aRangeRepresentation )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
+ const ::rtl::OUString& aRangeRepresentation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XRangeXMLConversion ____
+ virtual ::rtl::OUString SAL_CALL convertRangeToXML(
+ const ::rtl::OUString& aRangeRepresentation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL convertRangeFromXML(
+ const ::rtl::OUString& aXMLRange )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XComplexDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexRowDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexColumnDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartData (base of XChartDataArray) ____
+ virtual void SAL_CALL addChartDataChangeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNotANumber(
+ double nNumber )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::lang::XInitialization:
+ virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
+
+private:
+ void lcl_addDataSequenceToMap(
+ const ::rtl::OUString & rRangeRepresentation,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xSequence );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >
+ lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation,
+ const ::rtl::OUString & rRole );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >
+ lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
+
+ void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
+
+ void lcl_adaptMapReferences(
+ const ::rtl::OUString & rOldRangeRepresentation,
+ const ::rtl::OUString & rNewRangeRepresentation );
+
+ void lcl_increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
+ void lcl_decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
+
+ typedef ::std::multimap< ::rtl::OUString,
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > >
+ tSequenceMap;
+ typedef ::std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange;
+ typedef ::std::pair< tSequenceMap::const_iterator, tSequenceMap::const_iterator > tConstSequenceMapRange;
+
+ /** cache for all sequences that have been returned.
+
+ If the range-representation of a sequence changes and it is still
+ referred to by some component (weak reference is valid), the range will
+ be adapted.
+ */
+ tSequenceMap m_aSequenceMap;
+ InternalData m_aInternalData;
+ bool m_bDataInColumns;
+};
+
+} // namespace chart
+
+// CHART2_INTERNALDATAPROVIDER_HXX
+#endif
diff --git a/chart2/source/inc/LabeledDataSequence.hxx b/chart2/source/inc/LabeledDataSequence.hxx
new file mode 100644
index 000000000000..a5ec1d99307d
--- /dev/null
+++ b/chart2/source/inc/LabeledDataSequence.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_LABELEDDATASEQUENCE_HXX
+#define CHART2_LABELEDDATASEQUENCE_HXX
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase4.hxx>
+
+#ifndef _COM_SUN_STAR_CHART2_XLABELEDDATASEQUENCE_HPP_
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#endif
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef cppu::WeakImplHelper4<
+ ::com::sun::star::chart2::data::XLabeledDataSequence,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::lang::XServiceInfo >
+ LabeledDataSequence_Base;
+}
+
+class LabeledDataSequence :
+ public MutexContainer,
+ public impl::LabeledDataSequence_Base
+{
+public:
+ explicit LabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit LabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & rValues );
+ explicit LabeledDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & rValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & rLabels );
+
+ virtual ~LabeledDataSequence();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LabeledDataSequence )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XLabeledDataSequence ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getValues()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValues(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > m_xData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > m_xLabel;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART2_LABELEDDATASEQUENCE_HXX
+#endif
diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx
new file mode 100644
index 000000000000..5f8279286b72
--- /dev/null
+++ b/chart2/source/inc/LegendHelper.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TOOLS_LEGENDHELPER_HXX
+#define _CHART2_TOOLS_LEGENDHELPER_HXX
+
+// header for class OUString
+#include <rtl/ustring.hxx>
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper
+{
+public:
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >
+ showLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+
+ static void hideLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >
+ getLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext = 0
+ , bool bCreate = false );
+
+ /** returns <FALSE/>, if either there is no legend at the diagram, or there
+ is a legend which has a "Show" property of value <FALSE/>. Otherwise,
+ <TRUE/> is returned.
+ */
+ static bool hasLegend( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx
new file mode 100644
index 000000000000..8e278168259f
--- /dev/null
+++ b/chart2/source/inc/LifeTime.hxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LIFETIME_HXX
+#define _LIFETIME_HXX
+
+#include <osl/mutex.hxx>
+#include <osl/conditn.hxx>
+#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HDL_
+#include <com/sun/star/uno/Exception.hdl>
+#endif
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/weakref.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace apphelper
+{
+
+class LifeTimeGuard;
+class LifeTimeManager
+{
+friend class LifeTimeGuard;
+protected:
+ mutable ::osl::Mutex m_aAccessMutex;
+public:
+OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager( ::com::sun::star::lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable = sal_False );
+OOO_DLLPUBLIC_CHARTTOOLS virtual ~LifeTimeManager();
+
+OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposed( bool bAssert=true );
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool dispose() throw(::com::sun::star::uno::RuntimeException);
+
+public:
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer;
+
+protected:
+ virtual sal_Bool impl_canStartApiCall();
+ virtual void impl_apiCallCountReachedNull(){}
+
+ void impl_registerApiCall(sal_Bool bLongLastingCall);
+ void impl_unregisterApiCall(sal_Bool bLongLastingCall);
+
+ void impl_init();
+
+protected:
+ ::com::sun::star::lang::XComponent* m_pComponent;
+
+ ::osl::Condition m_aNoAccessCountCondition;
+ sal_Int32 volatile m_nAccessCount;
+
+ sal_Bool volatile m_bDisposed;
+ sal_Bool volatile m_bInDispose;
+
+ //
+ sal_Bool m_bLongLastingCallsCancelable;
+ ::osl::Condition m_aNoLongLastingCallCountCondition;
+ sal_Int32 volatile m_nLongLastingCallCount;
+};
+
+class CloseableLifeTimeManager : public LifeTimeManager
+{
+protected:
+ ::com::sun::star::util::XCloseable* m_pCloseable;
+
+ ::osl::Condition m_aEndTryClosingCondition;
+ sal_Bool volatile m_bClosed;
+ sal_Bool volatile m_bInTryClose;
+ //the ownership between model and controller is not clear at first
+ //each controller might consider him as owner of the model first
+ //at start the model is not considered as owner of itself
+ sal_Bool volatile m_bOwnership;
+ //with a XCloseable::close call and during XCloseListener::queryClosing
+ //the ownership can be regulated more explicit,
+ //if so the ownership is considered to be well known
+ sal_Bool volatile m_bOwnershipIsWellKnown;
+
+public:
+OOO_DLLPUBLIC_CHARTTOOLS CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable
+ , ::com::sun::star::lang::XComponent* pComponent
+ , sal_Bool bLongLastingCallsCancelable = sal_False );
+OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager();
+
+OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposedOrClosed( bool bAssert=true );
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_startTryClose(sal_Bool bDeliverOwnership)
+ throw ( ::com::sun::star::uno::Exception );
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, ::com::sun::star::util::CloseVetoException& ex )
+ throw ( ::com::sun::star::util::CloseVetoException );
+OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool bMyVeto );
+OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose_doClose();
+OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_addCloseListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XCloseListener > & xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual sal_Bool impl_canStartApiCall();
+ virtual void impl_apiCallCountReachedNull();
+
+ void impl_setOwnership( sal_Bool bDeliverOwnership, sal_Bool bMyVeto );
+ sal_Bool impl_shouldCloseAtNextChance();
+ void impl_doClose();
+
+ void impl_init()
+ {
+ m_bClosed = sal_False;
+ m_bInTryClose = sal_False;
+ m_bOwnership = sal_False;
+ m_bOwnershipIsWellKnown = sal_False;
+ m_aEndTryClosingCondition.set();
+ }
+};
+
+//-----------------------------------------------------------------
+/*
+Use this Guard in your apicalls to protect access on resources
+which will be released in dispose.
+It's guarantied, that the release of resources only starts if your
+guarded call has finished.
+! It's only partly guaranteed that this resources will not change during the call.
+See the example for details.
+
+This class is to be used as described in the example.
+
+If this guard is used in all api calls of an XCloseable object
+it's guarantied, that the closeable will close itself after finishing the last call
+if it should do so.
+
+ ::ApiCall
+{
+ //hold no mutex!!!
+ LifeTimeGuard aLifeTimeGuard(m_aLifeTimeManager);
+
+ //mutex is acquired; call is not registered
+
+ if(!aLifeTimeGuard.startApiCall())
+ return ; //behave as passive as possible, if disposed or closed
+
+ //mutex is acquired, call is registered
+ {
+ //you might access some private members here
+ //but than you need to protect access to these members always like this
+ //never call to the outside here
+ }
+
+ aLifeTimeGuard.clear(); //!!!
+
+ //Mutex is released, the running call is still registered
+ //this call will finish before the 'release-section' in dispose is allowed to start
+
+ {
+ //you might access some private members here guarded with your own mutex
+ //but release your mutex at the end of this block
+ }
+
+ //you can call to the outside (without holding the mutex) without becoming disposed
+
+ //End of method -> ~LifeTimeGuard
+ //-> call is unregistered
+ //-> this object might be disposed now
+}
+
+your XComponent::dispose method has to be implemented in the following way:
+
+ ::dispose()
+{
+ //hold no mutex!!!
+ if( !m_aLifeTimeManager.dispose() )
+ return;
+
+ //--release all resources and references
+ //...
+}
+
+*/
+//-----------------------------------------------------------------
+
+class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeGuard
+{
+
+public:
+ LifeTimeGuard( LifeTimeManager& rManager )
+ : m_guard( rManager.m_aAccessMutex )
+ , m_rManager(rManager)
+ , m_bCallRegistered(sal_False)
+ , m_bLongLastingCallRegistered(sal_False)
+ {
+
+ }
+ sal_Bool startApiCall(sal_Bool bLongLastingCall=sal_False);
+ ~LifeTimeGuard();
+ void clear() { m_guard.clear(); }
+
+private:
+ osl::ClearableMutexGuard m_guard;
+ LifeTimeManager& m_rManager;
+ sal_Bool m_bCallRegistered;
+ sal_Bool m_bLongLastingCallRegistered;
+
+private:
+ // these make no sense
+ LifeTimeGuard( ::osl::Mutex& rMutex );
+ LifeTimeGuard( const LifeTimeGuard& );
+ LifeTimeGuard& operator= ( const LifeTimeGuard& );
+};
+
+
+template<class T>
+class NegativeGuard
+{
+protected:
+ T * m_pT;
+public:
+
+ NegativeGuard(T * pT) : m_pT(pT)
+ {
+ m_pT->release();
+ }
+
+ NegativeGuard(T & t) : m_pT(&t)
+ {
+ m_pT->release();
+ }
+
+ ~NegativeGuard()
+ {
+ m_pT->acquire();
+ }
+};
+
+}//end namespace apphelper
+#endif
diff --git a/chart2/source/inc/LineProperties.hxx b/chart2/source/inc/LineProperties.hxx
new file mode 100644
index 000000000000..15cd08654a46
--- /dev/null
+++ b/chart2/source/inc/LineProperties.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LINEPROPERTIES_HXX
+#define CHART_LINEPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements service LineProperties
+class OOO_DLLPUBLIC_CHARTTOOLS LineProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // com.sun.star.drawing.LineProperties
+ PROP_LINE_STYLE = FAST_PROPERTY_ID_START_LINE_PROP,
+ PROP_LINE_DASH,
+ PROP_LINE_DASH_NAME, //not in service description
+ PROP_LINE_COLOR,
+ PROP_LINE_TRANSPARENCE,
+ PROP_LINE_WIDTH,
+ PROP_LINE_JOINT
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+ SAL_DLLPRIVATE static bool IsLineVisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties );
+ SAL_DLLPRIVATE static void SetLineVisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties );
+ static void SetLineInvisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties );
+
+private:
+ // not implemented
+ LineProperties();
+};
+
+} // namespace chart
+
+// CHART_LINEPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/LinearRegressionCurveCalculator.hxx b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..faef7bdbe0c8
--- /dev/null
+++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX
+#define CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX
+
+#include "RegressionCurveCalculator.hxx"
+
+namespace chart
+{
+
+class LinearRegressionCurveCalculator :
+ public RegressionCurveCalculator
+{
+public:
+ LinearRegressionCurveCalculator();
+ virtual ~LinearRegressionCurveCalculator();
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const;
+
+private:
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // formula is: f(x) = m_fSlope * x + m_fIntercept
+ double m_fSlope;
+ double m_fIntercept;
+};
+
+} // namespace chart
+
+// CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..4b3a6fa8d0b0
--- /dev/null
+++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
+#define CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
+
+#include "RegressionCurveCalculator.hxx"
+
+namespace chart
+{
+
+class LogarithmicRegressionCurveCalculator :
+ public RegressionCurveCalculator
+{
+public:
+ LogarithmicRegressionCurveCalculator();
+ virtual ~LogarithmicRegressionCurveCalculator();
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const;
+
+private:
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // formula is: f(x) = m_fSlope * log( x ) + m_fIntercept
+ double m_fSlope;
+ double m_fIntercept;
+};
+
+} // namespace chart
+
+// CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..3fc2c6f1c354
--- /dev/null
+++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
+#define CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
+
+#include "RegressionCurveCalculator.hxx"
+
+namespace chart
+{
+
+class MeanValueRegressionCurveCalculator :
+ public RegressionCurveCalculator
+{
+public:
+ MeanValueRegressionCurveCalculator();
+ virtual ~MeanValueRegressionCurveCalculator();
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const;
+
+private:
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // formula is: f(x) = m_fMeanValue
+ double m_fMeanValue;
+};
+
+} // namespace chart
+
+// CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/MediaDescriptorHelper.hxx b/chart2/source/inc/MediaDescriptorHelper.hxx
new file mode 100644
index 000000000000..a41ad1f8c751
--- /dev/null
+++ b/chart2/source/inc/MediaDescriptorHelper.hxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MEDIADESCRIPTORHELPER_HXX
+#define _MEDIADESCRIPTORHELPER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include "charttoolsdllapi.hxx"
+
+/*
+* This class helps to read and write the properties mentioned in the service description
+* com.sun.star.document.MediaDescriptor from and to a sequence of PropertyValues.
+* Properties that are not mentioned in the service description
+* are stored in the member AdditionalProperties.
+*
+* As an additional feature this helper class can generate a reduced sequence of PropertyValues
+* that does not contain properties which are known to be only view relevant. This
+* reduced sequence than might be attached to a model directly.
+*/
+
+namespace apphelper
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS MediaDescriptorHelper
+{
+private:
+ //MediaDescriptorHelper(){};
+public:
+ MediaDescriptorHelper( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rMediaDescriptor );
+ virtual ~MediaDescriptorHelper();
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > getReducedForModel();
+
+public:
+ //---------------------
+ //all properties given in the constructor are stored in the following three sequences
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >
+ m_aRegularProperties; //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >
+ m_aDeprecatedProperties; //these are properties which are described in service com.sun.star.document.MediaDescriptor but are marked as deprecated
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >
+ m_aAdditionalProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor
+
+ //----------------------
+ //properties which should be given to a model are additionally stored in this sequence (not documented properties and deprecated properties are not included!)
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >
+ m_aModelProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor
+
+
+ //@todo define this for debug only, except URL
+ sal_Bool AsTemplate; //document is a template.
+ sal_Bool ISSET_AsTemplate;
+ ::rtl::OUString Author; //
+ sal_Bool ISSET_Author;
+ ::rtl::OUString CharacterSet; //identifier of used character set.
+ sal_Bool ISSET_CharacterSet;
+ ::rtl::OUString Comment;//
+ sal_Bool ISSET_Comment;
+
+ ::com::sun::star::uno::Any
+ ComponentData;//
+ sal_Bool ISSET_ComponentData;
+ ::rtl::OUString FileName; //deprecated, same as url
+ sal_Bool ISSET_FileName;
+ ::com::sun::star::uno::Any
+ FilterData;//
+ sal_Bool ISSET_FilterData;
+ ::rtl::OUString FilterName; //internal filter name.
+ sal_Bool ISSET_FilterName;
+ ::rtl::OUString FilterFlags;//deprecated,
+ sal_Bool ISSET_FilterFlags;
+ ::rtl::OUString FilterOptions;//
+ sal_Bool ISSET_FilterOptions;
+ //not documented ... @todo remove?
+ ::rtl::OUString FrameName; //name of target frame.
+ sal_Bool ISSET_FrameName;
+ sal_Bool Hidden; //load document, invisible.
+ sal_Bool ISSET_Hidden;
+
+ ::rtl::OUString HierarchicalDocumentName;
+ sal_Bool ISSET_HierarchicalDocumentName;
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ OutputStream; //a stream to receive the document data for saving
+ sal_Bool ISSET_OutputStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ InputStream; //content of document.
+ sal_Bool ISSET_InputStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ InteractionHandler; // //::com::sun::star::task::XInteractionHandler
+ sal_Bool ISSET_InteractionHandler;
+
+ ::rtl::OUString JumpMark; //specifies the name of a mark within the document where the first view is to position itself.
+ sal_Bool ISSET_JumpMark;
+ ::rtl::OUString MediaType; //mime type.
+ sal_Bool ISSET_MediaType;
+ ::rtl::OUString OpenFlags; //deprecated
+ sal_Bool ISSET_OpenFlags;
+ sal_Bool OpenNewView; //opens a new view for an already loaded document.
+ sal_Bool ISSET_OpenNewView;
+ sal_Bool Overwrite; //opens a new view for an already loaded document.
+ sal_Bool ISSET_Overwrite;
+ ::rtl::OUString Password; //
+ sal_Bool ISSET_Password;
+
+ //not documented ... @todo remove?
+ ::com::sun::star::awt::Rectangle
+ PosSize; //position and size of document window.
+ sal_Bool ISSET_PosSize;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 >
+ PostData; //contains the data for HTTP post method as a sequence of bytes.
+ sal_Bool ISSET_PostData;
+ ::rtl::OUString PostString; //deprecated, contains the data for HTTP post method as a sequence of bytes.
+ sal_Bool ISSET_PostString;
+ sal_Bool Preview; //show preview.
+ sal_Bool ISSET_Preview;
+ sal_Bool ReadOnly; //open document readonly.
+ sal_Bool ISSET_ReadOnly;
+ ::rtl::OUString Referer; //name of document referrer.
+ sal_Bool ISSET_Referer;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ StatusIndicator; // //::com::sun::star::task::XStatusIndicator
+ sal_Bool ISSET_StatusIndicator;
+ //not documented ... @todo remove?
+ sal_Bool Silent; //prevents dialogs to query for more information.
+ sal_Bool ISSET_Silent;
+ ::rtl::OUString TemplateName; //deprecated, name of the template instead of the URL.
+ sal_Bool ISSET_TemplateName;
+ ::rtl::OUString TemplateRegionName; //deprecated, name of the region of the template.
+ sal_Bool ISSET_TemplateRegionName;
+ sal_Bool Unpacked;
+ sal_Bool ISSET_Unpacked;
+ ::rtl::OUString URL;// FileName, URL of the document.
+ sal_Bool ISSET_URL;
+ sal_Int16 Version; //storage version.
+ sal_Bool ISSET_Version;
+
+ ::com::sun::star::uno::Any
+ ViewData;//
+ sal_Bool ISSET_ViewData;
+ sal_Int16 ViewId; //id of the initial view.
+ sal_Bool ISSET_ViewId;
+
+ // new framework objects
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ Storage;
+ sal_Bool ISSET_Storage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ Stream;
+ sal_Bool ISSET_Stream;
+
+ // undocumented SFX Properties
+ ::com::sun::star::uno::Sequence< sal_Int32 >
+ WinExtent;
+ sal_Bool ISSET_WinExtent;
+ sal_Bool SetEmbedded;
+ sal_Bool ISSET_SetEmbedded;
+
+protected:
+SAL_DLLPRIVATE void impl_init();
+};
+
+}
+
+#endif
diff --git a/chart2/source/inc/ModifyListenerCallBack.hxx b/chart2/source/inc/ModifyListenerCallBack.hxx
new file mode 100644
index 000000000000..3833806d185e
--- /dev/null
+++ b/chart2/source/inc/ModifyListenerCallBack.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART2_MODIFYLISTENERCALLBACK_HXX
+#define CHART2_MODIFYLISTENERCALLBACK_HXX
+
+// header for class Link
+#include <tools/link.hxx>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include "charttoolsdllapi.hxx"
+
+namespace chart {
+
+/** Use this class as a member if you want to listen on a XModifyBroadcaster
+without becoming a XModifyListener yourself
+ */
+
+class ModifyListenerCallBack_impl;
+
+class OOO_DLLPUBLIC_CHARTTOOLS ModifyListenerCallBack
+{
+public:
+ explicit ModifyListenerCallBack( const Link& rCallBack );
+
+ virtual ~ModifyListenerCallBack();
+
+ void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >& xBroadcaster );
+ SAL_DLLPRIVATE void stopListening();
+
+private: //methods
+ SAL_DLLPRIVATE ModifyListenerCallBack();
+ SAL_DLLPRIVATE ModifyListenerCallBack( const ModifyListenerCallBack& );
+
+private: //member
+ ModifyListenerCallBack_impl* pModifyListener_impl;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > m_xModifyListener;
+};
+
+} // namespace chart
+
+#endif
+
diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx
new file mode 100644
index 000000000000..262d2078deea
--- /dev/null
+++ b/chart2/source/inc/ModifyListenerHelper.hxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_MODIFYLISTENERHELPER_HXX
+#define CHART2_MODIFYLISTENERHELPER_HXX
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/uno/XWeak.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include "MutexContainer.hxx"
+#include "charttoolsdllapi.hxx"
+
+#include <list>
+#include <algorithm>
+#include <functional>
+#include <utility>
+
+namespace com { namespace sun { namespace star {
+namespace chart2
+{
+ class XChartDocument;
+}}}}
+
+namespace chart
+{
+namespace ModifyListenerHelper
+{
+
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::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::WeakComponentImplHelper2<
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+{
+public:
+ ModifyEventForwarder();
+
+ void FireEvent( const ::com::sun::star::lang::EventObject & rEvent );
+
+ void AddListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
+ void RemoveListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener );
+
+protected:
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ virtual void SAL_CALL disposing();
+
+private:
+ /// call disposing() at all listeners and remove all listeners
+ void DisposeAndClear( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XWeak > & xSource );
+
+// ::osl::Mutex & m_rMutex;
+ ::cppu::OBroadcastHelper m_aModifyListeners;
+
+ typedef ::std::list<
+ ::std::pair<
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener >,
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > > >
+ tListenerMap;
+
+ tListenerMap m_aListenerMap;
+};
+
+// ================================================================================
+
+namespace impl
+{
+
+template< class InterfaceRef >
+struct addListenerFunctor : public ::std::unary_function< InterfaceRef, void >
+{
+ explicit addListenerFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const InterfaceRef & xObject )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >
+ xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->addModifyListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+};
+
+template< class InterfaceRef >
+struct removeListenerFunctor : public ::std::unary_function< InterfaceRef, void >
+{
+ explicit removeListenerFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const InterfaceRef & xObject )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >
+ xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->removeModifyListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+};
+
+template< class Pair >
+struct addListenerToMappedElementFunctor : public ::std::unary_function< Pair, void >
+{
+ explicit addListenerToMappedElementFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const Pair & aPair )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >
+ xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->addModifyListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+};
+
+template< class Pair >
+struct removeListenerFromMappedElementFunctor : public ::std::unary_function< Pair, void >
+{
+ explicit removeListenerFromMappedElementFunctor( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener ) :
+ m_xListener( xListener )
+ {}
+
+ void operator() ( const Pair & aPair )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >
+ xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xListener.is())
+ xBroadcaster->removeModifyListener( m_xListener );
+ }
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+};
+
+} // namespace impl
+
+// --------------------------------------------------------------------------------
+
+
+template< class InterfaceRef >
+void addListener(
+ const InterfaceRef & xObject,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ {
+ impl::addListenerFunctor< InterfaceRef > aFunctor( xListener );
+ aFunctor( xObject );
+ }
+}
+
+template< class Container >
+void addListenerToAllElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::addListenerFunctor< typename Container::value_type >( xListener ));
+}
+
+template< class Container >
+void addListenerToAllMapElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::addListenerToMappedElementFunctor< typename Container::value_type >( xListener ));
+}
+
+template< typename T >
+void addListenerToAllSequenceElements(
+ const ::com::sun::star::uno::Sequence< T > & rSequence,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(),
+ impl::addListenerFunctor< T >( xListener ));
+}
+
+template< class InterfaceRef >
+void removeListener(
+ const InterfaceRef & xObject,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ {
+ impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener );
+ aFunctor( xObject );
+ }
+}
+
+template< class Container >
+void removeListenerFromAllElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::removeListenerFunctor< typename Container::value_type >( xListener ));
+}
+
+template< class Container >
+void removeListenerFromAllMapElements(
+ const Container & rContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rContainer.begin(), rContainer.end(),
+ impl::removeListenerFromMappedElementFunctor< typename Container::value_type >( xListener ));
+}
+
+template< typename T >
+void removeListenerFromAllSequenceElements(
+ const ::com::sun::star::uno::Sequence< T > & rSequence,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > & xListener )
+{
+ if( xListener.is())
+ ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(),
+ impl::removeListenerFunctor< T >( xListener ));
+}
+
+} // namespace ModifyListenerHelper
+} // namespace chart
+
+// CHART2_MODIFYLISTENERHELPER_HXX
+#endif
diff --git a/chart2/source/inc/MutexContainer.hxx b/chart2/source/inc/MutexContainer.hxx
new file mode 100644
index 000000000000..026c53634b12
--- /dev/null
+++ b/chart2/source/inc/MutexContainer.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_MUTEXCONTAINER_HXX
+#define CHART_MUTEXCONTAINER_HXX
+
+#include <osl/mutex.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS MutexContainer
+{
+public:
+ virtual ~MutexContainer();
+
+protected:
+ mutable ::osl::Mutex m_aMutex;
+
+ virtual ::osl::Mutex & GetMutex() const;
+};
+
+} // namespace chart
+
+// CHART_MUTEXCONTAINER_HXX
+#endif
diff --git a/chart2/source/inc/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx
new file mode 100644
index 000000000000..f44d3cea490a
--- /dev/null
+++ b/chart2/source/inc/NameContainer.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_NAMECONTAINER_HXX
+#define _CHART2_NAMECONTAINER_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include "charttoolsdllapi.hxx"
+
+#include <map>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createNameContainer(
+ const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName );
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable >
+ NameContainer_Base;
+}
+
+class NameContainer : public impl::NameContainer_Base
+{
+public:
+ NameContainer( const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName );
+ explicit NameContainer( const NameContainer & rOther );
+ virtual ~NameContainer();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual com::sun::star::uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual sal_Bool SAL_CALL hasElements( ) throw( com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Type SAL_CALL getElementType( ) throw( com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw (::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ NameContainer();//no default contructor
+
+private: //member
+ const ::com::sun::star::uno::Type m_aType;
+ const rtl::OUString m_aServicename;
+ const rtl::OUString m_aImplementationName;
+
+ typedef ::std::map< ::rtl::OUString, com::sun::star::uno::Any > tContentMap;
+
+ tContentMap m_aMap;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/NamedFillProperties.hxx b/chart2/source/inc/NamedFillProperties.hxx
new file mode 100644
index 000000000000..325f8960f7fd
--- /dev/null
+++ b/chart2/source/inc/NamedFillProperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_NAMEDFILLPROPERTIES_HXX
+#define CHART_NAMEDFILLPROPERTIES_HXX
+
+#error "Deprecated, do not include this file"
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// CHANGED! : these are the UNnamed properties!
+// @deprecated
+class NamedFillProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // com.sun.star.drawing.FillProperties (only named properties)
+ //optional properties:
+ PROP_FILL_TRANSPARENCE_GRADIENT,
+ PROP_FILL_GRADIENT,
+ PROP_FILL_HATCH,
+ PROP_FILL_BITMAP,
+
+ FAST_PROPERTY_ID_END_NAMED_FILL_PROP
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+ //will return e.g. "FillGradientName" for nHandle == PROP_FILL_GRADIENT_NAME
+ static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle );
+
+private:
+ // not implemented
+ NamedFillProperties();
+};
+
+} // namespace chart
+
+// CHART_NAMEDFILLPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/NamedLineProperties.hxx b/chart2/source/inc/NamedLineProperties.hxx
new file mode 100644
index 000000000000..8f16cd970932
--- /dev/null
+++ b/chart2/source/inc/NamedLineProperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_NAMEDLINEPROPERTIES_HXX
+#define CHART_NAMEDLINEPROPERTIES_HXX
+
+#error "Deprecated, do not include this file"
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+
+// @depreated !!
+class NamedLineProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // com.sun.star.drawing.LineProperties (only named properties)
+ PROP_LINE_DASH_NAME = FAST_PROPERTY_ID_START_NAMED_LINE_PROP,
+ PROP_LINE_END_NAME,
+ PROP_LINE_START_NAME,
+
+ FAST_PROPERTY_ID_END_NAMED_LINE_PROP
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties,
+ bool bIncludeLineEnds = false );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap,
+ bool bIncludeLineEnds = false );
+
+ //will return e.g. "LineDashName" for PROP_LINE_DASH_NAME
+ static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle );
+
+private:
+ // not implemented
+ NamedLineProperties();
+};
+
+} // namespace chart
+
+// CHART_NAMEDLINEPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/NamedProperties.hxx b/chart2/source/inc/NamedProperties.hxx
new file mode 100644
index 000000000000..5f9f5eb94823
--- /dev/null
+++ b/chart2/source/inc/NamedProperties.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_NAMEDPROPERTIES_HXX
+#define CHART_NAMEDPROPERTIES_HXX
+
+#include "NamedLineProperties.hxx"
+#include "NamedFillProperties.hxx"
+
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+class NamedProperties
+{
+ /** this class combines the classes NamedFillAttributes and NamedLineAttributes
+ thus you can handle all named properties with one call if you like
+ */
+public:
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ //will return e.g. "FillGradientName" for nHandle == PROP_FILL_GRADIENT_NAME
+ static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle );
+
+private:
+ // not implemented
+ NamedProperties();
+};
+
+} // namespace chart
+
+// CHART_NAMEDPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/NoWarningThisInCTOR.hxx b/chart2/source/inc/NoWarningThisInCTOR.hxx
new file mode 100644
index 000000000000..00167d07636b
--- /dev/null
+++ b/chart2/source/inc/NoWarningThisInCTOR.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_NOWARNINGTHISINCTOR_HXX
+#define CHART2_NOWARNINGTHISINCTOR_HXX
+
+/** Include this file, if you have to use "this" in the base initializer list of
+ a constructor.
+
+ Include it only, if the usage of this is unavoidable, like in the
+ initialization of controls in a dialog.
+
+ Do not include this header in other header files, because this might result
+ in unintended suppression of the warning via indirect inclusion.
+ */
+
+#ifdef _MSC_VER
+// warning C4355: 'this' : used in base member initializer list
+# pragma warning (disable : 4355)
+#endif
+
+// CHART2_NOWARNINGTHISINCTOR_HXX
+#endif
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
new file mode 100644
index 000000000000..fa773a6dab00
--- /dev/null
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_OPROPERTYSET_HXX
+#define CHART_OPROPERTYSET_HXX
+
+// helper classes
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/weak.hxx>
+
+// interfaces and types
+// #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+// #include <com/sun/star/lang/XServiceInfo.hpp>
+// #endif
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/style/XStyleSupplier.hpp>
+// #ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSTATE_HPP_
+// #include <com/sun/star/beans/XFastPropertyState.hpp>
+// #endif
+#include <osl/mutex.hxx>
+#include "charttoolsdllapi.hxx"
+
+#include <memory>
+
+namespace property
+{
+
+namespace impl
+{ class ImplOPropertySet; }
+
+
+class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet :
+ public ::cppu::OBroadcastHelper,
+ // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
+ public ::cppu::OPropertySetHelper,
+ // includes uno::XWeak (and XInterface, esp. ref-counting)
+// public virtual ::cppu::OWeakObject,
+
+// public virtual ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertyStates,
+ public ::com::sun::star::style::XStyleSupplier
+// public ::com::sun::star::beans::XFastPropertyState
+{
+public:
+ OPropertySet( ::osl::Mutex & rMutex );
+ virtual ~OPropertySet();
+
+protected:
+ explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex );
+
+ 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.
+ */
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException) = 0;
+
+ /** The InfoHelper table contains all property names and types of
+ this object.
+
+ @return the object that provides information for the
+ PropertySetInfo
+
+ @see ::cppu::OPropertySetHelper
+ */
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
+
+ // ____ XPropertySet ____
+ /** sample implementation using the InfoHelper:
+
+ <pre>
+ uno::Reference&lt; beans::XPropertySetInfo &gt; SAL_CALL
+ OPropertySet::getPropertySetInfo()
+ throw (uno::RuntimeException)
+ {
+ static uno::Reference&lt; beans::XPropertySetInfo &gt; xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+ }
+ </pre>
+
+ <p>(The reason why this isn't implemented here is, that the static
+ object is only valid per concrete PropertySet. Otherwise all
+ PropertySets derived from this base calss would have the same
+ properties.)</p>
+
+ @see ::cppu::OPropertySetHelper
+ */
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+// getPropertySetInfo()
+// throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ /** Try to convert the value <code>rValue</code> to the type required by the
+ property associated with <code>nHandle</code>.
+
+ Overload this method to take influence in modification of properties.
+
+ If the conversion changed , </TRUE> is returned and the converted value
+ is in <code>rConvertedValue</code>. The former value is contained in
+ <code>rOldValue</code>.
+
+ After this call returns successfully, the vetoable listeners are
+ notified.
+
+ @throws IllegalArgumentException, if the conversion was not successful,
+ or if there is no corresponding property to the given handle.
+
+ @param rConvertedValue the converted value. Only set if return is true.
+ @param rOldValue the old value. Only set if return is true.
+ @param nHandle the handle of the property.
+
+ @return true, if the conversion was successful and converted value
+ differs from the old value.
+
+ @see ::cppu::OPropertySetHelper
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue
+ ( ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ /** The same as setFastProperyValue; nHandle is always valid.
+ The changes must not be broadcasted in this method.
+
+ @attention
+ Although you are permitted to throw any UNO exception, only the following
+ are valid for usage:
+ -- ::com::sun::star::beans::UnknownPropertyException
+ -- ::com::sun::star::beans::PropertyVetoException
+ -- ::com::sun::star::lang::IllegalArgumentException
+ -- ::com::sun::star::lang::WrappedTargetException
+ -- ::com::sun::star::uno::RuntimeException
+
+ @param nHandle handle
+ @param rValue value
+
+ @see ::cppu::OPropertySetHelper
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ /**
+ The same as getFastProperyValue, but return the value through rValue and
+ nHandle is always valid.
+
+ @see ::cppu::OPropertySetHelper
+ */
+ virtual void SAL_CALL getFastPropertyValue
+ ( ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle ) const;
+
+ /// 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();
+
+ /// call this when a derived component is disposed
+ virtual void disposePropertySet();
+
+ // ========================================
+ // Interfaces
+ // ========================================
+
+ // ____ XInterface ____
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL acquire() throw ();
+// virtual void SAL_CALL release() throw ();
+
+
+ // ____ XServiceInfo ____
+// virtual ::rtl::OUString SAL_CALL
+// getImplementationName()
+// throw (::com::sun::star::uno::RuntimeException);
+// virtual sal_Bool SAL_CALL
+// supportsService( const ::rtl::OUString& ServiceName )
+// throw (::com::sun::star::uno::RuntimeException);
+// virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+// getSupportedServiceNames()
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTypeProvider ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XPropertyState ____
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState( const ::rtl::OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
+ getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ setPropertyToDefault( const ::rtl::OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getPropertyDefault( const ::rtl::OUString& aPropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XMultiPropertyStates ____
+ // Note: getPropertyStates() is already implemented in XPropertyState with the
+ // same signature
+ virtual void SAL_CALL
+ setAllPropertiesToDefault()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
+ getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XStyleSupplier ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > SAL_CALL getStyle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XFastPropertyState ____
+// virtual ::com::sun::star::beans::PropertyState SAL_CALL getFastPropertyState( sal_Int32 nHandle )
+// throw (::com::sun::star::beans::UnknownPropertyException,
+// ::com::sun::star::uno::RuntimeException);
+// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getFastPropertyStates( const ::com::sun::star::uno::Sequence< sal_Int32 >& aHandles )
+// throw (::com::sun::star::beans::UnknownPropertyException,
+// ::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setFastPropertyToDefault( sal_Int32 nHandle )
+// throw (::com::sun::star::beans::UnknownPropertyException,
+// ::com::sun::star::uno::RuntimeException);
+// virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyDefault( sal_Int32 nHandle )
+// throw (::com::sun::star::beans::UnknownPropertyException,
+// ::com::sun::star::lang::WrappedTargetException,
+// ::com::sun::star::uno::RuntimeException);
+
+ // ____ XMultiPropertySet ____
+ virtual void SAL_CALL setPropertyValues(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ____ XFastPropertySet ____
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // 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;
+
+ /// pImpl idiom implementation
+ ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties;
+ bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
+};
+
+} // namespace property
+
+// CHART_OPROPERTYSET_HXX
+#endif
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
new file mode 100644
index 000000000000..0765c9acf94a
--- /dev/null
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_OBJECTIDENTIFIER_HXX
+#define _CHART2_OBJECTIDENTIFIER_HXX
+
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include "TitleHelper.hxx"
+#include "charttoolsdllapi.hxx"
+
+// header for class OUString
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+enum ObjectType
+{
+ OBJECTTYPE_PAGE,
+ OBJECTTYPE_TITLE,
+ OBJECTTYPE_LEGEND,
+ OBJECTTYPE_LEGEND_ENTRY,
+ OBJECTTYPE_DIAGRAM,
+ OBJECTTYPE_DIAGRAM_WALL,
+ OBJECTTYPE_DIAGRAM_FLOOR,
+ OBJECTTYPE_AXIS,
+ OBJECTTYPE_AXIS_UNITLABEL,
+ OBJECTTYPE_GRID,
+ OBJECTTYPE_SUBGRID,
+ OBJECTTYPE_DATA_SERIES,
+ OBJECTTYPE_DATA_POINT,
+ OBJECTTYPE_DATA_LABELS,
+ OBJECTTYPE_DATA_LABEL,
+ OBJECTTYPE_DATA_ERRORS,
+ OBJECTTYPE_DATA_ERRORS_X,
+ OBJECTTYPE_DATA_ERRORS_Y,
+ OBJECTTYPE_DATA_ERRORS_Z,
+ OBJECTTYPE_DATA_CURVE,//e.g. a statistical method printed as line
+ OBJECTTYPE_DATA_AVERAGE_LINE,
+ OBJECTTYPE_DATA_CURVE_EQUATION,
+ OBJECTTYPE_DATA_STOCK_RANGE,
+ OBJECTTYPE_DATA_STOCK_LOSS,
+ OBJECTTYPE_DATA_STOCK_GAIN,
+ OBJECTTYPE_SHAPE,
+ OBJECTTYPE_UNKNOWN
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
+{
+ //CID == ClassifiedIdentifier <--> name of shape
+ //semicolon, colon, equal sign and slash have special meanings in a CID
+ //and are therefore not allowed in its components
+
+ //syntax of a CID: CID:/classification/ObjectID
+
+ //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString"
+ // or a combination of these seperated with a colon
+ //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose
+ //where DragParameterString is any string you like to transport information to your special drag service
+ // only semicolon, colon, equal sign and slash are not allowed characters
+ // also the keywors used in the ObjectIdentifiers are not allowed
+
+ //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22
+ //where Particle: Type=ParticleID //e.g. Point=22
+ //where Type: getStringForType( ObjectType eType ) or other string
+
+public:
+ ObjectIdentifier();
+ ObjectIdentifier( const ::rtl::OUString& rObjectCID );
+ ObjectIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
+ ObjectIdentifier( const ::com::sun::star::uno::Any& rAny );
+ virtual ~ObjectIdentifier();
+
+ ObjectIdentifier( const ObjectIdentifier& rOID );
+ ObjectIdentifier& operator=( const ObjectIdentifier& rOID );
+ bool operator==( const ObjectIdentifier& rOID ) const;
+ bool operator!=( const ObjectIdentifier& rOID ) const;
+ bool operator<( const ObjectIdentifier& rOID ) const;
+
+ static rtl::OUString createClassifiedIdentifierForObject(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xObject
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static rtl::OUString createClassifiedIdentifierForParticle(
+ const rtl::OUString& rParticle );
+
+ static rtl::OUString createClassifiedIdentifierForParticles(
+ const rtl::OUString& rParentParticle
+ , const rtl::OUString& rChildParticle
+ , const rtl::OUString& rDragMethodServiceName = rtl::OUString()
+ , const rtl::OUString& rDragParameterString = rtl::OUString() );
+
+ static rtl::OUString createClassifiedIdentifierForGrid(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
+
+ SAL_DLLPRIVATE static rtl::OUString createParticleForDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+
+ static rtl::OUString createParticleForCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static rtl::OUString createParticleForAxis(
+ sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+ static rtl::OUString createParticleForGrid(
+ sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+ static rtl::OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
+ , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex );
+
+ static rtl::OUString createParticleForLegend(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >& xLegend
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static rtl::OUString addChildParticle( const rtl::OUString& rParticle, const rtl::OUString& rChildParticle );
+ static rtl::OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
+ static sal_Int32 getIndexFromParticleOrCID( const rtl::OUString& rParticleOrCID );
+
+ static rtl::OUString createClassifiedIdentifier(
+ enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
+ , const rtl::OUString& rParticleID );//e.g. SeriesID
+
+ static rtl::OUString createClassifiedIdentifierWithParent(
+ enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
+ , const rtl::OUString& rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object
+ , const rtl::OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
+ , const rtl::OUString& rDragMethodServiceName = rtl::OUString()
+ , const rtl::OUString& rDragParameterString = rtl::OUString()
+ );
+
+ static bool isCID( const rtl::OUString& rName );
+ static rtl::OUString getDragMethodServiceName( const rtl::OUString& rClassifiedIdentifier );
+ static rtl::OUString getDragParameterString( const rtl::OUString& rCID );
+ static bool isDragableObject( const rtl::OUString& rClassifiedIdentifier );
+ bool isDragableObject();
+ static bool isRotateableObject( const rtl::OUString& rClassifiedIdentifier );
+ static bool isMultiClickObject( const rtl::OUString& rClassifiedIdentifier );
+ static bool areSiblings( const rtl::OUString& rCID1, const rtl::OUString& rCID2 );//identical object is no sibling
+ static bool areIdenticalObjects( const ::rtl::OUString& rCID1, const ::rtl::OUString& rCID2 );
+
+ static rtl::OUString getStringForType( ObjectType eObjectType );
+ static ObjectType getObjectType( const rtl::OUString& rCID );
+ ObjectType getObjectType();
+
+ static rtl::OUString createSeriesSubObjectStub( ObjectType eSubObjectType
+ , const rtl::OUString& rSeriesParticle
+ , const rtl::OUString& rDragMethodServiceName = rtl::OUString()
+ , const rtl::OUString& rDragParameterString = rtl::OUString() );
+ static rtl::OUString createPointCID( const rtl::OUString& rPointCID_Stub, sal_Int32 nIndex );
+
+ static rtl::OUString createDataCurveCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
+ static rtl::OUString createDataCurveEquationCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex );
+
+ SAL_DLLPRIVATE static rtl::OUString getObjectID( const rtl::OUString& rCID );
+ static rtl::OUString getParticleID( const rtl::OUString& rCID );
+ static rtl::OUString getFullParentParticle( const rtl::OUString& rCID );
+
+ //returns the series particle of a CID when the CID is a child of the series
+ static rtl::OUString getSeriesParticleFromCID( const rtl::OUString& rCID );
+
+ //return the model object that is indicated by rObjectCID
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getObjectPropertySet(
+ const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getObjectPropertySet(
+ const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+
+ //return the axis object that belongs to rObjectCID if any
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
+ getAxisForCID(
+ const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ //return the series object that belongs to rObjectCID if any
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+ getDataSeriesForCID(
+ const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >
+ getDiagramForCID(
+ const rtl::OUString& rObjectCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+
+ static const ::rtl::OUString& getPieSegmentDragMethodServiceName();
+ static ::rtl::OUString createPieSegmentDragParameterString(
+ sal_Int32 nOffsetPercent
+ , const ::com::sun::star::awt::Point& rMinimumPosition
+ , const ::com::sun::star::awt::Point& rMaximumPosition );
+ static bool parsePieSegmentDragParameterString( const rtl::OUString& rDragParameterString
+ , sal_Int32& rOffsetPercent
+ , ::com::sun::star::awt::Point& rMinimumPosition
+ , ::com::sun::star::awt::Point& rMaximumPosition );
+
+ static TitleHelper::eTitleType getTitleTypeForCID( const ::rtl::OUString& rCID );
+
+ static ::rtl::OUString getMovedSeriesCID( const ::rtl::OUString& rObjectCID, sal_Bool bForward );
+
+ bool isValid() const;
+ bool isAutoGeneratedObject() const;
+ bool isAdditionalShape() const;
+ ::rtl::OUString getObjectCID() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getAdditionalShape() const;
+ ::com::sun::star::uno::Any getAny() const;
+
+private:
+ // #i12587# support for shapes in chart
+ // For autogenerated chart objects a CID is specified in m_aObjectCID,
+ // for all other objects m_xAdditionalShape is set.
+ // Note, that if m_aObjectCID is set, m_xAdditionalShape must be empty
+ // and vice versa.
+ ::rtl::OUString m_aObjectCID;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xAdditionalShape;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..5548cf81be87
--- /dev/null
+++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_POTENTIALREGRESSIONCURVECALCULATOR_HXX
+#define CHART2_POTENTIALREGRESSIONCURVECALCULATOR_HXX
+
+#include "RegressionCurveCalculator.hxx"
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+
+class PotentialRegressionCurveCalculator :
+ public RegressionCurveCalculator
+{
+public:
+ PotentialRegressionCurveCalculator();
+ virtual ~PotentialRegressionCurveCalculator();
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const;
+
+private:
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // formula is: f(x) = x ^ m_fSlope * m_fIntercept
+ double m_fSlope;
+ double m_fIntercept;
+};
+
+} // namespace chart
+
+// CHART2_POTENTIALREGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/PropertyHelper.hxx b/chart2/source/inc/PropertyHelper.hxx
new file mode 100644
index 000000000000..eb4fce0360cc
--- /dev/null
+++ b/chart2/source/inc/PropertyHelper.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_PROPERTYHELPER_HXX
+#define CHART_PROPERTYHELPER_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/property.hxx>
+#include <map>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+typedef int tPropertyValueMapKey;
+
+typedef ::std::map< tPropertyValueMapKey, ::com::sun::star::uno::Any >
+ tPropertyValueMap;
+
+namespace PropertyHelper
+{
+
+/** adds a line dash with a unique name to the gradient obtained by the given
+ factory.
+
+ @return The name used for storing this element in the table
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addLineDashUniqueNameToTable(
+ const ::com::sun::star::uno::Any & rValue,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFact,
+ const ::rtl::OUString & rPreferredName );
+
+/** adds a gradient with a unique name to the gradient obtained by the given
+ factory.
+
+ @return The name used for storing this element in the table
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addGradientUniqueNameToTable(
+ const ::com::sun::star::uno::Any & rValue,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFact,
+ const ::rtl::OUString & rPreferredName );
+
+/** adds a transparency gradient with a unique name to the gradient obtained
+ by the given factory.
+
+ @return The name used for storing this element in the table
+*/
+OOO_DLLPUBLIC_CHARTTOOLS
+::rtl::OUString addTransparencyGradientUniqueNameToTable(
+ const ::com::sun::star::uno::Any & rValue,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFact,
+ const ::rtl::OUString & rPreferredName );
+
+/** adds a hatch with a unique name to the gradient obtained by the given
+ factory.
+
+ @return The name used for storing this element in the table
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addHatchUniqueNameToTable(
+ const ::com::sun::star::uno::Any & rValue,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFact,
+ const ::rtl::OUString & rPreferredName );
+
+/** adds a bitmap with a unique name to the gradient obtained by the given
+ factory.
+
+ @return The name used for storing this element in the table
+*/
+OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addBitmapUniqueNameToTable(
+ const ::com::sun::star::uno::Any & rValue,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFact,
+ const ::rtl::OUString & rPreferredName );
+
+// --------------------------------------------------------------------------------
+
+/** Set a property to a certain value in the given map. This works for
+ properties that are already set, and those which are not yet in the map.
+
+ @param any is the value encapsulated in the variant type Any
+ */
+OOO_DLLPUBLIC_CHARTTOOLS
+void setPropertyValueAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key,
+ const ::com::sun::star::uno::Any & rAny );
+
+/** Set a property to a certain value in the given map. This works for
+ properties that are already set, and those which are not yet in the map.
+
+ @param value is the value of type Value that will be put into a variant type
+ Any before set in the property map.
+ */
+template< typename Value >
+ void setPropertyValue( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value )
+{
+ setPropertyValueAny( rOutMap, key, ::com::sun::star::uno::makeAny( value ));
+}
+
+template<>
+ void setPropertyValue< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny );
+
+OOO_DLLPUBLIC_CHARTTOOLS void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny );
+
+/** Calls setPropertyValue() but asserts that the given property hasn't been set
+ before.
+ */
+template< typename Value >
+ void setPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value )
+{
+ setPropertyValueDefaultAny( rOutMap, key, ::com::sun::star::uno::makeAny( value ));
+}
+
+/** Calls setPropertyValue() but asserts that the given property hasn't been set
+ before.
+ */
+template<>
+ void setPropertyValueDefault< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny );
+
+/** Calls setPropertyValueDefault() with an empty Any as value
+ */
+OOO_DLLPUBLIC_CHARTTOOLS void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key );
+
+
+} // namespace PropertyHelper
+
+// ================================================================================
+
+struct OOO_DLLPUBLIC_CHARTTOOLS PropertyNameLess
+{
+ inline bool operator() ( const ::com::sun::star::beans::Property & first,
+ const ::com::sun::star::beans::Property & second )
+ {
+ return ( first.Name.compareTo( second.Name ) < 0 );
+ }
+};
+
+struct OOO_DLLPUBLIC_CHARTTOOLS PropertyLess : public ::std::binary_function<
+ ::com::sun::star::beans::Property,
+ ::com::sun::star::beans::Property,
+ bool >
+{
+ bool operator() ( const ::com::sun::star::beans::Property & rFirst,
+ const ::com::sun::star::beans::Property & rSecond )
+ {
+ return ( rFirst.Name.compareTo( rSecond.Name ) < 0 );
+ }
+};
+
+struct OOO_DLLPUBLIC_CHARTTOOLS PropertyValueNameEquals : public ::std::unary_function< ::com::sun::star::beans::PropertyValue, bool >
+{
+ explicit PropertyValueNameEquals( const ::rtl::OUString & rName ) :
+ m_aName( rName )
+ {}
+
+ bool operator() ( const ::com::sun::star::beans::PropertyValue & rPropValue )
+ {
+ return rPropValue.Name.equals( m_aName );
+ }
+
+private:
+ ::rtl::OUString m_aName;
+};
+
+} // namespace chart
+
+// CHART_PROPERTYHELPER_HXX
+#endif
diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx
new file mode 100644
index 000000000000..48719ec2eeda
--- /dev/null
+++ b/chart2/source/inc/RangeHighlighter.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RANGEHIGHLIGHTER_HXX
+#define CHART2_RANGEHIGHLIGHTER_HXX
+
+#include "MutexContainer.hxx"
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+namespace com { namespace sun { namespace star {
+namespace chart2 {
+ class XDiagram;
+ class XDataSeries;
+ class XAxis;
+}}}}
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::chart2::data::XRangeHighlighter,
+ ::com::sun::star::view::XSelectionChangeListener
+ >
+ RangeHighlighter_Base;
+}
+
+class RangeHighlighter :
+ public MutexContainer,
+ public impl::RangeHighlighter_Base
+{
+public:
+ explicit RangeHighlighter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::view::XSelectionSupplier > & xSelectionSupplier );
+ virtual ~RangeHighlighter();
+
+protected:
+ // ____ XRangeHighlighter ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange > SAL_CALL getSelectedRanges()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionChangeListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionChangeListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XSelectionChangeListener ____
+ virtual void SAL_CALL selectionChanged(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XSelectionChangeListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ WeakComponentImplHelperBase ____
+ // is called when dispose() is called at this component
+ virtual void SAL_CALL disposing();
+
+private:
+ void fireSelectionEvent();
+ void startListening();
+ void stopListening();
+ void determineRanges();
+
+ void fillRangesForDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram );
+ void fillRangesForDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries );
+ void fillRangesForCategories( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > & xAxis );
+ void fillRangesForDataPoint( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xDataSeries, sal_Int32 nIndex );
+ void fillRangesForErrorBars( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xErrorBar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xDataSeries );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier >
+ m_xSelectionSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >
+ m_xListener;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange >
+ m_aSelectedRanges;
+ sal_Int32 m_nAddedListenerCount;
+ bool m_bIncludeHiddenCells;
+};
+
+} // namespace chart
+
+// CHART2_RANGEHIGHLIGHTER_HXX
+#endif
diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx
new file mode 100644
index 000000000000..35819ba111cb
--- /dev/null
+++ b/chart2/source/inc/ReferenceSizeProvider.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REFERENCESIZEPROVIDER_HXX
+#define CHART2_REFERENCESIZEPROVIDER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include "charttoolsdllapi.hxx"
+
+namespace com { namespace sun { namespace star {
+namespace chart2 {
+ class XTitle;
+ class XTitled;
+}
+}}}
+
+// ----------------------------------------
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
+{
+public:
+
+ enum AutoResizeState
+ {
+ AUTO_RESIZE_YES,
+ AUTO_RESIZE_NO,
+ AUTO_RESIZE_AMBIGUOUS,
+ AUTO_RESIZE_UNKNOWN
+ };
+
+ ReferenceSizeProvider(
+ ::com::sun::star::awt::Size aPageSize,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ ::com::sun::star::awt::Size getPageSize() const;
+
+ /** Retrieves the state auto-resize from all objects that support this
+ feature. If all objects return the same state, AUTO_RESIZE_YES or
+ AUTO_RESIZE_NO is returned.
+
+ If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
+ returned. If there are multiple objects, some with state YES and some
+ with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
+ */
+ static AutoResizeState getAutoResizeState(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & 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
+ is ambiguous, it is turned on. If the current state is unknown it stays
+ unknown.
+ */
+ void toggleAutoResizeState();
+
+
+ /** Sets the ReferencePageSize according to the internal settings of this
+ class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
+ is </TRUE>.
+ */
+ SAL_DLLPRIVATE void setValuesAtPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xProp,
+ bool bAdaptFontSizes = true );
+
+ /** Sets the ReferencePageSize according to the internal settings of this
+ class at the XTitle, and the adapted font sizes at the contained
+ XFormattedStrings
+ */
+ SAL_DLLPRIVATE void setValuesAtTitle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle );
+
+ /** Sets the internal value at all data series in the currently set model.
+ This is useful, if you have changed a chart-type and thus probably added
+ some new data series via model functionality.
+ */
+ void setValuesAtAllDataSeries();
+
+private:
+ SAL_DLLPRIVATE bool useAutoScale() const;
+
+ /** sets the auto-resize at all objects that support this feature for text.
+ eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
+ */
+ SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
+
+ /** Retrieves the auto-resize state from the given propertyset. The result
+ will be put into eInOutState. If you initialize eInOutState with
+ AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
+ other state, the result will be the accumulated state,
+ esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
+ the current property set, or the other way round.
+ */
+ SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xProp,
+ AutoResizeState & rInOutState );
+
+ SAL_DLLPRIVATE void impl_setValuesAtTitled(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitled > & xTitled );
+ SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitled > & xTitled,
+ AutoResizeState & rInOutState );
+
+ ::com::sun::star::awt::Size m_aPageSize;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
+ bool m_bUseAutoScale;
+};
+
+} // namespace chart
+
+// CHART2_REFERENCESIZEPROVIDER_HXX
+#endif
diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx
new file mode 100644
index 000000000000..25fda5080409
--- /dev/null
+++ b/chart2/source/inc/RegressionCurveCalculator.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REGRESSIONCURVECALCULATOR_HXX
+#define CHART2_REGRESSIONCURVECALCULATOR_HXX
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+namespace chart
+{
+
+class RegressionCurveCalculator : public
+ ::cppu::WeakImplHelper1< ::com::sun::star::chart2::XRegressionCurveCalculator >
+{
+public:
+ RegressionCurveCalculator();
+ virtual ~RegressionCurveCalculator();
+
+ static bool isLinearScaling(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
+ static bool isLogarithmicScaling(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
+
+protected:
+ virtual ::rtl::OUString ImplGetRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const = 0;
+
+ ::rtl::OUString getFormattedString(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey,
+ double fNumber ) const;
+
+ double m_fCorrelationCoeffitient;
+
+ // ____ XRegressionCurveCalculator ____
+ virtual void SAL_CALL recalculateRegression(
+ const ::com::sun::star::uno::Sequence< double >& aXValues,
+ const ::com::sun::star::uno::Sequence< double >& aYValues )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual double SAL_CALL getCurveValue( double x )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
+ double min,
+ double max,
+ ::sal_Int32 nPointCount,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getCorrelationCoefficient()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRepresentation()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getFormattedRepresentation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumFmtSupplier,
+ ::sal_Int32 nNumberFormatKey )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART2_REGRESSIONCURVECALCULATOR_HXX
+#endif
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx
new file mode 100644
index 000000000000..0a8fd0315bb5
--- /dev/null
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REGRESSIONCURVEHELPER_HXX
+#define CHART2_REGRESSIONCURVEHELPER_HXX
+
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS RegressionCurveHelper
+{
+public:
+ /// returns a model mean-value line
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >
+ createMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+ /// returns a model regression curve
+ SAL_DLLPRIVATE static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >
+ createRegressionCurveByServiceName(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ ::rtl::OUString aServiceName );
+
+ // ------------------------------------------------------------
+
+ static bool hasMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ static bool isMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xRegCurve );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >
+ getMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & 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
+ */
+ static void addMeanValueLine(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProp );
+
+ static void removeMeanValueLine(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ enum tRegressionType
+ {
+ REGRESSION_TYPE_NONE,
+ REGRESSION_TYPE_LINEAR,
+ REGRESSION_TYPE_LOG,
+ REGRESSION_TYPE_EXP,
+ REGRESSION_TYPE_POWER,
+ REGRESSION_TYPE_MEAN_VALUE,
+ REGRESSION_TYPE_UNKNOWN
+ };
+
+ /** Returns the first regression curve found that is not of type
+ mean-value line
+ */
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >
+ getFirstCurveNotMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ /** Returns the type of the first regression curve found that is not of type
+ mean-value line
+ */
+ static tRegressionType getFirstRegressTypeNotMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ static tRegressionType getRegressionType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xCurve );
+
+ /** @param xPropertySource is taken as source to copy all properties from if
+ not null
+ @param xEquationProperties is set at the new regression curve as
+ equation properties if not null
+ */
+ static void addRegressionCurve( tRegressionType eType,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPropertySource =
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >(),
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xEquationProperties =
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >()
+ );
+
+ static bool removeAllExceptMeanValueLine(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ static void removeEquations(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
+ /** adds the given regression curve if there was none before. If there are
+ regression curves, the first one is replaced by the one given by the
+ type. All remaining curves are remnoved.
+
+ <p>This fuction ignores mean-value lines.</p>
+ */
+ static void replaceOrAddCurveAndReduceToOne(
+ tRegressionType eType,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+
+ // ------------------------------------------------------------
+
+ /// returns a calculator object for regression curves (used by the view)
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveCalculator >
+ createRegressionCurveCalculatorByServiceName(
+ ::rtl::OUString aServiceName );
+
+ /** recalculates the regression parameters according to the data given in
+ the data source.
+
+ A sequence having the role "values-x" will be used as x-values for the
+ calculation if found. Otherwise a sequence (1, 2, 3, ...) of category
+ indexes will be used for the recalculateRegression() method of the
+ regression curve.
+
+ The first sequence having the role "values-y" will be used as y-values
+ for the recalculateRegression() method of the regression curve.
+
+ @param bUseXValuesIfAvailable
+ If false, the sequence (1, 2, 3, ...) will always be used, even if
+ there is a data-sequence with role "values-x"
+ */
+ SAL_DLLPRIVATE static void initializeCurveCalculator(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveCalculator > & xOutCurveCalculator,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xSource,
+ bool bUseXValuesIfAvailable = true );
+
+ /** Same method as above, but uses the given XModel to determine the
+ parameter bUseXValuesIfAvailable in the above function. It is also
+ necessary that the data::XDataSource is an XDataSeries, thus this parameter
+ also changed.
+ */
+ static void initializeCurveCalculator(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveCalculator > & xOutCurveCalculator,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ static ::rtl::OUString getUINameForRegressionCurve( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >& xCurve );
+
+ static ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > > getAllRegressionCurvesNotMeanValueLine(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ static void resetEquationPosition( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xCurve );
+
+ /// @return the index of the given curve in the given container. -1 if not contained
+ static sal_Int32 getRegressionCurveIndex(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xContainer,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xCurve );
+
+ static bool hasEquation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xCurve );
+
+private:
+ // not implemented
+ RegressionCurveHelper();
+};
+
+} // namespace chart
+
+// CHART2_REGRESSIONCURVEHELPER_HXX
+#endif
diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx
new file mode 100644
index 000000000000..1dd0617236ad
--- /dev/null
+++ b/chart2/source/inc/RelativePositionHelper.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_RELATIVEPOSITIONHELPER_HXX
+#define _CHART2_RELATIVEPOSITIONHELPER_HXX
+
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/drawing/Alignment.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTTOOLS RelativePositionHelper
+{
+public:
+ /** returns the upper left corner of an object that has size aObjectSize and
+ where the point indicated by aAnchor has coordinates indicated by aPoint
+ ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the
+ coordinates of the bottom left corner of an object with size aObjectSize )
+ */
+ static ::com::sun::star::awt::Point
+ getUpperLeftCornerOfAnchoredObject(
+ ::com::sun::star::awt::Point aPoint,
+ ::com::sun::star::awt::Size aObjectSize,
+ ::com::sun::star::drawing::Alignment aAnchor );
+
+ /** returns the center of an object that has size aObjectSize and
+ where the point indicated by aAnchor has coordinates indicated by aPoint
+ ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the
+ coordinates of the bottom left corner of an object with size aObjectSize )
+ */
+ static ::com::sun::star::awt::Point
+ getCenterOfAnchoredObject(
+ ::com::sun::star::awt::Point aPoint,
+ ::com::sun::star::awt::Size aUnrotatedObjectSize,
+ ::com::sun::star::drawing::Alignment aAnchor,
+ double fAnglePi );
+
+ /** Returns a relative position that is the same point after the anchor has
+ been changed to the given one. The passed object size is taken into
+ account for shifting the position.
+ */
+ SAL_DLLPRIVATE static ::com::sun::star::chart2::RelativePosition
+ getReanchoredPosition(
+ const ::com::sun::star::chart2::RelativePosition & rPosition,
+ const ::com::sun::star::chart2::RelativeSize & rObjectSize,
+ ::com::sun::star::drawing::Alignment aNewAnchor );
+
+ /** grows a relative size about the given amount and shifts the given
+ position such that the resize is relative to the former rectangle's
+ center.
+
+ @param bCheck If </TRUE>, the resize is only done, if after
+ transformation, the position and size are within the bounds [0,1].
+
+ @return </TRUE>, if changes were applied.
+
+ <p>That means, if the position's alignment is center, the position will
+ not change at all.</p>
+ */
+ static bool centerGrow(
+ ::com::sun::star::chart2::RelativePosition & rInOutPosition,
+ ::com::sun::star::chart2::RelativeSize & rInOutSize,
+ double fAmountX, double fAmountY,
+ bool bCheck = true );
+
+ /** shifts a relative position about the given amount
+
+ @param bCheck If </TRUE>, the shift is only done, if after
+ transformation, the object represented by the position
+ rInOutPosition and its size rObjectSize the position and size are
+ within the bounds [0,1].
+
+ @return </TRUE>, if changes were applied.
+ */
+ static bool moveObject(
+ ::com::sun::star::chart2::RelativePosition & rInOutPosition,
+ const ::com::sun::star::chart2::RelativeSize & rObjectSize,
+ double fAmountX, double fAmountY,
+ bool bCheck = true );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/RelativeSizeHelper.hxx b/chart2/source/inc/RelativeSizeHelper.hxx
new file mode 100644
index 000000000000..a5585d9901bc
--- /dev/null
+++ b/chart2/source/inc/RelativeSizeHelper.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RELATIVESIZEHELPER_HXX
+#define CHART2_RELATIVESIZEHELPER_HXX
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS RelativeSizeHelper
+{
+public:
+ static double calculate(
+ double fValue,
+ const ::com::sun::star::awt::Size & rOldReferenceSize,
+ const ::com::sun::star::awt::Size & rNewReferenceSize );
+
+ static void adaptFontSizes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xTargetProperties,
+ const ::com::sun::star::awt::Size & rOldReferenceSize,
+ const ::com::sun::star::awt::Size & rNewReferenceSize );
+
+private:
+ // not implemented
+ RelativeSizeHelper();
+};
+
+} // namespace chart
+
+// CHART2_RELATIVESIZEHELPER_HXX
+#endif
diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx
new file mode 100644
index 000000000000..551f5f0da40d
--- /dev/null
+++ b/chart2/source/inc/ResId.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RESID_HXX
+#define CHART2_RESID_HXX
+
+#include <tools/resid.hxx>
+#include <rtl/ustring.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS SchResId : public ResId
+{
+public:
+ SchResId( sal_Int16 nId );
+
+ static ::rtl::OUString getResString( sal_Int16 nId );
+};
+
+} // namespace chart
+
+// CHART2_RESID_HXX
+#endif
diff --git a/chart2/source/inc/RessourceManager.hxx b/chart2/source/inc/RessourceManager.hxx
new file mode 100644
index 000000000000..9204fa106580
--- /dev/null
+++ b/chart2/source/inc/RessourceManager.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_RESSOURCEMANAGER_HXX
+#define CHART2_RESSOURCEMANAGER_HXX
+
+#include "charttoolsdllapi.hxx"
+
+// defined in <tools/resmgr.hxx>
+class ResMgr;
+
+namespace chart
+{
+
+class RessourceManager
+{
+public:
+ static ::ResMgr & getRessourceManager();
+
+private:
+ // not implemented -- avoid instantiation
+ RessourceManager();
+
+ static ::ResMgr * m_pRessourceManager;
+};
+
+} // namespace chart
+
+// CHART2_RESSOURCEMANAGER_HXX
+#endif
diff --git a/chart2/source/inc/Scaling.hxx b/chart2/source/inc/Scaling.hxx
new file mode 100644
index 000000000000..29fd8e2fb2e0
--- /dev/null
+++ b/chart2/source/inc/Scaling.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SCALING_HXX
+#define _CHART2_SCALING_HXX
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/XScaling.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase3.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class LogarithmicScaling :
+ public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ /// base is 10.0
+ explicit LogarithmicScaling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ LogarithmicScaling( double fBase = 10.0 );
+ virtual ~LogarithmicScaling();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const double m_fBase;
+ const double m_fLogOfBase;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+};
+
+// ----------------------------------------
+
+class ExponentialScaling :
+ public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ /// base is 10.0
+ explicit ExponentialScaling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit ExponentialScaling( double fBase = 10.0 );
+ virtual ~ExponentialScaling();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL
+ doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const double m_fBase;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+};
+
+// ----------------------------------------
+
+class LinearScaling : public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ /// y(x) = x
+ explicit LinearScaling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ /// y(x) = fSlope * x + fOffset
+ LinearScaling( double fSlope = 1.0, double fOffset = 0.0 );
+ virtual ~LinearScaling();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const double m_fSlope;
+ const double m_fOffset;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+};
+
+// ----------------------------------------
+
+class PowerScaling : public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ /// exponent 10.0
+ explicit PowerScaling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit PowerScaling( double fExponent = 10.0 );
+ virtual ~PowerScaling();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling )
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL
+ doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const double m_fExponent;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
diff --git a/chart2/source/inc/SceneProperties.hxx b/chart2/source/inc/SceneProperties.hxx
new file mode 100644
index 000000000000..bceef6712106
--- /dev/null
+++ b/chart2/source/inc/SceneProperties.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SCENEPROPERTIES_HXX
+#define CHART_SCENEPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements service SceneProperties
+class OOO_DLLPUBLIC_CHARTTOOLS SceneProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // "com.sun.star.drawing.SceneProperties" (does not exist)
+ PROP_SCENE_TRANSF_MATRIX = FAST_PROPERTY_ID_START_SCENE_PROP,
+ PROP_SCENE_DISTANCE,
+ PROP_SCENE_FOCAL_LENGTH,
+ PROP_SCENE_SHADOW_SLANT,
+ PROP_SCENE_SHADE_MODE,
+ PROP_SCENE_AMBIENT_COLOR,
+ PROP_SCENE_TWO_SIDED_LIGHTING,
+ PROP_SCENE_CAMERA_GEOMETRY,
+ PROP_SCENE_PERSPECTIVE,
+ PROP_SCENE_LIGHT_COLOR_1,
+ PROP_SCENE_LIGHT_DIRECTION_1,
+ PROP_SCENE_LIGHT_ON_1,
+ PROP_SCENE_LIGHT_COLOR_2,
+ PROP_SCENE_LIGHT_DIRECTION_2,
+ PROP_SCENE_LIGHT_ON_2,
+ PROP_SCENE_LIGHT_COLOR_3,
+ PROP_SCENE_LIGHT_DIRECTION_3,
+ PROP_SCENE_LIGHT_ON_3,
+ PROP_SCENE_LIGHT_COLOR_4,
+ PROP_SCENE_LIGHT_DIRECTION_4,
+ PROP_SCENE_LIGHT_ON_4,
+ PROP_SCENE_LIGHT_COLOR_5,
+ PROP_SCENE_LIGHT_DIRECTION_5,
+ PROP_SCENE_LIGHT_ON_5,
+ PROP_SCENE_LIGHT_COLOR_6,
+ PROP_SCENE_LIGHT_DIRECTION_6,
+ PROP_SCENE_LIGHT_ON_6,
+ PROP_SCENE_LIGHT_COLOR_7,
+ PROP_SCENE_LIGHT_DIRECTION_7,
+ PROP_SCENE_LIGHT_ON_7,
+ PROP_SCENE_LIGHT_COLOR_8,
+ PROP_SCENE_LIGHT_DIRECTION_8,
+ PROP_SCENE_LIGHT_ON_8
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+private:
+ // not implemented
+ SceneProperties();
+};
+
+} // namespace chart
+
+// CHART_FILLPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/ServiceMacros.hxx b/chart2/source/inc/ServiceMacros.hxx
new file mode 100644
index 000000000000..03913fa22842
--- /dev/null
+++ b/chart2/source/inc/ServiceMacros.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _APPHELPER_SERVICEMACROS_HXX
+#define _APPHELPER_SERVICEMACROS_HXX
+
+/*
+to use these macros the supported services and the implementation name needs to be static
+especially you need to implement (declaration is contained in macro already):
+
+static com::sun::star::uno::Sequence< rtl::OUString >
+ Class::getSupportedServiceNames_Static();
+*/
+
+//=========================================================================
+//
+// XServiceInfo decl
+//
+//=========================================================================
+namespace apphelper
+{
+
+#define APPHELPER_XSERVICEINFO_DECL() \
+ virtual ::rtl::OUString SAL_CALL \
+ getImplementationName() \
+ throw( ::com::sun::star::uno::RuntimeException ); \
+ virtual sal_Bool SAL_CALL \
+ supportsService( const ::rtl::OUString& ServiceName ) \
+ throw( ::com::sun::star::uno::RuntimeException ); \
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL \
+ getSupportedServiceNames() \
+ throw( ::com::sun::star::uno::RuntimeException ); \
+ \
+ static ::rtl::OUString getImplementationName_Static(); \
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > \
+ getSupportedServiceNames_Static();
+
+//=========================================================================
+//
+// XServiceInfo impl
+//
+//=========================================================================
+
+#define APPHELPER_XSERVICEINFO_IMPL( Class, ImplName ) \
+::rtl::OUString SAL_CALL Class::getImplementationName() \
+ throw( ::com::sun::star::uno::RuntimeException ) \
+{ \
+ return getImplementationName_Static(); \
+} \
+ \
+::rtl::OUString Class::getImplementationName_Static() \
+{ \
+ return ImplName; \
+} \
+ \
+sal_Bool SAL_CALL \
+Class::supportsService( const ::rtl::OUString& ServiceName ) \
+ throw( ::com::sun::star::uno::RuntimeException ) \
+{ \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = \
+ getSupportedServiceNames(); \
+ const ::rtl::OUString* pArray = aSNL.getArray(); \
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \
+ { \
+ if( pArray[ i ] == ServiceName ) \
+ return sal_True; \
+ } \
+ \
+ return sal_False; \
+} \
+ \
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL \
+Class::getSupportedServiceNames() \
+ throw( ::com::sun::star::uno::RuntimeException ) \
+{ \
+ return getSupportedServiceNames_Static(); \
+}
+
+//=========================================================================
+//
+// Service factory helper decl+impl
+//
+//to use this macro you need to provide a constructor:
+//class( Reference< XComponentContext > const & xContext )
+//and implement OWeakObject
+//=========================================================================
+
+#define APPHELPER_SERVICE_FACTORY_HELPER(Class) \
+static ::com::sun::star::uno::Reference< \
+ ::com::sun::star::uno::XInterface > SAL_CALL \
+ create( ::com::sun::star::uno::Reference< \
+ ::com::sun::star::uno::XComponentContext > const & xContext) \
+ throw(::com::sun::star::uno::Exception) \
+{ \
+ return (::cppu::OWeakObject *)new Class( xContext ); \
+}
+
+/** This macro contains the default implementation for getImplementationId().
+ Note, that you have to include the header necessary for rtl_createUuid.
+ Insert the following into your file:
+
+ <code>
+#include <rtl/uuid.h>
+ </code>
+
+ @param Class the Class-Name for which getImplementationId() should be
+ implemented
+ */
+#define APPHELPER_GETIMPLEMENTATIONID_IMPL(Class) \
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL Class::getImplementationId() \
+ throw (::com::sun::star::uno::RuntimeException) \
+{ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aId; \
+ if( aId.getLength() == 0 ) \
+ { \
+ aId.realloc( 16 ); \
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); \
+ } \
+ return aId; \
+}
+
+}//end namespace apphelper
+#endif
diff --git a/chart2/source/inc/StackMode.hxx b/chart2/source/inc/StackMode.hxx
new file mode 100644
index 000000000000..e341205522d4
--- /dev/null
+++ b/chart2/source/inc/StackMode.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_STACKMODE_HXX
+#define CHART2_STACKMODE_HXX
+
+namespace chart
+{
+
+// needed for chart type templates
+
+enum StackMode
+{
+ StackMode_NONE = 0,
+ StackMode_Y_STACKED,
+ StackMode_Y_STACKED_PERCENT,
+ StackMode_Z_STACKED,
+ StackMode_AMBIGUOUS
+};
+
+} // namespace chart
+
+// CHART2_STACKMODE_HXX
+#endif
diff --git a/chart2/source/inc/StatisticsHelper.hxx b/chart2/source/inc/StatisticsHelper.hxx
new file mode 100644
index 000000000000..af05d5f3f0e8
--- /dev/null
+++ b/chart2/source/inc/StatisticsHelper.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_STATISTICSHELPER_HXX
+#define CHART2_STATISTICSHELPER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS StatisticsHelper
+{
+public:
+ /** Calculates 1/n * sum (x_i - x_mean)^2.
+
+ @see http://mathworld.wolfram.com/Variance.html
+
+ @param bUnbiasedEstimator
+ If true, 1/(n-1) * sum (x_i - x_mean)^2 is returned.
+ */
+ static double getVariance( const ::com::sun::star::uno::Sequence< double > & rData,
+ bool bUnbiasedEstimator = false );
+
+ // square root of the variance
+ static double getStandardDeviation( const ::com::sun::star::uno::Sequence< double > & rData );
+
+ // also called "Standard deviation of the mean (SDOM)"
+ static double getStandardError( const ::com::sun::star::uno::Sequence< double > & rData );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence >
+ getErrorLabeledDataSequenceFromDataSource(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xDataSource,
+ bool bPositiveValue,
+ bool bYError = true );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >
+ getErrorDataSequenceFromDataSource(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xDataSource,
+ bool bPositiveValue,
+ bool bYError = true );
+
+ static double getErrorFromDataSource(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xDataSource,
+ sal_Int32 nIndex,
+ bool bPositiveValue,
+ bool bYError = true );
+
+ static void setErrorDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > & xDataSource,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider > & xDataProvider,
+ const ::rtl::OUString & rNewRange,
+ bool bPositiveValue,
+ bool bYError = true,
+ ::rtl::OUString * pXMLRange = 0 );
+
+ /// @return the newly created or existing error bar object
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ addErrorBars(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ sal_Int32 nStyle,
+ bool bYError = true );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ getErrorBars(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ bool bYError = true );
+
+ static bool hasErrorBars(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ bool bYError = true );
+
+ static void removeErrorBars(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ bool bYError = true );
+
+ static bool usesErrorBarRanges(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xDataSeries,
+ bool bYError = true );
+
+private:
+ // not implemented
+ StatisticsHelper();
+};
+
+} // namespace chart
+
+// CHART2_STATISTICSHELPER_HXX
+#endif
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
new file mode 100644
index 000000000000..47ed75e80a9a
--- /dev/null
+++ b/chart2/source/inc/Strings.hrc
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STRINGS_HRC
+#define CHART_STRINGS_HRC
+
+// this includes no link dependency
+#include <svl/solar.hrc>
+
+//next free is 291
+//single free is: 134
+
+//#define RID_APP_START 30000
+////#define STR_NULL (RID_APP_START + 1)
+////#define STR_BASIC_IDE (RID_APP_START + 2)
+//#define STR_LINES (RID_APP_START + 3)
+//#define STR_COLUMNS (RID_APP_START + 4)
+//#define STR_BARS (RID_APP_START + 5)
+//#define STR_AREAS (RID_APP_START + 6)
+//#define STR_CIRCLES (RID_APP_START + 7)
+//#define STR_DONUT2 (RID_APP_START + 9)
+//#define STR_OFS (RID_APP_START + 14)
+//#define STR_XY (RID_APP_START + 16)
+//#define STR_XYZ (RID_APP_START + 17)
+//#define STR_ONLY_SYMBOLS (RID_APP_START + 115)
+//#define STR_LINESYMB (RID_APP_START + 15)
+//#define STR_LINE_SYMBOLS (RID_APP_START + 117)
+//#define STR_SYMBOL (RID_APP_START + 53)
+//#define STR_SYMBOL_STACK (RID_APP_START + 54)
+//#define STR_SYMBOL_PERCENT (RID_APP_START + 55)
+//#define STR_SPLINE_CUBIC (RID_APP_START + 56)
+//#define STR_SPLINE_CUBIC_SYMBOL (RID_APP_START + 57)
+//#define STR_SPLINE_B (RID_APP_START + 58)
+//#define STR_SPLINE_B_SYMBOL (RID_APP_START + 59)
+//#define STR_STOCKCHART (RID_APP_START + 142)
+//#define STR_SAEULE_3D_1 (RID_APP_START + 149)
+//#define STR_SAEULE_3D_2 (RID_APP_START + 150)
+//#define STR_SAEULE_3D_3 (RID_APP_START + 151)
+//#define STR_SAEULE_3D_4 (RID_APP_START + 152)
+//#define STR_ROEHRE_3D_1 (RID_APP_START + 153)
+//#define STR_ROEHRE_3D_2 (RID_APP_START + 154)
+//#define STR_ROEHRE_3D_3 (RID_APP_START + 155)
+//#define STR_ROEHRE_3D_4 (RID_APP_START + 156)
+//#define STR_PYRAMID_3D_1 (RID_APP_START + 157)
+//#define STR_PYRAMID_3D_2 (RID_APP_START + 158)
+//#define STR_PYRAMID_3D_3 (RID_APP_START + 159)
+//#define STR_PYRAMID_3D_4 (RID_APP_START + 160)
+//#define STR_PYRAMIDQ_3D_1 (RID_APP_START + 161)
+//#define STR_PYRAMIDQ_3D_2 (RID_APP_START + 162)
+//#define STR_PYRAMIDQ_3D_3 (RID_APP_START + 163)
+//#define STR_PYRAMIDQ_3D_4 (RID_APP_START + 164)
+//#define STR_KEGEL_3D_1 (RID_APP_START + 165)
+//#define STR_KEGEL_3D_2 (RID_APP_START + 166)
+//#define STR_KEGEL_3D_3 (RID_APP_START + 167)
+//#define STR_KEGEL_3D_4 (RID_APP_START + 168)
+//#define STR_KEGELQ_3D_1 (RID_APP_START + 169)
+//#define STR_KEGELQ_3D_2 (RID_APP_START + 170)
+//#define STR_KEGELQ_3D_3 (RID_APP_START + 171)
+//#define STR_KEGELQ_3D_4 (RID_APP_START + 172)
+////#define STR_NORMAL_LINES (RID_APP_START + 18)
+////#define STR_SURFACE (RID_APP_START + 19)
+// #define STR_STEPMAIN_LT_MAXVALUE (RID_APP_START + 103)
+// #define STR_STEPHELP_LT_STEPMAIN (RID_APP_START + 104)
+// #define STR_WRONG_ORIGIN (RID_APP_START + 112)
+////#define STR_AREA (RID_APP_START + 122)
+////#define STR_LINE (RID_APP_START + 123)
+////#define STR_OBJECT_SOURCE_DATA (RID_APP_START + 129)
+
+//-----------------------------------------------------------------------------
+//chart types
+//see Strings_ChartTypes.src
+
+#define STR_NORMAL (RID_APP_START + 10)
+#define STR_STACKED (RID_APP_START + 11)
+#define STR_PERCENT (RID_APP_START + 12)
+#define STR_DEEP (RID_APP_START + 13)
+#define STR_FILLED (RID_APP_START + 285)
+
+#define STR_DONUT (RID_APP_START + 8)
+#define STR_TYPE_PIE (RID_APP_START + 187)
+#define STR_PIE_EXPLODED (RID_APP_START + 188)
+#define STR_DONUT_EXPLODED (RID_APP_START + 189)
+
+#define STR_TYPE_COLUMN (RID_APP_START + 190)
+#define STR_TYPE_BAR (RID_APP_START + 191)
+#define STR_TYPE_AREA (RID_APP_START + 192)
+
+#define STR_LINES_3D (RID_APP_START + 193)
+#define STR_POINTS_ONLY (RID_APP_START + 194)
+#define STR_LINES_ONLY (RID_APP_START + 116)
+#define STR_POINTS_AND_LINES (RID_APP_START + 124)
+#define STR_TYPE_LINE (RID_APP_START + 125)
+#define STR_TYPE_XY (RID_APP_START + 240)
+
+#define STR_LINE_COLUMN (RID_APP_START + 22)
+#define STR_LINE_STACKEDCOLUMN (RID_APP_START + 23)
+#define STR_TYPE_COMBI_COLUMN_LINE (RID_APP_START + 24)
+
+#define STR_TYPE_NET (RID_APP_START + 52)
+
+#define STR_TYPE_STOCK (RID_APP_START + 126)
+#define STR_STOCK_1 (RID_APP_START + 143)
+#define STR_STOCK_2 (RID_APP_START + 144)
+#define STR_STOCK_3 (RID_APP_START + 145)
+#define STR_STOCK_4 (RID_APP_START + 146)
+
+#define STR_TYPE_BUBBLE (RID_APP_START + 282)
+#define STR_BUBBLE_1 (RID_APP_START + 283)
+
+//-----------------------------------------------------------------------------
+//additional controls for wizard:
+
+#define STR_BAR_GEOMETRY (RID_APP_START + 127)
+#define STR_NUMBER_OF_LINES (RID_APP_START + 128)
+#define STR_TIP_SELECT_RANGE (RID_APP_START + 196)
+
+#define STR_3DSCHEME_SIMPLE (RID_APP_START + 231)
+#define STR_3DSCHEME_REALISTIC (RID_APP_START + 232)
+#define STR_3DSCHEME_CUSTOM (RID_APP_START + 259)
+
+//additional strings
+#define STR_TEXT_SEPARATOR (RID_APP_START + 20)
+
+//-----------------------------------------------------------------------------
+//SchStatisticTabPage and SchDataStatisticsDlg
+//see Strings_Statistic.src
+
+#define STR_INDICATE_BOTH (RID_APP_START + 131)
+#define STR_INDICATE_UP (RID_APP_START + 132)
+#define STR_INDICATE_DOWN (RID_APP_START + 133)
+
+#define STR_REGRESSION_LINEAR (RID_APP_START + 135)
+#define STR_REGRESSION_LOG (RID_APP_START + 136)
+#define STR_REGRESSION_EXP (RID_APP_START + 137)
+#define STR_REGRESSION_POWER (RID_APP_START + 138)
+
+//-----------------------------------------------------------------------------
+//for scale tab page
+//see Strings_Scale.src
+
+#define STR_INVALID_NUMBER (RID_APP_START + 100)
+#define STR_STEP_GT_ZERO (RID_APP_START + 102)
+#define STR_BAD_LOGARITHM (RID_APP_START + 111)
+#define STR_MIN_GREATER_MAX (RID_APP_START + 101)
+
+//-----------------------------------------------------------------------------
+//for range didalog
+#define STR_DATA_ROLE_LABEL (RID_APP_START + 241)
+#define STR_DATA_ROLE_X (RID_APP_START + 242)
+#define STR_DATA_ROLE_Y (RID_APP_START + 243)
+#define STR_DATA_ROLE_X_ERROR (RID_APP_START + 244)
+#define STR_DATA_ROLE_X_ERROR_POSITIVE (RID_APP_START + 272)
+#define STR_DATA_ROLE_X_ERROR_NEGATIVE (RID_APP_START + 273)
+#define STR_DATA_ROLE_Y_ERROR (RID_APP_START + 245)
+#define STR_DATA_ROLE_Y_ERROR_POSITIVE (RID_APP_START + 274)
+#define STR_DATA_ROLE_Y_ERROR_NEGATIVE (RID_APP_START + 275)
+#define STR_DATA_ROLE_FIRST (RID_APP_START + 246)
+#define STR_DATA_ROLE_LAST (RID_APP_START + 247)
+#define STR_DATA_ROLE_MIN (RID_APP_START + 248)
+#define STR_DATA_ROLE_MAX (RID_APP_START + 249)
+#define STR_DATA_ROLE_CATEGORIES (RID_APP_START + 260)
+#define STR_DATA_ROLE_SIZE (RID_APP_START + 284)
+
+#define STR_DATA_UNNAMED_SERIES (RID_APP_START + 250)
+#define STR_DATA_UNNAMED_SERIES_WITH_INDEX (RID_APP_START + 251)
+
+#define STR_DATA_SELECT_RANGE_FOR_SERIES (RID_APP_START + 252)
+#define STR_DATA_SELECT_RANGE_FOR_CATEGORIES (RID_APP_START + 253)
+#define STR_DATA_SELECT_RANGE_FOR_DATALABELS (RID_APP_START + 195)
+#define STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS (RID_APP_START + 21)
+#define STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS (RID_APP_START + 267)
+
+//-----------------------------------------------------------------------------
+//chart objects
+//e.g. used as titles for insert dialogs and object properties dialog
+//also used in tip help, in status descriptions e.g. '%object% marked' or in undo action e.g. 'moved %object%'
+
+#define STR_PAGE_CHARTTYPE (RID_APP_START + 197)
+#define STR_PAGE_DATA_RANGE (RID_APP_START + 238)
+#define STR_ACTION_EDIT_CHART_DATA (RID_APP_START + 198)
+
+#define STR_OBJECT_PAGE (RID_APP_START + 30)
+#define STR_OBJECT_DIAGRAM (RID_APP_START + 31)
+#define STR_OBJECT_DIAGRAM_WALL (RID_APP_START + 32)
+#define STR_OBJECT_DIAGRAM_FLOOR (RID_APP_START + 33)
+#define STR_OBJECT_LEGEND (RID_APP_START + 48)
+#define STR_OBJECT_LEGEND_SYMBOL (RID_APP_START + 49)
+
+#define STR_OBJECT_DATALABELS (RID_APP_START + 45)
+#define STR_OBJECT_LABEL (RID_APP_START + 199)
+
+#define STR_OBJECT_TITLE (RID_APP_START + 200)
+#define STR_OBJECT_TITLES (RID_APP_START + 201)
+
+#define STR_OBJECT_TITLE_MAIN (RID_APP_START + 254)
+#define STR_OBJECT_TITLE_SUB (RID_APP_START + 255)
+#define STR_OBJECT_TITLE_X_AXIS (RID_APP_START + 256)
+#define STR_OBJECT_TITLE_Y_AXIS (RID_APP_START + 257)
+#define STR_OBJECT_TITLE_Z_AXIS (RID_APP_START + 258)
+#define STR_OBJECT_TITLE_SECONDARY_X_AXIS (RID_APP_START + 87)
+#define STR_OBJECT_TITLE_SECONDARY_Y_AXIS (RID_APP_START + 88)
+
+#define STR_OBJECT_DATAPOINT (RID_APP_START + 202)
+#define STR_OBJECT_DATAPOINTS (RID_APP_START + 203)
+#define STR_OBJECT_DATASERIES (RID_APP_START + 204)
+#define STR_OBJECT_DATASERIES_PLURAL (RID_APP_START + 205)
+
+#define STR_OBJECT_FOR_SERIES (RID_APP_START + 288)
+#define STR_OBJECT_FOR_ALL_SERIES (RID_APP_START + 289)
+
+#define STR_OBJECT_AVERAGE_LINE (RID_APP_START + 174)
+#define STR_OBJECT_ERROR_BARS (RID_APP_START + 175)
+#define STR_OBJECT_CURVE (RID_APP_START + 176)
+#define STR_OBJECT_CURVES (RID_APP_START + 130)
+
+#define STR_OBJECT_STOCK_LOSS (RID_APP_START + 207)
+#define STR_OBJECT_STOCK_GAIN (RID_APP_START + 208)
+
+#define STR_OBJECT_AXES (RID_APP_START + 209)
+#define STR_OBJECT_AXIS (RID_APP_START + 210)
+#define STR_OBJECT_AXIS_X (RID_APP_START + 211)
+#define STR_OBJECT_AXIS_Y (RID_APP_START + 212)
+#define STR_OBJECT_AXIS_Z (RID_APP_START + 213)
+
+#define STR_OBJECT_SECONDARY_X_AXIS (RID_APP_START + 286)
+#define STR_OBJECT_SECONDARY_Y_AXIS (RID_APP_START + 287)
+
+#define STR_OBJECT_GRID (RID_APP_START + 214)
+#define STR_OBJECT_GRIDS (RID_APP_START + 215)
+
+#define STR_OBJECT_GRID_MAJOR_X (RID_APP_START + 37)
+#define STR_OBJECT_GRID_MAJOR_Y (RID_APP_START + 38)
+#define STR_OBJECT_GRID_MAJOR_Z (RID_APP_START + 39)
+#define STR_OBJECT_GRID_MINOR_X (RID_APP_START + 40)
+#define STR_OBJECT_GRID_MINOR_Y (RID_APP_START + 41)
+#define STR_OBJECT_GRID_MINOR_Z (RID_APP_START + 42)
+
+#define STR_OBJECT_CURVE_WITH_PARAMETERS (RID_APP_START + 264)
+#define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS (RID_APP_START + 265)
+
+#define STR_OBJECT_CURVE_EQUATION (RID_APP_START + 268)
+#define STR_STATISTICS_IN_LEGEND (RID_APP_START + 180)
+
+#define STR_OBJECT_SHAPE (RID_APP_START + 290)
+
+//-----------------------------------------------------------------------------
+//Titles for tabpages and dialogs
+
+#define STR_PAGE_LINE (RID_APP_START + 216)
+#define STR_PAGE_BORDER (RID_APP_START + 217)
+#define STR_PAGE_AREA (RID_APP_START + 218)
+#define STR_PAGE_TRANSPARENCY (RID_APP_START + 219)
+#define STR_PAGE_FONT (RID_APP_START + 220)
+#define STR_PAGE_FONT_EFFECTS (RID_APP_START + 221)
+#define STR_PAGE_LAYOUT (RID_APP_START + 222)
+#define STR_PAGE_OPTIONS (RID_APP_START + 223)
+#define STR_PAGE_SCALE (RID_APP_START + 224)
+#define STR_PAGE_NUMBERS (RID_APP_START + 225)
+#define STR_PAGE_ALIGNMENT (RID_APP_START + 226)
+#define STR_PAGE_POSITION (RID_APP_START + 227)
+
+#define STR_PAGE_PERSPECTIVE (RID_APP_START + 235)
+#define STR_PAGE_APPEARANCE (RID_APP_START + 236)
+#define STR_PAGE_ILLUMINATION (RID_APP_START + 237)
+
+#define STR_PAGE_TRENDLINE_TYPE (RID_APP_START + 89)
+#define STR_PAGE_YERROR_BARS (RID_APP_START + 206)
+#define STR_CONTROLTEXT_ERROR_BARS_FROM_DATA (RID_APP_START + 276)
+
+#define STR_DLG_CHART_WIZARD (RID_APP_START + 228)
+#define STR_PAGE_CHART_ELEMENTS (RID_APP_START + 229)
+#define STR_PAGE_CHART_LOCATION (RID_APP_START + 230)
+
+#define STR_DLG_SMOOTH_LINE_PROPERTIES (RID_APP_START + 239)
+#define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266)
+
+#define STR_PAGE_POSITIONING (RID_APP_START + 277)
+#define STR_PAGE_ASIAN (RID_APP_START + 281)
+
+//-----------------------------------------------------------------------------
+//strings used as description for actions on toolbar icons, as tip help or for undo
+
+#define STR_ACTION_EDIT_CHARTTYPE (RID_APP_START + 78)
+#define STR_ACTION_EDIT_DATA_RANGES (RID_APP_START + 64)
+#define STR_ACTION_EDIT_3D_VIEW (RID_APP_START + 80)
+#define STR_ACTION_TOGGLE_LEGEND (RID_APP_START + 83)
+#define STR_ACTION_TOGGLE_GRID_HORZ (RID_APP_START + 86)
+#define STR_ACTION_SCALE_TEXT (RID_APP_START + 93)
+#define STR_ACTION_REARRANGE_CHART (RID_APP_START + 94)
+
+#define STR_TIP_CHOOSECOLOR (RID_APP_START + 233)
+#define STR_TIP_LIGHTSOURCE_X (RID_APP_START + 234)
+
+//-----------------------------------------------------------------------------
+//statusbar strings and balloon help
+
+#define STR_STATUS_PIE_SEGMENT_EXPLODED (RID_APP_START + 179)
+#define STR_STATUS_OBJECT_MARKED (RID_APP_START + 51)
+#define STR_STATUS_DATAPOINT_MARKED (RID_APP_START + 44)
+#define STR_TIP_DATASERIES (RID_APP_START + 43)
+#define STR_TIP_DATAPOINT (RID_APP_START + 140)
+#define STR_TIP_DATAPOINT_INDEX (RID_APP_START + 141)
+#define STR_TIP_DATAPOINT_VALUES (RID_APP_START + 142)
+#define STR_TIP_CATEGORY_VALUE (RID_APP_START + 139)
+
+//-----------------------------------------------------------------------------
+//warning and info boxes
+#define STR_ACTION_NOTPOSSIBLE (RID_APP_START + 107)
+
+#define STR_COLUMN_LABEL (RID_APP_START + 262)
+#define STR_ROW_LABEL (RID_APP_START + 263)
+
+#define STR_DATA_EDITOR_INCORRECT_INPUT (RID_APP_START + 269)
+
+// frame direction ------------------------------------------------------------
+
+#define STR_TEXT_DIRECTION_LTR (RID_APP_START + 278)
+#define STR_TEXT_DIRECTION_RTL (RID_APP_START + 279)
+#define STR_TEXT_DIRECTION_SUPER (RID_APP_START + 280)
+
+//-----------------------------------------------------------------------------
+/*
+////#define STR_DIAGRAM_X_AXIS (RID_APP_START + 34)
+////#define STR_DIAGRAM_Y_AXIS (RID_APP_START + 35)
+////#define STR_DIAGRAM_Z_AXIS (RID_APP_START + 36)
+////#define STR_ACTION_DIAGRAM_DATA (RID_APP_START + 63)
+////#define STR_UNDO_AUTOFORMAT (RID_APP_START + 79)
+////#define STR_DIAGRAM_DESCR_ROW (RID_APP_START + 46)
+////#define STR_DIAGRAM_DESCR_COL (RID_APP_START + 47)
+////#define STR_LEGEND_SYMBOL_COL (RID_APP_START + 50)
+////#define STR_BAD_PASSWORD_OR_FILE_CORRUPTED (RID_APP_START + 110)
+////#define STR_QUERY_SORT (RID_APP_START + 113)
+////#define STR_CFG_DEFAULT_COLORS (RID_APP_START + 177)
+////#define STR_DIAGRAM_DATA_SAFETY_QUERY (RID_APP_START + 181)
+////#define STR_UNDO_CUT (RID_APP_START + 60)
+////#define STR_UNDO_DELETE (RID_APP_START + 61)
+////#define STR_UNDO_DRAGDROP (RID_APP_START + 62)
+////#define STR_UNDO_INSERT_TITLE (RID_APP_START + 65)
+////#define STR_UNDO_INSERT_LEGEND (RID_APP_START + 66)
+////#define STR_UNDO_INSERT_DESCR (RID_APP_START + 67)
+////#define STR_UNDO_INSERT_AXIS (RID_APP_START + 68)
+////#define STR_UNDO_DATA_ROW (RID_APP_START + 69)
+////#define STR_UNDO_DATA_POINT (RID_APP_START + 70)
+////#define STR_UNDO_TITLE (RID_APP_START + 71)
+////#define STR_UNDO_LEGEND (RID_APP_START + 72)
+////#define STR_UNDO_DIAGRAM_AXIS (RID_APP_START + 73)
+////#define STR_UNDO_DIAGRAM_GRID (RID_APP_START + 74)
+////#define STR_UNDO_DIAGRAM_WALL (RID_APP_START + 75)
+////#define STR_UNDO_DIAGRAM_FLOOR (RID_APP_START + 76)
+////#define STR_UNDO_DIAGRAM_AREA (RID_APP_START + 77)
+////#define STR_UNDO_LIGHTING (RID_APP_START + 81)
+////#define STR_UNDO_TOGGLE_TITLE (RID_APP_START + 82)
+////#define STR_UNDO_TOGGLE_AXIS_TITLE (RID_APP_START + 84)
+////#define STR_UNDO_TOGGLE_AXIS_DESCR (RID_APP_START + 85)
+////#define STR_DEFAULTVIEW (RID_APP_START + 90)
+////#define STR_UNDO_STATISTICS (RID_APP_START + 91)
+////#define STR_UNDO_DIAGRAM_LINE (RID_APP_START + 92)
+////#define STR_UNDO_REMOVEPOINTATTRS (RID_APP_START + 94)
+////#define STR_UNDO_MOREFRONT (RID_APP_START + 95)
+////#define STR_UNDO_MOREBACK (RID_APP_START + 96)
+////#define STR_UNDO_INSERT_SPECCHAR (RID_APP_START + 173)
+////#define STR_UNDO_INSERT_GRID (RID_APP_START + 178)
+////#define STR_UNDO_TRANSFORM (RID_APP_START + 183)
+////#define STR_UNDO_MOVE (RID_APP_START + 184)
+////#define STR_UNDO_RESIZE (RID_APP_START + 185)
+////#define STR_UNDO_ROTATE (RID_APP_START + 186)
+////#define STR_UNDO_DIAGRAM_STOCK_LOSS (RID_APP_START + 147)
+////#define STR_UNDO_DIAGRAM_STOCK_PLUS (RID_APP_START + 148)
+////#define STR_OPEN_DOCUMENT (RID_APP_START + 105) use SID_DOC_LOADING instead
+////#define STR_SAVE_DOCUMENT (RID_APP_START + 106) use SID_SAVEDOC instead
+////#define STR_GRAPHIC (RID_APP_START + 108)
+////#define STR_CHART_DOCUMENT (RID_APP_START + 109)
+////#define STR_CHART_DOCUMENT_FULLTYPE_40 (RID_APP_START + 114)
+////#define STR_CHART_DOCUMENT_FULLTYPE_31 (RID_APP_START + 118)
+////#define STR_CHART_DOCUMENT_FULLTYPE_50 (RID_APP_START + 119)
+////#define STR_CHART_DOCUMENT_FULLTYPE_60 (RID_APP_START + 182)
+////#define STR_INVISIBLE (RID_APP_START + 120)
+////#define STR_SOLID (RID_APP_START + 121)
+////#define STR_APPNAME (RID_APP_START + 139)
+*/
+
+// ids must not exceed RID_APP_START + 499
+// ids >= RID_APP_START + 500 are defined in glob.hrc
+
+// CHART_STRINGS_HRC
+#endif
diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx
new file mode 100644
index 000000000000..d3d31bd38c5d
--- /dev/null
+++ b/chart2/source/inc/ThreeDHelper.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART2_THREEDHELPER_HXX
+#define CHART2_THREEDHELPER_HXX
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include "charttoolsdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+enum ThreeDLookScheme
+{
+ ThreeDLookScheme_Simple,
+ ThreeDLookScheme_Realistic,
+ ThreeDLookScheme_Unknown
+};
+
+enum CuboidPlanePosition
+{
+ CuboidPlanePosition_Left,
+ CuboidPlanePosition_Right,
+ CuboidPlanePosition_Top,
+ CuboidPlanePosition_Bottom,
+ CuboidPlanePosition_Front,
+ CuboidPlanePosition_Back
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
+{
+public:
+
+ /** Returns the default camera geometry that is set in the Diagram CTOR.
+ This is not the property default!
+
+ @todo deprecate the hard set camera geometry and use the property
+ default
+ */
+ static ::com::sun::star::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
+
+ static void getRotationAngleFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties
+ , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
+ static void setRotationAngleToDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties
+ , double fXAngleRad, double fYAngleRad, double fZAngleRad );
+
+ static void getRotationFromDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties
+ , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
+ static void setRotationToDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties
+ , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
+
+ static void switchRightAngledAxes( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties
+ , sal_Bool bRightAngledAxes, bool bRotateLights=true );
+
+ static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
+ static double getXDegreeAngleLimitForRightAngledAxes();
+ static double getYDegreeAngleLimitForRightAngledAxes();
+ static double getValueClippedToRange( double fValue, const double& fPositivLimit );
+
+ static void convertElevationRotationDegToXYZAngleRad(
+ sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
+ , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
+
+ SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
+ sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
+ , double fXRad, double fYRad, double fZRad );
+
+ static double getCameraDistance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+ static void setCameraDistance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+ static void setDefaultRotation( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+ static void setDefaultIllumination( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+
+ static void setDefaultRotation( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut );
+
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+ static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSceneProperties );
+
+ static ThreeDLookScheme detectScheme( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram );
+ static void setScheme( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , ThreeDLookScheme aScheme );
+
+ //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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
+ static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
+ , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx
new file mode 100644
index 000000000000..2de0c16266db
--- /dev/null
+++ b/chart2/source/inc/TitleHelper.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TOOLS_TITLEHELPER_HXX
+#define _CHART2_TOOLS_TITLEHELPER_HXX
+
+#include "ReferenceSizeProvider.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class OOO_DLLPUBLIC_CHARTTOOLS TitleHelper
+{
+public:
+ enum eTitleType
+ {
+ TITLE_BEGIN = 0,
+ MAIN_TITLE = 0,
+ SUB_TITLE,
+ X_AXIS_TITLE,
+ Y_AXIS_TITLE,
+ Z_AXIS_TITLE,
+ SECONDARY_X_AXIS_TITLE,
+ SECONDARY_Y_AXIS_TITLE,
+ NORMAL_TITLE_END,
+
+ //it is intended that this both types are after NORMAL_TITLE_END
+ TITLE_AT_STANDARD_X_AXIS_POSITION, //equals the Y_AXIS_TITLE for barchart
+ TITLE_AT_STANDARD_Y_AXIS_POSITION //equals the X_AXIS_TITLE for barchart
+ };
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >
+ getTitle( eTitleType nTitleIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >
+ createTitle( eTitleType nTitleIndex
+ , const rtl::OUString& rTitleText
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext
+ , ReferenceSizeProvider * pRefSizeProvider = 0 );
+
+ static void removeTitle( eTitleType nTitleIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static rtl::OUString getCompleteString( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle );
+ static void setCompleteString( const rtl::OUString& rNewText
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext
+ , float * pDefaultCharHeight = 0 );
+
+ static bool getTitleType( eTitleType& rType
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/TrueGuard.hxx b/chart2/source/inc/TrueGuard.hxx
new file mode 100644
index 000000000000..6a3c639df26e
--- /dev/null
+++ b/chart2/source/inc/TrueGuard.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_TRUEGUARD_HXX
+#define CHART2_TRUEGUARD_HXX
+
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+/** This guard sets the given boolean reference to true in the constructor and to false in the destructor
+ */
+class OOO_DLLPUBLIC_CHARTTOOLS TrueGuard
+{
+public:
+ explicit TrueGuard( bool& rbTrueDuringGuardedTime );
+ virtual ~TrueGuard();
+
+private:
+ bool& m_rbTrueDuringGuardedTime;
+};
+
+}
+// CHART2_TRUEGUARD_HXX
+#endif
diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx
new file mode 100644
index 000000000000..0b601b06f721
--- /dev/null
+++ b/chart2/source/inc/UncachedDataSequence.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_UNCACHEDDATASEQUENCE_HXX
+#define _CHART_UNCACHEDDATASEQUENCE_HXX
+
+// helper classes
+#include <cppuhelper/compbase8.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include "ServiceMacros.hxx"
+#include "charttoolsdllapi.hxx"
+
+// interfaces and types
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+#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 <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+
+#include <vector>
+
+// ____________________
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper8<
+ ::com::sun::star::chart2::data::XDataSequence,
+ ::com::sun::star::chart2::data::XNumericalDataSequence,
+ ::com::sun::star::chart2::data::XTextualDataSequence,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifiable, // contains util::XModifyBroadcaster
+ ::com::sun::star::container::XIndexReplace,
+ ::com::sun::star::container::XNamed, // for setting a new range representation
+ ::com::sun::star::lang::XServiceInfo >
+ UncachedDataSequence_Base;
+}
+
+class UncachedDataSequence :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >,
+ public impl::UncachedDataSequence_Base
+{
+public:
+ /** The referring data provider is held as uno reference to ensure its
+ lifetime is at least as long as the one of this object.
+ */
+ UncachedDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv,
+ const ::rtl::OUString & rRangeRepresentation );
+ UncachedDataSequence(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv,
+ const ::rtl::OUString & rRangeRepresentation,
+ const ::rtl::OUString & rRole );
+ UncachedDataSequence( const UncachedDataSequence & rSource );
+ virtual ~UncachedDataSequence();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ XPropertySet ____
+ /// @see ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @see ::comphelper::OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ /// @see ::comphelper::OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+
+ // ____ XDataSequence ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel(
+ ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XNumericalDataSequence ____
+ /// @see ::com::sun::star::chart::data::XNumericalDataSequence
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTextualDataSequence ____
+ /// @see ::com::sun::star::chart::data::XTextualDataSequence
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XIndexReplace ____
+ virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XIndexAccess (base of XIndexReplace) ____
+ virtual ::sal_Int32 SAL_CALL getCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XElementAccess (base of XIndexAccess) ____
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XNamed (for setting a new range representation) ____
+ virtual ::rtl::OUString SAL_CALL getName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifiable ____
+ virtual ::sal_Bool SAL_CALL isModified()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setModified( ::sal_Bool bModified )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster (base of XModifiable) ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void fireModifyEvent();
+
+ mutable ::osl::Mutex m_aMutex;
+
+ // <properties>
+ sal_Int32 m_nNumberFormatKey;
+ ::rtl::OUString m_sRole;
+ ::rtl::OUString m_aXMLRange;
+ // </properties>
+
+ /** This method registers all properties. It should be called by all
+ constructors.
+ */
+ void registerProperties();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XInternalDataProvider > m_xDataProvider;
+ ::rtl::OUString m_aSourceRepresentation;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
+ m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+
+// _CHART_UNCACHEDDATASEQUENCE_HXX
+#endif
diff --git a/chart2/source/inc/UndoGuard.hxx b/chart2/source/inc/UndoGuard.hxx
new file mode 100644
index 000000000000..864d5ccff994
--- /dev/null
+++ b/chart2/source/inc/UndoGuard.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_UNDOGUARD_HXX
+#define CHART2_UNDOGUARD_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+
+// header for class OUString
+#include <rtl/ustring.hxx>
+
+namespace chart
+{
+/** Base Class for UndoGuard and UndoLiveUpdateGuard
+*/
+class UndoGuard_Base
+{
+public:
+ explicit UndoGuard_Base( const rtl::OUString & rUndoMessage
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > & xUndoManager
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoGuard_Base();
+
+ void commitAction();
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
+
+ rtl::OUString m_aUndoString;
+ bool m_bActionPosted;
+};
+
+/** This guard calls preAction at the given Model in the CTOR and
+ cancelAction in the DTOR if no other method is called.
+ If commitAction is called the destructor does nothin anymore.
+ */
+class UndoGuard : public UndoGuard_Base
+{
+public:
+ explicit UndoGuard( const rtl::OUString& rUndoMessage
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > & xUndoManager
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoGuard();
+};
+
+/** This guard calls preAction at the given Model in the CTOR and
+ cancelActionUndo in the DTOR if no other method is called.
+ If commitAction is called the destructor does nothin anymore.
+ */
+class UndoLiveUpdateGuard : public UndoGuard_Base
+{
+public:
+ explicit UndoLiveUpdateGuard( const rtl::OUString& rUndoMessage
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > & xUndoManager
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoLiveUpdateGuard();
+};
+
+/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
+ Only use this if the data has internal data.
+ */
+class UndoLiveUpdateGuardWithData :
+ public UndoGuard_Base
+{
+public:
+ explicit UndoLiveUpdateGuardWithData( const rtl::OUString& rUndoMessage
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > & xUndoManager
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoLiveUpdateGuardWithData();
+};
+
+class UndoGuardWithSelection : public UndoGuard_Base
+{
+public:
+ explicit UndoGuardWithSelection( const rtl::OUString& rUndoMessage
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XUndoManager > & xUndoManager
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+ virtual ~UndoGuardWithSelection();
+};
+
+}
+// CHART2_UNDOGUARD_HXX
+#endif
diff --git a/chart2/source/inc/UndoManager.hxx b/chart2/source/inc/UndoManager.hxx
new file mode 100644
index 000000000000..a28a0d78c470
--- /dev/null
+++ b/chart2/source/inc/UndoManager.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_UNDOMANAGER_HXX
+#define CHART2_UNDOMANAGER_HXX
+
+#include "ConfigItemListener.hxx"
+#include "MutexContainer.hxx"
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/chart2/XUndoHelper.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <cppuhelper/compbase4.hxx>
+#include <rtl/ustring.hxx>
+
+// for pair
+#include <utility>
+// for auto_ptr
+#include <memory>
+
+class SdrUndoAction;
+
+namespace com { namespace sun { namespace star {
+namespace frame {
+ class XModel;
+}
+}}}
+
+namespace chart
+{
+// ----------------------------------------
+namespace impl
+{
+
+class UndoStepsConfigItem;
+class UndoElement;
+class UndoStack;
+class ModifyBroadcaster;
+
+typedef ::cppu::WeakComponentImplHelper4<
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::chart2::XUndoManager,
+ ::com::sun::star::chart2::XUndoHelper,
+ ::com::sun::star::lang::XUnoTunnel >
+ UndoManager_Base;
+
+} // namespace impl
+// ----------------------------------------
+
+/** Manages undo by storing the entire XModel in the undo- and redo-buffers.
+ Note, that therefore this should not be used for "big" XModels.
+
+ A prerequisite for this to work is that the XModels added to the undo-
+ redo-stacks support the css::util::XCloneable interface, which is
+ implemented such that the entire model is cloned.
+ */
+class UndoManager :
+ public MutexContainer,
+ public ConfigItemListener,
+ public impl::UndoManager_Base
+{
+public:
+ explicit UndoManager();
+ virtual ~UndoManager();
+
+ void addShapeUndoAction( SdrUndoAction* pAction );
+
+ // ____ XUnoTunnel ____
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+ static UndoManager* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xObj );
+
+protected:
+ // ____ ConfigItemListener ____
+ virtual void notify( const ::rtl::OUString & rPropertyName );
+
+ // ____ util::XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ chart2::XUndoManager ____
+ virtual void SAL_CALL preAction( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL preActionWithArguments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancelAction()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancelActionWithUndo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToRestore )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL undoPossible()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL redoPossible()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentUndoString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentRedoString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoStrings()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoStrings()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XUndoHelper ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModelCloneForUndo(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyModelContent(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToChange,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToCopyFrom )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ void retrieveConfigUndoSteps();
+ void fireModifyEvent();
+ void impl_undoRedo(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xCurrentModel,
+ impl::UndoStack * pStackToRemoveFrom,
+ impl::UndoStack * pStackToAddTo,
+ bool bUndo = true );
+
+ ::std::auto_ptr< impl::UndoStack > m_apUndoStack;
+ ::std::auto_ptr< impl::UndoStack > m_apRedoStack;
+
+ impl::UndoElement * m_pLastRemeberedUndoElement;
+
+ ::std::auto_ptr< impl::UndoStepsConfigItem > m_apUndoStepsConfigItem;
+ sal_Int32 m_nMaxNumberOfUndos;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyBroadcaster > m_xModifyBroadcaster;
+ // pointer is valid as long as m_xModifyBroadcaster.is()
+ impl::ModifyBroadcaster * m_pModifyBroadcaster;
+};
+
+} // namespace chart
+
+// CHART2_UNDOMANAGER_HXX
+#endif
diff --git a/chart2/source/inc/UserDefinedProperties.hxx b/chart2/source/inc/UserDefinedProperties.hxx
new file mode 100644
index 000000000000..af616a6f6c22
--- /dev/null
+++ b/chart2/source/inc/UserDefinedProperties.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_USERDEFINEDPROPERTIES_HXX
+#define CHART_USERDEFINEDPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements service com.sun.star.xml.UserDefinedAttributeSupplier
+class OOO_DLLPUBLIC_CHARTTOOLS UserDefinedProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // UserDefined attributes in the chart-properties
+ PROP_XML_USERDEF_CHART = FAST_PROPERTY_ID_START_USERDEF_PROP,
+ PROP_XML_USERDEF_TEXT,
+ PROP_XML_USERDEF_PARA,
+ // com.sun.star.xml.UserDefinedAttributeSupplier
+ // UserDefined attributes in the other properties-sections. (as long as
+ // there is no reliable mechanism, properties may move between the
+ // sections)
+ PROP_XML_USERDEF
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+private:
+ // not implemented
+ UserDefinedProperties();
+};
+
+} // namespace chart
+
+// CHART_USERDEFINEDPROPERTIES_HXX
+#endif
diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx
new file mode 100644
index 000000000000..55f283a94600
--- /dev/null
+++ b/chart2/source/inc/WeakListenerAdapter.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_WEAKLISTENERADAPTER_HXX
+#define CHART2_WEAKLISTENERADAPTER_HXX
+
+#include <com/sun/star/uno/XWeak.hpp>
+#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/implbase1.hxx>
+
+namespace chart
+{
+// --------------------------------------------------------------------------------
+
+/** Adapter that enables adding listeners as weak UNO references. Thus, adding
+ an object as listener to a broadcaster does not increase its reference
+ count.
+
+ <p>The helper class, of course, is held as hard reference at the
+ broadcaster, but this should never be a problem as the adapter's life time
+ depends on no other object.</p>
+
+ <p>Note that in order to remove an object as listener, you have to remove
+ the same wrapper that you added, i.e., you should store the adapter as a
+ member in the adaptee class for later use.</p>
+ */
+template< class Listener >
+ class WeakListenerAdapter : public
+ ::cppu::WeakImplHelper1< Listener >
+{
+public:
+ explicit WeakListenerAdapter( const ::com::sun::star::uno::Reference< Listener > & xListener ) :
+ m_xListener( xListener )
+ {}
+ explicit WeakListenerAdapter( const ::com::sun::star::uno::WeakReference< Listener > & xListener ) :
+ m_xListener( xListener )
+ {}
+ virtual ~WeakListenerAdapter()
+ {}
+
+protected:
+ // ____ XEventListener (base of all listeners) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > xEventListener =
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >(
+ ::com::sun::star::uno::Reference< Listener >( m_xListener), ::com::sun::star::uno::UNO_QUERY );
+ if( xEventListener.is())
+ xEventListener->disposing( Source );
+ }
+
+ ::com::sun::star::uno::Reference< Listener > getListener() const
+ {
+ return m_xListener;
+ }
+
+private:
+ ::com::sun::star::uno::WeakReference< Listener > m_xListener;
+};
+
+// --------------------------------------------------------------------------------
+
+class WeakModifyListenerAdapter :
+ public WeakListenerAdapter< ::com::sun::star::util::XModifyListener >
+{
+public:
+ explicit WeakModifyListenerAdapter(
+ const ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > & xListener );
+ virtual ~WeakModifyListenerAdapter();
+
+protected:
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+// --------------------------------------------------------------------------------
+
+class WeakSelectionChangeListenerAdapter :
+ public WeakListenerAdapter< ::com::sun::star::view::XSelectionChangeListener >
+{
+public:
+ explicit WeakSelectionChangeListenerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener );
+ virtual ~WeakSelectionChangeListenerAdapter();
+
+protected:
+ // ____ XSelectionChangeListener ____
+ virtual void SAL_CALL selectionChanged(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART2_WEAKLISTENERADAPTER_HXX
+#endif
diff --git a/chart2/source/inc/WrappedDefaultProperty.hxx b/chart2/source/inc/WrappedDefaultProperty.hxx
new file mode 100644
index 000000000000..78a263c70cdc
--- /dev/null
+++ b/chart2/source/inc/WrappedDefaultProperty.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_WRAPPEDDEFAULTPROPERTY_HXX
+#define CHART2_WRAPPEDDEFAULTPROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS WrappedDefaultProperty : public WrappedProperty
+{
+public:
+ explicit WrappedDefaultProperty(
+ const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName,
+ const ::com::sun::star::uno::Any& rNewOuterDefault );
+ virtual ~WrappedDefaultProperty();
+
+ virtual void setPropertyToDefault(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+private:
+ ::com::sun::star::uno::Any m_aOuterDefaultValue;
+};
+
+} // namespace chart
+
+// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX
+#endif
diff --git a/chart2/source/inc/WrappedDirectStateProperty.hxx b/chart2/source/inc/WrappedDirectStateProperty.hxx
new file mode 100644
index 000000000000..1dd5889f0d55
--- /dev/null
+++ b/chart2/source/inc/WrappedDirectStateProperty.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_WRAPPEDDIRECTSTATEPROPERTY_HXX
+#define CHART2_WRAPPEDDIRECTSTATEPROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+
+class OOO_DLLPUBLIC_CHARTTOOLS WrappedDirectStateProperty :
+ public WrappedProperty
+{
+public:
+ explicit WrappedDirectStateProperty(
+ const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName );
+ virtual ~WrappedDirectStateProperty();
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX
+#endif
diff --git a/chart2/source/inc/WrappedIgnoreProperty.hxx b/chart2/source/inc/WrappedIgnoreProperty.hxx
new file mode 100644
index 000000000000..1e76bf91ea95
--- /dev/null
+++ b/chart2/source/inc/WrappedIgnoreProperty.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_IGNORE_PROPERTY_HXX
+#define CHART_WRAPPED_IGNORE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "charttoolsdllapi.hxx"
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperty : public WrappedProperty
+{
+public:
+ WrappedIgnoreProperty( const ::rtl::OUString& rOuterName, const ::com::sun::star::uno::Any& rDefaultValue );
+ virtual ~WrappedIgnoreProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+SAL_DLLPRIVATE virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+SAL_DLLPRIVATE virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+SAL_DLLPRIVATE virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ ::com::sun::star::uno::Any m_aDefaultValue;
+ mutable ::com::sun::star::uno::Any m_aCurrentValue;
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperties
+{
+public:
+ static void addIgnoreLineProperties( std::vector< WrappedProperty* >& rList );
+
+ static void addIgnoreFillProperties( std::vector< WrappedProperty* >& rList );
+ SAL_DLLPRIVATE static void addIgnoreFillProperties_without_BitmapProperties( std::vector< WrappedProperty* >& rList );
+ SAL_DLLPRIVATE static void addIgnoreFillProperties_only_BitmapProperties( std::vector< WrappedProperty* >& rList );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_IGNORE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/inc/WrappedProperty.hxx b/chart2/source/inc/WrappedProperty.hxx
new file mode 100644
index 000000000000..91a4b40fd2c9
--- /dev/null
+++ b/chart2/source/inc/WrappedProperty.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPEDPROPERTY_HXX
+#define CHART_WRAPPEDPROPERTY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include "charttoolsdllapi.hxx"
+
+#include <map>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class 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 ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName );
+ virtual ~WrappedProperty();
+
+ const ::rtl::OUString& getOuterName() const;
+ virtual ::rtl::OUString getInnerName() const;
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+protected:
+ ::rtl::OUString m_aOuterName;
+ ::rtl::OUString m_aInnerName;
+};
+
+//.............................................................................
+
+typedef ::std::map< sal_Int32, const WrappedProperty* > tWrappedPropertyMap;
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPEDPROPERTY_HXX
+#endif
diff --git a/chart2/source/inc/WrappedPropertySet.hxx b/chart2/source/inc/WrappedPropertySet.hxx
new file mode 100644
index 000000000000..03cfea84f502
--- /dev/null
+++ b/chart2/source/inc/WrappedPropertySet.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPEDPROPERTYSET_HXX
+#define CHART_WRAPPEDPROPERTYSET_HXX
+
+#include "WrappedProperty.hxx"
+#include "MutexContainer.hxx"
+#include "charttoolsdllapi.hxx"
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <cppuhelper/implbase4.hxx>
+
+// header for class OPropertyArrayHelper
+#include <cppuhelper/propshlp.hxx>
+
+// header for class OMultiTypeInterfaceContainerHelperInt32
+#include <cppuhelper/propshlp.hxx>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet :
+ public MutexContainer
+ , public ::cppu::WeakImplHelper4
+ < ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::beans::XMultiPropertyStates
+ // ,::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,::com::sun::star::uno::XInterface // implemented by WeakImplHelper
+ // ,::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+public:
+ WrappedPropertySet();
+ virtual ~WrappedPropertySet();
+
+ void clearWrappedPropertySet();
+
+public:
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertySet
+ //getPropertySetInfo() already declared in XPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //getPropertyStates() already declared in XPropertyState
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ /** give all the properties that should be visible to the outer side
+ */
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence()=0;
+ /** give a list of all properties that need a special treatment;
+ properties that are not in this list will be wrapped identical.
+ The base class 'WrappedPropertySet' will take ownership on the contained pointer.
+ It is not allowed to have duplicate entries in this list.
+ */
+ virtual const std::vector< WrappedProperty* > createWrappedProperties()=0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > getInnerPropertySet() = 0;
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyState > getInnerPropertyState();
+
+ ::cppu::IPropertyArrayHelper& getInfoHelper();
+ SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap();
+
+ const WrappedProperty* getWrappedProperty( const ::rtl::OUString& rOuterName );
+ const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
+
+protected: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo
+
+ ::cppu::OPropertyArrayHelper* m_pPropertyArrayHelper;//holds all possible outer properties
+
+ tWrappedPropertyMap* m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties)
+
+ //Container for the XProperyChangedListener. The listeners are inserted by handle.
+ //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer;
+
+ //Container for the XPropertyVetoableListener. The listeners are inserted by handle.
+ //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPEDPROPERTYSET_HXX
+#endif
diff --git a/chart2/source/inc/XMLRangeHelper.hxx b/chart2/source/inc/XMLRangeHelper.hxx
new file mode 100644
index 000000000000..addc8a351c29
--- /dev/null
+++ b/chart2/source/inc/XMLRangeHelper.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_XMLRANGEHELPER_HXX
+#define CHART2_XMLRANGEHELPER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include "charttoolsdllapi.hxx"
+
+namespace chart
+{
+namespace XMLRangeHelper
+{
+
+struct OOO_DLLPUBLIC_CHARTTOOLS Cell
+{
+ sal_Int32 nColumn;
+ sal_Int32 nRow;
+ bool bRelativeColumn;
+ bool bRelativeRow;
+ bool bIsEmpty;
+
+ Cell() :
+ nColumn(0),
+ nRow(0),
+ bRelativeColumn(false),
+ bRelativeRow(false),
+ bIsEmpty(true)
+ {}
+
+ inline bool empty() const { return bIsEmpty; }
+};
+
+struct OOO_DLLPUBLIC_CHARTTOOLS CellRange
+{
+ Cell aUpperLeft;
+ Cell aLowerRight;
+ ::rtl::OUString aTableName;
+};
+
+CellRange getCellRangeFromXMLString( const ::rtl::OUString & rXMLString );
+
+::rtl::OUString getXMLStringFromCellRange( const CellRange & rRange );
+
+
+} // namespace XMLRangeHelper
+} // namespace chart
+
+// CHART2_XMLRANGEHELPER_HXX
+#endif
diff --git a/chart2/source/inc/charttoolsdllapi.hxx b/chart2/source/inc/charttoolsdllapi.hxx
new file mode 100644
index 000000000000..5534f2ca737c
--- /dev/null
+++ b/chart2/source/inc/charttoolsdllapi.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ***********************************************************************/
+
+#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX
+#define INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_CHARTTOOLS
+#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
new file mode 100644
index 000000000000..fbcce70bd1d6
--- /dev/null
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHARTSFXITEMIDS_HXX
+#define CHARTSFXITEMIDS_HXX
+
+#include <sfx2/sfxdefs.hxx>
+
+/*
+// header for SID_OBJ1_START
+#include <sfx2/sfxsids.hrc>
+*/
+
+// ============================================================
+// SCHATTR
+// ============================================================
+
+#define SCHATTR_START 1
+
+#define SCHATTR_DATADESCR_START SCHATTR_START
+#define SCHATTR_DATADESCR_SHOW_NUMBER SCHATTR_DATADESCR_START
+#define SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1)
+#define SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2)
+#define SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3)
+#define SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 4)
+#define SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 5)
+#define SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 6)
+#define SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 7) //percentage values should not be offered
+#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_NO_PERCENTVALUE
+
+#define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1)
+#define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START
+#define SCHATTR_LEGEND_END SCHATTR_LEGEND_POS
+
+#define SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1)
+// #define SCHATTR_TEXT_ORIENT SCHATTR_TEXT_START
+// name changed:
+#define SCHATTR_TEXT_STACKED SCHATTR_TEXT_START
+#define SCHATTR_TEXT_ORDER (SCHATTR_TEXT_START + 1)
+#define SCHATTR_TEXT_END SCHATTR_TEXT_ORDER
+
+#define SCHATTR_Y_AXIS_START (SCHATTR_TEXT_END + 1)
+#define SCHATTR_Y_AXIS_AUTO_MIN SCHATTR_Y_AXIS_START
+#define SCHATTR_Y_AXIS_MIN (SCHATTR_Y_AXIS_START + 1)
+#define SCHATTR_Y_AXIS_AUTO_MAX (SCHATTR_Y_AXIS_START + 2)
+#define SCHATTR_Y_AXIS_MAX (SCHATTR_Y_AXIS_START + 3)
+#define SCHATTR_Y_AXIS_AUTO_STEP_MAIN (SCHATTR_Y_AXIS_START + 4)
+#define SCHATTR_Y_AXIS_STEP_MAIN (SCHATTR_Y_AXIS_START + 5)
+#define SCHATTR_Y_AXIS_AUTO_STEP_HELP (SCHATTR_Y_AXIS_START + 6)
+#define SCHATTR_Y_AXIS_STEP_HELP (SCHATTR_Y_AXIS_START + 7)
+#define SCHATTR_Y_AXIS_LOGARITHM (SCHATTR_Y_AXIS_START + 8)
+#define SCHATTR_Y_AXIS_AUTO_ORIGIN (SCHATTR_Y_AXIS_START + 9)
+#define SCHATTR_Y_AXIS_ORIGIN (SCHATTR_Y_AXIS_START + 10)
+#define SCHATTR_Y_AXIS_END SCHATTR_Y_AXIS_ORIGIN
+
+#define SCHATTR_X_AXIS_START (SCHATTR_Y_AXIS_END + 1)
+#define SCHATTR_X_AXIS_AUTO_MIN SCHATTR_X_AXIS_START
+#define SCHATTR_X_AXIS_MIN (SCHATTR_X_AXIS_START + 1)
+#define SCHATTR_X_AXIS_AUTO_MAX (SCHATTR_X_AXIS_START + 2)
+#define SCHATTR_X_AXIS_MAX (SCHATTR_X_AXIS_START + 3)
+#define SCHATTR_X_AXIS_AUTO_STEP_MAIN (SCHATTR_X_AXIS_START + 4)
+#define SCHATTR_X_AXIS_STEP_MAIN (SCHATTR_X_AXIS_START + 5)
+#define SCHATTR_X_AXIS_AUTO_STEP_HELP (SCHATTR_X_AXIS_START + 6)
+#define SCHATTR_X_AXIS_STEP_HELP (SCHATTR_X_AXIS_START + 7)
+#define SCHATTR_X_AXIS_LOGARITHM (SCHATTR_X_AXIS_START + 8)
+#define SCHATTR_X_AXIS_AUTO_ORIGIN (SCHATTR_X_AXIS_START + 9)
+#define SCHATTR_X_AXIS_ORIGIN (SCHATTR_X_AXIS_START + 10)
+#define SCHATTR_X_AXIS_END SCHATTR_X_AXIS_ORIGIN
+
+#define SCHATTR_Z_AXIS_START (SCHATTR_X_AXIS_END + 1)
+#define SCHATTR_Z_AXIS_AUTO_MIN SCHATTR_Z_AXIS_START
+#define SCHATTR_Z_AXIS_MIN (SCHATTR_Z_AXIS_START + 1)
+#define SCHATTR_Z_AXIS_AUTO_MAX (SCHATTR_Z_AXIS_START + 2)
+#define SCHATTR_Z_AXIS_MAX (SCHATTR_Z_AXIS_START + 3)
+#define SCHATTR_Z_AXIS_AUTO_STEP_MAIN (SCHATTR_Z_AXIS_START + 4)
+#define SCHATTR_Z_AXIS_STEP_MAIN (SCHATTR_Z_AXIS_START + 5)
+#define SCHATTR_Z_AXIS_AUTO_STEP_HELP (SCHATTR_Z_AXIS_START + 6)
+#define SCHATTR_Z_AXIS_STEP_HELP (SCHATTR_Z_AXIS_START + 7)
+#define SCHATTR_Z_AXIS_LOGARITHM (SCHATTR_Z_AXIS_START + 8)
+#define SCHATTR_Z_AXIS_AUTO_ORIGIN (SCHATTR_Z_AXIS_START + 9)
+#define SCHATTR_Z_AXIS_ORIGIN (SCHATTR_Z_AXIS_START + 10)
+#define SCHATTR_Z_AXIS_END SCHATTR_Z_AXIS_ORIGIN
+
+// miscellaneous
+
+#define SCHATTR_AXISTYPE (SCHATTR_Z_AXIS_END + 1)
+#define SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_Z_AXIS_END + 2)
+#define SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_Z_AXIS_END + 3)
+
+#define SCHATTR_STAT_START (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE + 1)
+#define SCHATTR_STAT_AVERAGE SCHATTR_STAT_START
+#define SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1)
+#define SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2)
+#define SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3)
+#define SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4)
+#define SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5)
+#define SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6)
+#define SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7)
+#define SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8)
+#define SCHATTR_STAT_END SCHATTR_STAT_RANGE_NEG
+
+#define SCHATTR_TEXT2_START ( SCHATTR_STAT_END + 1)
+#define SCHATTR_TEXT_DEGREES ( SCHATTR_TEXT2_START )
+#define SCHATTR_TEXT_OVERLAP (SCHATTR_TEXT2_START +1)
+#define SCHATTR_TEXT2_END ( SCHATTR_TEXT_OVERLAP )
+
+// --------------------------------------------------------
+// these attributes are for replacement of enum eChartStyle
+// --------------------------------------------------------
+
+#define SCHATTR_STYLE_START ( SCHATTR_TEXT2_END +1 )
+
+// for whole chart
+#define SCHATTR_STYLE_DEEP ( SCHATTR_STYLE_START )
+#define SCHATTR_STYLE_3D ( SCHATTR_STYLE_START + 1 )
+#define SCHATTR_STYLE_VERTICAL ( SCHATTR_STYLE_START + 2 )
+
+// also for series
+#define SCHATTR_STYLE_BASETYPE ( SCHATTR_STYLE_START + 3 )// Line,Area,...,Pie
+#define SCHATTR_STYLE_LINES ( SCHATTR_STYLE_START + 4 )// draw line
+#define SCHATTR_STYLE_PERCENT ( SCHATTR_STYLE_START + 5 )
+#define SCHATTR_STYLE_STACKED ( SCHATTR_STYLE_START + 6 )
+#define SCHATTR_STYLE_SPLINES ( SCHATTR_STYLE_START + 7 )
+
+// also for data point
+#define SCHATTR_STYLE_SYMBOL ( SCHATTR_STYLE_START + 8 )
+#define SCHATTR_STYLE_SHAPE ( SCHATTR_STYLE_START + 9 )
+#define SCHATTR_STYLE_END ( SCHATTR_STYLE_SHAPE )
+
+// --------------------------------------------------------------------------
+
+#define SCHATTR_AXIS (SCHATTR_STYLE_END + 1)// see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc.
+//Ummappen:
+#define SCHATTR_AXIS_START (SCHATTR_AXIS + 1)
+#define SCHATTR_AXIS_AUTO_MIN SCHATTR_AXIS_START
+#define SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 1)
+#define SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 2)
+#define SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 3)
+#define SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 4)
+#define SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 5)
+#define SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 6)
+// SCHATTR_AXIS_STEP_HELP: type changed from double to sal_Int32 !
+#define SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 7)
+#define SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 8)
+#define SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 9)
+#define SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 10)
+//Neu:
+#define SCHATTR_AXIS_TICKS (SCHATTR_AXIS_START + 11)
+#define SCHATTR_AXIS_NUMFMT (SCHATTR_AXIS_START + 12)
+#define SCHATTR_AXIS_NUMFMTPERCENT (SCHATTR_AXIS_START + 13)
+#define SCHATTR_AXIS_SHOWAXIS (SCHATTR_AXIS_START + 14)
+#define SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_START + 15)
+#define SCHATTR_AXIS_SHOWMAINGRID (SCHATTR_AXIS_START + 16)
+#define SCHATTR_AXIS_SHOWHELPGRID (SCHATTR_AXIS_START + 17)
+#define SCHATTR_AXIS_TOPDOWN (SCHATTR_AXIS_START + 18)
+#define SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_START + 19)
+#define SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 20)
+#define SCHATTR_AXIS_POSITION (SCHATTR_AXIS_START + 21)
+#define SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_START + 22)
+#define SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_START + 23)
+#define SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_START + 24)
+#define SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_START + 25)
+#define SCHATTR_AXIS_END SCHATTR_AXIS_MARK_POSITION
+
+#define SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1)
+#define SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2)
+#define SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3)
+#define SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4)
+
+// non persistent items (binary format)
+#define SCHATTR_CHARTTYPE_START (SCHATTR_SYMBOL_SIZE + 1)
+
+// new from New Chart
+#define SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START )
+#define SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1)
+#define SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2)
+#define SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3)
+#define SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4)
+#define SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5)
+#define SCHATTR_DIAGRAM_STYLE (SCHATTR_CHARTTYPE_START + 6)
+#define SCHATTR_TEXTBREAK (SCHATTR_CHARTTYPE_START + 7)
+#define SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 8)
+#define SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 9)
+#define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 10)
+#define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 11)
+#define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 12)
+#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 13)
+
+#define SCHATTR_CHARTTYPE_END SCHATTR_INCLUDE_HIDDEN_CELLS
+
+// items for transporting information to dialogs
+#define SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1)
+#define SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START)
+#define SCHATTR_MISC_END SCHATTR_AXIS_FOR_ALL_SERIES
+
+// regression curve equation
+#define SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1)
+#define SCHATTR_REGRESSION_TYPE SCHATTR_REGRESSION_START
+#define SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1)
+#define SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2)
+#define SCHATTR_REGRESSION_END SCHATTR_REGRESSION_SHOW_COEFF
+
+#define SCHATTR_END SCHATTR_REGRESSION_END
+
+// ============================================================
+// values for Items
+// ============================================================
+
+// values for SCHATTR_AXIS_TICKS and SCHATTR_AXIS_HELPTICKS items
+#define CHAXIS_MARK_BOTH 3
+#define CHAXIS_MARK_OUTER 2
+#define CHAXIS_MARK_INNER 1
+#define CHAXIS_MARK_NONE 0
+
+// values for SCHATTR_AXISTYPE items
+#define CHART_AXIS_X 0
+#define CHART_AXIS_Y 1
+#define CHART_AXIS_Z 2
+
+// values for SCHATTR_STYLE_SHAPE items
+#define CHART_SHAPE3D_IGNORE -2 //intern! (GetChartShapeStyle()!)
+#define CHART_SHAPE3D_ANY -1 //undefinierter Typ (GetChartShapeStyle()!)
+#define CHART_SHAPE3D_SQUARE 0
+#define CHART_SHAPE3D_CYLINDER 1
+#define CHART_SHAPE3D_CONE 2
+#define CHART_SHAPE3D_PYRAMID 3 //reserved
+#define CHART_SHAPE3D_HANOI 4
+
+// values for SCHATTR_AXIS items
+#define CHART_AXIS_PRIMARY_X 1
+#define CHART_AXIS_PRIMARY_Y 2
+#define CHART_AXIS_PRIMARY_Z 3
+#define CHART_AXIS_SECONDARY_Y 4
+#define CHART_AXIS_SECONDARY_X 5
+
+// ============================================================
+// ============================================================
+
+#endif
diff --git a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
new file mode 100644
index 000000000000..4d07791a884f
--- /dev/null
+++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_DATAPOINTSYMBOLSUPPLIER_HXX
+#define _CHART2_DATAPOINTSYMBOLSUPPLIER_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include "chartviewdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class OOO_DLLPUBLIC_CHARTVIEW DataPointSymbolSupplier
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ create2DSymbolList( ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > xShapeFactory
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Direction3D& rSize );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx
new file mode 100644
index 000000000000..5bcf67a8592b
--- /dev/null
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DRAWMODELWRAPPER_HXX
+#define _CHART2_DRAWMODELWRAPPER_HXX
+
+//----
+#include <svx/svdmodel.hxx>
+// header for class SdrObject
+#include <svx/svdobj.hxx>
+
+//----
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "chartviewdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF;
+ SfxItemPool* m_pChartItemPool;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xMainDrawPage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xHiddenDrawPage;
+
+ std::auto_ptr< OutputDevice > m_apRefDevice;
+
+ //no default constructor
+ DrawModelWrapper();
+
+public:
+ SAL_DLLPRIVATE DrawModelWrapper(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ SAL_DLLPRIVATE virtual ~DrawModelWrapper();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getShapeFactory();
+
+ // the main page will contain the normal view objects
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getMainDrawPage();
+ SAL_DLLPRIVATE void clearMainDrawPage();
+
+ // the extra page is not visible, but contains some extras like the symbols for data points
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getHiddenDrawPage();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage );
+
+
+ SAL_DLLPRIVATE void lockControllers();
+ SAL_DLLPRIVATE void unlockControllers();
+
+ /// tries to get an OutputDevice from the XParent of the model to use as reference device
+ SAL_DLLPRIVATE void attachParentReferenceDevice(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
+
+ OutputDevice* getReferenceDevice() const;
+
+ SfxItemPool& GetItemPool();
+ SAL_DLLPRIVATE const SfxItemPool& GetItemPool() const;
+
+ SAL_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ createUnoModel();
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ getUnoModel();
+ SdrModel& getSdrModel();
+
+ XColorTable* GetColorTable() const;
+ XDashList* GetDashList() const;
+ XLineEndList* GetLineEndList() const;
+ XGradientList* GetGradientList() const;
+ XHatchList* GetHatchList() const;
+ XBitmapList* GetBitmapList() const;
+
+ SdrObject* getNamedSdrObject( const rtl::OUString& rName );
+ static SdrObject* getNamedSdrObject( const String& rName, SdrObjList* pObjList );
+
+ static bool removeShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
new file mode 100644
index 000000000000..d10ee8d415fc
--- /dev/null
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_EXPLICITVALUEPROVIDER_HXX
+#define _CHART2_EXPLICITVALUEPROVIDER_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include "chartviewdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class DrawModelWrapper;
+class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider
+{
+public:
+ /** Gives calculated scale and increment values for a given xAxis in the current view.
+ In contrast to the model data these explicit values are always complete as misssing auto properties are calculated.
+ If the given Axis could not be found or for another reason no correct output can be given false is returned.
+ */
+ virtual sal_Bool getExplicitValuesForAxis(
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
+ , ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
+ , ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement )=0;
+
+ /** for rotated objects the shape size and position differs from the visible rectangle
+ if bSnapRect is set to true you get the resulting visible position (left-top) and size
+ */
+ virtual ::com::sun::star::awt::Rectangle
+ getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false )=0;
+
+ virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes()=0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ getShapeForCID( const rtl::OUString& rObjectCID )=0;
+
+ virtual ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0;
+
+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ static ExplicitValueProvider* getExplicitValueProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView );
+
+ static ::com::sun::star::awt::Rectangle
+ addAxisTitleSizes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xChartView
+ , const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize );
+
+ static ::com::sun::star::awt::Rectangle
+ substractAxisTitleSizes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xChartView
+ , const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles );
+
+ static sal_Int32 getExplicitNumberFormatKeyForAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+
+ SAL_DLLPRIVATE static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+
+ static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
+ , sal_Int32 nPointIndex /*-1 for whole series*/
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+
+ static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
new file mode 100644
index 000000000000..9f5f44107997
--- /dev/null
+++ b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VIEW_NUMBERFORMATTERWRAPPER_HXX
+#define _CHART2_VIEW_NUMBERFORMATTERWRAPPER_HXX
+
+#include <svl/zforlist.hxx>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include "chartviewdllapi.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class FixedNumberFormatter;
+
+class OOO_DLLPUBLIC_CHARTVIEW NumberFormatterWrapper
+{
+public:
+ NumberFormatterWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier );
+ virtual ~NumberFormatterWrapper();
+
+ SvNumberFormatter* getSvNumberFormatter() const;
+ ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
+ getNumberFormatsSupplier() { return m_xNumberFormatsSupplier; };
+
+ rtl::OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const;
+
+private: //private member
+ ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
+ m_xNumberFormatsSupplier;
+
+ SvNumberFormatter* m_pNumberFormatter;
+ ::com::sun::star::uno::Any m_aNullDate;
+};
+
+
+class FixedNumberFormatter
+{
+public:
+ FixedNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier
+ , sal_Int32 nNumberFormatKey );
+ virtual ~FixedNumberFormatter();
+
+ rtl::OUString getFormattedString( double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const;
+
+private:
+ NumberFormatterWrapper m_aNumberFormatterWrapper;
+ ULONG m_nNumberFormatKey;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/chartview/chartviewdllapi.hxx b/chart2/source/inc/chartview/chartviewdllapi.hxx
new file mode 100644
index 000000000000..39c553a15fe6
--- /dev/null
+++ b/chart2/source/inc/chartview/chartviewdllapi.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ***********************************************************************/
+
+#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX
+#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_CHARTVIEW
+#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/chart2/source/inc/chartview/servicenames_charttypes.hxx b/chart2/source/inc/chartview/servicenames_charttypes.hxx
new file mode 100644
index 000000000000..bd52c33f51ec
--- /dev/null
+++ b/chart2/source/inc/chartview/servicenames_charttypes.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SERVICENAMES_CHARTTYPES_HXX
+#define _CHART2_SERVICENAMES_CHARTTYPES_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define CHART2_VIEW_BARCHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.BarChart_Impl")
+#define CHART2_VIEW_BARCHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.BarChart")
+
+#define CHART2_VIEW_PIECHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.PieChart_Impl")
+#define CHART2_VIEW_PIECHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.PieChart")
+
+#define CHART2_VIEW_AREACHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.AreaChart_Impl")
+#define CHART2_VIEW_AREACHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.AreaChart")
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/exports.dxp b/chart2/source/inc/exports.dxp
new file mode 100644
index 000000000000..f0e1c69934bc
--- /dev/null
+++ b/chart2/source/inc/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/chart2/source/inc/macros.hxx b/chart2/source/inc/macros.hxx
new file mode 100644
index 000000000000..ac64e879e9ec
--- /dev/null
+++ b/chart2/source/inc/macros.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_MACROS_HXX
+#define CHART_MACROS_HXX
+
+#include <typeinfo>
+
+/// creates a unicode-string from an ASCII string
+#define C2U(constAsciiStr) (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) ))
+
+/** shows an error-box for an exception ex
+ else-branch necessary to avoid warning
+*/
+#if OSL_DEBUG_LEVEL > 0
+#define ASSERT_EXCEPTION(ex) \
+ OSL_ENSURE( false, ::rtl::OUStringToOString( \
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +\
+ ::rtl::OUString::createFromAscii( typeid( ex ).name()) +\
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +\
+ ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr())
+#else
+//avoid compilation warnings
+#define ASSERT_EXCEPTION(ex) (void)(ex)
+#endif
+
+#define U2C(ouString) (::rtl::OUStringToOString(ouString,RTL_TEXTENCODING_ASCII_US).getStr())
+
+// CHART_MACROS_HXX
+#endif
diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx
new file mode 100644
index 000000000000..d1af0edb3335
--- /dev/null
+++ b/chart2/source/inc/servicenames.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_SERVICENAMES_HXX
+#define _CHART_SERVICENAMES_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define CHART_MODEL_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartModel")
+#define CHART_MODEL_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocument")
+//@todo create your own service containing the service com.sun.star.document.OfficeDocument
+
+#define CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartController")
+#define CHART_CONTROLLER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartController")
+//@todo create your own service containing the service com.sun.star.frame.Controller
+
+#define CHART_VIEW_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartView")
+#define CHART_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartView")
+
+#define CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartFrameLoader")
+#define CHART_FRAMELOADER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.frame.SynchronousFrameLoader")
+
+#define CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.WizardDialog")
+#define CHART_WIZARD_DIALOG_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.WizardDialog")
+
+#define CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartTypeDialog")
+#define CHART_TYPE_DIALOG_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartTypeDialog")
+
+// wrapper for old UNO API (com.sun.star.chart)
+#define CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartDocumentWrapper")
+#define CHART_CHARTAPIWRAPPER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocumentWrapper")
+
+// accessibility
+#define CHART_ACCESSIBLE_TEXT_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.AccessibleTextComponent")
+#define CHART_ACCESSIBLE_TEXT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.accessibility.AccessibleTextComponent")
+
+#define CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartRenderer")
+
+#define CHART_UNDOMANAGER_SERVICE_NAME ::rtl::OUString::createFromAscii( "com.sun.star.chart2.UndoManager" )
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
new file mode 100644
index 000000000000..60e39bccf09a
--- /dev/null
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SERVICENAMES_CHARTTYPES_HXX
+#define _CHART2_SERVICENAMES_CHARTTYPES_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define CHART2_SERVICE_NAME_CHARTTYPE_AREA ::rtl::OUString::createFromAscii("com.sun.star.chart2.AreaChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_BAR ::rtl::OUString::createFromAscii("com.sun.star.chart2.BarChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ::rtl::OUString::createFromAscii("com.sun.star.chart2.ColumnChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_LINE ::rtl::OUString::createFromAscii("com.sun.star.chart2.LineChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType")
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/servicenames_coosystems.hxx b/chart2/source/inc/servicenames_coosystems.hxx
new file mode 100644
index 000000000000..002f75c7ece6
--- /dev/null
+++ b/chart2/source/inc/servicenames_coosystems.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SERVICENAMES_COOSYSTEMS_HXX
+#define _CHART2_SERVICENAMES_COOSYSTEMS_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.Cartesian")
+#define CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.CartesianView")
+#define CHART2_COOSYSTEM_POLAR_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.Polar")
+#define CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.PolarView")
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/servicenames_dlwrapper.hxx b/chart2/source/inc/servicenames_dlwrapper.hxx
new file mode 100644
index 000000000000..0b78a8c8227f
--- /dev/null
+++ b/chart2/source/inc/servicenames_dlwrapper.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SERVICENAMES_DLWRAPPER_HXX
+#define _CHART2_SERVICENAMES_DLWRAPPER_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+#define CHART2_VIEW_DLWRAPPER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.DrawModelWrapper")
+#define CHART2_VIEW_DLWRAPPER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.DrawModelWrapper")
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/model/chartmodel.component b/chart2/source/model/chartmodel.component
new file mode 100644
index 000000000000..fa26e51ac401
--- /dev/null
+++ b/chart2/source/model/chartmodel.component
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.chart.AreaChartType">
+ <service name="com.sun.star.chart2.AreaChartType"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.BarChartType">
+ <service name="com.sun.star.chart2.BarChartType"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.BubbleChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.BubbleChartType"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.CandleStickChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.CandleStickChartType"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.ChartTypeManager">
+ <service name="com.sun.star.chart2.ChartTypeManager"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.ColumnChartType">
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.ColumnChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.DataSeries">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.DataPointProperties"/>
+ <service name="com.sun.star.chart2.DataSeries"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.FilledNetChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.FilledNetChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.FormattedString">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.FormattedString"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.LineChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.LineChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.NetChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.NetChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.PieChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.PieChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.ScatterChartType">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.ChartType"/>
+ <service name="com.sun.star.chart2.ScatterChartType"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.Axis">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.Axis"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem2d">
+ <service name="com.sun.star.chart2.CartesianCoordinateSystem2d"/>
+ <service name="com.sun.star.chart2.CoordinateSystems.Cartesian"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.CartesianCoordinateSystem3d">
+ <service name="com.sun.star.chart2.CartesianCoordinateSystem3d"/>
+ <service name="com.sun.star.chart2.CoordinateSystems.Cartesian"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ChartModel">
+ <service name="com.sun.star.chart.ChartDocument"/>
+ <service name="com.sun.star.chart2.ChartDocument"/>
+ <service name="com.sun.star.document.OfficeDocument"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.Diagram">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.Diagram"/>
+ <service name="com.sun.star.layout.LayoutElement"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.GridProperties">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.GridProperties"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.Legend">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.Legend"/>
+ <service name="com.sun.star.drawing.FillProperties"/>
+ <service name="com.sun.star.drawing.LineProperties"/>
+ <service name="com.sun.star.layout.LayoutElement"/>
+ <service name="com.sun.star.style.CharacterProperties"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.PageBackground">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.PageBackground"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem2d">
+ <service name="com.sun.star.chart2.CoordinateSystems.Polar"/>
+ <service name="com.sun.star.chart2.PolarCoordinateSystem2d"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.PolarCoordinateSystem3d">
+ <service name="com.sun.star.chart2.CoordinateSystems.Polar"/>
+ <service name="com.sun.star.chart2.PolarCoordinateSystem3d"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.Title">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.Title"/>
+ <service name="com.sun.star.layout.LayoutElement"/>
+ <service name="com.sun.star.style.ParagraphProperties"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.XMLFilter">
+ <service name="com.sun.star.document.ExportFilter"/>
+ <service name="com.sun.star.document.ImportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.report.XMLFilter">
+ <service name="com.sun.star.document.ExportFilter"/>
+ <service name="com.sun.star.document.ImportFilter"/>
+ </implementation>
+</component>
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
new file mode 100644
index 000000000000..b66c4bc46102
--- /dev/null
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "XMLFilter.hxx"
+#include "macros.hxx"
+#include "MediaDescriptorHelper.hxx"
+#include "ContainerHelper.hxx"
+#include <comphelper/mediadescriptor.hxx>
+
+// for ERRCODE_SFX_GENERAL etc.
+// header contains only macros
+#include <svtools/sfxecode.hxx>
+// header for class SvtSaveOptions
+#include <unotools/saveopt.hxx>
+#include <comphelper/genericpropertyset.hxx>
+// header for struct PropertyMapEntry
+#include <comphelper/propertysetinfo.hxx>
+#include <comphelper/documentconstants.hxx>
+
+// header for class SotStorage
+#include <sot/storage.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// ----------------------------------------
+namespace
+{
+#define LOCAL_CONST_STR(i, x) sal_Char __READONLY_DATA i[sizeof(x)] = x
+#define MAP_LEN(x) x, sizeof(x) - 1
+
+LOCAL_CONST_STR( sXML_metaStreamName, "meta.xml");
+LOCAL_CONST_STR( sXML_styleStreamName, "styles.xml" );
+LOCAL_CONST_STR( sXML_contentStreamName, "content.xml" );
+LOCAL_CONST_STR( sXML_oldContentStreamName, "Content.xml" );
+
+// soffice 6/7
+// LOCAL_CONST_STR( sXML_export_chart_meta_service, "com.sun.star.comp.Chart.XMLMetaExporter" );
+LOCAL_CONST_STR( sXML_export_chart_styles_service, "com.sun.star.comp.Chart.XMLStylesExporter" );
+LOCAL_CONST_STR( sXML_export_chart_content_service, "com.sun.star.comp.Chart.XMLContentExporter" );
+
+// LOCAL_CONST_STR( sXML_import_chart_meta_service, "com.sun.star.comp.Chart.XMLMetaImporter" );
+LOCAL_CONST_STR( sXML_import_chart_styles_service, "com.sun.star.comp.Chart.XMLStylesImporter" );
+LOCAL_CONST_STR( sXML_import_chart_content_service, "com.sun.star.comp.Chart.XMLContentImporter" );
+LOCAL_CONST_STR( sXML_import_chart_old_content_service, "com.sun.star.office.sax.importer.Chart" );
+
+// Oasis
+LOCAL_CONST_STR( sXML_export_chart_oasis_styles_service, "com.sun.star.comp.Chart.XMLOasisStylesExporter" );
+LOCAL_CONST_STR( sXML_export_chart_oasis_content_service, "com.sun.star.comp.Chart.XMLOasisContentExporter" );
+LOCAL_CONST_STR( sXML_export_chart_oasis_meta_service, "com.sun.star.comp.Chart.XMLOasisMetaExporter" );
+
+LOCAL_CONST_STR( sXML_import_chart_oasis_styles_service, "com.sun.star.comp.Chart.XMLOasisStylesImporter" );
+LOCAL_CONST_STR( sXML_import_chart_oasis_content_service, "com.sun.star.comp.Chart.XMLOasisContentImporter" );
+LOCAL_CONST_STR( sXML_import_chart_oasis_meta_service, "com.sun.star.comp.Chart.XMLOasisMetaImporter" );
+
+uno::Reference< embed::XStorage > lcl_getWriteStorage(
+ const Sequence< beans::PropertyValue >& rMediaDescriptor,
+ const uno::Reference< uno::XComponentContext >& xContext,const ::rtl::OUString& _sMediaType)
+{
+ uno::Reference< embed::XStorage > xStorage;
+ try
+ {
+ apphelper::MediaDescriptorHelper aMDHelper( rMediaDescriptor );
+ if( aMDHelper.ISSET_Storage )
+ {
+ xStorage = aMDHelper.Storage;
+ }
+ else
+ {
+ Reference< lang::XSingleServiceFactory > xStorageFact(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.embed.StorageFactory"),
+ xContext ), uno::UNO_QUERY_THROW );
+
+ ::std::vector< beans::PropertyValue > aPropertiesForStorage;
+
+ for( sal_Int32 i=rMediaDescriptor.getLength(); i--; )
+ {
+ // properties understood by storage factory
+ // (see package/source/xstor/xfactory.cxx for details)
+ if ( rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "InteractionHandler" ))
+ || rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "Password" ))
+ || rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "RepairPackage" ))
+ // || rMediaDescriptor[i].Name.equalsAsciiL(
+ // RTL_CONSTASCII_STRINGPARAM( "StatusIndicator" ))
+ // || rMediaDescriptor[i].Name.equalsAsciiL(
+ // RTL_CONSTASCII_STRINGPARAM( "Unpacked" ))
+ )
+ {
+ aPropertiesForStorage.push_back( rMediaDescriptor[i] );
+ }
+ }
+
+ if( aMDHelper.ISSET_Storage )
+ 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] <<= ::chart::ContainerHelper::ContainerToSequence( aPropertiesForStorage );
+
+ xStorage.set(
+ xStorageFact->createInstanceWithArguments( aStorageArgs ),
+ uno::UNO_QUERY_THROW );
+ }
+ }
+
+ // set correct media type at storage
+ uno::Reference<beans::XPropertySet> xProp(xStorage,uno::UNO_QUERY);
+ OUString aMediaType;
+ if ( ! xProp.is() ||
+ ! ( xProp->getPropertyValue( C2U("MediaType")) >>= aMediaType ) ||
+ ( aMediaType.getLength() == 0 ))
+ {
+ xProp->setPropertyValue( C2U("MediaType"), uno::makeAny( _sMediaType ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xStorage;
+}
+
+uno::Reference< embed::XStorage > lcl_getReadStorage(
+ const Sequence< beans::PropertyValue >& rMediaDescriptor,
+ const uno::Reference< uno::XComponentContext >& xContext)
+{
+ uno::Reference< embed::XStorage > xStorage;
+
+ try
+ {
+ apphelper::MediaDescriptorHelper aMDHelper( rMediaDescriptor );
+ if( aMDHelper.ISSET_Storage )
+ {
+ xStorage = aMDHelper.Storage;
+ }
+ else
+ {
+ // get XStream from MediaDescriptor
+ uno::Reference< io::XInputStream > xStream;
+ ::std::vector< beans::PropertyValue > aPropertiesForStorage;
+ for( sal_Int32 i=rMediaDescriptor.getLength(); i--; )
+ {
+ if( rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "InputStream" )))
+ xStream.set( rMediaDescriptor[i].Value, uno::UNO_QUERY );
+
+ // properties understood by storage factory
+ // (see package/source/xstor/xfactory.cxx for details)
+ if ( rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "InteractionHandler" ))
+ || rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "Password" ))
+ || rMediaDescriptor[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "RepairPackage" ))
+// || rMediaDescriptor[i].Name.equalsAsciiL(
+// RTL_CONSTASCII_STRINGPARAM( "StatusIndicator" ))
+// || rMediaDescriptor[i].Name.equalsAsciiL(
+// RTL_CONSTASCII_STRINGPARAM( "Unpacked" ))
+ )
+ {
+ aPropertiesForStorage.push_back( rMediaDescriptor[i] );
+ }
+ }
+ OSL_ENSURE( xStream.is(), "No Stream" );
+ if( ! xStream.is())
+ return xStorage;
+
+ // convert XInputStream to XStorage via the storage factory
+ Reference< lang::XSingleServiceFactory > xStorageFact(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.embed.StorageFactory"),
+ xContext ),
+ uno::UNO_QUERY_THROW );
+ Sequence< uno::Any > aStorageArgs( 3 );
+ aStorageArgs[0] <<= xStream;
+ aStorageArgs[1] <<= (embed::ElementModes::READ | embed::ElementModes::NOCREATE);
+ aStorageArgs[2] <<= ::chart::ContainerHelper::ContainerToSequence( aPropertiesForStorage );
+ xStorage.set(
+ xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW );
+ }
+
+ OSL_ENSURE( xStorage.is(), "No Storage" );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xStorage;
+}
+
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+namespace chart
+{
+
+XMLFilter::XMLFilter( Reference< uno::XComponentContext > const & xContext ) :
+ m_xContext( xContext ),
+ m_bCancelOperation( false )
+{}
+
+XMLFilter::~XMLFilter()
+{}
+
+// ____ XFilter ____
+sal_Bool SAL_CALL XMLFilter::filter(
+ const Sequence< beans::PropertyValue >& aDescriptor )
+ throw (uno::RuntimeException)
+{
+ bool bResult = false;
+
+ 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" );
+ if( impl_Export( m_xSourceDoc,
+ aDescriptor ) == 0 )
+ {
+ m_xSourceDoc = NULL;
+ bResult = true;
+ }
+ }
+ else if( m_xTargetDoc.is())
+ {
+ if( impl_Import( m_xTargetDoc,
+ aDescriptor ) == 0 )
+ {
+ m_xTargetDoc = NULL;
+ bResult = true;
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "filter() called with no document set" );
+ }
+
+ return bResult;
+}
+
+void SAL_CALL XMLFilter::cancel()
+ throw (uno::RuntimeException)
+{
+ // if mutex is locked set "cancel state"
+ // note: is currently ignored in filter-method
+ if( ! m_aMutex.tryToAcquire())
+ {
+ m_bCancelOperation = true;
+ }
+}
+
+// ____ XImporter ____
+void SAL_CALL XMLFilter::setTargetDocument(
+ const Reference< lang::XComponent >& Document )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ OSL_ENSURE( ! m_xSourceDoc.is(), "Setting target doc while source doc is set" );
+
+ m_xTargetDoc = Document;
+}
+
+
+// ____ XExporter ____
+void SAL_CALL XMLFilter::setSourceDocument(
+ const Reference< lang::XComponent >& Document )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ MutexGuard aGuard( m_aMutex );
+ OSL_ENSURE( ! m_xTargetDoc.is(), "Setting source doc while target doc is set" );
+
+ m_xSourceDoc = Document;
+}
+
+
+sal_Int32 XMLFilter::impl_Import(
+ const Reference< lang::XComponent > & xDocumentComp,
+ const Sequence< beans::PropertyValue > & rMediaDescriptor )
+{
+ sal_Int32 nWarning = 0;
+
+ OSL_ENSURE( xDocumentComp.is(), "Import: No Model" );
+ OSL_ENSURE( m_xContext.is(), "Import: No ComponentContext" );
+
+ if( ! (xDocumentComp.is() &&
+ m_xContext.is()))
+ return nWarning;
+
+ try
+ {
+ Reference< lang::XServiceInfo > xServInfo( xDocumentComp, uno::UNO_QUERY_THROW );
+ if( ! xServInfo->supportsService( C2U( "com.sun.star.chart2.ChartDocument" )))
+ {
+ OSL_ENSURE( false, "Import: No ChartDocument" );
+ return ERRCODE_SFX_GENERAL;
+ }
+
+ Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager());
+ OSL_ENSURE( xFactory.is(), "Import: No Factory" );
+ if( ! xFactory.is())
+ return ERRCODE_SFX_GENERAL;
+
+ // create a sax parser
+ Reference< xml::sax::XParser > xSaxParser(
+ xFactory->createInstanceWithContext( C2U( "com.sun.star.xml.sax.Parser" ), m_xContext ),
+ uno::UNO_QUERY_THROW );
+
+ bool bOasis = true;
+ isOasisFormat( rMediaDescriptor, bOasis );
+ Reference< embed::XStorage > xStorage( lcl_getReadStorage( rMediaDescriptor, m_xContext));
+ if( ! xStorage.is())
+ return ERRCODE_SFX_GENERAL;
+
+// bool bOasis = (SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60);
+
+ Reference< document::XGraphicObjectResolver > xGraphicObjectResolver;
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( xFactory, uno::UNO_QUERY);
+ if( xServiceFactory.is())
+ {
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[0] <<= xStorage;
+ xGraphicObjectResolver.set(
+ xServiceFactory->createInstanceWithArguments(
+ C2U("com.sun.star.comp.Svx.GraphicImportHelper"), aArgs ), uno::UNO_QUERY );
+ }
+
+ // create XPropertySet with extra informatio for the filter
+ /** property map for import info set */
+ comphelper::PropertyMapEntry aImportInfoMap[] =
+ {
+ // #80365# necessary properties for XML progress bar at load time
+ { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN( "PrivateData" ), 0,
+ &::getCppuType( (Reference<XInterface> *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "BaseURI" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamRelPath" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "StreamName" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN( "BuildId" ), 0,
+ &::getCppuType( (OUString *)0 ),
+ ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ uno::Reference< beans::XPropertySet > xImportInfo(
+ comphelper::GenericPropertySet_CreateInstance(
+ new comphelper::PropertySetInfo( aImportInfoMap ) ) );
+
+ // Set base URI and Hierarchical Name
+ OUString aHierarchName, aBaseUri;
+ uno::Reference< frame::XModel > xModel( m_xSourceDoc, uno::UNO_QUERY );
+ if( xModel.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aModProps = xModel->getArgs();
+ for( sal_Int32 nInd = 0; nInd < aModProps.getLength(); nInd++ )
+ {
+ if( aModProps[nInd].Name.equals( C2U( "HierarchicalDocumentName" ) ) )
+ {
+ // Actually this argument only has meaning for embedded documents
+ aModProps[nInd].Value >>= aHierarchName;
+ }
+ else if( aModProps[nInd].Name.equals( C2U( "DocumentBaseURL" ) ) )
+ {
+ aModProps[nInd].Value >>= aBaseUri;
+ }
+ }
+ }
+
+ if( aBaseUri.getLength() )
+ xImportInfo->setPropertyValue( C2U("BaseURI"), uno::makeAny( aBaseUri ) );
+
+ if( aHierarchName.getLength() )
+ xImportInfo->setPropertyValue( C2U("StreamRelPath"), uno::makeAny( aHierarchName ) );
+
+ // import meta information
+ if( bOasis )
+ nWarning |= impl_ImportStream(
+ C2U( sXML_metaStreamName ),
+ C2U( sXML_import_chart_oasis_meta_service ),
+ xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo );
+
+ // import styles
+ nWarning |= impl_ImportStream(
+ C2U( sXML_styleStreamName ),
+ bOasis
+ ? C2U( sXML_import_chart_oasis_styles_service )
+ : C2U( sXML_import_chart_styles_service ),
+ xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo );
+
+ // import content
+ sal_Int32 nContentWarning = impl_ImportStream(
+ C2U( sXML_contentStreamName ),
+ bOasis
+ ? C2U( sXML_import_chart_oasis_content_service )
+ : C2U( sXML_import_chart_content_service ),
+ xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo );
+ nWarning |= nContentWarning;
+
+ // import of "content.xml" didn't work - try old "Content.xml" stream
+ if( nContentWarning != 0 )
+ {
+ nWarning = impl_ImportStream(
+ C2U( sXML_oldContentStreamName ),
+ C2U( sXML_import_chart_old_content_service ),
+ xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+
+ // something went awry
+ nWarning = ERRCODE_SFX_GENERAL;
+ }
+
+ return nWarning;
+}
+
+sal_Int32 XMLFilter::impl_ImportStream(
+ const OUString & rStreamName,
+ const OUString & rServiceName,
+ const Reference< embed::XStorage > & xStorage,
+ const Reference< xml::sax::XParser > & xParser,
+ const Reference< lang::XMultiComponentFactory > & xFactory,
+ const Reference< document::XGraphicObjectResolver > & xGraphicObjectResolver,
+ uno::Reference< beans::XPropertySet >& xImportInfo )
+{
+ sal_Int32 nWarning = ERRCODE_SFX_GENERAL;
+
+ Reference< container::XNameAccess > xNameAcc( xStorage, uno::UNO_QUERY );
+ if( ! (xNameAcc.is() &&
+ xNameAcc->hasByName( rStreamName )))
+ return 0;
+
+ if( xImportInfo.is() )
+ xImportInfo->setPropertyValue( C2U("StreamName"), uno::makeAny( rStreamName ) );
+
+ if( xStorage.is() &&
+ xStorage->isStreamElement( rStreamName ) )
+ {
+ try
+ {
+ xml::sax::InputSource aParserInput;
+ aParserInput.aInputStream.set(
+ xStorage->openStreamElement(
+ rStreamName,
+ embed::ElementModes::READ | embed::ElementModes::NOCREATE ),
+ uno::UNO_QUERY );
+
+ // todo: encryption
+
+ if( aParserInput.aInputStream.is())
+ {
+ sal_Int32 nArgs = 0;
+ //if( m_xStatusIndicator.is())
+ // nArgs++;
+ if( xGraphicObjectResolver.is())
+ nArgs++;
+ if( xImportInfo.is())
+ nArgs++;
+
+ uno::Sequence< uno::Any > aFilterCompArgs( nArgs );
+
+ nArgs = 0;
+ //if( m_xStatusIndicator.is())
+ // aFilterCompArgs[ nArgs++ ] <<= m_xStatusIndicator;
+ if( xGraphicObjectResolver.is())
+ aFilterCompArgs[nArgs++] <<= xGraphicObjectResolver;
+ if( xImportInfo.is())
+ aFilterCompArgs[ nArgs++ ] <<= xImportInfo;
+
+ Reference< xml::sax::XDocumentHandler > xDocHandler(
+ xFactory->createInstanceWithArgumentsAndContext( rServiceName, aFilterCompArgs, m_xContext ),
+ uno::UNO_QUERY_THROW );
+
+
+ Reference< document::XImporter > xImporter( xDocHandler, uno::UNO_QUERY_THROW );
+ xImporter->setTargetDocument( Reference< lang::XComponent >( m_xTargetDoc, uno::UNO_QUERY_THROW ));
+
+ if ( m_sDocumentHandler.getLength() )
+ {
+ try
+ {
+ uno::Sequence< uno::Any > aArgs(2);
+ beans::NamedValue aValue;
+ aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentHandler"));
+ aValue.Value <<= xDocHandler;
+ aArgs[0] <<= aValue;
+ aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model"));
+ aValue.Value <<= m_xTargetDoc;
+ aArgs[1] <<= aValue;
+
+ xDocHandler.set(xFactory->createInstanceWithArgumentsAndContext(m_sDocumentHandler,aArgs,m_xContext), uno::UNO_QUERY );
+ xImporter.set(xDocHandler,uno::UNO_QUERY);
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+ }
+ xParser->setDocumentHandler( xDocHandler );
+ xParser->parseStream( aParserInput );
+ }
+
+ // load was successful
+ nWarning = 0;
+ }
+ catch( xml::sax::SAXParseException )
+ {
+ // todo: if encrypted: ERRCODE_SFX_WRONGPASSWORD
+ }
+ catch( xml::sax::SAXException )
+ {
+ // todo: if encrypted: ERRCODE_SFX_WRONGPASSWORD
+ }
+ catch( packages::zip::ZipIOException )
+ {
+ nWarning = ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch( io::IOException )
+ {
+ }
+ catch( uno::Exception& aEx )
+ {
+ ASSERT_EXCEPTION( aEx );
+ }
+ }
+
+ return nWarning;
+}
+
+sal_Int32 XMLFilter::impl_Export(
+ const Reference< lang::XComponent > & xDocumentComp,
+ const Sequence< beans::PropertyValue > & rMediaDescriptor )
+{
+ //save
+
+ sal_Int32 nWarning = 0;
+
+ OSL_ENSURE( xDocumentComp.is(), "Export: No Model" );
+ OSL_ENSURE( m_xContext.is(), "Export: No ComponentContext" );
+
+ if( !xDocumentComp.is() || !m_xContext.is() )
+ return nWarning;
+
+ try
+ {
+ Reference< lang::XServiceInfo > xServInfo( xDocumentComp, uno::UNO_QUERY_THROW );
+ if( ! xServInfo->supportsService( C2U( "com.sun.star.chart2.ChartDocument" )))
+ {
+ OSL_ENSURE( false, "Export: No ChartDocument" );
+ return ERRCODE_SFX_GENERAL;
+ }
+
+ Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager());
+ OSL_ENSURE( xFactory.is(), "Export: No Factory" );
+ if( ! xFactory.is())
+ return ERRCODE_SFX_GENERAL;
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_xContext->getServiceManager(), uno::UNO_QUERY);
+ if( ! xServiceFactory.is())
+ return ERRCODE_SFX_GENERAL;
+
+ uno::Reference< io::XActiveDataSource > xSaxWriter( xServiceFactory->createInstance(
+ C2U("com.sun.star.xml.sax.Writer")), uno::UNO_QUERY );
+ if ( !xSaxWriter.is() )
+ return ERRCODE_SFX_GENERAL;
+
+ bool bOasis = true;
+ isOasisFormat( rMediaDescriptor, bOasis );
+
+ uno::Reference< embed::XStorage > xStorage( lcl_getWriteStorage( rMediaDescriptor, m_xContext, getMediaType(bOasis) ) );
+ OSL_ENSURE( xStorage.is(), "No Storage" );
+ if( ! xStorage.is())
+ return ERRCODE_SFX_GENERAL;
+
+ uno::Reference< xml::sax::XDocumentHandler> xDocHandler( xSaxWriter, uno::UNO_QUERY );
+
+ if ( m_sDocumentHandler.getLength() )
+ {
+ try
+ {
+ uno::Sequence< uno::Any > aArgs(2);
+ beans::NamedValue aValue;
+ aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentHandler"));
+ aValue.Value <<= xDocHandler;
+ aArgs[0] <<= aValue;
+ aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model"));
+ aValue.Value <<= xDocumentComp;
+ aArgs[1] <<= aValue;
+
+ xDocHandler.set(xServiceFactory->createInstanceWithArguments(m_sDocumentHandler,aArgs), uno::UNO_QUERY );
+ xSaxWriter.set(xDocHandler,uno::UNO_QUERY);
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught!");
+ }
+ }
+
+ uno::Sequence< uno::Any > aGraphicResolverArgs(1);
+ aGraphicResolverArgs[0] <<= xStorage;
+ Reference< document::XGraphicObjectResolver > xGraphicObjectResolver(
+ xServiceFactory->createInstanceWithArguments(
+ C2U("com.sun.star.comp.Svx.GraphicExportHelper"), aGraphicResolverArgs ), uno::UNO_QUERY );
+
+ uno::Reference< beans::XPropertySet > xInfoSet;
+ {
+ // property map for export info set
+ comphelper::PropertyMapEntry aExportInfoMap[] =
+ {
+ { MAP_LEN("UsePrettyPrinting"), 0, &::getBooleanCppuType(), beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN("BaseURI"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("StreamRelPath"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("StreamName"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("ExportTableNumberList"), 0, &::getBooleanCppuType(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ xInfoSet = comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) );
+
+ SvtSaveOptions aSaveOpt;
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
+ sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) );
+ if( ! bOasis )
+ xInfoSet->setPropertyValue( C2U("ExportTableNumberList"), uno::makeAny( true ));
+ }
+
+ sal_Int32 nArgs = 2;
+ if( xGraphicObjectResolver.is())
+ nArgs++;
+
+ uno::Sequence< uno::Any > aFilterProperties( nArgs );
+ {
+ nArgs = 0;
+ aFilterProperties[ nArgs++ ] <<= xInfoSet;
+ aFilterProperties[ nArgs++ ] <<= xDocHandler;
+ if( xGraphicObjectResolver.is())
+ aFilterProperties[ nArgs++ ] <<= xGraphicObjectResolver;
+ }
+
+// bool bOasis = (SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60);
+
+ // export meta information
+ if( bOasis )
+ nWarning |= impl_ExportStream(
+ C2U( sXML_metaStreamName ),
+ C2U( sXML_export_chart_oasis_meta_service ),
+ xStorage, xSaxWriter, xServiceFactory, aFilterProperties );
+
+ // export styles
+ nWarning |= impl_ExportStream(
+ C2U( sXML_styleStreamName ),
+ bOasis
+ ? C2U( sXML_export_chart_oasis_styles_service )
+ : C2U( sXML_export_chart_styles_service ),
+ xStorage, xSaxWriter, xServiceFactory, aFilterProperties );
+
+ // export content
+ sal_Int32 nContentWarning = impl_ExportStream(
+ C2U( sXML_contentStreamName ),
+ bOasis
+ ? C2U( sXML_export_chart_oasis_content_service )
+ : C2U( sXML_export_chart_content_service ),
+ xStorage, xSaxWriter, xServiceFactory, aFilterProperties );
+ nWarning |= nContentWarning;
+
+ Reference< lang::XComponent > xComp( xGraphicObjectResolver, uno::UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+
+ uno::Reference<embed::XTransactedObject> xTransact( xStorage ,uno::UNO_QUERY);
+ if ( xTransact.is() )
+ xTransact->commit();
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+
+ // something went awry
+ nWarning = ERRCODE_SFX_GENERAL;
+ }
+
+ return nWarning;
+}
+
+sal_Int32 XMLFilter::impl_ExportStream(
+ const OUString & rStreamName,
+ const OUString & rServiceName,
+ const Reference< embed::XStorage > & xStorage,
+ const uno::Reference< io::XActiveDataSource >& xActiveDataSource,
+ const Reference< lang::XMultiServiceFactory >& xServiceFactory,
+ const Sequence< uno::Any > & rFilterProperties )
+{
+ sal_Int32 nWarning = 0;
+
+ try
+ {
+ if( !xServiceFactory.is() )
+ return ERRCODE_SFX_GENERAL;
+ if( !xStorage.is() )
+ return ERRCODE_SFX_GENERAL;
+ if ( !xActiveDataSource.is() )
+ return ERRCODE_SFX_GENERAL;
+
+ uno::Reference< io::XStream > xStream( xStorage->openStreamElement(
+ rStreamName, embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ) );
+ if ( !xStream.is() )
+ return ERRCODE_SFX_GENERAL;
+ uno::Reference< io::XOutputStream > xOutputStream( xStream->getOutputStream() );
+ if ( !xOutputStream.is() )
+ return ERRCODE_SFX_GENERAL;
+
+ uno::Reference< beans::XPropertySet > xStreamProp( xOutputStream, uno::UNO_QUERY );
+ if(xStreamProp.is()) try
+ {
+ xStreamProp->setPropertyValue( C2U("MediaType"), uno::makeAny( C2U("text/xml") ) );
+ xStreamProp->setPropertyValue( C2U("Compressed"), uno::makeAny( sal_True ) );//@todo?
+ xStreamProp->setPropertyValue( C2U("UseCommonStoragePasswordEncryption"), uno::makeAny( sal_True ) );
+ }
+ catch( uno::Exception& rEx )
+ {
+ ASSERT_EXCEPTION( rEx );
+ }
+
+ xActiveDataSource->setOutputStream(xOutputStream);
+
+ // set Base URL
+ {
+ uno::Reference< beans::XPropertySet > xInfoSet;
+ if( rFilterProperties.getLength() > 0 )
+ rFilterProperties.getConstArray()[0] >>= xInfoSet;
+ OSL_ENSURE( xInfoSet.is(), "missing infoset for export" );
+ if( xInfoSet.is() )
+ xInfoSet->setPropertyValue( C2U("StreamName"), uno::makeAny( rStreamName ) );
+ }
+
+ Reference< XExporter > xExporter( xServiceFactory->createInstanceWithArguments(
+ rServiceName, rFilterProperties ), uno::UNO_QUERY);
+ if ( !xExporter.is() )
+ return ERRCODE_SFX_GENERAL;
+
+ xExporter->setSourceDocument( m_xSourceDoc );
+
+ uno::Reference< document::XFilter > xFilter( xExporter, uno::UNO_QUERY );
+ if ( !xFilter.is() )
+ return ERRCODE_SFX_GENERAL;
+
+ uno::Sequence < beans::PropertyValue > aMediaDesc(0);
+ //@todo? filter properties? ... url? ...
+ xFilter->filter( aMediaDesc );
+ }
+ catch( uno::Exception& rEx )
+ {
+ ASSERT_EXCEPTION( rEx );
+ }
+ return nWarning;
+}
+
+// --------------------------------------------------------------------------------
+
+Sequence< OUString > XMLFilter::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.document.ImportFilter" );
+ aServices[ 1 ] = C2U( "com.sun.star.document.ExportFilter" );
+
+ // todo: services are incomplete. Missing:
+ // XInitialization, XNamed
+ return aServices;
+}
+// -----------------------------------------------------------------------------
+
+void XMLFilter::isOasisFormat(const Sequence< beans::PropertyValue >& _rMediaDescriptor, bool & rOutOASIS )
+{
+ apphelper::MediaDescriptorHelper aMDHelper( _rMediaDescriptor );
+ if( aMDHelper.ISSET_FilterName )
+ rOutOASIS = aMDHelper.FilterName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("chart8"));
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString XMLFilter::getMediaType(bool _bOasis)
+{
+ return _bOasis ? MIMETYPE_OASIS_OPENDOCUMENT_CHART : MIMETYPE_VND_SUN_XML_CHART;
+}
+// -----------------------------------------------------------------------------
+
+APPHELPER_XSERVICEINFO_IMPL( XMLFilter, C2U( "com.sun.star.comp.chart2.XMLFilter" ) );
+// -----------------------------------------------------------------------------
+
+void XMLReportFilterHelper::isOasisFormat(const Sequence< beans::PropertyValue >& _rMediaDescriptor, bool & rOutOASIS )
+{
+ apphelper::MediaDescriptorHelper aMDHelper( _rMediaDescriptor );
+ if( aMDHelper.ISSET_FilterName )
+ rOutOASIS = aMDHelper.FilterName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("StarOffice XML (Base) Report Chart"));
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString XMLReportFilterHelper::getMediaType(bool )
+{
+ return MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/filter/makefile.mk b/chart2/source/model/filter/makefile.mk
new file mode 100644
index 000000000000..fc9f7ebb9973
--- /dev/null
+++ b/chart2/source/model/filter/makefile.mk
@@ -0,0 +1,49 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJNAME= chart2
+TARGET= chmodelfilter
+
+PRJINC= $(PRJ)$/source
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/XMLFilter.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/model/inc/BaseCoordinateSystem.hxx b/chart2/source/model/inc/BaseCoordinateSystem.hxx
new file mode 100644
index 000000000000..22346e917453
--- /dev/null
+++ b/chart2/source/model/inc/BaseCoordinateSystem.hxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_COORDINATESYSTEM_HXX
+#define CHART_COORDINATESYSTEM_HXX
+
+#include "ServiceMacros.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase6.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.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 <vector>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper6
+ < ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::chart2::XCoordinateSystem,
+ ::com::sun::star::chart2::XChartTypeContainer,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ BaseCoordinateSystem_Base;
+}
+
+class BaseCoordinateSystem :
+ public impl::BaseCoordinateSystem_Base,
+ public MutexContainer,
+ public ::property::OPropertySet
+{
+public:
+ BaseCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount = 2,
+ sal_Bool bSwapXAndYAxis = sal_False );
+ explicit BaseCoordinateSystem( const BaseCoordinateSystem & rSource );
+ virtual ~BaseCoordinateSystem();
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ XCoordinateSystem ____
+ virtual ::sal_Int32 SAL_CALL getDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+ // not implemented
+// virtual ::rtl::OUString SAL_CALL getCoordinateSystemType()
+// throw (::com::sun::star::uno::RuntimeException);
+ // not implemented
+// virtual ::rtl::OUString SAL_CALL getViewServiceName()
+// throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAxisByDimension(
+ ::sal_Int32 nDimension,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis,
+ ::sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > SAL_CALL getAxisByDimension(
+ ::sal_Int32 nDimension, ::sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaximumAxisIndexByDimension( ::sal_Int32 nDimension )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeContainer ____
+ virtual void SAL_CALL addChartType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& aChartType )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > SAL_CALL getChartTypes()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setChartTypes(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > >& aChartTypes )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ // not implemented
+// virtual ::com::sun::star::uno::Reference<
+// ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceInfo ____
+ // not implemented
+// virtual ::rtl::OUString SAL_CALL getImplementationName()
+// throw (::com::sun::star::uno::RuntimeException);
+// virtual ::sal_Bool SAL_CALL supportsService(
+// const ::rtl::OUString& ServiceName )
+// throw (::com::sun::star::uno::RuntimeException);
+// virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+
+private:
+ sal_Int32 m_nDimensionCount;
+ typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > > > tAxisVecVecType;
+ tAxisVecVecType m_aAllAxis; //outer sequence is the dimension; inner sequence is the axis index that indicates main or secondary axis
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any > m_aOrigin;
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > m_aChartTypes;
+};
+
+} // namespace chart
+
+// CHART_COORDINATESYSTEM_HXX
+#endif
diff --git a/chart2/source/model/inc/CartesianCoordinateSystem.hxx b/chart2/source/model/inc/CartesianCoordinateSystem.hxx
new file mode 100644
index 000000000000..7c9fd075d787
--- /dev/null
+++ b/chart2/source/model/inc/CartesianCoordinateSystem.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_CARTESIANCOORDINATESYSTEM_HXX
+#define _CHART_CARTESIANCOORDINATESYSTEM_HXX
+
+#include "ServiceMacros.hxx"
+#include "BaseCoordinateSystem.hxx"
+
+namespace chart
+{
+
+class CartesianCoordinateSystem : public BaseCoordinateSystem
+{
+public:
+ explicit CartesianCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount = 2,
+ sal_Bool bSwapXAndYAxis = sal_False );
+ explicit CartesianCoordinateSystem( const CartesianCoordinateSystem & rSource );
+ virtual ~CartesianCoordinateSystem();
+
+ // ____ XCoordinateSystem ____
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getViewServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+class CartesianCoordinateSystem2d : public CartesianCoordinateSystem
+{
+public:
+ explicit CartesianCoordinateSystem2d(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~CartesianCoordinateSystem2d();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( CartesianCoordinateSystem2d )
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+class CartesianCoordinateSystem3d : public CartesianCoordinateSystem
+{
+public:
+ explicit CartesianCoordinateSystem3d(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~CartesianCoordinateSystem3d();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( CartesianCoordinateSystem3d )
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+} // namespace chart
+
+// _CHART_CARTESIANCOORDINATESYSTEM_HXX
+#endif
diff --git a/chart2/source/model/inc/ChartTypeManager.hxx b/chart2/source/model/inc/ChartTypeManager.hxx
new file mode 100644
index 000000000000..de721be48142
--- /dev/null
+++ b/chart2/source/model/inc/ChartTypeManager.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTTYPEMANAGER_HXX
+#define CHART_CHARTTYPEMANAGER_HXX
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include "ServiceMacros.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+// #ifndef _COM_SUN_STAR_LANG_XMULTICOMPONENTFACTORY_HPP_
+// #include <com/sun/star/lang/XMultiComponentFactory.hpp>
+// #endif
+
+#include <com/sun/star/chart2/XChartTypeManager.hpp>
+
+// #include <map>
+
+namespace chart
+{
+
+class ChartTypeManager :
+ public ::cppu::WeakImplHelper2<
+ ::com::sun::star::lang::XMultiServiceFactory,
+// ::com::sun::star::lang::XMultiComponentFactory,
+ ::com::sun::star::chart2::XChartTypeManager >
+{
+public:
+ explicit ChartTypeManager(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~ChartTypeManager();
+
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ChartTypeManager )
+
+protected:
+ // ____ XMultiServiceFactory ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
+ const ::rtl::OUString& ServiceSpecifier,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& Arguments )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getAvailableServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeManager ____
+ // currently empty
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+};
+
+} // namespace chart
+
+// CHART_CHARTTYPEMANAGER_HXX
+#endif
diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/model/inc/DataSeries.hxx
new file mode 100644
index 000000000000..e05bac782b86
--- /dev/null
+++ b/chart2/source/model/inc/DataSeries.hxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_DATASERIES_HXX
+#define _CHART_DATASERIES_HXX
+
+// UNO types
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#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/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+// helper classes
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase8.hxx>
+#include <comphelper/uno3.hxx>
+#include <osl/mutex.hxx>
+
+// STL
+#include <vector>
+#include <map>
+
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+
+namespace com { namespace sun { namespace star { namespace style {
+ class XStyle;
+}}}}
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper8<
+ ::com::sun::star::chart2::XDataSeries,
+ ::com::sun::star::chart2::data::XDataSink,
+ ::com::sun::star::chart2::data::XDataSource,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::chart2::XRegressionCurveContainer,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ DataSeries_Base;
+}
+
+class DataSeries :
+ public MutexContainer,
+ public impl::DataSeries_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit DataSeries(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataSeries();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( DataSeries )
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit DataSeries( const DataSeries & rOther );
+
+ // late initialization to call after copy-constructing
+ void Init( const DataSeries & rOther );
+
+ // ____ XDataSeries ____
+ // _____________________
+ /// @see ::com::sun::star::chart2::XDataSeries
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ SAL_CALL getDataPointByIndex( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetAllDataPoints()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSink ____
+ // ___________________
+ /// @see ::com::sun::star::chart2::data::XDataSink
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSource ____
+ // _____________________
+ /// @see ::com::sun::star::chart2::data::XDataSource
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ // ______________________
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ // ______________________
+ /// @see ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// make original interface function visible again
+ using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
+
+ // ____ XRegressionCurveContainer ____
+ // ___________________________________
+ /// @see ::com::sun::star::chart2::XRegressionCurveContainer
+ virtual void SAL_CALL addRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > > SAL_CALL getRegressionCurves()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRegressionCurves(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > >& aRegressionCurves )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+ /** const variant of getInfoHelper()
+ */
+ ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelperConst() const;
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ typedef ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
+ tDataSequenceContainer m_aDataSequences;
+
+ typedef ::std::map< sal_Int32,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > tDataPointAttributeContainer;
+ tDataPointAttributeContainer m_aAttributedDataPoints;
+
+ typedef
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > >
+ tRegressionCurveContainerType;
+ tRegressionCurveContainerType m_aRegressionCurves;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// _CHART_DATASERIES_HXX
+#endif
diff --git a/chart2/source/model/inc/DataSeriesTree.hxx b/chart2/source/model/inc/DataSeriesTree.hxx
new file mode 100644
index 000000000000..5c6734dde845
--- /dev/null
+++ b/chart2/source/model/inc/DataSeriesTree.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATASERIESTREE_HXX
+#define CHART_DATASERIESTREE_HXX
+
+#include <cppuhelper/implbase2.hxx>
+
+#include "ServiceMacros.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XDataSeriesTreeParent.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+class DataSeriesTree : public
+ ::cppu::WeakImplHelper2<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::chart2::XDataSeriesTreeParent >
+{
+public:
+ DataSeriesTree( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataSeriesTree();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( DataSeriesTree )
+
+protected:
+
+ // ____ XDataSeriesTreeParent ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeriesTreeNode > >
+ SAL_CALL getChildren()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setChildren(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeriesTreeNode > >& aNewChildren )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addChild(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeriesTreeNode >& aNode )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChild(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeriesTreeNode >& aNode )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSeriesTreeNode ____
+
+private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeriesTreeNode > >
+ m_tChildType;
+
+ m_tChildType m_aChildren;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+};
+
+} // namespace chart
+
+// CHART_DATASERIESTREE_HXX
+#endif
diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx
new file mode 100644
index 000000000000..fc672e29b24c
--- /dev/null
+++ b/chart2/source/model/inc/Diagram.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DIAGRAM_HXX
+#define CHART_DIAGRAM_HXX
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase8.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#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/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include "ServiceMacros.hxx"
+
+#include <map>
+#include <vector>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper8<
+ ::com::sun::star::chart2::XDiagram,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::chart2::XCoordinateSystemContainer,
+ ::com::sun::star::chart2::XTitled,
+ ::com::sun::star::chart::X3DDefaultSetter,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::util::XCloneable >
+ Diagram_Base;
+}
+
+class Diagram :
+ public MutexContainer,
+ public impl::Diagram_Base,
+ public ::property::OPropertySet
+{
+public:
+ Diagram( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~Diagram();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( Diagram )
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit Diagram( const Diagram & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XFastPropertySet ____
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ /// make original interface function visible again
+ using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
+
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XDiagram ____
+// virtual ::rtl::OUString SAL_CALL getChartTypeTemplateServiceName()
+// throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend > SAL_CALL getLegend()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >& xLegend )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > SAL_CALL getDefaultColorScheme()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultColorScheme(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme >& xColorScheme )
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // ____ XCoordinateSystemContainer ____
+ virtual void SAL_CALL addCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& aCoordSys )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCoordinateSystems(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > >& aCoordinateSystems )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XTitled ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& Title )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ X3DDefaultSetter ____
+ virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ typedef
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > >
+ tCoordinateSystemContainerType;
+
+ tCoordinateSystemContainerType m_aCoordSystems;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xWall;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xFloor;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >
+ m_xTitle;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >
+ m_xLegend;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XColorScheme >
+ m_xColorScheme;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_DIAGRAM_HXX
+#endif
diff --git a/chart2/source/model/inc/PolarCoordinateSystem.hxx b/chart2/source/model/inc/PolarCoordinateSystem.hxx
new file mode 100644
index 000000000000..cf82e1cb0871
--- /dev/null
+++ b/chart2/source/model/inc/PolarCoordinateSystem.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_POLARCOORDINATESYSTEM_HXX
+#define _CHART_POLARCOORDINATESYSTEM_HXX
+
+#include "ServiceMacros.hxx"
+#include "BaseCoordinateSystem.hxx"
+
+namespace chart
+{
+
+class PolarCoordinateSystem : public BaseCoordinateSystem
+{
+public:
+ explicit PolarCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount = 2,
+ sal_Bool bSwapXAndYAxis = sal_False );
+ explicit PolarCoordinateSystem( const PolarCoordinateSystem & rSource );
+ virtual ~PolarCoordinateSystem();
+
+ // ____ XCoordinateSystem ____
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getViewServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+class PolarCoordinateSystem2d : public PolarCoordinateSystem
+{
+public:
+ explicit PolarCoordinateSystem2d(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~PolarCoordinateSystem2d();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PolarCoordinateSystem2d )
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+class PolarCoordinateSystem3d : public PolarCoordinateSystem
+{
+public:
+ explicit PolarCoordinateSystem3d(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~PolarCoordinateSystem3d();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PolarCoordinateSystem3d )
+ // ____ XServiceInfo ____
+ APPHELPER_XSERVICEINFO_DECL()
+};
+
+} // namespace chart
+
+// _CHART_POLARCOORDINATESYSTEM_HXX
+#endif
diff --git a/chart2/source/model/inc/StockBar.hxx b/chart2/source/model/inc/StockBar.hxx
new file mode 100644
index 000000000000..7fa98b79964b
--- /dev/null
+++ b/chart2/source/model/inc/StockBar.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STOCKBAR_HXX
+#define CHART_STOCKBAR_HXX
+
+#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 "ServiceMacros.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ StockBar_Base;
+}
+
+class StockBar :
+ public MutexContainer,
+ public impl::StockBar_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit StockBar( bool bRisingCourse );
+ virtual ~StockBar();
+
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+
+protected:
+ explicit StockBar( const StockBar & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ const bool m_bRisingCourse;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_STOCKBAR_HXX
+#endif
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
new file mode 100644
index 000000000000..69b008bbcb75
--- /dev/null
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_XMLFILTER_HXX
+#define CHART2_XMLFILTER_HXX
+
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <osl/mutex.hxx>
+
+// for APPHELPER_... macros
+#include "ServiceMacros.hxx"
+
+namespace com { namespace sun { namespace star {
+namespace embed
+{
+ class XStorage;
+}
+namespace xml { namespace sax
+{
+ class XParser;
+}}
+namespace document
+{
+ class XGraphicObjectResolver;
+}
+}}}
+
+namespace chart
+{
+
+class XMLFilter : public
+ ::cppu::WeakImplHelper4<
+ ::com::sun::star::document::XFilter,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit XMLFilter( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~XMLFilter();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( XMLFilter )
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XFilter ____
+ virtual sal_Bool SAL_CALL filter(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XImporter ____
+ virtual void SAL_CALL setTargetDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& Document )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XExporter ____
+ virtual void SAL_CALL setSourceDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& Document )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ inline ::rtl::OUString getDocumentHandler() const { return m_sDocumentHandler; }
+ inline void setDocumentHandler(const ::rtl::OUString& _sDocumentHandler) { m_sDocumentHandler = _sDocumentHandler; }
+
+ virtual ::rtl::OUString getMediaType(bool _bOasis);
+
+ /** fills the oasis flag only when a filtername was set
+ *
+ * \param _rMediaDescriptor
+ * \param _rOutOASIS
+ */
+ virtual void isOasisFormat(const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor, bool & _rOutOASIS );
+
+private:
+ // methods
+
+ /// @return a warning code, or 0 for successful operation
+ sal_Int32 impl_Import( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > & xDocumentComp,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & aMediaDescriptor );
+ /// @return a warning code, or 0 for successful operation
+ sal_Int32 impl_ImportStream(
+ const ::rtl::OUString & rStreamName,
+ const ::rtl::OUString & rServiceName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & xStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XParser > & xParser,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiComponentFactory > & xFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XGraphicObjectResolver > & xGraphicObjectResolver,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPropSet );
+
+ /// @return a warning code, or 0 for successful operation
+ sal_Int32 impl_Export( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > & xDocumentComp,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & aMediaDescriptor );
+ /// @return a warning code, or 0 for successful operation
+ sal_Int32 impl_ExportStream(
+ const ::rtl::OUString & rStreamName,
+ const ::rtl::OUString & rServiceName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & xStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XActiveDataSource >& xActiveDataSource,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xFactory,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any > & rFilterProperties );
+
+ // members
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > m_xTargetDoc;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > m_xSourceDoc;
+ ::rtl::OUString m_sDocumentHandler; // when set it will be set as doc handler
+
+ volatile bool m_bCancelOperation;
+ ::osl::Mutex m_aMutex;
+};
+
+// =============================================================================
+class XMLReportFilterHelper : public XMLFilter
+{
+ virtual void isOasisFormat(const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor, bool & _rOutOASIS );
+public:
+ explicit XMLReportFilterHelper( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & _xContext )
+ :XMLFilter(_xContext)
+ {}
+ /// establish methods for factory instatiation
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL create(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
+ {
+ return (::cppu::OWeakObject *)new XMLReportFilterHelper( xContext );
+ }
+ static ::rtl::OUString getImplementationName_Static()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart2.report.XMLFilter" ));
+ }
+protected:
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException )
+ {
+ return getImplementationName_Static();
+ }
+ // ____ XImporter ____
+ virtual void SAL_CALL setTargetDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& Document )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ setDocumentHandler(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ImportDocumentHandler")));
+ XMLFilter::setTargetDocument(Document);
+ }
+
+ // ____ XExporter ____
+ virtual void SAL_CALL setSourceDocument(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& Document )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ setDocumentHandler(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ExportDocumentHandler")));
+ XMLFilter::setSourceDocument(Document);
+ }
+
+ virtual ::rtl::OUString getMediaType(bool _bOasis);
+};
+
+} // namespace chart
+
+// CHART2_XMLFILTER_HXX
+#endif
diff --git a/chart2/source/model/inc/_serviceregistration_charttypes.hxx b/chart2/source/model/inc/_serviceregistration_charttypes.hxx
new file mode 100644
index 000000000000..481a7064f311
--- /dev/null
+++ b/chart2/source/model/inc/_serviceregistration_charttypes.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2__SERVICEREGISTRATION_CHARTTYPES_HXX
+#define CHART2__SERVICEREGISTRATION_CHARTTYPES_HXX
+
+#include <cppuhelper/implementationentry.hxx>
+
+class ChartTypeEntriesForServiceRegistration
+{
+public:
+ static struct ::cppu::ImplementationEntry*
+ getImplementationEntries();
+};
+
+// CHART2__SERVICEREGISTRATION_CHARTTYPES_HXX
+#endif
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
new file mode 100644
index 000000000000..fd1d78ebe071
--- /dev/null
+++ b/chart2/source/model/main/Axis.cxx
@@ -0,0 +1,646 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Axis.hxx"
+#include "GridProperties.hxx"
+#include "macros.hxx"
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "AxisHelper.hxx"
+#include "EventListenerHelper.hxx"
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Axis" ));
+
+enum
+{
+ PROP_AXIS_SHOW,
+ PROP_AXIS_CROSSOVER_POSITION,
+ PROP_AXIS_CROSSOVER_VALUE,
+ PROP_AXIS_DISPLAY_LABELS,
+ PROP_AXIS_NUMBER_FORMAT,
+ PROP_AXIS_LABEL_POSITION,
+ PROP_AXIS_TEXT_ROTATION,
+ PROP_AXIS_TEXT_BREAK,
+ PROP_AXIS_TEXT_OVERLAP,
+ PROP_AXIS_TEXT_STACKED,
+ PROP_AXIS_TEXT_ARRANGE_ORDER,
+ PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
+
+ PROP_AXIS_MAJOR_TICKMARKS,
+ PROP_AXIS_MINOR_TICKMARKS,
+ PROP_AXIS_MARK_POSITION
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Show" ),
+ PROP_AXIS_SHOW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverPosition" ),
+ PROP_AXIS_CROSSOVER_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverValue" ),
+ PROP_AXIS_CROSSOVER_VALUE,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DisplayLabels" ),
+ PROP_AXIS_DISPLAY_LABELS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_AXIS_NUMBER_FORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPosition" ),
+ PROP_AXIS_LABEL_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_AXIS_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextBreak" ),
+ PROP_AXIS_TEXT_BREAK,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextOverlap" ),
+ PROP_AXIS_TEXT_OVERLAP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StackCharacters" ),
+ PROP_AXIS_TEXT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ArrangeOrder" ),
+ PROP_AXIS_TEXT_ARRANGE_ORDER,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisArrangeOrderType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReferencePageSize" ),
+ PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
+ ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MajorTickmarks" ),
+ PROP_AXIS_MAJOR_TICKMARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "MinorTickmarks" ),
+ PROP_AXIS_MINOR_TICKMARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "MarkPosition" ),
+ PROP_AXIS_MARK_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::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, ::com::sun::star::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, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+typedef uno::Reference< beans::XPropertySet > lcl_tSubGridType;
+typedef uno::Sequence< lcl_tSubGridType > lcl_tSubGridSeq;
+
+void lcl_CloneSubGrids(
+ const lcl_tSubGridSeq & rSource, lcl_tSubGridSeq & rDestination )
+{
+ const lcl_tSubGridType * pBegin = rSource.getConstArray();
+ const lcl_tSubGridType * pEnd = pBegin + rSource.getLength();
+
+ rDestination.realloc( rSource.getLength());
+ lcl_tSubGridType * pDestBegin = rDestination.getArray();
+ lcl_tSubGridType * pDestEnd = pDestBegin + rDestination.getLength();
+ lcl_tSubGridType * pDestIt = pDestBegin;
+
+ for( const lcl_tSubGridType * pIt = pBegin; pIt != pEnd; ++pIt )
+ {
+ Reference< beans::XPropertySet > xSubGrid( *pIt );
+ 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 );
+ (void)(pDestEnd); // avoid warning
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace chart
+{
+
+Axis::Axis( Reference< uno::XComponentContext > const & /* xContext */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_aScaleData( AxisHelper::createDefaultScale() ),
+ m_xGrid( new GridProperties() ),
+ m_aSubGridProperties(),
+ m_xTitle()
+{
+ osl_incrementInterlockedCount(&m_refCount);
+ setFastPropertyValue_NoBroadcast(
+ ::chart::LineProperties::PROP_LINE_COLOR, uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30
+
+ if( m_xGrid.is())
+ ModifyListenerHelper::addListener( m_xGrid, m_xModifyEventForwarder );
+ if( m_aScaleData.Categories.is())
+ ModifyListenerHelper::addListener( m_aScaleData.Categories, m_xModifyEventForwarder );
+
+ AllocateSubGrids();
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+Axis::Axis( const Axis & rOther ) :
+ MutexContainer(),
+ impl::Axis_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_aScaleData( rOther.m_aScaleData )
+{
+ m_xGrid.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( 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.getLength() != 0 )
+ lcl_CloneSubGrids( rOther.m_aSubGridProperties, m_aSubGridProperties );
+ ModifyListenerHelper::addListenerToAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder );
+
+ m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle ));
+ if( m_xTitle.is())
+ ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
+}
+
+// late initialization to call after copy-constructing
+void Axis::Init( const Axis & /* rOther */ )
+{
+ if( m_aScaleData.Categories.is())
+ EventListenerHelper::addListener( m_aScaleData.Categories, this );
+}
+
+Axis::~Axis()
+{
+ try
+ {
+ ModifyListenerHelper::removeListener( m_xGrid, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListenerFromAllSequenceElements( 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(0);
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ m_aSubGridProperties.realloc(0);
+ m_xGrid = 0;
+ m_xTitle = 0;
+}
+
+void Axis::AllocateSubGrids()
+{
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ Reference< lang::XEventListener > xEventListener;
+ std::vector< Reference< beans::XPropertySet > > aOldBroadcasters;
+ std::vector< Reference< beans::XPropertySet > > aNewBroadcasters;
+ {
+ MutexGuard aGuard( m_aMutex );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ xEventListener = this;
+
+ sal_Int32 nNewSubIncCount = m_aScaleData.IncrementData.SubIncrements.getLength();
+ sal_Int32 nOldSubIncCount = m_aSubGridProperties.getLength();
+
+ if( nOldSubIncCount > nNewSubIncCount )
+ {
+ // remove superfluous entries
+ for( sal_Int32 i = nNewSubIncCount; i < nOldSubIncCount; ++i )
+ aOldBroadcasters.push_back( m_aSubGridProperties[ i ] );
+ m_aSubGridProperties.realloc( nNewSubIncCount );
+ }
+ else if( nOldSubIncCount < nNewSubIncCount )
+ {
+ m_aSubGridProperties.realloc( nNewSubIncCount );
+
+ // allocate new entries
+ for( sal_Int32 i = nOldSubIncCount; i < nNewSubIncCount; ++i )
+ {
+ m_aSubGridProperties[ i ] = new GridProperties();
+ LineProperties::SetLineInvisible( m_aSubGridProperties[ i ] );
+ aNewBroadcasters.push_back( m_aSubGridProperties[ i ] );
+ }
+ }
+ }
+ //don't keep the mutex locked while calling out
+ std::vector< Reference< beans::XPropertySet > >::iterator aBroadcaster = aOldBroadcasters.begin();
+ for( ;aBroadcaster != aOldBroadcasters.end(); ++aBroadcaster )
+ ModifyListenerHelper::removeListener( *aBroadcaster, xModifyEventForwarder );
+ for( aBroadcaster = aNewBroadcasters.begin(); aBroadcaster != aNewBroadcasters.end(); ++aBroadcaster )
+ ModifyListenerHelper::addListener( *aBroadcaster, xModifyEventForwarder );
+}
+
+// --------------------------------------------------------------------------------
+
+// ____ XAxis ____
+void SAL_CALL Axis::setScaleData( const chart2::ScaleData& rScaleData )
+ throw (uno::RuntimeException)
+{
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ Reference< lang::XEventListener > xEventListener;
+ Reference< chart2::data::XLabeledDataSequence > xOldCategories;
+ Reference< chart2::data::XLabeledDataSequence > xNewCategories = rScaleData.Categories;
+ {
+ MutexGuard aGuard( m_aMutex );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ xEventListener = this;
+ xOldCategories = m_aScaleData.Categories;
+ m_aScaleData = rScaleData;
+ }
+ AllocateSubGrids();
+
+ //don't keep the mutex locked while calling out
+ if( xOldCategories.is() && xOldCategories != xNewCategories )
+ {
+ ModifyListenerHelper::removeListener( xOldCategories, xModifyEventForwarder );
+ EventListenerHelper::removeListener( xOldCategories, xEventListener );
+ }
+ if( xNewCategories.is() && xOldCategories != xNewCategories )
+ {
+ ModifyListenerHelper::addListener( xNewCategories, m_xModifyEventForwarder );
+ EventListenerHelper::addListener( xNewCategories, xEventListener );
+ }
+ fireModifyEvent();
+}
+
+chart2::ScaleData SAL_CALL Axis::getScaleData()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aMutex );
+ return m_aScaleData;
+ // \--
+}
+
+Reference< beans::XPropertySet > SAL_CALL Axis::getGridProperties()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aMutex );
+ return m_xGrid;
+ // \--
+}
+Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubGridProperties()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aMutex );
+ return m_aSubGridProperties;
+ // \--
+}
+
+Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubTickProperties()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented yet" );
+ return Sequence< Reference< beans::XPropertySet > >();
+}
+
+
+// ____ XTitled ____
+Reference< chart2::XTitle > SAL_CALL Axis::getTitleObject()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return m_xTitle;
+ // \--
+}
+
+void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle )
+ throw (uno::RuntimeException)
+{
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ Reference< chart2::XTitle > xOldTitle;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xOldTitle = m_xTitle;
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ m_xTitle = xNewTitle;
+ }
+
+ //don't keep the mutex locked while calling out
+ if( xOldTitle.is() && xOldTitle != xNewTitle )
+ ModifyListenerHelper::removeListener( xOldTitle, xModifyEventForwarder );
+ if( xNewTitle.is() && xOldTitle != xNewTitle )
+ ModifyListenerHelper::addListener( xNewTitle, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ XCloneable ____
+Reference< util::XCloneable > SAL_CALL Axis::createClone()
+ throw (uno::RuntimeException)
+{
+ Axis * pNewAxis( new Axis( *this ));
+ // hold a reference to the clone
+ Reference< util::XCloneable > xResult( pNewAxis );
+ // do initialization that uses uno references to the clone
+ pNewAxis->Init( *this );
+ return xResult;
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL Axis::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL Axis::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL Axis::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL Axis::disposing( const lang::EventObject& Source )
+ throw (uno::RuntimeException)
+{
+ if( Source.Source == m_aScaleData.Categories )
+ m_aScaleData.Categories = 0;
+}
+
+// ____ OPropertySet ____
+void Axis::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void Axis::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any Axis::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ CharacterProperties::AddDefaultsToMap( aStaticDefaults );
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL Axis::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ Axis::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ================================================================================
+
+Sequence< OUString > Axis::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.Axis" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+using impl::Axis_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( Axis, Axis_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( Axis, Axis_Base, ::property::OPropertySet )
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( Axis, lcl_aServiceName );
+
+} // namespace chart
diff --git a/chart2/source/model/main/Axis.hxx b/chart2/source/model/main/Axis.hxx
new file mode 100644
index 000000000000..7f72e08b8b69
--- /dev/null
+++ b/chart2/source/model/main/Axis.hxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AXIS_HXX
+#define CHART_AXIS_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include <cppuhelper/implbase6.hxx>
+#include <comphelper/uno3.hxx>
+
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#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>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper6<
+ ::com::sun::star::chart2::XAxis,
+ ::com::sun::star::chart2::XTitled,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ Axis_Base;
+}
+
+class Axis :
+ public MutexContainer,
+ public impl::Axis_Base,
+ public ::property::OPropertySet
+{
+public:
+ Axis( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~Axis();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( Axis )
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit Axis( const Axis & rOther );
+
+ // late initialization to call after copy-constructing
+ void Init( const Axis & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XAxis ____
+ virtual void SAL_CALL setScaleData( const ::com::sun::star::chart2::ScaleData& rScaleData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::ScaleData SAL_CALL getScaleData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getGridProperties()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > SAL_CALL getSubGridProperties()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > SAL_CALL getSubTickProperties()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTitled ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitleObject(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& Title )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ // Note: the coordinate systems are not cloned!
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private: //methods
+ void AllocateSubGrids();
+
+private: //member
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+
+ ::com::sun::star::chart2::ScaleData m_aScaleData;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xGrid;
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > m_aSubGridProperties;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > m_xTitle;
+};
+
+} // namespace chart
+
+// CHART_AXIS_HXX
+#endif
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
new file mode 100644
index 000000000000..4fa58cff5039
--- /dev/null
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BaseCoordinateSystem.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+#include "UserDefinedProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "Axis.hxx"
+#include "AxisHelper.hxx"
+#include <com/sun/star/chart2/AxisType.hpp>
+
+#include <algorithm>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <rtl/math.hxx>
+#endif
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+
+namespace
+{
+enum
+{
+ PROP_COORDINATESYSTEM_SWAPXANDYAXIS
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "SwapXAndYAxis" ),
+ PROP_COORDINATESYSTEM_SWAPXANDYAXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_COORDINATESYSTEM_SWAPXANDYAXIS, false );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BaseCoordinateSystem::BaseCoordinateSystem(
+ const Reference< uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount /* = 2 */,
+ sal_Bool bSwapXAndYAxis /* = sal_False */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ 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(m_xContext) );
+ m_aAllAxis[nN][0] = xAxis;
+
+ ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ if(nN==0)
+ {
+ aScaleData.AxisType = chart2::AxisType::CATEGORY;
+ }
+ else if( nN==1)
+ {
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ }
+ else if( nN==2)
+ {
+ aScaleData.AxisType = chart2::AxisType::SERIES;
+ }
+ xAxis->setScaleData( aScaleData );
+ }
+
+ m_aOrigin.realloc( m_nDimensionCount );
+ for( sal_Int32 i = 0; i < m_nDimensionCount; ++i )
+ m_aOrigin[ i ] = uno::makeAny( double( 0.0 ) );
+
+ setFastPropertyValue_NoBroadcast( PROP_COORDINATESYSTEM_SWAPXANDYAXIS, uno::makeAny( sal_Bool( bSwapXAndYAxis )));
+}
+
+// explicit
+BaseCoordinateSystem::BaseCoordinateSystem(
+ const BaseCoordinateSystem & rSource ) :
+ impl::BaseCoordinateSystem_Base(),
+ MutexContainer(),
+ ::property::OPropertySet( rSource, m_aMutex ),
+ m_xContext( rSource.m_xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_nDimensionCount( rSource.m_nDimensionCount ),
+ m_aOrigin( rSource.m_aOrigin )
+{
+ m_aAllAxis.resize(rSource.m_aAllAxis.size());
+ tAxisVecVecType::size_type nN=0;
+ for( nN=0; nN<m_aAllAxis.size(); nN++ )
+ CloneHelper::CloneRefVector< Reference< chart2::XAxis > >( rSource.m_aAllAxis[nN], m_aAllAxis[nN] );
+ CloneHelper::CloneRefVector< Reference< chart2::XChartType > >( rSource.m_aChartTypes, m_aChartTypes );
+
+ for( nN=0; nN<m_aAllAxis.size(); nN++ )
+ ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
+ ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
+}
+
+BaseCoordinateSystem::~BaseCoordinateSystem()
+{
+ try
+ {
+ for( tAxisVecVecType::size_type nN=0; nN<m_aAllAxis.size(); nN++ )
+ ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XCoordinateSystem ____
+sal_Int32 SAL_CALL BaseCoordinateSystem::getDimension()
+ throw (uno::RuntimeException)
+{
+ return m_nDimensionCount;
+}
+
+void SAL_CALL BaseCoordinateSystem::setAxisByDimension(
+ sal_Int32 nDimensionIndex,
+ const Reference< chart2::XAxis >& xAxis,
+ sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
+ throw lang::IndexOutOfBoundsException();
+
+ if( nIndex < 0 )
+ throw lang::IndexOutOfBoundsException();
+
+ if( m_aAllAxis[ nDimensionIndex ].size() < static_cast< tAxisVecVecType::size_type >( nIndex+1 ))
+ {
+ m_aAllAxis[ nDimensionIndex ].resize( nIndex+1 );
+ m_aAllAxis[ nDimensionIndex ][nIndex] = 0;
+ }
+
+ Reference< chart2::XAxis > xOldAxis( m_aAllAxis[ nDimensionIndex ][nIndex] );
+ if( xOldAxis.is())
+ ModifyListenerHelper::removeListener( xOldAxis, m_xModifyEventForwarder );
+ m_aAllAxis[ nDimensionIndex ][nIndex] = xAxis;
+ if( xAxis.is())
+ ModifyListenerHelper::addListener( xAxis, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+Reference< chart2::XAxis > SAL_CALL BaseCoordinateSystem::getAxisByDimension(
+ sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
+ throw lang::IndexOutOfBoundsException();
+
+ OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( getDimension()));
+
+ if( nAxisIndex < 0 || nAxisIndex > this->getMaximumAxisIndexByDimension(nDimensionIndex) )
+ throw lang::IndexOutOfBoundsException();
+
+ return m_aAllAxis[ nDimensionIndex ][nAxisIndex];
+}
+
+sal_Int32 SAL_CALL BaseCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
+ throw lang::IndexOutOfBoundsException();
+
+ OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( getDimension()));
+
+ sal_Int32 nRet = m_aAllAxis[ nDimensionIndex ].size();
+ if(nRet)
+ nRet-=1;
+
+ return nRet;
+}
+
+// ____ XChartTypeContainer ____
+void SAL_CALL BaseCoordinateSystem::addChartType( const Reference< chart2::XChartType >& aChartType )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( ::std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType )
+ != m_aChartTypes.end())
+ throw lang::IllegalArgumentException();
+
+ m_aChartTypes.push_back( aChartType );
+ ModifyListenerHelper::addListener( aChartType, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void SAL_CALL BaseCoordinateSystem::removeChartType( const Reference< chart2::XChartType >& aChartType )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ ::std::vector< uno::Reference< chart2::XChartType > >::iterator
+ aIt( ::std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType ));
+ if( aIt == m_aChartTypes.end())
+ throw container::NoSuchElementException(
+ C2U( "The given chart type is no element of the container" ),
+ static_cast< uno::XWeak * >( this ));
+
+ m_aChartTypes.erase( aIt );
+ ModifyListenerHelper::removeListener( aChartType, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+Sequence< Reference< chart2::XChartType > > SAL_CALL BaseCoordinateSystem::getChartTypes()
+ throw (uno::RuntimeException)
+{
+ return ContainerHelper::ContainerToSequence( m_aChartTypes );
+}
+
+void SAL_CALL BaseCoordinateSystem::setChartTypes( const Sequence< Reference< chart2::XChartType > >& aChartTypes )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ m_aChartTypes = ContainerHelper::SequenceToVector( aChartTypes );
+ ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL BaseCoordinateSystem::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL BaseCoordinateSystem::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL BaseCoordinateSystem::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL BaseCoordinateSystem::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void BaseCoordinateSystem::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void BaseCoordinateSystem::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+
+// ____ OPropertySet ____
+uno::Any BaseCoordinateSystem::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL BaseCoordinateSystem::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ BaseCoordinateSystem::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+using impl::BaseCoordinateSystem_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( BaseCoordinateSystem, BaseCoordinateSystem_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BaseCoordinateSystem, BaseCoordinateSystem_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/CartesianCoordinateSystem.cxx b/chart2/source/model/main/CartesianCoordinateSystem.cxx
new file mode 100644
index 000000000000..fdaa333b1cb8
--- /dev/null
+++ b/chart2/source/model/main/CartesianCoordinateSystem.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "macros.hxx"
+#include "servicenames_coosystems.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceNameCartesian2d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.CartesianCoordinateSystem2d" ));
+static const ::rtl::OUString lcl_aServiceNameCartesian3d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.CartesianCoordinateSystem3d" ));
+
+static const ::rtl::OUString lcl_aImplementationNameCartesian2d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.CartesianCoordinateSystem2d" ));
+static const ::rtl::OUString lcl_aImplementationNameCartesian3d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.CartesianCoordinateSystem3d" ));
+}
+
+namespace chart
+{
+
+// explicit
+CartesianCoordinateSystem::CartesianCoordinateSystem(
+ const uno::Reference< uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount /* = 2 */,
+ sal_Bool bSwapXAndYAxis /* = sal_False */ ) :
+ BaseCoordinateSystem( xContext, nDimensionCount, bSwapXAndYAxis )
+{}
+
+CartesianCoordinateSystem::CartesianCoordinateSystem(
+ const CartesianCoordinateSystem & rSource ) :
+ BaseCoordinateSystem( rSource )
+{}
+
+CartesianCoordinateSystem::~CartesianCoordinateSystem()
+{}
+
+// ____ XCoordinateSystem ____
+::rtl::OUString SAL_CALL CartesianCoordinateSystem::getCoordinateSystemType()
+ throw (RuntimeException)
+{
+ return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+}
+
+::rtl::OUString SAL_CALL CartesianCoordinateSystem::getViewServiceName()
+ throw (RuntimeException)
+{
+ return CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME;
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL CartesianCoordinateSystem::createClone()
+ throw (RuntimeException)
+{
+ return Reference< util::XCloneable >( new CartesianCoordinateSystem( *this ));
+}
+
+// ____ XServiceInfo ____
+Sequence< OUString > CartesianCoordinateSystem::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( CartesianCoordinateSystem,
+ C2U( "com.sun.star.comp.chart.CartesianCoordinateSystem" ))
+
+
+// =================================
+// ==== CartesianCoordinateSystem2d ====
+// =================================
+
+CartesianCoordinateSystem2d::CartesianCoordinateSystem2d(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ CartesianCoordinateSystem( xContext, 2, sal_False )
+{}
+
+CartesianCoordinateSystem2d::~CartesianCoordinateSystem2d()
+{}
+
+// ____ XServiceInfo ____
+Sequence< OUString > CartesianCoordinateSystem2d::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+ aServices[ 1 ] = lcl_aServiceNameCartesian2d;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( CartesianCoordinateSystem2d, lcl_aImplementationNameCartesian2d )
+
+// =================================
+// ==== CartesianCoordinateSystem3d ====
+// =================================
+
+CartesianCoordinateSystem3d::CartesianCoordinateSystem3d(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ CartesianCoordinateSystem( xContext, 3, sal_False )
+{}
+
+CartesianCoordinateSystem3d::~CartesianCoordinateSystem3d()
+{}
+
+// ____ XServiceInfo ____
+Sequence< OUString > CartesianCoordinateSystem3d::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+ aServices[ 1 ] = lcl_aServiceNameCartesian3d;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( CartesianCoordinateSystem3d, lcl_aImplementationNameCartesian3d )
+
+} // namespace chart
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
new file mode 100755
index 000000000000..5a30d97118c5
--- /dev/null
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -0,0 +1,1379 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartModel.hxx"
+#include "servicenames.hxx"
+#include "MediaDescriptorHelper.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "NoWarningThisInCTOR.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DisposeHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ObjectIdentifier.hxx"
+#include "PageBackground.hxx"
+#include "CloneHelper.hxx"
+#include "NameContainer.hxx"
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+
+#include <comphelper/InlineContainer.hxx>
+#include <comphelper/processfactory.hxx>
+
+// header for class SvNumberFormatsSupplierObj
+#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/XEmbedObjectCreator.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/EmbedMapUnits.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+// header for class SvNumberFormatter
+#include <svl/zforlist.hxx>
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+using namespace ::com::sun::star;
+using namespace ::apphelper;
+using namespace ::chart::CloneHelper;
+
+namespace
+{
+const OUString lcl_aGDIMetaFileMIMEType(
+ RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""));
+const OUString lcl_aGDIMetaFileMIMETypeHighContrast(
+ RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""));
+
+} // anonymous namespace
+
+//-----------------------------------------------------------------
+// ChartModel Constructor and Destructor
+//-----------------------------------------------------------------
+
+namespace chart
+{
+
+ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
+ : m_aLifeTimeManager( this, this )
+ , m_bReadOnly( sal_False )
+ , m_bModified( sal_False )
+ , m_nInLoad(0)
+ , m_bUpdateNotificationsPending(false)
+ , m_aControllers( m_aModelMutex )
+ , m_nControllerLockCount(0)
+ , m_xContext( xContext )
+ , m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() )
+ , m_xDataProvider( 0 )
+ , m_xInternalDataProvider( 0 )
+ , m_xPageBackground( new PageBackground( m_xContext ) )
+ , m_xXMLNamespaceMap( createNameContainer( ::getCppuType( (const OUString*) 0 ),
+ C2U( "com.sun.star.xml.NamespaceMap" ), C2U( "com.sun.star.comp.chart.XMLNameSpaceMap" ) ), uno::UNO_QUERY)
+{
+ OSL_TRACE( "ChartModel: CTOR called" );
+ osl_incrementInterlockedCount(&m_refCount);
+
+ ModifyListenerHelper::addListener( m_xPageBackground, this );
+ m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
+ m_xUndoManager = Reference< chart2::XUndoManager >(
+ this->createInstance( CHART_UNDOMANAGER_SERVICE_NAME ), uno::UNO_QUERY );
+
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+ChartModel::ChartModel( const ChartModel & rOther )
+ : impl::ChartModel_Base()
+ , m_aLifeTimeManager( this, this )
+ , m_bReadOnly( rOther.m_bReadOnly )
+ , m_bModified( rOther.m_bModified )
+ , m_nInLoad(0)
+ , m_bUpdateNotificationsPending(false)
+ , m_aResource( rOther.m_aResource )
+ , m_aMediaDescriptor( rOther.m_aMediaDescriptor )
+ , m_aControllers( m_aModelMutex )
+ , m_nControllerLockCount(0)
+ , m_xContext( rOther.m_xContext )
+ // @note: the old model aggregate must not be shared with other models if it
+ // is, you get mutex deadlocks
+ , m_xOldModelAgg( 0 ) //rOther.m_xOldModelAgg )
+ , m_xStorage( 0 ) //rOther.m_xStorage )
+ , m_aVisualAreaSize( rOther.m_aVisualAreaSize )
+ , m_aGraphicObjectVector( rOther.m_aGraphicObjectVector )
+ , m_xDataProvider( rOther.m_xDataProvider )
+ , m_xInternalDataProvider( rOther.m_xInternalDataProvider )
+ , m_xUndoManager( rOther.m_xUndoManager )
+{
+ OSL_TRACE( "ChartModel: Copy-CTOR called" );
+ osl_incrementInterlockedCount(&m_refCount);
+
+ Reference< util::XModifyListener > xListener;
+ Reference< chart2::XTitle > xNewTitle = CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle );
+ Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< Reference< chart2::XDiagram > >()( rOther.m_xDiagram );
+ Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xPageBackground );
+ Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< Reference< chart2::XChartTypeManager > >()( rOther.m_xChartTypeManager );
+ Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< Reference< container::XNameAccess > >()( rOther.m_xXMLNamespaceMap );
+
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ xListener = this;
+ m_xTitle = xNewTitle;
+ m_xDiagram = xNewDiagram;
+ m_xPageBackground = xNewPageBackground;
+ m_xChartTypeManager = xChartTypeManager;
+ m_xXMLNamespaceMap = xXMLNamespaceMap;
+ }
+
+ ModifyListenerHelper::addListener( xNewTitle, xListener );
+ ModifyListenerHelper::addListener( xNewDiagram, xListener );
+ ModifyListenerHelper::addListener( xNewPageBackground, xListener );
+ xListener.clear();
+
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+ChartModel::~ChartModel()
+{
+ OSL_TRACE( "ChartModel: DTOR called" );
+ if( m_xOldModelAgg.is())
+ m_xOldModelAgg->setDelegator( 0 );
+}
+
+
+//-----------------------------------------------------------------
+// private methods
+//-----------------------------------------------------------------
+
+::rtl::OUString ChartModel::impl_g_getLocation()
+{
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return ::rtl::OUString(); //behave passive if already disposed or closed or throw exception @todo?
+ //mutex is acquired
+ return m_aResource;
+}
+
+sal_Bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XController >& xController )
+{
+ try
+ {
+ uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements();
+ for( sal_Int32 nN = aSeq.getLength(); nN--; )
+ {
+ if( aSeq[nN] == xController )
+ return sal_True;
+ }
+ }
+ catch( uno::Exception )
+ {
+ }
+ return sal_False;
+}
+
+uno::Reference< frame::XController > ChartModel::impl_getCurrentController() throw(uno::RuntimeException)
+{
+ //@todo? hold only weak references to controllers
+
+ // get the last active controller of this model
+ if( m_xCurrentController.is() )
+ return m_xCurrentController;
+
+ // get the first controller of this model
+ if( m_aControllers.getLength() )
+ {
+ uno::Reference<uno::XInterface> xI = m_aControllers.getElements()[0];
+ return uno::Reference<frame::XController>( xI, uno::UNO_QUERY );
+ }
+
+ //return nothing if no controllers are connected at all
+ return uno::Reference< frame::XController > ();
+}
+
+void SAL_CALL ChartModel::impl_notifyCloseListeners()
+ throw( uno::RuntimeException)
+{
+ ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
+ .getContainer( ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+}
+
+void ChartModel::impl_adjustAdditionalShapesPositionAndSize( const awt::Size& aVisualAreaSize )
+{
+ uno::Reference< beans::XPropertySet > xProperties( static_cast< ::cppu::OWeakObject* >( this ), uno::UNO_QUERY );
+ if ( xProperties.is() )
+ {
+ uno::Reference< drawing::XShapes > xShapes;
+ xProperties->getPropertyValue( C2U( "AdditionalShapes" ) ) >>= xShapes;
+ if ( xShapes.is() )
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< drawing::XShape > xShape;
+ if ( xShapes->getByIndex( i ) >>= xShape )
+ {
+ if ( xShape.is() )
+ {
+ awt::Point aPos( xShape->getPosition() );
+ awt::Size aSize( xShape->getSize() );
+
+ 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 );
+
+ xShape->setPosition( aPos );
+ xShape->setSize( aSize );
+ }
+ }
+ }
+ }
+ }
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+
+APPHELPER_XSERVICEINFO_IMPL(ChartModel,CHART_MODEL_SERVICE_IMPLEMENTATION_NAME)
+
+uno::Sequence< rtl::OUString > ChartModel::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 3 );
+ aSNS[0] = CHART_MODEL_SERVICE_NAME;
+ aSNS[1] = C2U( "com.sun.star.document.OfficeDocument" );
+ aSNS[2] = C2U( "com.sun.star.chart.ChartDocument" );
+ //// @todo : add additional services if you support any further
+ return aSNS;
+}
+
+//-----------------------------------------------------------------
+// frame::XModel (required interface)
+//-----------------------------------------------------------------
+
+sal_Bool SAL_CALL ChartModel::attachResource( const ::rtl::OUString& rURL
+ , const uno::Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw(uno::RuntimeException)
+{
+ /*
+ The method attachResource() is used by the frame loader implementations
+ to inform the model about its URL and MediaDescriptor.
+ */
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return sal_False; //behave passive if already disposed or closed or throw exception @todo?
+ //mutex is acquired
+
+ if(m_aResource.getLength()!=0)//we have a resource already //@todo? or is setting a new resource allowed?
+ return sal_False;
+ m_aResource = rURL;
+ m_aMediaDescriptor = rMediaDescriptor;
+
+ //@todo ? check rURL ??
+ //@todo ? evaluate m_aMediaDescriptor;
+ //@todo ? ... ??? --> nothing, this method is only for setting informations
+
+ return sal_True;
+}
+
+::rtl::OUString SAL_CALL ChartModel::getURL() throw(uno::RuntimeException)
+{
+ return impl_g_getLocation();
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL ChartModel::getArgs() throw(uno::RuntimeException)
+{
+ /*
+ The method getArgs() returns a sequence of property values
+ that report the resource description according to com.sun.star.document.MediaDescriptor,
+ specified on loading or saving with storeAsURL.
+ */
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return uno::Sequence< beans::PropertyValue >(); //behave passive if already disposed or closed or throw exception @todo?
+ //mutex is acquired
+
+ return m_aMediaDescriptor;
+}
+
+void SAL_CALL ChartModel::connectController( const uno::Reference< frame::XController >& xController )
+ throw(uno::RuntimeException)
+{
+ //@todo? this method is declared as oneway -> ...?
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return ; //behave passive if already disposed or closed
+ //mutex is acquired
+
+ //--add controller
+ m_aControllers.addInterface(xController);
+}
+
+void SAL_CALL ChartModel::disconnectController( const uno::Reference< frame::XController >& xController )
+ throw(uno::RuntimeException)
+{
+ //@todo? this method is declared as oneway -> ...?
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return; //behave passive if already disposed or closed
+
+ //--remove controller
+ m_aControllers.removeInterface(xController);
+
+ //case: current controller is disconnected:
+ if( m_xCurrentController == xController )
+ m_xCurrentController.clear();
+
+ DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+}
+
+void SAL_CALL ChartModel::lockControllers() throw(uno::RuntimeException)
+{
+ /*
+ suspends some notifications to the controllers which are used for display updates.
+
+ The calls to lockControllers() and unlockControllers() may be nested
+ and even overlapping, but they must be in pairs. While there is at least one lock
+ remaining, some notifications for display updates are not broadcasted.
+ */
+
+ //@todo? this method is declared as oneway -> ...?
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return; //behave passive if already disposed or closed or throw exception @todo?
+ ++m_nControllerLockCount;
+}
+
+void SAL_CALL ChartModel::unlockControllers() throw(uno::RuntimeException)
+{
+ /*
+ resumes the notifications which were suspended by lockControllers() .
+
+ The calls to lockControllers() and unlockControllers() may be nested
+ and even overlapping, but they must be in pairs. While there is at least one lock
+ remaining, some notifications for display updates are not broadcasted.
+ */
+
+ //@todo? this method is declared as oneway -> ...?
+
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return; //behave passive if already disposed or closed or throw exception @todo?
+ if( m_nControllerLockCount == 0 )
+ {
+ OSL_TRACE( "ChartModel: unlockControllers called with m_nControllerLockCount == 0" );
+ return;
+ }
+ --m_nControllerLockCount;
+ if( m_nControllerLockCount == 0 && m_bUpdateNotificationsPending )
+ {
+ aGuard.clear();
+ impl_notifyModifiedListeners();
+ }
+}
+
+sal_Bool SAL_CALL ChartModel::hasControllersLocked() throw(uno::RuntimeException)
+{
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ return sal_False; //behave passive if already disposed or closed or throw exception @todo?
+ return ( m_nControllerLockCount != 0 ) ;
+}
+
+uno::Reference< frame::XController > SAL_CALL ChartModel::getCurrentController() throw(uno::RuntimeException)
+{
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "getCurrentController was called on an already disposed or closed model" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ return impl_getCurrentController();
+}
+
+void SAL_CALL ChartModel::setCurrentController( const uno::Reference< frame::XController >& xController )
+ throw(container::NoSuchElementException, uno::RuntimeException)
+{
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "setCurrentController was called on an already disposed or closed model" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ //OSL_ENSURE( impl_isControllerConnected(xController), "setCurrentController is called with a Controller which is not connected" );
+ if(!impl_isControllerConnected(xController))
+ throw container::NoSuchElementException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "setCurrentController is called with a Controller which is not connected" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ m_xCurrentController = xController;
+
+ DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection() throw(uno::RuntimeException)
+{
+ LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall())
+ throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "getCurrentSelection was called on an already disposed or closed model" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+
+ uno::Reference< uno::XInterface > xReturn;
+ uno::Reference< frame::XController > xController = impl_getCurrentController();
+
+ aGuard.clear();
+ if( xController.is() )
+ {
+ uno::Reference< view::XSelectionSupplier > xSelectionSupl( xController, uno::UNO_QUERY );
+ if ( xSelectionSupl.is() )
+ {
+ uno::Any aSel = xSelectionSupl->getSelection();
+ rtl::OUString aObjectCID;
+ if( aSel >>= aObjectCID )
+ {
+ xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, Reference< XChartDocument >(this)));
+ }
+ }
+ }
+ return xReturn;
+}
+
+
+//-----------------------------------------------------------------
+// lang::XComponent (base of XModel)
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
+{
+ //This object should release all resources and references in the
+ //easiest possible manner
+ //This object must notify all registered listeners using the method
+ //<member>XEventListener::disposing</member>
+
+ //hold no mutex
+ if( !m_aLifeTimeManager.dispose() )
+ return;
+
+ //--release all resources and references
+ //// @todo
+
+ 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 );
+
+ // not owner of storage
+// if( m_xStorage.is())
+// {
+// Reference< lang::XComponent > xComp( m_xStorage, uno::UNO_QUERY );
+// if( xComp.is())
+// xComp->dispose();
+// }
+ m_xStorage.clear();
+
+ if( m_xOldModelAgg.is())
+ {
+ m_xOldModelAgg->setDelegator( 0 );
+ m_xOldModelAgg.clear();
+ }
+
+ m_aControllers.disposeAndClear( lang::EventObject( static_cast< cppu::OWeakObject * >( this )));
+ m_xCurrentController.clear();
+
+ m_xStorage.clear();
+ m_xParent.clear();
+ DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+ OSL_TRACE( "ChartModel: dispose() called" );
+}
+
+void SAL_CALL ChartModel::addEventListener( const uno::Reference< lang::XEventListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
+}
+
+void SAL_CALL ChartModel::removeEventListener( const uno::Reference< lang::XEventListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
+ return;
+}
+
+//-----------------------------------------------------------------
+// util::XCloseBroadcaster (base of XCloseable)
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::addCloseListener( const uno::Reference< util::XCloseListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ m_aLifeTimeManager.g_addCloseListener( xListener );
+}
+
+void SAL_CALL ChartModel::removeCloseListener( const uno::Reference< util::XCloseListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< util::XCloseListener >*)0), xListener );
+ return;
+}
+
+//-----------------------------------------------------------------
+// util::XCloseable
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::close( sal_Bool bDeliverOwnership )
+ throw( util::CloseVetoException,
+ uno::RuntimeException )
+{
+ //hold no mutex
+
+ if( !m_aLifeTimeManager.g_close_startTryClose( bDeliverOwnership ) )
+ return;
+ //no mutex is acquired
+
+ // At the end of this method may we must dispose ourself ...
+ // and may nobody from outside hold a reference to us ...
+ // then it's a good idea to do that by ourself.
+ uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
+
+ //the listeners have had no veto
+ //check wether we self can close
+ {
+ util::CloseVetoException aVetoException = util::CloseVetoException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "the model itself could not be closed" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ if( m_aLifeTimeManager.g_close_isNeedToCancelLongLastingCalls( bDeliverOwnership, aVetoException ) )
+ {
+ ////you can empty this block, if you never start longlasting calls or
+ ////if your longlasting calls are per default not cancelable (check how you have constructed your LifeTimeManager)
+
+ sal_Bool bLongLastingCallsAreCanceled = sal_False;
+ try
+ {
+ //try to cancel running longlasting calls
+ //// @todo
+ }
+ catch( uno::Exception )
+ {
+ //// @todo
+ //do not throw anything here!! (without endTryClose)
+ }
+ //if not successful canceled
+ if(!bLongLastingCallsAreCanceled)
+ {
+ m_aLifeTimeManager.g_close_endTryClose( bDeliverOwnership, sal_True );
+ throw aVetoException;
+ }
+ }
+
+ }
+ m_aLifeTimeManager.g_close_endTryClose_doClose();
+
+ // BM @todo: is it ok to call the listeners here?
+ impl_notifyCloseListeners();
+}
+
+//-----------------------------------------------------------------
+// lang::XTypeProvider
+//-----------------------------------------------------------------
+uno::Sequence< uno::Type > SAL_CALL ChartModel::getTypes()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< lang::XTypeProvider > xAggTypeProvider;
+ if( (m_xOldModelAgg->queryAggregation( ::getCppuType( & xAggTypeProvider )) >>= xAggTypeProvider)
+ && xAggTypeProvider.is())
+ {
+ uno::Sequence< uno::Type > aOwnTypes( impl::ChartModel_Base::getTypes());
+ uno::Sequence< uno::Type > aAggTypes( xAggTypeProvider->getTypes());
+ uno::Sequence< uno::Type > aResult( aOwnTypes.getLength() + aAggTypes.getLength());
+ sal_Int32 i=0;
+ for( ;i<aOwnTypes.getLength(); ++i )
+ aResult[i] = aOwnTypes[i];
+ for( sal_Int32 j=0; i<aResult.getLength(); ++j, ++i)
+ aResult[i] = aAggTypes[j];
+ return aResult;
+ }
+
+ return impl::ChartModel_Base::getTypes();
+}
+
+//-----------------------------------------------------------------
+// document::XDocumentPropertiesSupplier
+//-----------------------------------------------------------------
+uno::Reference< document::XDocumentProperties > SAL_CALL
+ ChartModel::getDocumentProperties() throw (uno::RuntimeException)
+{
+ if ( !m_xDocumentProperties.is() )
+ {
+ uno::Reference< document::XDocumentProperties > xDocProps(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ C2U("com.sun.star.document.DocumentProperties") ), uno::UNO_QUERY );
+ m_xDocumentProperties.set(xDocProps);
+ }
+ return m_xDocumentProperties;
+}
+
+//-----------------------------------------------------------------
+// chart2::XChartDocument
+//-----------------------------------------------------------------
+
+uno::Reference< chart2::XDiagram > SAL_CALL ChartModel::getFirstDiagram()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xDiagram;
+}
+
+void SAL_CALL ChartModel::setFirstDiagram( const uno::Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xOldDiagram;
+ Reference< util::XModifyListener > xListener;
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ if( xDiagram == m_xDiagram )
+ return;
+ xOldDiagram = m_xDiagram;
+ m_xDiagram = xDiagram;
+ xListener = this;
+ }
+ //don't keep the mutex locked while calling out
+ ModifyListenerHelper::removeListener( xOldDiagram, xListener );
+ ModifyListenerHelper::addListener( xDiagram, xListener );
+ setModified( sal_True );
+}
+
+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
+ {
+ uno::Sequence< uno::Any > aArgs(1);
+ beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True));
+ aArgs[0] <<= aParam;
+ xIni->initialize(aArgs);
+ }
+ //create data
+ uno::Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
+ uno::makeAny( C2U("all") ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("HasCategories"), -1,
+ uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1,
+ uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("DataRowSource"), -1,
+ uno::makeAny( ::com::sun::star::chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
+ xDataSource = m_xInternalDataProvider->createDataSource( aArgs );
+ }
+ }
+ return xDataSource;
+}
+
+void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingData )
+ throw (util::CloseVetoException, uno::RuntimeException)
+{
+ // don't lock the mutex, because this call calls out to code that tries to
+ // lock the solar mutex. On the other hand, a paint locks the solar mutex
+ // and calls to the model lock the model's mutex => deadlock
+ // @todo: lock a separate mutex in the InternalData class
+ if( !hasInternalDataProvider() )
+ {
+ if( bCloneExistingData )
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true );
+ else
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( Reference<XChartDocument>(), true );
+ m_xDataProvider.set( m_xInternalDataProvider );
+ }
+ setModified( sal_True );
+}
+
+sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
+ throw (uno::RuntimeException)
+{
+ return m_xDataProvider.is() && m_xInternalDataProvider.is();
+}
+
+uno::Reference< chart2::data::XDataProvider > SAL_CALL ChartModel::getDataProvider()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xDataProvider;
+ // \--
+}
+
+// ____ XDataReceiver ____
+
+void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data::XDataProvider >& xDataProvider )
+ throw (uno::RuntimeException)
+{
+ {
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ uno::Reference< beans::XPropertySet > xProp( xDataProvider, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ sal_Bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), uno::makeAny(bIncludeHiddenCells));
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+ }
+
+ m_xDataProvider.set( xDataProvider );
+ m_xInternalDataProvider.clear();
+
+ //the numberformatter is kept independent of the data provider!
+ // \--
+ }
+ setModified( sal_True );
+}
+
+void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< util::XNumberFormatsSupplier >& xNewSupplier )
+ throw (uno::RuntimeException)
+{
+ {
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ if( xNewSupplier==m_xNumberFormatsSupplier )
+ return;
+ if( xNewSupplier==m_xOwnNumberFormatsSupplier )
+ return;
+ if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() )
+ {
+ //@todo
+ //merge missing numberformats from own to new formatter
+ }
+ else if( !xNewSupplier.is() )
+ {
+ if( m_xNumberFormatsSupplier.is() )
+ {
+ //@todo
+ //merge missing numberformats from old numberformatter to own numberformatter
+ //create own numberformatter if necessary
+ }
+ }
+
+ m_xNumberFormatsSupplier.set( xNewSupplier );
+ m_xOwnNumberFormatsSupplier.clear();
+ // \--
+ }
+ setModified( sal_True );
+}
+
+void SAL_CALL ChartModel::setArguments( const Sequence< beans::PropertyValue >& aArguments )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ {
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ if( !m_xDataProvider.is() )
+ return;
+ lockControllers();
+
+ try
+ {
+ Reference< chart2::data::XDataSource > xDataSource( m_xDataProvider->createDataSource( aArguments ) );
+ if( xDataSource.is() )
+ {
+ // set new data
+ Reference< chart2::XChartTypeTemplate > xTemplate;
+ Reference< chart2::XDiagram > xDia( getFirstDiagram() );
+ if( xDia.is())
+ {
+ // apply new data
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram(
+ xDia, Reference< lang::XMultiServiceFactory >( m_xChartTypeManager, uno::UNO_QUERY ));
+ xTemplate.set( aTemplateAndService.first );
+ }
+
+ if( !xTemplate.is())
+ xTemplate.set( impl_createDefaultChartTypeTemplate() );
+
+ if( xTemplate.is())
+ {
+ if( xDia.is())
+ xTemplate->changeDiagramData( xDia, xDataSource, aArguments );
+ else
+ setFirstDiagram( xTemplate->createDiagramByDataSource( xDataSource, aArguments ) );
+ }
+ }
+ }
+ catch( lang::IllegalArgumentException & )
+ {
+ throw;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ unlockControllers();
+ // \--
+ }
+ setModified( sal_True );
+}
+
+Sequence< OUString > SAL_CALL ChartModel::getUsedRangeRepresentations()
+ throw (uno::RuntimeException)
+{
+ return DataSourceHelper::getUsedDataRanges( Reference< frame::XModel >(this));
+}
+
+Reference< chart2::data::XDataSource > SAL_CALL ChartModel::getUsedData()
+ throw (uno::RuntimeException)
+{
+ return DataSourceHelper::getUsedData( Reference< chart2::XChartDocument >(this));
+}
+
+Reference< chart2::data::XRangeHighlighter > SAL_CALL ChartModel::getRangeHighlighter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xRangeHighlighter.is())
+ {
+ uno::Reference< view::XSelectionSupplier > xSelSupp( this->getCurrentController(), uno::UNO_QUERY );
+ if( xSelSupp.is() )
+ m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( xSelSupp ));
+ }
+ return m_xRangeHighlighter;
+}
+
+Reference< chart2::XChartTypeTemplate > ChartModel::impl_createDefaultChartTypeTemplate()
+{
+ Reference< chart2::XChartTypeTemplate > xTemplate;
+ Reference< lang::XMultiServiceFactory > xFact( m_xChartTypeManager, uno::UNO_QUERY );
+ if( xFact.is() )
+ xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY );
+ return xTemplate;
+}
+
+void SAL_CALL ChartModel::setChartTypeManager( const uno::Reference< chart2::XChartTypeManager >& xNewManager )
+ throw (uno::RuntimeException)
+{
+ {
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ m_xChartTypeManager = xNewManager;
+ // \--
+ }
+ setModified( sal_True );
+}
+
+uno::Reference< chart2::XChartTypeManager > SAL_CALL ChartModel::getChartTypeManager()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xChartTypeManager;
+ // \--
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getPageBackground()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xPageBackground;
+ // \--
+}
+
+// ____ XTitled ____
+uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ return m_xTitle;
+ // \--
+}
+
+void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xTitle )
+ throw (uno::RuntimeException)
+{
+ {
+ // /--
+ MutexGuard aGuard( m_aModelMutex );
+ if( m_xTitle.is() )
+ ModifyListenerHelper::removeListener( m_xTitle, this );
+ m_xTitle = xTitle;
+ ModifyListenerHelper::addListener( m_xTitle, this );
+ // \--
+ }
+ setModified( sal_True );
+}
+
+void ChartModel::impl_createOldModelAgg()
+{
+ if( ! m_xOldModelAgg.is())
+ {
+ m_xOldModelAgg.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ CHART_CHARTAPIWRAPPER_SERVICE_NAME,
+ m_xContext ), uno::UNO_QUERY_THROW );
+ m_xOldModelAgg->setDelegator( static_cast< ::cppu::OWeakObject* >( this ));
+ }
+}
+
+// ____ XInterface (for old API wrapper) ____
+uno::Any SAL_CALL ChartModel::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aResult( impl::ChartModel_Base::queryInterface( aType ));
+
+ if( ! aResult.hasValue())
+ {
+ // try old API wrapper
+ try
+ {
+ impl_createOldModelAgg();
+ if( m_xOldModelAgg.is())
+ aResult = m_xOldModelAgg->queryAggregation( aType );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+// ____ XCloneable ____
+Reference< util::XCloneable > SAL_CALL ChartModel::createClone()
+ throw (uno::RuntimeException)
+{
+ return Reference< util::XCloneable >( new ChartModel( *this ));
+}
+
+// ____ XVisualObject ____
+void SAL_CALL ChartModel::setVisualAreaSize( ::sal_Int64 nAspect, const awt::Size& aSize )
+ throw (lang::IllegalArgumentException,
+ embed::WrongStateException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ if( nAspect == embed::Aspects::MSOLE_CONTENT )
+ {
+ ControllerLockGuard aLockGuard( this );
+ bool bChanged =
+ (m_aVisualAreaSize.Width != aSize.Width ||
+ m_aVisualAreaSize.Height != aSize.Height);
+
+ // #i12587# support for shapes in chart
+ if ( bChanged )
+ {
+ impl_adjustAdditionalShapesPositionAndSize( aSize );
+ }
+
+ m_aVisualAreaSize = aSize;
+ if( bChanged )
+ setModified( sal_True );
+ }
+ else
+ {
+ OSL_ENSURE( false, "setVisualAreaSize: Aspect not implemented yet.");
+ }
+}
+
+awt::Size SAL_CALL ChartModel::getVisualAreaSize( ::sal_Int64 nAspect )
+ throw (lang::IllegalArgumentException,
+ embed::WrongStateException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
+ "No aspects other than content are supported" );
+ (void)(nAspect); // avoid warning in non-debug builds
+ // other possible aspects are MSOLE_THUMBNAIL, MSOLE_ICON and MSOLE_DOCPRINT
+
+ return m_aVisualAreaSize;
+}
+
+embed::VisualRepresentation SAL_CALL ChartModel::getPreferredVisualRepresentation( ::sal_Int64 nAspect )
+ throw (lang::IllegalArgumentException,
+ embed::WrongStateException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
+ "No aspects other than content are supported" );
+ (void)(nAspect); // avoid warning in non-debug builds
+
+ embed::VisualRepresentation aResult;
+
+ try
+ {
+ Sequence< sal_Int8 > aMetafile;
+
+ //get view from old api wrapper
+ Reference< datatransfer::XTransferable > xTransferable(
+ this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if( xTransferable.is() )
+ {
+ datatransfer::DataFlavor aDataFlavor( lcl_aGDIMetaFileMIMEType,
+ C2U( "GDIMetaFile" ),
+ ::getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
+
+ uno::Any aData( xTransferable->getTransferData( aDataFlavor ) );
+ aData >>= aMetafile;
+ }
+
+ aResult.Flavor.MimeType = lcl_aGDIMetaFileMIMEType;
+ aResult.Flavor.DataType = getCppuType( &aMetafile );
+
+ aResult.Data <<= aMetafile;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return aResult;
+}
+
+::sal_Int32 SAL_CALL ChartModel::getMapUnit( ::sal_Int64 nAspect )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
+ "No aspects other than content are supported" );
+ (void)(nAspect); // avoid warning in non-debug builds
+ return embed::EmbedMapUnits::ONE_100TH_MM;
+}
+
+// ____ datatransfer::XTransferable ____
+uno::Any SAL_CALL ChartModel::getTransferData( const datatransfer::DataFlavor& aFlavor )
+ throw (datatransfer::UnsupportedFlavorException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ uno::Any aResult;
+ if( this->isDataFlavorSupported( aFlavor ))
+ {
+ try
+ {
+ //get view from old api wrapper
+ Reference< datatransfer::XTransferable > xTransferable(
+ this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if( xTransferable.is() &&
+ xTransferable->isDataFlavorSupported( aFlavor ))
+ {
+ aResult = xTransferable->getTransferData( aFlavor );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ throw datatransfer::UnsupportedFlavorException(
+ aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
+ }
+
+ return aResult;
+}
+
+Sequence< datatransfer::DataFlavor > SAL_CALL ChartModel::getTransferDataFlavors()
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< datatransfer::DataFlavor > aRet(1);
+
+// aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMEType,
+// C2U( "GDIMetaFile" ),
+// ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
+ aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
+ C2U( "GDIMetaFile" ),
+ ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
+
+ return aRet;
+}
+
+::sal_Bool SAL_CALL ChartModel::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
+ throw (uno::RuntimeException)
+{
+// return ( aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMEType) ||
+// aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMETypeHighContrast) );
+ return aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMETypeHighContrast);
+}
+
+
+
+namespace
+{
+enum eServiceType
+{
+ SERVICE_DASH_TABLE,
+ SERVICE_GARDIENT_TABLE,
+ SERVICE_HATCH_TABLE,
+ SERVICE_BITMAP_TABLE,
+ SERVICE_TRANSP_GRADIENT_TABLE,
+ SERVICE_MARKER_TABLE,
+ SERVICE_NAMESPACE_MAP
+};
+
+typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap;
+typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap;
+
+tServiceNameMap & lcl_getStaticServiceNameMap()
+{
+ static tServiceNameMap aServiceNameMap(
+ tMakeServiceNameMap
+ ( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_DASH_TABLE )
+ ( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_GARDIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.HatchTable" ), SERVICE_HATCH_TABLE )
+ ( C2U( "com.sun.star.drawing.BitmapTable" ), SERVICE_BITMAP_TABLE )
+ ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ), SERVICE_TRANSP_GRADIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.MarkerTable" ), SERVICE_MARKER_TABLE )
+ ( C2U( "com.sun.star.xml.NamespaceMap" ), SERVICE_NAMESPACE_MAP )
+ );
+ return aServiceNameMap;
+}
+}
+// ____ XMultiServiceFactory ____
+Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString& rServiceSpecifier )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ uno::Reference< uno::XInterface > xResult;
+ tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
+
+ tServiceNameMap::const_iterator aIt( rMap.find( rServiceSpecifier ));
+ if( aIt != rMap.end())
+ {
+ switch( (*aIt).second )
+ {
+ case SERVICE_DASH_TABLE:
+ case SERVICE_GARDIENT_TABLE:
+ case SERVICE_HATCH_TABLE:
+ case SERVICE_BITMAP_TABLE:
+ case SERVICE_TRANSP_GRADIENT_TABLE:
+ case SERVICE_MARKER_TABLE:
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFact(
+ this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if ( xFact.is() )
+ {
+ return xFact->createInstance( rServiceSpecifier );
+ }
+ }
+ break;
+ case SERVICE_NAMESPACE_MAP:
+ return Reference< uno::XInterface >( m_xXMLNamespaceMap );
+ }
+ }
+ else
+ {
+ impl_createOldModelAgg();
+ if( m_xOldModelAgg.is() )
+ {
+ Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
+ uno::Reference< lang::XMultiServiceFactory > xOldModelFactory;
+ if( (aAny >>= xOldModelFactory) && xOldModelFactory.is() )
+ {
+ return xOldModelFactory->createInstance( rServiceSpecifier );
+ }
+ }
+ }
+ return 0;
+}
+
+Reference< uno::XInterface > SAL_CALL ChartModel::createInstanceWithArguments(
+ const OUString& rServiceSpecifier , const Sequence< Any >& Arguments )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" );
+ (void)(Arguments); // avoid warning in non-debug builds
+ return createInstance( rServiceSpecifier );
+}
+
+Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames()
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aResult;
+
+ impl_createOldModelAgg();
+ if( m_xOldModelAgg.is())
+ {
+ Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
+ uno::Reference< lang::XMultiServiceFactory > xOldModelFactory;
+ if( (aAny >>= xOldModelFactory) && xOldModelFactory.is() )
+ {
+ return xOldModelFactory->getAvailableServiceNames();
+ }
+ }
+ return aResult;
+}
+
+Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSupplier()
+{
+ if( !m_xNumberFormatsSupplier.is() )
+ {
+ if( !m_xOwnNumberFormatsSupplier.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_QUERY );
+ m_xOwnNumberFormatsSupplier = new SvNumberFormatsSupplierObj( new SvNumberFormatter( xFactory, LANGUAGE_SYSTEM ) );
+ //pOwnNumberFormatter->ChangeStandardPrec( 15 ); todo?
+ }
+ m_xNumberFormatsSupplier = m_xOwnNumberFormatsSupplier;
+ }
+ return m_xNumberFormatsSupplier;
+}
+
+// ____ XUnoTunnel ___
+::sal_Int64 SAL_CALL ChartModel::getSomething( const Sequence< ::sal_Int8 >& aIdentifier )
+ throw( uno::RuntimeException)
+{
+ if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( SvNumberFormatsSupplierObj::getUnoTunnelId().getConstArray(),
+ aIdentifier.getConstArray(), 16 ) )
+ {
+ Reference< lang::XUnoTunnel > xTunnel( impl_getNumberFormatsSupplier(), uno::UNO_QUERY );
+ if( xTunnel.is() )
+ return xTunnel->getSomething( aIdentifier );
+ }
+ return 0;
+}
+
+// ____ XNumberFormatsSupplier ____
+uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getNumberFormatSettings()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
+ if( xSupplier.is() )
+ return xSupplier->getNumberFormatSettings();
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< util::XNumberFormats > SAL_CALL ChartModel::getNumberFormats()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
+ if( xSupplier.is() )
+ return xSupplier->getNumberFormats();
+ return uno::Reference< util::XNumberFormats >();
+}
+
+// ____ XChild ____
+Reference< uno::XInterface > SAL_CALL ChartModel::getParent()
+ throw (uno::RuntimeException)
+{
+ return Reference< uno::XInterface >(m_xParent,uno::UNO_QUERY);
+}
+
+void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent )
+ throw (lang::NoSupportException,
+ uno::RuntimeException)
+{
+ if( Parent != m_xParent )
+ m_xParent.set( Parent, uno::UNO_QUERY );
+}
+
+// ____ XUndoManager ____
+Reference< chart2::XUndoManager > SAL_CALL ChartModel::getUndoManager()
+ throw (uno::RuntimeException)
+{
+ return m_xUndoManager;
+}
+
+// ____ XDataSource ____
+uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences()
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::data::XDataSource > xSource(
+ DataSourceHelper::getUsedData( uno::Reference< frame::XModel >(this) ) );
+ if( xSource.is())
+ return xSource->getDataSequences();
+
+ return uno::Sequence< Reference< chart2::data::XLabeledDataSequence > >();
+}
+
+} // namespace chart
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx
new file mode 100644
index 000000000000..23da02f3f83a
--- /dev/null
+++ b/chart2/source/model/main/ChartModel.hxx
@@ -0,0 +1,609 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_MODEL_HXX
+#define _CHART_MODEL_HXX
+
+#include "LifeTime.hxx"
+#include "ServiceMacros.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XStorable2.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/chart2/XUndoSupplier.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+// public API
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 20
+#include "comphelper/implbase_var.hxx"
+#endif
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <svtools/grfmgr.hxx>
+
+// for auto_ptr
+#include <memory>
+
+//=============================================================================
+/** this is an example implementation for the service ::com::sun::star::document::OfficeDocument
+*/
+
+namespace chart
+{
+
+namespace impl
+{
+
+// Note: needed for queryInterface (if it calls the base-class implementation)
+typedef ::comphelper::WeakImplHelper20<
+// ::com::sun::star::frame::XModel //comprehends XComponent (required interface), base of XChartDocument
+ ::com::sun::star::util::XCloseable //comprehends XCloseBroadcaster
+ ,::com::sun::star::frame::XStorable2 //(extension of XStorable)
+// ,::com::sun::star::frame::XStorable //(required interface) base of XStorable2
+ ,::com::sun::star::util::XModifiable //comprehends XModifyBroadcaster (required interface)
+ // ,::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ // ,::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ ,::com::sun::star::lang::XServiceInfo
+ ,::com::sun::star::chart2::XChartDocument // derived from XModel
+ ,::com::sun::star::chart2::data::XDataReceiver // public API
+ ,::com::sun::star::chart2::XTitled
+ ,::com::sun::star::frame::XLoadable
+ ,::com::sun::star::util::XCloneable
+ ,::com::sun::star::embed::XVisualObject
+ ,::com::sun::star::lang::XMultiServiceFactory
+ ,::com::sun::star::document::XStorageBasedDocument
+ ,::com::sun::star::lang::XUnoTunnel
+ ,::com::sun::star::util::XNumberFormatsSupplier
+ ,::com::sun::star::container::XChild
+ ,::com::sun::star::util::XModifyListener
+ ,::com::sun::star::datatransfer::XTransferable
+ ,::com::sun::star::chart2::XUndoSupplier
+ ,::com::sun::star::document::XDocumentPropertiesSupplier
+ ,::com::sun::star::chart2::data::XDataSource
+ >
+ ChartModel_Base;
+}
+
+class ChartModel : public impl::ChartModel_Base
+{
+
+private:
+ mutable ::apphelper::CloseableLifeTimeManager m_aLifeTimeManager;
+
+ mutable ::osl::Mutex m_aModelMutex;
+ sal_Bool volatile m_bReadOnly;
+ sal_Bool volatile m_bModified;
+ sal_Int32 m_nInLoad;
+ sal_Bool volatile m_bUpdateNotificationsPending;
+
+ ::rtl::OUString m_aResource;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aMediaDescriptor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocumentProperties;
+
+ ::cppu::OInterfaceContainerHelper m_aControllers;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xCurrentController;
+ sal_uInt16 m_nControllerLockCount;
+
+// ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aPrinterOptions;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xOldModelAgg;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage;
+ //the content of this should be always synchronized with the current m_xViewWindow size. The variable is necessary to hold the information as long as no view window exists.
+ ::com::sun::star::awt::Size m_aVisualAreaSize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xParent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > m_xRangeHighlighter;
+ ::std::vector< GraphicObject > m_aGraphicObjectVector;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
+ /** is only valid if m_xDataProvider is set. If m_xDataProvider is set to an
+ external data provider this reference must be set to 0
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > m_xInternalDataProvider;
+
+ ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
+ m_xOwnNumberFormatsSupplier;
+ ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
+ m_xNumberFormatsSupplier;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeManager >
+ m_xChartTypeManager;
+
+ // Diagram Access
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >
+ m_xDiagram;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >
+ m_xTitle;
+
+ bool m_bIsDisposed;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xPageBackground;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager >
+ m_xUndoManager;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xXMLNamespaceMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyListener;
+
+private:
+ //private methods
+
+ ::rtl::OUString impl_g_getLocation();
+
+ sal_Bool
+ impl_isControllerConnected( const com::sun::star::uno::Reference<
+ com::sun::star::frame::XController >& xController );
+
+ com::sun::star::uno::Reference< com::sun::star::frame::XController >
+ impl_getCurrentController()
+ throw( com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL
+ impl_notifyModifiedListeners()
+ throw( com::sun::star::uno::RuntimeException);
+ void SAL_CALL
+ impl_notifyCloseListeners()
+ throw( com::sun::star::uno::RuntimeException);
+ void SAL_CALL
+ impl_notifyStorageChangeListeners()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ void impl_killInternalData() throw( com::sun::star::util::CloseVetoException );
+
+ void impl_createOldModelAgg();
+ void impl_store(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & xStorage );
+ void impl_load(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage >& xStorage );
+ void impl_loadGraphics(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage >& xStorage );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XFilter >
+ impl_createFilter( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rMediaDescriptor );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeTemplate > impl_createDefaultChartTypeTemplate();
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > impl_createDefaultData();
+
+ void impl_adjustAdditionalShapesPositionAndSize(
+ const ::com::sun::star::awt::Size& aVisualAreaSize );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
+ impl_getNumberFormatsSupplier();
+
+public:
+ //no default constructor
+ ChartModel(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext);
+ explicit ChartModel( const ChartModel & rOther );
+ virtual ~ChartModel();
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XServiceInfo
+ //-----------------------------------------------------------------
+
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ChartModel)
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XModel (required interface)
+ //-----------------------------------------------------------------
+
+ virtual sal_Bool SAL_CALL
+ attachResource( const ::rtl::OUString& rURL
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL
+ getURL() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
+ getArgs() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ connectController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& xController )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ disconnectController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& xController )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ lockControllers() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ unlockControllers() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ hasControllersLocked()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL
+ getCurrentController()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setCurrentController( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController >& xController )
+ throw (::com::sun::star::container::NoSuchElementException
+ , ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ getCurrentSelection()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XComponent (base of XModel)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XCloseable
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ close( sal_Bool bDeliverOwnership )
+ throw(::com::sun::star::util::CloseVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XCloseBroadcaster (base of XCloseable)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ addCloseListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XCloseListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeCloseListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XCloseListener > & xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XStorable2 (extension of XStorable)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL storeSelf(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::frame::XStorable (required interface)
+ //-----------------------------------------------------------------
+ virtual sal_Bool SAL_CALL
+ hasLocation() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL
+ getLocation() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ isReadonly() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ store() throw (::com::sun::star::io::IOException
+ , ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ storeAsURL( const ::rtl::OUString& rURL
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::io::IOException
+ , ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ storeToURL( const ::rtl::OUString& rURL
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::io::IOException
+ , ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModifiable (required interface)
+ //-----------------------------------------------------------------
+ virtual sal_Bool SAL_CALL
+ isModified() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ setModified( sal_Bool bModified )
+ throw (::com::sun::star::beans::PropertyVetoException
+ , ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModifyBroadcaster (base of XModifiable)
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL
+ addModifyListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeModifyListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XModifyListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ datatransferable::XTransferable ____
+ virtual ::com::sun::star::uno::Any SAL_CALL getTransferData(
+ const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::datatransfer::UnsupportedFlavorException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isDataFlavorSupported(
+ const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // lang::XTypeProvider (overloaded method of WeakImplHelper)
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
+ getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ document::XDocumentPropertiesSupplier ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > SAL_CALL
+ getDocumentProperties( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::chart2::XChartDocument
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > SAL_CALL
+ getFirstDiagram() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFirstDiagram(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ createInternalDataProvider( sal_Bool bCloneExistingData )
+ throw (::com::sun::star::util::CloseVetoException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasInternalDataProvider()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > SAL_CALL
+ getDataProvider()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ setChartTypeManager( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartTypeManager >& xNewManager )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeManager > SAL_CALL
+ getChartTypeManager()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
+ getPageBackground()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataReceiver (public API) ____
+ virtual void SAL_CALL
+ attachDataProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataProvider >& xProvider )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setArguments(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUsedRangeRepresentations()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL getUsedData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL attachNumberFormatsSupplier( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > SAL_CALL getRangeHighlighter()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTitled ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& Title )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XInterface (for old API wrapper) ____
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XLoadable ____
+ virtual void SAL_CALL initNew()
+ throw (::com::sun::star::frame::DoubleInitializationException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL load( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::frame::DoubleInitializationException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XVisualObject ____
+ virtual void SAL_CALL setVisualAreaSize(
+ ::sal_Int64 nAspect,
+ const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::embed::WrongStateException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize(
+ ::sal_Int64 nAspect )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::embed::WrongStateException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation(
+ ::sal_Int64 nAspect )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::embed::WrongStateException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMapUnit(
+ ::sal_Int64 nAspect )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XMultiServiceFactory ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier
+ , const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XStorageBasedDocument ____
+ virtual void SAL_CALL loadFromStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::frame::DoubleInitializationException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL storeToStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescriptor )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL switchToStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL getDocumentStorage()
+ throw (::com::sun::star::io::IOException,
+ ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStorageChangeListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageChangeListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStorageChangeListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageChangeListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // for SvNumberFormatsSupplierObj
+ // ____ XUnoTunnel ___
+ virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XNumberFormatsSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getNumberFormatSettings()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormats > SAL_CALL getNumberFormats()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChild ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent )
+ throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XUndoSupplier ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > SAL_CALL getUndoManager()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSource ____ allows access to the curently used data and data ranges
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
new file mode 100644
index 000000000000..1868c38e094f
--- /dev/null
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -0,0 +1,860 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartModel.hxx"
+#include "MediaDescriptorHelper.hxx"
+#include "ChartDebugTrace.hxx"
+#include "macros.hxx"
+#include "ChartViewHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ThreeDHelper.hxx"
+
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+#include <ucbhelper/content.hxx>
+#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#include <vcl/cvtgrf.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <vcl/svapp.hxx>
+
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+namespace
+{
+struct lcl_PropNameEquals : public ::std::unary_function< beans::PropertyValue, bool >
+{
+ lcl_PropNameEquals( const OUString & rStrToCompareWith ) :
+ m_aStr( rStrToCompareWith )
+ {}
+ bool operator() ( const beans::PropertyValue & rProp )
+ {
+ return rProp.Name.equals( m_aStr );
+ }
+private:
+ OUString m_aStr;
+};
+
+template< typename T >
+T lcl_getProperty(
+ const Sequence< beans::PropertyValue > & rMediaDescriptor,
+ const OUString & rPropName )
+{
+ T aResult;
+ if( rMediaDescriptor.getLength())
+ {
+ OUString aPropName( rPropName );
+ const beans::PropertyValue * pIt = rMediaDescriptor.getConstArray();
+ const beans::PropertyValue * pEndIt = pIt + + rMediaDescriptor.getLength();
+ pIt = ::std::find_if( pIt, pEndIt, lcl_PropNameEquals( aPropName ));
+ if( pIt != pEndIt )
+ (*pIt).Value >>= aResult;
+ }
+ return aResult;
+}
+
+void lcl_addStorageToMediaDescriptor(
+ Sequence< beans::PropertyValue > & rOutMD,
+ const Reference< embed::XStorage > & xStorage )
+{
+ rOutMD.realloc( rOutMD.getLength() + 1 );
+ rOutMD[rOutMD.getLength() - 1] = beans::PropertyValue(
+ C2U("Storage"), -1, uno::makeAny( xStorage ), beans::PropertyState_DIRECT_VALUE );
+}
+
+Reference< embed::XStorage > lcl_createStorage(
+ const OUString & rURL,
+ const Reference< uno::XComponentContext > & xContext,
+ const Sequence< beans::PropertyValue > & rMediaDescriptor )
+{
+ // create new storage
+ Reference< embed::XStorage > xStorage;
+ if( !xContext.is())
+ return xStorage;
+
+ try
+ {
+ Reference< io::XStream > xStream(
+ ::ucbhelper::Content( rURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >()).openStream(),
+ uno::UNO_QUERY );
+
+ Reference< lang::XSingleServiceFactory > xStorageFact(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.embed.StorageFactory"),
+ xContext ),
+ uno::UNO_QUERY_THROW );
+ Sequence< uno::Any > aStorageArgs( 3 );
+ aStorageArgs[0] <<= xStream;
+ aStorageArgs[1] <<= embed::ElementModes::READWRITE;
+ aStorageArgs[2] <<= rMediaDescriptor;
+ xStorage.set(
+ xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW );
+ OSL_ENSURE( xStorage.is(), "No Storage" );
+ }
+ catch( ::com::sun::star::ucb::ContentCreationException & rEx )
+ {
+ ASSERT_EXCEPTION( rEx );
+ }
+
+ return xStorage;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+Reference< document::XFilter > ChartModel::impl_createFilter(
+ const Sequence< beans::PropertyValue > & rMediaDescriptor )
+{
+ Reference< document::XFilter > xFilter;
+
+ // find FilterName in MediaDescriptor
+ OUString aFilterName(
+ lcl_getProperty< OUString >( rMediaDescriptor, OUString::createFromAscii("FilterName")));
+
+ // if FilterName was found, get Filter from factory
+ if( aFilterName.getLength() > 0 )
+ {
+ try
+ {
+ Reference< container::XNameAccess > xFilterFact(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.document.FilterFactory" ), m_xContext ),
+ uno::UNO_QUERY_THROW );
+ uno::Any aFilterProps( xFilterFact->getByName( aFilterName ));
+ Sequence< beans::PropertyValue > aProps;
+
+ if( aFilterProps.hasValue() &&
+ (aFilterProps >>= aProps))
+ {
+ OUString aFilterServiceName(
+ lcl_getProperty< OUString >( aProps, OUString::createFromAscii("FilterService")));
+
+ if( aFilterServiceName.getLength())
+ {
+ xFilter.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ aFilterServiceName, m_xContext ), uno::UNO_QUERY_THROW );
+ OSL_TRACE( "Filter found for service %s", U2C( aFilterServiceName ));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ OSL_ENSURE( xFilter.is(), "Filter not found via factory" );
+ }
+
+ // fall-back: create XML-Filter
+ if( ! xFilter.is())
+ {
+ OSL_TRACE( "No FilterName passed in MediaDescriptor" );
+ xFilter.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.comp.chart2.XMLFilter"), m_xContext ),
+ uno::UNO_QUERY_THROW );
+ }
+
+ return xFilter;
+}
+
+//-----------------------------------------------------------------
+// frame::XStorable2
+//-----------------------------------------------------------------
+
+void SAL_CALL ChartModel::storeSelf( const Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw (lang::IllegalArgumentException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ // only some parameters are allowed (see also SfxBaseModel)
+ // "VersionComment", "Author", "InteractionHandler", "StatusIndicator"
+ // However, they are ignored here. They would become interesting when
+ // charts support a standalone format again.
+ impl_store( rMediaDescriptor, m_xStorage );
+}
+
+//-----------------------------------------------------------------
+// frame::XStorable (base of XStorable2)
+//-----------------------------------------------------------------
+sal_Bool SAL_CALL ChartModel::hasLocation()
+ throw(uno::RuntimeException)
+{
+ //@todo guard
+ return m_aResource.getLength()!=0;
+}
+
+::rtl::OUString SAL_CALL ChartModel::getLocation()
+ throw(uno::RuntimeException)
+{
+ return impl_g_getLocation();
+}
+
+sal_Bool SAL_CALL ChartModel::isReadonly()
+ throw(uno::RuntimeException)
+{
+ //@todo guard
+ return m_bReadOnly;
+}
+
+void SAL_CALL ChartModel::store()
+ throw(io::IOException,
+ uno::RuntimeException)
+{
+ apphelper::LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall(sal_True)) //start LongLastingCall
+ return; //behave passive if already disposed or closed or throw exception @todo?
+
+ ::rtl::OUString aLocation = m_aResource;
+
+ if( aLocation.getLength() == 0 )
+ throw io::IOException( C2U( "no location specified" ), static_cast< ::cppu::OWeakObject* >(this));
+ //@todo check wether aLocation is something like private:factory...
+ if( m_bReadOnly )
+ throw io::IOException( C2U( "document is read only" ), static_cast< ::cppu::OWeakObject* >(this));
+
+ aGuard.clear();
+
+ // store
+ impl_store( m_aMediaDescriptor, m_xStorage );
+}
+
+void SAL_CALL ChartModel::storeAsURL(
+ const ::rtl::OUString& rURL,
+ const uno::Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw(io::IOException, uno::RuntimeException)
+{
+ apphelper::LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall(sal_True)) //start LongLastingCall
+ return; //behave passive if already disposed or closed or throw exception @todo?
+
+ apphelper::MediaDescriptorHelper aMediaDescriptorHelper(rMediaDescriptor);
+ uno::Sequence< beans::PropertyValue > aReducedMediaDescriptor(
+ aMediaDescriptorHelper.getReducedForModel() );
+
+ m_bReadOnly = sal_False;
+ aGuard.clear();
+
+ // create new storage
+ Reference< embed::XStorage > xStorage( lcl_createStorage( rURL, m_xContext, aReducedMediaDescriptor ));
+
+ if( xStorage.is())
+ {
+ impl_store( aReducedMediaDescriptor, xStorage );
+ attachResource( rURL, aReducedMediaDescriptor );
+ }
+}
+
+void SAL_CALL ChartModel::storeToURL(
+ const ::rtl::OUString& rURL,
+ const uno::Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw(io::IOException,
+ uno::RuntimeException)
+{
+ apphelper::LifeTimeGuard aGuard(m_aLifeTimeManager);
+ if(!aGuard.startApiCall(sal_True)) //start LongLastingCall
+ return; //behave passive if already disposed or closed or throw exception @todo?
+ //do not change the internal state of the document here
+ //...
+
+ aGuard.clear();
+
+ apphelper::MediaDescriptorHelper aMediaDescriptorHelper(rMediaDescriptor);
+ uno::Sequence< beans::PropertyValue > aReducedMediaDescriptor(
+ aMediaDescriptorHelper.getReducedForModel() );
+
+ if( rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("private:stream")))
+ {
+ try
+ {
+ if( m_xContext.is() && aMediaDescriptorHelper.ISSET_OutputStream )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ Reference< io::XStream > xStream(
+ xFact->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW );
+ Reference< io::XInputStream > xInputStream( xStream->getInputStream());
+
+ Reference< embed::XStorage > xStorage(
+ ::comphelper::OStorageHelper::GetStorageFromStream( xStream, embed::ElementModes::READWRITE, xFact ));
+ if( xStorage.is())
+ {
+ impl_store( aReducedMediaDescriptor, xStorage );
+
+ Reference< io::XSeekable > xSeekable( xStream, uno::UNO_QUERY_THROW );
+ xSeekable->seek( 0 );
+ ::comphelper::OStorageHelper::CopyInputToOutput( xInputStream, aMediaDescriptorHelper.OutputStream );
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ // create new storage
+ Reference< embed::XStorage > xStorage( lcl_createStorage( rURL, m_xContext, aReducedMediaDescriptor ));
+
+ if( xStorage.is())
+ impl_store( aReducedMediaDescriptor, xStorage );
+ }
+}
+
+void ChartModel::impl_store(
+ const Sequence< beans::PropertyValue >& rMediaDescriptor,
+ const Reference< embed::XStorage > & xStorage )
+{
+ Reference< document::XFilter > xFilter( impl_createFilter( rMediaDescriptor));
+ if( xFilter.is() && xStorage.is())
+ {
+ Sequence< beans::PropertyValue > aMD( rMediaDescriptor );
+ lcl_addStorageToMediaDescriptor( aMD, xStorage );
+ try
+ {
+ Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY_THROW );
+ xExporter->setSourceDocument( Reference< lang::XComponent >( this ));
+ xFilter->filter( aMD );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "No filter" );
+ }
+
+ setModified( sal_False );
+
+ //#i66865#
+ //for data change notification during chart is not loaded:
+ //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() )
+ {
+ apphelper::MediaDescriptorHelper aMDHelper(rMediaDescriptor);
+ try
+ {
+ xPropSet->setPropertyValue( OUString::createFromAscii("SavedObject"),
+ uno::makeAny( aMDHelper.HierarchicalDocumentName ) );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+}
+
+//-----------------------------------------------------------------
+// frame::XLoadable
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::initNew()
+ throw (frame::DoubleInitializationException,
+ io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ lockControllers();
+ createInternalDataProvider( sal_False );
+ try
+ {
+ // create default chart
+ Reference< chart2::XChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
+ if( xTemplate.is())
+ {
+ try
+ {
+ Reference< chart2::data::XDataSource > xDataSource( impl_createDefaultData() );
+ Sequence< beans::PropertyValue > aParam;
+
+ bool bSupportsCategories = xTemplate->supportsCategories();
+ if( bSupportsCategories )
+ {
+ aParam.realloc( 1 );
+ aParam[0] = beans::PropertyValue( C2U("HasCategories"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+ }
+
+ Reference< chart2::XDiagram > xDiagram( xTemplate->createDiagramByDataSource( xDataSource, aParam ) );
+
+ setFirstDiagram( xDiagram );
+
+ bool bIsRTL = Application::GetSettings().GetLayoutRTL();
+ //reverse x axis for rtl charts
+ if( bIsRTL )
+ AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
+
+ // create and attach legend
+ Reference< chart2::XLegend > xLegend(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.Legend" ), m_xContext ), uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xLegendProperties( xLegend, uno::UNO_QUERY );
+ if( xLegendProperties.is() )
+ {
+ xLegendProperties->setPropertyValue( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_NONE ));
+ xLegendProperties->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_NONE ));
+ xLegendProperties->setPropertyValue( C2U( "LineColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30
+ xLegendProperties->setPropertyValue( C2U( "FillColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
+
+ if( bIsRTL )
+ xLegendProperties->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( 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() )
+ {
+ xDiagramProperties->setPropertyValue( C2U("RightAngledAxes"), uno::makeAny( sal_True ));
+ xDiagramProperties->setPropertyValue( C2U("D3DScenePerspective"), uno::makeAny( drawing::ProjectionMode_PARALLEL ));
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ }
+
+ //set some new 'defaults' for wall and floor
+ if( xDiagram.is() )
+ {
+ Reference< beans::XPropertySet > xWall( xDiagram->getWall() );
+ if( xWall.is() )
+ {
+ xWall->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) );
+ xWall->setPropertyValue( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_NONE ) );
+ xWall->setPropertyValue( C2U( "LineColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30
+ xWall->setPropertyValue( C2U( "FillColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
+ }
+ Reference< beans::XPropertySet > xFloor( xDiagram->getFloor() );
+ if( xFloor.is() )
+ {
+ xFloor->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ xFloor->setPropertyValue( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_SOLID ) );
+ xFloor->setPropertyValue( C2U( "LineColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30
+ xFloor->setPropertyValue( C2U( "FillColor" ), uno::makeAny( static_cast< sal_Int32 >( 0xcccccc ) ) ); // gray20
+ }
+
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ ChartModelHelper::setIncludeHiddenCells( false, this );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ setModified( sal_False );
+ unlockControllers();
+
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+ OSL_TRACE( "ChartModel::initNew: Showing ChartDocument structure" );
+ OSL_TRACE( "----------------------------------------------------" );
+ debug::ChartDebugTraceDocument( Reference< chart2::XChartDocument >( this ));
+#endif
+}
+
+void SAL_CALL ChartModel::load(
+ const Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw (frame::DoubleInitializationException,
+ io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ Reference< embed::XStorage > xStorage;
+ OUString aURL;
+ try
+ {
+ apphelper::MediaDescriptorHelper aMDHelper( rMediaDescriptor );
+ if( aMDHelper.ISSET_Storage )
+ {
+ xStorage = aMDHelper.Storage;
+ }
+ else if( aMDHelper.ISSET_Stream ||
+ aMDHelper.ISSET_InputStream )
+ {
+ if( aMDHelper.ISSET_FilterName &&
+ (aMDHelper.FilterName.equals( C2U("StarChart 5.0")) ||
+ aMDHelper.FilterName.equals( C2U("StarChart 4.0")) ||
+ aMDHelper.FilterName.equals( C2U("StarChart 3.0")) ))
+ {
+ attachResource( aMDHelper.URL, rMediaDescriptor );
+ impl_load( rMediaDescriptor, 0 ); // cannot create a storage from binary streams, but I do not need the storage here anyhow
+ m_bReadOnly = sal_True;
+ return;
+ }
+
+ Reference< lang::XSingleServiceFactory > xStorageFact(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.embed.StorageFactory"),
+ m_xContext ),
+ uno::UNO_QUERY_THROW );
+
+ 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);
+
+ xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ),
+ uno::UNO_QUERY_THROW );
+ }
+ else
+ {
+ 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);
+
+ xStorage.set( xStorageFact->createInstanceWithArguments( aStorageArgs ),
+ uno::UNO_QUERY_THROW );
+ }
+ }
+
+ if( aMDHelper.ISSET_URL )
+ aURL = aMDHelper.URL;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( xStorage.is())
+ {
+ attachResource( aURL, rMediaDescriptor );
+ impl_load( rMediaDescriptor, xStorage );
+ }
+}
+
+void ChartModel::impl_load(
+ const Sequence< beans::PropertyValue >& rMediaDescriptor,
+ const Reference< embed::XStorage >& xStorage )
+{
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ m_nInLoad++;
+ }
+
+ Reference< document::XFilter > xFilter( impl_createFilter( rMediaDescriptor ));
+
+ if( xFilter.is())
+ {
+ Reference< document::XImporter > xImporter( xFilter, uno::UNO_QUERY_THROW );
+ xImporter->setTargetDocument( this );
+ Sequence< beans::PropertyValue > aMD( rMediaDescriptor );
+ lcl_addStorageToMediaDescriptor( aMD, xStorage );
+
+ xFilter->filter( aMD );
+ xFilter.clear();
+ }
+ else
+ {
+ OSL_ENSURE( false, "loadFromStorage cannot create filter" );
+ }
+
+ if( xStorage.is() )
+ impl_loadGraphics( xStorage );
+
+ setModified( sal_False );
+
+ // switchToStorage without notifying listeners (which shouldn't exist at
+ // this time, anyway)
+ m_xStorage = xStorage;
+
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ m_nInLoad--;
+ }
+}
+
+void ChartModel::impl_loadGraphics(
+ const Reference< embed::XStorage >& xStorage )
+{
+ try
+ {
+ const Reference< embed::XStorage >& xGraphicsStorage(
+ xStorage->openStorageElement( C2U( "Pictures" ),
+ embed::ElementModes::READ ) );
+
+ if( xGraphicsStorage.is() )
+ {
+ const uno::Sequence< ::rtl::OUString > aElementNames(
+ xGraphicsStorage->getElementNames() );
+
+ for( int i = 0; i < aElementNames.getLength(); ++i )
+ {
+ if( xGraphicsStorage->isStreamElement( aElementNames[ i ] ) )
+ {
+ uno::Reference< io::XStream > xElementStream(
+ xGraphicsStorage->openStreamElement(
+ aElementNames[ i ],
+ embed::ElementModes::READ ) );
+
+ if( xElementStream.is() )
+ {
+ std::auto_ptr< SvStream > apIStm(
+ ::utl::UcbStreamHelper::CreateStream(
+ xElementStream, true ) );
+
+ if( apIStm.get() )
+ {
+ Graphic aGraphic;
+
+ if( !GraphicConverter::Import(
+ *apIStm.get(),
+ aGraphic ) )
+ {
+ m_aGraphicObjectVector.push_back( aGraphic );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+}
+
+//-----------------------------------------------------------------
+// util::XModifiable
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::impl_notifyModifiedListeners()
+ throw( uno::RuntimeException)
+{
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ m_bUpdateNotificationsPending = false;
+ }
+
+ //always notify the view first!
+ ChartViewHelper::setViewToDirtyState( this );
+
+ ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
+ .getContainer( ::getCppuType((const uno::Reference< util::XModifyListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+}
+
+sal_Bool SAL_CALL ChartModel::isModified()
+ throw(uno::RuntimeException)
+{
+ //@todo guard
+ return m_bModified;
+}
+
+void SAL_CALL ChartModel::setModified( sal_Bool bModified )
+ throw(beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ 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?
+ m_bModified = bModified;
+
+ if( m_nControllerLockCount > 0 )
+ {
+ m_bUpdateNotificationsPending = true;
+ return;//don't call listeners if controllers are locked
+ }
+ aGuard.clear();
+
+ if(bModified)
+ impl_notifyModifiedListeners();
+}
+
+//-----------------------------------------------------------------
+// util::XModifyBroadcaster (base of XModifiable)
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::addModifyListener(
+ const uno::Reference< util::XModifyListener >& xListener )
+ throw(uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.addInterface(
+ ::getCppuType((const uno::Reference< util::XModifyListener >*)0), xListener );
+}
+
+void SAL_CALL ChartModel::removeModifyListener(
+ const uno::Reference< util::XModifyListener >& xListener )
+ throw(uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface(
+ ::getCppuType((const uno::Reference< util::XModifyListener >*)0), xListener );
+}
+
+//-----------------------------------------------------------------
+// util::XModifyListener
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::modified( const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+ if( m_nInLoad == 0 )
+ setModified( sal_True );
+}
+
+//-----------------------------------------------------------------
+// lang::XEventListener (base of util::XModifyListener)
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::disposing( const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+ // child was disposed -- should not happen from outside
+}
+
+
+//-----------------------------------------------------------------
+// document::XStorageBasedDocument
+//-----------------------------------------------------------------
+void SAL_CALL ChartModel::loadFromStorage(
+ const Reference< embed::XStorage >& xStorage,
+ const Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw (lang::IllegalArgumentException,
+ frame::DoubleInitializationException,
+ io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ attachResource( OUString(), rMediaDescriptor );
+ impl_load( rMediaDescriptor, xStorage );
+}
+
+void SAL_CALL ChartModel::storeToStorage(
+ const Reference< embed::XStorage >& xStorage,
+ const Sequence< beans::PropertyValue >& rMediaDescriptor )
+ throw (lang::IllegalArgumentException,
+ io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ impl_store( rMediaDescriptor, xStorage );
+}
+
+void SAL_CALL ChartModel::switchToStorage( const Reference< embed::XStorage >& xStorage )
+ throw (lang::IllegalArgumentException,
+ io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ m_xStorage = xStorage;
+ impl_notifyStorageChangeListeners();
+}
+
+Reference< embed::XStorage > SAL_CALL ChartModel::getDocumentStorage()
+ throw (io::IOException,
+ uno::Exception,
+ uno::RuntimeException)
+{
+ return m_xStorage;
+}
+
+void SAL_CALL ChartModel::impl_notifyStorageChangeListeners()
+ throw( uno::RuntimeException)
+{
+ ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
+ .getContainer( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0) );
+ if( pIC )
+ {
+ ::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 );
+ }
+ }
+}
+
+void SAL_CALL ChartModel::addStorageChangeListener( const Reference< document::XStorageChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.addInterface(
+ ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener );
+}
+
+void SAL_CALL ChartModel::removeStorageChangeListener( const Reference< document::XStorageChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
+ return; //behave passive if already disposed or closed
+
+ m_aLifeTimeManager.m_aListenerContainer.removeInterface(
+ ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener );
+}
+
+} // namespace chart
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx
new file mode 100644
index 000000000000..1f3d92e4d94b
--- /dev/null
+++ b/chart2/source/model/main/DataPoint.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataPoint.hxx"
+#include "DataPointProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+// ____________________________________________________________
+
+namespace
+{
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::DataPointProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+} // anonymous namespace
+
+// ____________________________________________________________
+
+namespace chart
+{
+
+DataPoint::DataPoint( const uno::Reference< beans::XPropertySet > & rParentProperties ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xParentProperties( rParentProperties ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_bNoParentPropAllowed( false )
+{
+ SetNewValuesExplicitlyEvenIfTheyEqualDefault();
+}
+
+DataPoint::DataPoint( const DataPoint & rOther ) :
+ MutexContainer(),
+ impl::DataPoint_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_bNoParentPropAllowed( true )
+{
+ SetNewValuesExplicitlyEvenIfTheyEqualDefault();
+
+ // m_xParentProperties has to be set from outside, like in the method
+ // DataSeries::createClone
+
+ // add as listener to XPropertySet properties
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+
+ m_bNoParentPropAllowed = false;
+}
+
+DataPoint::~DataPoint()
+{
+ try
+ {
+ // remove listener from XPropertySet properties
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL DataPoint::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new DataPoint( *this ));
+}
+
+// ____ XChild ____
+Reference< uno::XInterface > SAL_CALL DataPoint::getParent()
+ throw (uno::RuntimeException)
+{
+ return Reference< uno::XInterface >( m_xParentProperties, uno::UNO_QUERY );
+}
+
+void SAL_CALL DataPoint::setParent(
+ const Reference< uno::XInterface >& Parent )
+ throw (lang::NoSupportException,
+ uno::RuntimeException)
+{
+ m_xParentProperties.set( Parent, uno::UNO_QUERY );
+}
+
+// ____ OPropertySet ____
+uno::Any DataPoint::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ // the value set at the data series is the default
+ uno::Reference< beans::XFastPropertySet > xFast( m_xParentProperties, uno::UNO_QUERY );
+ if( !xFast.is())
+ {
+ OSL_ENSURE( m_bNoParentPropAllowed, "data point needs a parent property set to provide values correctly" );
+ return uno::Any();
+ }
+
+ return xFast->getFastPropertyValue( nHandle );
+}
+
+void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, const uno::Any& rValue )
+ throw (uno::Exception)
+{
+ if( nHandle == DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y
+ || nHandle == DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X )
+ {
+ uno::Any aOldValue;
+ Reference< util::XModifyBroadcaster > xBroadcaster;
+ this->getFastPropertyValue( aOldValue, nHandle );
+ if( aOldValue.hasValue() &&
+ (aOldValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::removeListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+
+ OSL_ASSERT( rValue.getValueType().getTypeClass() == uno::TypeClass_INTERFACE );
+ if( rValue.hasValue() &&
+ (rValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::addListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+ }
+
+ ::property::OPropertySet::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelper()
+{
+ return getInfoHelperConst();
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelperConst() const
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ DataPoint::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL DataPoint::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL DataPoint::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL DataPoint::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL DataPoint::disposing( const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void DataPoint::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void DataPoint::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+Sequence< OUString > DataPoint::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.DataPoint" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.DataPointProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// needed by MSC compiler
+using impl::DataPoint_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( DataPoint, DataPoint_Base, ::property::OPropertySet )
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DataPoint, C2U( "com.sun.star.comp.chart.DataPoint" ));
+
+} // namespace chart
diff --git a/chart2/source/model/main/DataPoint.hxx b/chart2/source/model/main/DataPoint.hxx
new file mode 100644
index 000000000000..1498b8345963
--- /dev/null
+++ b/chart2/source/model/main/DataPoint.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATAPOINT_HXX
+#define CHART_DATAPOINT_HXX
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "ServiceMacros.hxx"
+
+//for auto_ptr
+#include <memory>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::container::XChild,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::lang::XServiceInfo >
+ DataPoint_Base;
+}
+
+class DataPoint :
+ public MutexContainer,
+ public impl::DataPoint_Base,
+ public ::property::OPropertySet
+{
+public:
+ DataPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rParentProperties );
+ virtual ~DataPoint();
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ explicit DataPoint( const DataPoint & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ // Note: m_xParentProperties are not cloned!
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChild ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent )
+ throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::RuntimeException);
+
+ /** const variant of getInfoHelper()
+ */
+ ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelperConst() const;
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xParentProperties;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+ bool m_bNoParentPropAllowed;
+};
+
+} // namespace chart
+
+// CHART_DATAPOINT_HXX
+#endif
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
new file mode 100644
index 000000000000..964f61b128ed
--- /dev/null
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataPointProperties.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+
+// #ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+// #include <com/sun/star/awt/Gradient.hpp>
+// #endif
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#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/PolyPolygonBezierCoords.hpp>
+// #ifndef _COM_SUN_STAR_DRAWING_HATCH_HPP_
+// #include <com/sun/star/drawing/Hatch.hpp>
+// #endif
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+
+// #ifndef _COM_SUN_STAR_CHART2_FILLBITMAP_HPP_
+// #include <com/sun/star/chart2/FillBitmap.hpp>
+// #endif
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+namespace chart
+{
+
+void DataPointProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ // DataPointProperties
+ // ===================
+
+ // Common
+ // ------
+ rOutProperties.push_back(
+ Property( C2U( "Color" ),
+ PROP_DATAPOINT_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Transparency" ),
+ PROP_DATAPOINT_TRANSPARENCY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // Fill Properties
+ // ---------------
+ rOutProperties.push_back(
+ Property( C2U( "FillStyle" ),
+ PROP_DATAPOINT_FILL_STYLE,
+ ::getCppuType( reinterpret_cast< const drawing::FillStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TransparencyGradientName" ),
+ PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GradientName" ),
+ PROP_DATAPOINT_GRADIENT_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+
+ rOutProperties.push_back(
+ beans::Property( C2U( "GradientStepCount" ),
+ PROP_DATAPOINT_GRADIENT_STEPCOUNT,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "HatchName" ),
+ PROP_DATAPOINT_HATCH_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapName" ),
+ PROP_DATAPOINT_FILL_BITMAP_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "FillBackground" ),
+ PROP_DATAPOINT_FILL_BACKGROUND,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // border for filled objects
+ rOutProperties.push_back(
+ Property( C2U( "BorderColor" ),
+ PROP_DATAPOINT_BORDER_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "BorderStyle" ),
+ PROP_DATAPOINT_BORDER_STYLE,
+ ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "BorderWidth" ),
+ PROP_DATAPOINT_BORDER_WIDTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "BorderDashName" ),
+ PROP_DATAPOINT_BORDER_DASH_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "BorderTransparency" ),
+ PROP_DATAPOINT_BORDER_TRANSPARENCY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // Line Properties
+ // ---------------
+ rOutProperties.push_back(
+ Property( C2U( "LineStyle" ),
+ LineProperties::PROP_LINE_STYLE,
+ ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "LineWidth" ),
+ LineProperties::PROP_LINE_WIDTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "LineDash" ),
+ LineProperties::PROP_LINE_DASH,
+ ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "LineDashName" ),
+ LineProperties::PROP_LINE_DASH_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // FillProperties
+ // bitmap properties
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapOffsetX" ),
+ FillProperties::PROP_FILL_BITMAP_OFFSETX,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapOffsetY" ),
+ FillProperties::PROP_FILL_BITMAP_OFFSETY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapPositionOffsetX" ),
+ FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapPositionOffsetY" ),
+ FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapRectanglePoint" ),
+ FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
+ ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapLogicalSize" ),
+ FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapSizeX" ),
+ FillProperties::PROP_FILL_BITMAP_SIZEX,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapSizeY" ),
+ FillProperties::PROP_FILL_BITMAP_SIZEY,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapMode" ),
+ FillProperties::PROP_FILL_BITMAP_MODE,
+ ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // others
+ rOutProperties.push_back(
+ Property( C2U( "Symbol" ),
+ PROP_DATAPOINT_SYMBOL_PROP,
+ ::getCppuType( reinterpret_cast< const chart2::Symbol * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Offset" ),
+ PROP_DATAPOINT_OFFSET,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Geometry3D" ),
+ PROP_DATAPOINT_GEOMETRY3D,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Label" ),
+ PROP_DATAPOINT_LABEL,
+ ::getCppuType( reinterpret_cast< const chart2::DataPointLabel * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelSeparator" ),
+ PROP_DATAPOINT_LABEL_SEPARATOR,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_DATAPOINT_NUMBER_FORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //additional 'PercentageNumberFormat'
+ rOutProperties.push_back(
+ Property( C2U( "PercentageNumberFormat" ),
+ PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPlacement" ),
+ PROP_DATAPOINT_LABEL_PLACEMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReferencePageSize" ),
+ PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
+ ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_DATAPOINT_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // statistics
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarX" ),
+ PROP_DATAPOINT_ERROR_BAR_X,
+ // XPropertySet supporting service ErrorBar
+ ::getCppuType( reinterpret_cast< const uno::Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarY" ),
+ PROP_DATAPOINT_ERROR_BAR_Y,
+ // XPropertySet supporting service ErrorBar
+ ::getCppuType( reinterpret_cast< const uno::Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "ShowErrorBox" ),
+ PROP_DATAPOINT_SHOW_ERROR_BOX,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "PercentDiagonal" ),
+ PROP_DATAPOINT_PERCENT_DIAGONAL,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ 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 );
+
+ //fill
+ PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_STYLE, drawing::FillStyle_SOLID );
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME );
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_GRADIENT_NAME );
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_HATCH_NAME );
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_FILL_BITMAP_NAME );
+ 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_STYLE, drawing::LineStyle_SOLID ); // drawing::LineStyle_NONE
+ PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATAPOINT_BORDER_WIDTH, 0 );
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, PROP_DATAPOINT_BORDER_DASH_NAME );
+ PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_BORDER_TRANSPARENCY, 0 );
+
+ //line
+ PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_STYLE, drawing::LineStyle_SOLID );
+ PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, LineProperties::PROP_LINE_WIDTH, 0 );
+ PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH, drawing::LineDash());
+ PropertyHelper::setEmptyPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH_NAME );
+
+ //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_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_MODE, drawing::BitmapMode_REPEAT );
+
+ //others
+ chart2::Symbol aSymbProp;
+ 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.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_GEOMETRY3D, chart2::DataPointGeometry3D::CUBOID );
+
+ PropertyHelper::setPropertyValueDefault(
+ rOutMap, PROP_DATAPOINT_LABEL,
+ chart2::DataPointLabel(
+ sal_False, // ShowNumber
+ sal_False, // ShowNumberInPercent
+ sal_False, // ShowCategoryName
+ sal_False // ShowLegendSymbol
+ ));
+
+ PropertyHelper::setPropertyValueDefault< rtl::OUString >( rOutMap, PROP_DATAPOINT_LABEL_SEPARATOR, C2U(" ") );
+
+ //@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< double >( rOutMap, PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
+}
+
+} // namespace chart
diff --git a/chart2/source/model/main/DataPointProperties.hxx b/chart2/source/model/main/DataPointProperties.hxx
new file mode 100644
index 000000000000..5d4d02af36ef
--- /dev/null
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATAPOINTPROPERTIES_HXX
+#define CHART_DATAPOINTPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+// implements service DataPointProperties
+class DataPointProperties
+{
+public:
+ // FastProperty Ids for properties
+ enum
+ {
+ // common
+ PROP_DATAPOINT_COLOR = FAST_PROPERTY_ID_START_DATA_POINT,
+ PROP_DATAPOINT_TRANSPARENCY,
+
+ // fill
+ PROP_DATAPOINT_FILL_STYLE,
+// PROP_DATAPOINT_TRANSPARENCY_STYLE,
+ PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME,
+ PROP_DATAPOINT_GRADIENT_NAME,
+ PROP_DATAPOINT_GRADIENT_STEPCOUNT,
+ PROP_DATAPOINT_HATCH_NAME,
+ PROP_DATAPOINT_FILL_BITMAP_NAME,
+ PROP_DATAPOINT_FILL_BACKGROUND,
+
+ // border (of filled objects)
+ PROP_DATAPOINT_BORDER_COLOR,
+ PROP_DATAPOINT_BORDER_STYLE,
+ PROP_DATAPOINT_BORDER_WIDTH,
+ PROP_DATAPOINT_BORDER_DASH_NAME,
+ PROP_DATAPOINT_BORDER_TRANSPARENCY,
+
+ // others
+ PROP_DATAPOINT_SYMBOL_PROP,
+ PROP_DATAPOINT_OFFSET,
+ PROP_DATAPOINT_GEOMETRY3D,
+ PROP_DATAPOINT_LABEL,
+ PROP_DATAPOINT_LABEL_SEPARATOR,
+ PROP_DATAPOINT_NUMBER_FORMAT,
+ PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
+ PROP_DATAPOINT_LABEL_PLACEMENT,
+ PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
+ PROP_DATAPOINT_TEXT_ROTATION,
+
+ // statistics
+ PROP_DATAPOINT_ERROR_BAR_X,
+ PROP_DATAPOINT_ERROR_BAR_Y,
+ PROP_DATAPOINT_SHOW_ERROR_BOX,
+ PROP_DATAPOINT_PERCENT_DIAGONAL
+
+ // additionally some properites from ::chart::LineProperties
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
+
+private:
+ // not implemented
+ DataPointProperties();
+};
+
+} // namespace chart
+
+// CHART_DATAPOINTPROPERTIES_HXX
+#endif
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
new file mode 100644
index 000000000000..89197aa5ba3f
--- /dev/null
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -0,0 +1,624 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataSeries.hxx"
+#include "DataSeriesProperties.hxx"
+#include "DataPointProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "DataPoint.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "EventListenerHelper.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// ----------------------------------------
+
+namespace
+{
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::DataSeriesProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+void lcl_SetParent(
+ const uno::Reference< uno::XInterface > & xChildInterface,
+ const uno::Reference< uno::XInterface > & xParentInterface )
+{
+ uno::Reference< container::XChild > xChild( xChildInterface, uno::UNO_QUERY );
+ if( xChild.is())
+ xChild->setParent( xParentInterface );
+}
+
+typedef ::std::map< sal_Int32, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > >
+ lcl_tDataPointMap;
+
+void lcl_CloneAttributedDataPoints(
+ const lcl_tDataPointMap & rSource, lcl_tDataPointMap & rDestination,
+ const uno::Reference< uno::XInterface > & xSeries )
+{
+ for( lcl_tDataPointMap::const_iterator aIt( rSource.begin());
+ aIt != rSource.end(); ++aIt )
+ {
+ Reference< beans::XPropertySet > xPoint( (*aIt).second );
+ if( xPoint.is())
+ {
+ Reference< util::XCloneable > xCloneable( xPoint, uno::UNO_QUERY );
+ if( xCloneable.is())
+ {
+ xPoint.set( xCloneable->createClone(), uno::UNO_QUERY );
+ if( xPoint.is())
+ {
+ lcl_SetParent( xPoint, xSeries );
+ rDestination.insert( lcl_tDataPointMap::value_type( (*aIt).first, xPoint ));
+ }
+ }
+ }
+ }
+}
+
+} // anonymous namespace
+
+// ----------------------------------------
+
+namespace chart
+{
+
+DataSeries::DataSeries( const uno::Reference< uno::XComponentContext > & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+}
+
+DataSeries::DataSeries( const DataSeries & rOther ) :
+ MutexContainer(),
+ impl::DataSeries_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xContext( rOther.m_xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ if( ! rOther.m_aDataSequences.empty())
+ {
+ CloneHelper::CloneRefVector< tDataSequenceContainer::value_type >(
+ rOther.m_aDataSequences, m_aDataSequences );
+ ModifyListenerHelper::addListenerToAllElements( m_aDataSequences, m_xModifyEventForwarder );
+ }
+
+ CloneHelper::CloneRefVector< Reference< chart2::XRegressionCurve > >( rOther.m_aRegressionCurves, m_aRegressionCurves );
+ ModifyListenerHelper::addListenerToAllElements( m_aRegressionCurves, m_xModifyEventForwarder );
+
+ // add as listener to XPropertySet properties
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+}
+
+// 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())
+ {
+ lcl_CloneAttributedDataPoints(
+ rOther.m_aAttributedDataPoints, m_aAttributedDataPoints, xThisInterface );
+ ModifyListenerHelper::addListenerToAllMapElements( m_aAttributedDataPoints, m_xModifyEventForwarder );
+ }
+
+ // add as parent to error bars
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ lcl_SetParent( xPropertySet, xThisInterface );
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ lcl_SetParent( xPropertySet, xThisInterface );
+}
+
+DataSeries::~DataSeries()
+{
+ try
+ {
+ ModifyListenerHelper::removeListenerFromAllMapElements( m_aAttributedDataPoints, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListenerFromAllElements( m_aRegressionCurves, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListenerFromAllElements( m_aDataSequences, m_xModifyEventForwarder );
+
+ // remove listener from XPropertySet properties
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL DataSeries::createClone()
+ throw (uno::RuntimeException)
+{
+ DataSeries * pNewSeries( new DataSeries( *this ));
+ // hold a reference to the clone
+ uno::Reference< util::XCloneable > xResult( pNewSeries );
+ // do initialization that uses uno references to the clone
+ pNewSeries->Init( *this );
+
+ return xResult;
+}
+
+Sequence< OUString > DataSeries::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.DataSeries" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.DataPointProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// ____ OPropertySet ____
+uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ DataSeriesProperties::AddDefaultsToMap( aStaticDefaults );
+ 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 );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ throw beans::UnknownPropertyException();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL DataSeries::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ DataSeries::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+void SAL_CALL DataSeries::getFastPropertyValue
+ ( uno::Any& rValue,
+ sal_Int32 nHandle ) const
+{
+ // special handling for get. set is not possible for this property
+ if( nHandle == DataSeriesProperties::PROP_DATASERIES_ATTRIBUTED_DATA_POINTS )
+ {
+ // ToDo: only add those property sets that are really modified
+ uno::Sequence< sal_Int32 > aSeq( m_aAttributedDataPoints.size());
+ sal_Int32 * pIndexArray = aSeq.getArray();
+ sal_Int32 i = 0;
+
+ for( tDataPointAttributeContainer::const_iterator aIt( m_aAttributedDataPoints.begin());
+ aIt != m_aAttributedDataPoints.end(); ++aIt )
+ {
+ pIndexArray[ i ] = (*aIt).first;
+ ++i;
+ }
+
+ rValue <<= aSeq;
+ }
+ else
+ OPropertySet::getFastPropertyValue( rValue, nHandle );
+}
+
+void SAL_CALL DataSeries::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, const uno::Any& rValue )
+ throw (uno::Exception)
+{
+ if( nHandle == DataPointProperties::PROP_DATAPOINT_ERROR_BAR_Y
+ || nHandle == DataPointProperties::PROP_DATAPOINT_ERROR_BAR_X )
+ {
+ uno::Any aOldValue;
+ Reference< util::XModifyBroadcaster > xBroadcaster;
+ this->getFastPropertyValue( aOldValue, nHandle );
+ if( aOldValue.hasValue() &&
+ (aOldValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::removeListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+
+ OSL_ASSERT( rValue.getValueType().getTypeClass() == uno::TypeClass_INTERFACE );
+ if( rValue.hasValue() &&
+ (rValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::addListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+ }
+
+ ::property::OPropertySet::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+}
+
+Reference< beans::XPropertySet >
+ SAL_CALL DataSeries::getDataPointByIndex( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xResult;
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences;
+ {
+ MutexGuard aGuard( GetMutex() );
+ aSequences = ContainerHelper::ContainerToSequence( m_aDataSequences );
+ }
+
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aValuesSeries(
+ DataSeriesHelper::getAllDataSequencesByRole( aSequences , C2U("values"), true ) );
+ if( !aValuesSeries.empty() )
+ {
+ Reference< chart2::data::XDataSequence > xSeq( aValuesSeries.front()->getValues() );
+ if( 0 <= nIndex && nIndex < xSeq->getData().getLength() )
+ {
+ {
+ MutexGuard aGuard( GetMutex() );
+ tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ) );
+ if( aIt != m_aAttributedDataPoints.end() )
+ xResult = (*aIt).second;
+ }
+ if( !xResult.is() )
+ {
+ Reference< beans::XPropertySet > xParentProperties;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xParentProperties = this;
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ }
+
+ // create a new XPropertySet for this data point
+ xResult.set( new DataPoint( xParentProperties ) );
+ {
+ MutexGuard aGuard( GetMutex() );
+ m_aAttributedDataPoints[ nIndex ] = xResult;
+ }
+ ModifyListenerHelper::addListener( xResult, xModifyEventForwarder );
+ }
+ }
+ }
+ else
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+
+ return xResult;
+}
+
+void SAL_CALL DataSeries::resetDataPoint( sal_Int32 nIndex )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xDataPointProp;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ));
+ if( aIt != m_aAttributedDataPoints.end())
+ {
+ xDataPointProp = (*aIt).second;
+ m_aAttributedDataPoints.erase(aIt);
+ }
+
+ }
+ if( xDataPointProp.is() )
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( xDataPointProp, uno::UNO_QUERY );
+ if( xBroadcaster.is() && xModifyEventForwarder.is())
+ xBroadcaster->removeModifyListener( xModifyEventForwarder );
+ fireModifyEvent();
+ }
+}
+
+void SAL_CALL DataSeries::resetAllDataPoints()
+ throw (uno::RuntimeException)
+{
+ tDataPointAttributeContainer aOldAttributedDataPoints;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ std::swap( aOldAttributedDataPoints, m_aAttributedDataPoints );
+ }
+ ModifyListenerHelper::removeListenerFromAllMapElements( aOldAttributedDataPoints, xModifyEventForwarder );
+ aOldAttributedDataPoints.clear();
+ fireModifyEvent();
+}
+
+// ____ XDataSink ____
+void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData )
+ throw (uno::RuntimeException)
+{
+ tDataSequenceContainer aOldDataSequences;
+ tDataSequenceContainer aNewDataSequences;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ Reference< lang::XEventListener > xListener;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ xListener = this;
+ std::swap( aOldDataSequences, m_aDataSequences );
+ aNewDataSequences = ContainerHelper::SequenceToVector( aData );
+ m_aDataSequences = aNewDataSequences;
+ }
+ ModifyListenerHelper::removeListenerFromAllElements( aOldDataSequences, xModifyEventForwarder );
+ EventListenerHelper::removeListenerFromAllElements( aOldDataSequences, xListener );
+ EventListenerHelper::addListenerToAllElements( aNewDataSequences, xListener );
+ ModifyListenerHelper::addListenerToAllElements( aNewDataSequences, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ XDataSource ____
+Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSeries::getDataSequences()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return ContainerHelper::ContainerToSequence( m_aDataSequences );
+}
+
+
+// ____ XRegressionCurveContainer ____
+void SAL_CALL DataSeries::addRegressionCurve(
+ const uno::Reference< chart2::XRegressionCurve >& xRegressionCurve )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ if( ::std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), xRegressionCurve )
+ != m_aRegressionCurves.end())
+ throw lang::IllegalArgumentException();
+ m_aRegressionCurves.push_back( xRegressionCurve );
+ }
+ ModifyListenerHelper::addListener( xRegressionCurve, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void SAL_CALL DataSeries::removeRegressionCurve(
+ const uno::Reference< chart2::XRegressionCurve >& xRegressionCurve )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ if( !xRegressionCurve.is() )
+ throw container::NoSuchElementException();
+
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ tRegressionCurveContainerType::iterator aIt(
+ ::std::find( m_aRegressionCurves.begin(), m_aRegressionCurves.end(), xRegressionCurve ) );
+ if( aIt == m_aRegressionCurves.end())
+ throw container::NoSuchElementException(
+ C2U( "The given regression curve is no element of this series" ),
+ static_cast< uno::XWeak * >( this ));
+ m_aRegressionCurves.erase( aIt );
+ }
+
+ ModifyListenerHelper::removeListener( xRegressionCurve, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+uno::Sequence< uno::Reference< chart2::XRegressionCurve > > SAL_CALL DataSeries::getRegressionCurves()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return ContainerHelper::ContainerToSequence( m_aRegressionCurves );
+}
+
+void SAL_CALL DataSeries::setRegressionCurves(
+ const Sequence< Reference< chart2::XRegressionCurve > >& aRegressionCurves )
+ throw (uno::RuntimeException)
+{
+ tRegressionCurveContainerType aOldCurves;
+ tRegressionCurveContainerType aNewCurves( ContainerHelper::SequenceToVector( aRegressionCurves ) );
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ std::swap( aOldCurves, m_aRegressionCurves );
+ m_aRegressionCurves = aNewCurves;
+ }
+ ModifyListenerHelper::removeListenerFromAllElements( aOldCurves, xModifyEventForwarder );
+ ModifyListenerHelper::addListenerToAllElements( aNewCurves, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL DataSeries::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL DataSeries::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL DataSeries::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL DataSeries::disposing( const lang::EventObject& rEventObject )
+ throw (uno::RuntimeException)
+{
+ // 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 ____
+void DataSeries::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void DataSeries::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+
+// ================================================================================
+
+using impl::DataSeries_Base;
+using ::property::OPropertySet;
+
+IMPLEMENT_FORWARD_XINTERFACE2( DataSeries, DataSeries_Base, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( DataSeries, DataSeries_Base, OPropertySet )
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DataSeries,
+ C2U( "com.sun.star.comp.chart.DataSeries" ));
+
+} // namespace chart
diff --git a/chart2/source/model/main/DataSeriesProperties.cxx b/chart2/source/model/main/DataSeriesProperties.cxx
new file mode 100644
index 000000000000..29a41bd38e14
--- /dev/null
+++ b/chart2/source/model/main/DataSeriesProperties.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataSeriesProperties.hxx"
+#include "DataPointProperties.hxx"
+#include "DataPoint.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/chart2/StackingDirection.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+
+namespace chart
+{
+
+void DataSeriesProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AttributedDataPoints" ),
+ PROP_DATASERIES_ATTRIBUTED_DATA_POINTS,
+ ::getCppuType( reinterpret_cast< const uno::Sequence< sal_Int32 > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StackingDirection" ),
+ PROP_DATASERIES_STACKING_DIRECTION,
+ ::getCppuType( reinterpret_cast< const chart2::StackingDirection * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "VaryColorsByPoint" ),
+ PROP_DATASERIES_VARY_COLORS_BY_POINT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AttachedAxisIndex" ),
+ PROP_DATASERIES_ATTACHED_AXIS_INDEX,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // add properties of service DataPointProperties
+ DataPointProperties::AddPropertiesToVector( rOutProperties );
+}
+
+void DataSeriesProperties::AddDefaultsToMap(
+ tPropertyValueMap & rOutMap )
+{
+ 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 );
+
+ // PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default
+
+ // add properties of service DataPointProperties
+ DataPointProperties::AddDefaultsToMap( rOutMap );
+}
+
+} // namespace chart
diff --git a/chart2/source/model/main/DataSeriesProperties.hxx b/chart2/source/model/main/DataSeriesProperties.hxx
new file mode 100644
index 000000000000..6805b80c975b
--- /dev/null
+++ b/chart2/source/model/main/DataSeriesProperties.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATASERIESPROPERTIES_HXX
+#define CHART_DATASERIESPROPERTIES_HXX
+
+#include "PropertyHelper.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/beans/Property.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+class DataSeriesProperties
+{
+public:
+ enum
+ {
+ PROP_DATASERIES_ATTRIBUTED_DATA_POINTS = FAST_PROPERTY_ID_START_DATA_SERIES,
+ PROP_DATASERIES_STACKING_DIRECTION,
+ PROP_DATASERIES_VARY_COLORS_BY_POINT,
+ PROP_DATASERIES_ATTACHED_AXIS_INDEX
+ };
+
+ static void AddPropertiesToVector(
+ ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+
+ static void AddDefaultsToMap( tPropertyValueMap & rOutMap );
+
+private:
+ // not implemented
+ DataSeriesProperties();
+};
+
+} // namespace chart
+
+// CHART_DATASERIESPROPERTIES_HXX
+#endif
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
new file mode 100644
index 000000000000..ff8a0c4030bc
--- /dev/null
+++ b/chart2/source/model/main/Diagram.cxx
@@ -0,0 +1,713 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Diagram.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+#include "Wall.hxx"
+#include "UserDefinedProperties.hxx"
+#include "ConfigColorScheme.hxx"
+#include "ContainerHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include "CloneHelper.hxx"
+#include "AxisHelper.hxx"
+#include "SceneProperties.hxx"
+#include "DisposeHelper.hxx"
+#include "BaseGFXHelper.hxx"
+#include <basegfx/numeric/ftools.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+
+#include <algorithm>
+#include <iterator>
+#include <functional>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+// ======================================================================
+
+namespace
+{
+
+enum
+{
+ PROP_DIAGRAM_REL_POS,
+ PROP_DIAGRAM_REL_SIZE,
+ PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+ PROP_DIAGRAM_CONNECT_BARS,
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ PROP_DIAGRAM_STARTING_ANGLE,
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ PROP_DIAGRAM_PERSPECTIVE,
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "RelativePosition" ),
+ PROP_DIAGRAM_REL_POS,
+ ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "RelativeSize" ),
+ PROP_DIAGRAM_REL_SIZE,
+ ::getCppuType( reinterpret_cast< const chart2::RelativeSize * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "PosSizeExcludeAxes" ),
+ PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SortByXValues" ),
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("ConnectBars"),
+ PROP_DIAGRAM_CONNECT_BARS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("GroupBarsPerAxis"),
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("IncludeHiddenCells"),
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StartingAngle" ),
+ PROP_DIAGRAM_STARTING_ANGLE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("RightAngledAxes"),
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("Perspective"),
+ PROP_DIAGRAM_PERSPECTIVE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationHorizontal"),
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationVertical"),
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MissingValueTreatment" ),
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::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< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::SceneProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+/// clones a UNO-sequence of UNO-References
+typedef Reference< chart2::XCoordinateSystem > lcl_tCooSysRef;
+typedef ::std::map< lcl_tCooSysRef, lcl_tCooSysRef > lcl_tCooSysMapping;
+typedef ::std::vector< lcl_tCooSysRef > lcl_tCooSysVector;
+
+lcl_tCooSysMapping lcl_CloneCoordinateSystems(
+ const lcl_tCooSysVector & rSource,
+ lcl_tCooSysVector & rDestination )
+{
+ lcl_tCooSysMapping aResult;
+
+ for( lcl_tCooSysVector::const_iterator aIt( rSource.begin());
+ aIt != rSource.end(); ++aIt )
+ {
+ lcl_tCooSysRef xClone;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >
+ xCloneable( *aIt, ::com::sun::star::uno::UNO_QUERY );
+ if( xCloneable.is())
+ xClone.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY );
+
+ if( xClone.is())
+ {
+ rDestination.push_back( xClone );
+ aResult.insert( lcl_tCooSysMapping::value_type( *aIt, xClone ));
+ }
+ else
+ rDestination.push_back( *aIt );
+ }
+
+ return aResult;
+}
+
+} // anonymous namespace
+
+// ======================================================================
+
+namespace chart
+{
+
+Diagram::Diagram( uno::Reference< uno::XComponentContext > const & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ // 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 implemetation.
+ setFastPropertyValue_NoBroadcast(
+ SceneProperties::PROP_SCENE_CAMERA_GEOMETRY, uno::makeAny(
+ ThreeDHelper::getDefaultCameraGeometry()));
+}
+
+Diagram::Diagram( const Diagram & rOther ) :
+ MutexContainer(),
+ impl::Diagram_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xContext( rOther.m_xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ lcl_tCooSysMapping aCooSysMapping =
+ lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems );
+ ModifyListenerHelper::addListenerToAllElements( m_aCoordSystems, m_xModifyEventForwarder );
+
+ m_xWall.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xWall ));
+ m_xFloor.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xFloor ));
+ m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle ));
+ m_xLegend.set( CloneHelper::CreateRefClone< Reference< chart2::XLegend > >()( rOther.m_xLegend ));
+
+ ModifyListenerHelper::addListener( m_xWall, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( m_xFloor, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( m_xLegend, m_xModifyEventForwarder );
+}
+
+Diagram::~Diagram()
+{
+ try
+ {
+ ModifyListenerHelper::removeListenerFromAllElements( m_aCoordSystems, m_xModifyEventForwarder );
+
+ ModifyListenerHelper::removeListener( m_xWall, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListener( m_xFloor, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListener( m_xTitle, m_xModifyEventForwarder );
+ ModifyListenerHelper::removeListener( m_xLegend, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XDiagram ____
+uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getWall()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xRet;
+ bool bAddListener = false;
+ {
+ MutexGuard aGuard( GetMutex() );
+ if( !m_xWall.is() )
+ {
+ m_xWall.set( new Wall() );
+ bAddListener = true;
+ }
+ xRet = m_xWall;
+ }
+ if(bAddListener)
+ ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
+ return xRet;
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getFloor()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xRet;
+ bool bAddListener = false;
+ {
+ MutexGuard aGuard( GetMutex() );
+ if( !m_xFloor.is() )
+ {
+ m_xFloor.set( new Wall() );
+ bAddListener = true;
+ }
+ xRet = m_xFloor;
+ }
+ if(bAddListener)
+ ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
+ return xRet;
+}
+
+uno::Reference< chart2::XLegend > SAL_CALL Diagram::getLegend()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return m_xLegend;
+}
+
+void SAL_CALL Diagram::setLegend( const uno::Reference< chart2::XLegend >& xNewLegend )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XLegend > xOldLegend;
+ {
+ MutexGuard aGuard( GetMutex() );
+ if( m_xLegend == xNewLegend )
+ return;
+ xOldLegend = m_xLegend;
+ m_xLegend = xNewLegend;
+ }
+ if( xOldLegend.is())
+ ModifyListenerHelper::removeListener( xOldLegend, m_xModifyEventForwarder );
+ if( xNewLegend.is())
+ ModifyListenerHelper::addListener( xNewLegend, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+Reference< chart2::XColorScheme > SAL_CALL Diagram::getDefaultColorScheme()
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XColorScheme > xRet;
+ {
+ MutexGuard aGuard( GetMutex() );
+ xRet = m_xColorScheme;
+ }
+
+ if( !xRet.is())
+ {
+ xRet.set( createConfigColorScheme( m_xContext ));
+ MutexGuard aGuard( GetMutex() );
+ m_xColorScheme = xRet;
+ }
+ return xRet;
+}
+
+void SAL_CALL Diagram::setDefaultColorScheme( const Reference< chart2::XColorScheme >& xColorScheme )
+ throw (uno::RuntimeException)
+{
+ {
+ MutexGuard aGuard( GetMutex() );
+ m_xColorScheme.set( xColorScheme );
+ }
+ fireModifyEvent();
+}
+
+// ____ XTitled ____
+uno::Reference< chart2::XTitle > SAL_CALL Diagram::getTitleObject()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return m_xTitle;
+}
+
+void SAL_CALL Diagram::setTitleObject( const uno::Reference< chart2::XTitle >& xNewTitle )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XTitle > xOldTitle;
+ {
+ MutexGuard aGuard( GetMutex() );
+ if( m_xTitle == xNewTitle )
+ return;
+ xOldTitle = m_xTitle;
+ m_xTitle = xNewTitle;
+ }
+ if( xOldTitle.is())
+ ModifyListenerHelper::removeListener( xOldTitle, m_xModifyEventForwarder );
+ if( xNewTitle.is())
+ ModifyListenerHelper::addListener( xNewTitle, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ X3DDefaultSetter ____
+void SAL_CALL Diagram::set3DSettingsToDefault()
+ throw (uno::RuntimeException)
+{
+ ThreeDHelper::set3DSettingsToDefault( this );
+}
+
+void SAL_CALL Diagram::setDefaultRotation()
+ throw (uno::RuntimeException)
+{
+ ThreeDHelper::setDefaultRotation( this );
+}
+
+void SAL_CALL Diagram::setDefaultIllumination()
+ throw (uno::RuntimeException)
+{
+ ThreeDHelper::setDefaultIllumination( this );
+}
+
+// ____ XCoordinateSystemContainer ____
+void SAL_CALL Diagram::addCoordinateSystem(
+ const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ {
+ MutexGuard aGuard( GetMutex() );
+ if( ::std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys )
+ != m_aCoordSystems.end())
+ throw lang::IllegalArgumentException();
+
+ if( m_aCoordSystems.size()>=1 )
+ {
+ OSL_ENSURE( false, "more than one coordinatesystem is not supported yet by the fileformat" );
+ return;
+ }
+ m_aCoordSystems.push_back( aCoordSys );
+ }
+ ModifyListenerHelper::addListener( aCoordSys, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void SAL_CALL Diagram::removeCoordinateSystem(
+ const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ {
+ MutexGuard aGuard( GetMutex() );
+ ::std::vector< uno::Reference< chart2::XCoordinateSystem > >::iterator
+ aIt( ::std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys ));
+ if( aIt == m_aCoordSystems.end())
+ throw container::NoSuchElementException(
+ C2U( "The given coordinate-system is no element of the container" ),
+ static_cast< uno::XWeak * >( this ));
+ m_aCoordSystems.erase( aIt );
+ }
+ ModifyListenerHelper::removeListener( aCoordSys, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > SAL_CALL Diagram::getCoordinateSystems()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return ContainerHelper::ContainerToSequence( m_aCoordSystems );
+}
+
+void SAL_CALL Diagram::setCoordinateSystems(
+ const Sequence< Reference< chart2::XCoordinateSystem > >& aCoordinateSystems )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ tCoordinateSystemContainerType aNew;
+ tCoordinateSystemContainerType aOld;
+ if( aCoordinateSystems.getLength()>0 )
+ {
+ OSL_ENSURE( aCoordinateSystems.getLength()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
+ aNew.push_back( aCoordinateSystems[0] );
+ }
+ {
+ MutexGuard aGuard( GetMutex() );
+ std::swap( aOld, m_aCoordSystems );
+ m_aCoordSystems = aNew;
+ }
+ ModifyListenerHelper::removeListenerFromAllElements( aOld, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListenerToAllElements( aNew, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ____ XCloneable ____
+Reference< util::XCloneable > SAL_CALL Diagram::createClone()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return Reference< util::XCloneable >( new Diagram( *this ));
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL Diagram::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL Diagram::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL Diagram::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL Diagram::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void Diagram::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void Diagram::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ============================================================
+
+Sequence< OUString > Diagram::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.Diagram" );
+ aServices[ 1 ] = C2U( "com.sun.star.layout.LayoutElement" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// ____ OPropertySet ____
+uno::Any Diagram::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ ::chart::SceneProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL Diagram::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ Diagram::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XFastPropertySet ____
+void SAL_CALL Diagram::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
+ throw(beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ //special treatment for some 3D properties
+ if( PROP_DIAGRAM_PERSPECTIVE == nHandle )
+ {
+ sal_Int32 fPerspective = 20;
+ if( rValue >>=fPerspective )
+ ThreeDHelper::setCameraDistance( this, ThreeDHelper::PerspectiveToCameraDistance( fPerspective ) );
+ }
+ else if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle
+ || PROP_DIAGRAM_ROTATION_VERTICAL == nHandle )
+ {
+ sal_Int32 nNewAngleDegree = 0;
+ if( rValue >>=nNewAngleDegree )
+ {
+ sal_Int32 nHorizontal, nVertical;
+ ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical );
+ if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle )
+ nHorizontal = nNewAngleDegree;
+ else
+ nVertical = nNewAngleDegree;
+ ThreeDHelper::setRotationToDiagram( this, nHorizontal, nVertical );
+ }
+ }
+ else
+ ::property::OPropertySet::setFastPropertyValue( nHandle, rValue );
+}
+
+void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ //special treatment for some 3D properties
+ if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
+ {
+ sal_Int32 nPerspective = ::basegfx::fround( ThreeDHelper::CameraDistanceToPerspective(
+ ThreeDHelper::getCameraDistance( const_cast< Diagram* >( this ) ) ) );
+ rValue = uno::makeAny(nPerspective);
+ }
+ else if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle
+ || PROP_DIAGRAM_ROTATION_VERTICAL == nHandle )
+ {
+ sal_Int32 nHorizontal, nVertical;
+ ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical );
+ sal_Int32 nAngleDegree = 0;
+ if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle )
+ nAngleDegree = nHorizontal;
+ else
+ nAngleDegree = nVertical;
+ rValue = uno::makeAny(nAngleDegree);
+ }
+ else
+ ::property::OPropertySet::getFastPropertyValue( rValue,nHandle );
+}
+
+// ================================================================================
+
+using impl::Diagram_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( Diagram, Diagram_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( Diagram, Diagram_Base, ::property::OPropertySet )
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( Diagram,
+ C2U( "com.sun.star.comp.chart2.Diagram" ));
+
+} // namespace chart
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
new file mode 100644
index 000000000000..9d38fafd3cf7
--- /dev/null
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "FormattedString.hxx"
+#include "ContainerHelper.hxx"
+
+#include "CharacterProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+FormattedString::FormattedString(
+ uno::Reference< uno::XComponentContext > const & /* xContext */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_aString(),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+FormattedString::FormattedString( const FormattedString & rOther ) :
+ MutexContainer(),
+ impl::FormattedString_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_aString( rOther.m_aString ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+FormattedString::~FormattedString()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL FormattedString::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new FormattedString( *this ));
+}
+
+// ____ XFormattedString ____
+::rtl::OUString SAL_CALL FormattedString::getString()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex());
+ return m_aString;
+ // \--
+}
+
+void SAL_CALL FormattedString::setString( const ::rtl::OUString& String )
+ throw (uno::RuntimeException)
+{
+ {
+ MutexGuard aGuard( GetMutex());
+ m_aString = String;
+ }
+ //don't keep the mutex locked while calling out
+ fireModifyEvent();
+
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL FormattedString::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL FormattedString::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL FormattedString::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL FormattedString::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void FormattedString::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void FormattedString::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+
+// ----------------------------------------
+
+Sequence< OUString > FormattedString::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.FormattedString" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// ____ OPropertySet ____
+uno::Any FormattedString::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ CharacterProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ throw beans::UnknownPropertyException();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL FormattedString::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ FormattedString::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ================================================================================
+
+using impl::FormattedString_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( FormattedString, FormattedString_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( FormattedString, FormattedString_Base, ::property::OPropertySet )
+
+// do this in derived classes!
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( FormattedString,
+ C2U( "com.sun.star.comp.chart.FormattedString" ));
+
+} // namespace chart
diff --git a/chart2/source/model/main/FormattedString.hxx b/chart2/source/model/main/FormattedString.hxx
new file mode 100644
index 000000000000..9293d73afa5b
--- /dev/null
+++ b/chart2/source/model/main/FormattedString.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_FORMATTEDSTRING_HXX
+#define CHART_FORMATTEDSTRING_HXX
+
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/uno3.hxx>
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XFormattedString.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::chart2::XFormattedString,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ FormattedString_Base;
+}
+
+class FormattedString :
+ public MutexContainer,
+ public impl::FormattedString_Base,
+ public ::property::OPropertySet
+{
+public:
+ FormattedString( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~FormattedString();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( FormattedString )
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit FormattedString( const FormattedString & rOther );
+
+ // ____ XFormattedString ____
+ virtual ::rtl::OUString SAL_CALL getString()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const ::rtl::OUString& String )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::rtl::OUString m_aString;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_FORMATTEDSTRING_HXX
+#endif
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
new file mode 100644
index 000000000000..a8d5be5d1453
--- /dev/null
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "GridProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+// ____________________________________________________________
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.GridProperties" ));
+
+enum
+{
+ PROP_GRID_SHOW
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Show" ),
+ PROP_GRID_SHOW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_addDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_GRID_SHOW, false );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >(
+ rOutMap, ::chart::LineProperties::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30
+}
+
+const Sequence< Property > & lcl_getPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_getPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ____________________________________________________________
+
+namespace chart
+{
+
+GridProperties::GridProperties( Reference< uno::XComponentContext > const & /* xContext */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+}
+
+GridProperties::GridProperties() :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+GridProperties::GridProperties( const GridProperties & rOther ) :
+ MutexContainer(),
+ impl::GridProperties_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+}
+
+GridProperties::~GridProperties()
+{}
+
+// ____ OPropertySet ____
+uno::Any GridProperties::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ lcl_addDefaultsToMap( aStaticDefaults );
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL GridProperties::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ GridProperties::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ lcl_getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL GridProperties::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new GridProperties( *this ));
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL GridProperties::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL GridProperties::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL GridProperties::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL GridProperties::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void GridProperties::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void GridProperties::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+Sequence< OUString > GridProperties::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.GridProperties" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( GridProperties, lcl_aServiceName );
+
+// needed by MSC compiler
+using impl::GridProperties_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( GridProperties, GridProperties_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridProperties, GridProperties_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/GridProperties.hxx b/chart2/source/model/main/GridProperties.hxx
new file mode 100644
index 000000000000..1c0ae0ed849a
--- /dev/null
+++ b/chart2/source/model/main/GridProperties.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_GRIDPROPERTIES_HXX
+#define CHART_GRIDPROPERTIES_HXX
+
+#include "ServiceMacros.hxx"
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include "ModifyListenerHelper.hxx"
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper4<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ GridProperties_Base;
+}
+
+class GridProperties :
+ public MutexContainer,
+ public impl::GridProperties_Base,
+ public ::property::OPropertySet
+{
+public:
+ GridProperties( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ explicit GridProperties();
+ virtual ~GridProperties();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( GridProperties )
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit GridProperties( const GridProperties & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_GRIDPROPERTIES_HXX
+#endif
diff --git a/chart2/source/model/main/LayoutContainer.cxx b/chart2/source/model/main/LayoutContainer.cxx
new file mode 100644
index 000000000000..d962113f78c7
--- /dev/null
+++ b/chart2/source/model/main/LayoutContainer.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LayoutContainer.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.layout.LayoutContainer" ));
+} // anonymous namespace
+
+namespace chart
+{
+
+LayoutContainer::LayoutContainer()
+{}
+
+LayoutContainer::~LayoutContainer()
+{}
+
+// ____ XLayoutContainer ____
+void SAL_CALL LayoutContainer::addConstrainedElementByIdentifier(
+ const ::rtl::OUString& aIdentifier,
+ const layout::Constraint& Constraint )
+ throw (layout::IllegalConstraintException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ addElementByIdentifier( aIdentifier );
+ m_aConstraints[ aIdentifier ] = Constraint;
+}
+
+void SAL_CALL LayoutContainer::addElementByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( ::std::find( m_aLayoutElements.begin(),
+ m_aLayoutElements.end(),
+ aIdentifier ) != m_aLayoutElements.end())
+ throw lang::IllegalArgumentException();
+
+ m_aLayoutElements.push_back( aIdentifier );
+}
+
+void SAL_CALL LayoutContainer::removeElementByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ tLayoutElements::iterator aIt(
+ ::std::find( m_aLayoutElements.begin(),
+ m_aLayoutElements.end(),
+ aIdentifier ));
+
+ if( aIt == m_aLayoutElements.end())
+ throw container::NoSuchElementException();
+
+ m_aLayoutElements.erase( aIt );
+ m_aConstraints.erase( aIdentifier );
+}
+
+void SAL_CALL LayoutContainer::setConstraintByIdentifier(
+ const ::rtl::OUString& aIdentifier,
+ const layout::Constraint& Constraint )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ if( ::std::find( m_aLayoutElements.begin(),
+ m_aLayoutElements.end(),
+ aIdentifier ) == m_aLayoutElements.end())
+ throw container::NoSuchElementException();
+
+ m_aConstraints[ aIdentifier ] = Constraint;
+}
+
+layout::Constraint SAL_CALL LayoutContainer::getConstraintByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ tConstraintsMap::const_iterator aIt( m_aConstraints.find( aIdentifier ));
+ if( aIt == m_aConstraints.end())
+ throw container::NoSuchElementException();
+
+ return (*aIt).second;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL LayoutContainer::getElementIdentifiers()
+ throw (uno::RuntimeException)
+{
+ return ContainerHelper::ContainerToSequence( m_aLayoutElements );
+}
+
+uno::Sequence< ::rtl::OUString > LayoutContainer::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 1 );
+
+ aServices[ 0 ] = C2U( "com.sun.star.layout.LayoutContainer" );
+ return aServices;
+}
+
+// --------------------------------------------------------------------------------
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LayoutContainer, lcl_aServiceName );
+
+} // namespace chart
diff --git a/chart2/source/model/main/LayoutContainer.hxx b/chart2/source/model/main/LayoutContainer.hxx
new file mode 100644
index 000000000000..ea645dcff536
--- /dev/null
+++ b/chart2/source/model/main/LayoutContainer.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LAYOUTCONTAINER_HXX
+#define CHART_LAYOUTCONTAINER_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/layout/XLayoutContainer.hpp>
+
+#include "ServiceMacros.hxx"
+
+#include <vector>
+#include <map>
+
+namespace chart
+{
+
+class LayoutContainer : public
+ ::cppu::WeakImplHelper2<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::layout::XLayoutContainer >
+{
+public:
+ LayoutContainer();
+ virtual ~LayoutContainer();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XLayoutContainer ____
+ virtual void SAL_CALL addConstrainedElementByIdentifier( const ::rtl::OUString& aIdentifier, const ::com::sun::star::layout::Constraint& Constraint )
+ throw (::com::sun::star::layout::IllegalConstraintException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addElementByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeElementByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setConstraintByIdentifier( const ::rtl::OUString& aIdentifier, const ::com::sun::star::layout::Constraint& Constraint )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::layout::Constraint SAL_CALL getConstraintByIdentifier( const ::rtl::OUString& aIdentifier )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getElementIdentifiers()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ typedef ::std::vector< ::rtl::OUString > tLayoutElements;
+
+ typedef ::std::map<
+ ::rtl::OUString,
+ ::com::sun::star::layout::Constraint > tConstraintsMap;
+
+ tLayoutElements m_aLayoutElements;
+ tConstraintsMap m_aConstraints;
+};
+
+} // namespace chart
+
+// CHART_LAYOUTCONTAINER_HXX
+#endif
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
new file mode 100644
index 000000000000..c1143ecdf77a
--- /dev/null
+++ b/chart2/source/model/main/Legend.cxx
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Legend.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "LegendHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::Property;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Legend" ));
+
+enum
+{
+ PROP_LEGEND_ANCHOR_POSITION,
+ PROP_LEGEND_PREFERRED_EXPANSION,
+ PROP_LEGEND_SHOW,
+ PROP_LEGEND_REF_PAGE_SIZE,
+ PROP_LEGEND_REL_POS
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AnchorPosition" ),
+ PROP_LEGEND_ANCHOR_POSITION,
+ ::getCppuType( reinterpret_cast< const chart2::LegendPosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Expansion" ),
+ PROP_LEGEND_PREFERRED_EXPANSION,
+ ::getCppuType( reinterpret_cast< const chart2::LegendExpansion * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Show" ),
+ PROP_LEGEND_SHOW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ReferencePageSize" ),
+ PROP_LEGEND_REF_PAGE_SIZE,
+ ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "RelativePosition" ),
+ PROP_LEGEND_REL_POS,
+ ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true );
+
+ 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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+Legend::Legend( Reference< uno::XComponentContext > const & /* xContext */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+}
+
+Legend::Legend( const Legend & rOther ) :
+ MutexContainer(),
+ impl::Legend_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ CloneHelper::CloneRefVector< Reference< chart2::XLegendEntry > >( rOther.m_aLegendEntries, m_aLegendEntries );
+ ModifyListenerHelper::addListenerToAllElements( m_aLegendEntries, m_xModifyEventForwarder );
+}
+
+Legend::~Legend()
+{
+ try
+ {
+ ModifyListenerHelper::removeListenerFromAllElements( m_aLegendEntries, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XLegend ____
+void SAL_CALL Legend::registerEntry( const Reference< chart2::XLegendEntry >& xEntry )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( ::std::find( m_aLegendEntries.begin(),
+ m_aLegendEntries.end(),
+ xEntry ) != m_aLegendEntries.end())
+ throw lang::IllegalArgumentException();
+
+ m_aLegendEntries.push_back( xEntry );
+ ModifyListenerHelper::addListener( xEntry, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+void SAL_CALL Legend::revokeEntry( const Reference< chart2::XLegendEntry >& xEntry )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ tLegendEntries::iterator aIt(
+ ::std::find( m_aLegendEntries.begin(),
+ m_aLegendEntries.end(),
+ xEntry ));
+
+ if( aIt == m_aLegendEntries.end())
+ throw container::NoSuchElementException();
+
+ m_aLegendEntries.erase( aIt );
+ ModifyListenerHelper::removeListener( xEntry, m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+Sequence< Reference< chart2::XLegendEntry > > SAL_CALL Legend::getEntries()
+ throw (uno::RuntimeException)
+{
+ return ContainerHelper::ContainerToSequence( m_aLegendEntries );
+}
+
+// ____ XCloneable ____
+Reference< util::XCloneable > SAL_CALL Legend::createClone()
+ throw (uno::RuntimeException)
+{
+ return Reference< util::XCloneable >( new Legend( *this ));
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL Legend::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL Legend::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL Legend::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL Legend::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void Legend::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void Legend::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+Sequence< OUString > Legend::getSupportedServiceNames_Static()
+{
+ const sal_Int32 nNumServices( 6 );
+ sal_Int32 nI = 0;
+ Sequence< OUString > aServices( nNumServices );
+ aServices[ nI++ ] = C2U( "com.sun.star.chart2.Legend" );
+ aServices[ nI++ ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ nI++ ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ nI++ ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ nI++ ] = C2U( "com.sun.star.style.CharacterProperties" );
+ aServices[ nI++ ] = C2U( "com.sun.star.layout.LayoutElement" );
+ OSL_ASSERT( nNumServices == nI );
+ return aServices;
+}
+
+// ____ OPropertySet ____
+Any Legend::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+ CharacterProperties::AddDefaultsToMap( aStaticDefaults );
+ // call last to overwrite some character property defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL Legend::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ Legend::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( Legend, lcl_aServiceName );
+
+// needed by MSC compiler
+using impl::Legend_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( Legend, Legend_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( Legend, Legend_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/Legend.hxx b/chart2/source/model/main/Legend.hxx
new file mode 100644
index 000000000000..6b645828f4c1
--- /dev/null
+++ b/chart2/source/model/main/Legend.hxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LEGEND_HXX
+#define CHART_LEGEND_HXX
+
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::chart2::XLegend,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ Legend_Base;
+}
+
+class Legend :
+ public MutexContainer,
+ public impl::Legend_Base,
+ public ::property::OPropertySet
+{
+public:
+ Legend( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~Legend();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( Legend )
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit Legend( const Legend & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XLegend ____
+ virtual void SAL_CALL registerEntry( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegendEntry >& xEntry )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokeEntry( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegendEntry >& xEntry )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegendEntry > > SAL_CALL getEntries()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ typedef ::std::vector<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegendEntry > > tLegendEntries;
+
+ tLegendEntries m_aLegendEntries;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_LEGEND_HXX
+#endif
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
new file mode 100644
index 000000000000..0dbe1d82fcf3
--- /dev/null
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PageBackground.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "PropertyHelper.hxx"
+
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PageBackground" ));
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace chart
+{
+
+PageBackground::PageBackground( const uno::Reference< uno::XComponentContext > & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+PageBackground::PageBackground( const PageBackground & rOther ) :
+ MutexContainer(),
+ impl::PageBackground_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xContext( rOther.m_xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+PageBackground::~PageBackground()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL PageBackground::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new PageBackground( *this ));
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any PageBackground::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+ // overrides defaults of FillProperties
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL PageBackground::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ PageBackground::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL PageBackground::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL PageBackground::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL PageBackground::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL PageBackground::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void PageBackground::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void PageBackground::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > PageBackground::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.PageBackground" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PageBackground, lcl_aServiceName );
+
+using impl::PageBackground_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( PageBackground, PageBackground_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/PageBackground.hxx b/chart2/source/model/main/PageBackground.hxx
new file mode 100644
index 000000000000..9875a76eae2b
--- /dev/null
+++ b/chart2/source/model/main/PageBackground.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_PAGEBACKGROUND_HXX
+#define CHART_PAGEBACKGROUND_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include <cppuhelper/implbase3.hxx>
+
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ PageBackground_Base;
+}
+
+class PageBackground :
+ public MutexContainer,
+ public impl::PageBackground_Base,
+ public ::property::OPropertySet
+{
+public:
+ PageBackground( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~PageBackground();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PageBackground )
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+
+protected:
+ explicit PageBackground( const PageBackground & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_PAGEBACKGROUND_HXX
+#endif
diff --git a/chart2/source/model/main/PolarCoordinateSystem.cxx b/chart2/source/model/main/PolarCoordinateSystem.cxx
new file mode 100644
index 000000000000..9022a5e17901
--- /dev/null
+++ b/chart2/source/model/main/PolarCoordinateSystem.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "macros.hxx"
+#include "servicenames_coosystems.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceNamePolar2d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PolarCoordinateSystem2d" ));
+static const ::rtl::OUString lcl_aServiceNamePolar3d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PolarCoordinateSystem3d" ));
+
+static const ::rtl::OUString lcl_aImplementationNamePolar2d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PolarCoordinateSystem2d" ));
+static const ::rtl::OUString lcl_aImplementationNamePolar3d(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PolarCoordinateSystem3d" ));
+}
+
+namespace chart
+{
+
+// explicit
+PolarCoordinateSystem::PolarCoordinateSystem(
+ const uno::Reference< uno::XComponentContext > & xContext,
+ sal_Int32 nDimensionCount /* = 2 */,
+ sal_Bool bSwapXAndYAxis /* = sal_False */ ) :
+ BaseCoordinateSystem( xContext, nDimensionCount, bSwapXAndYAxis )
+{}
+
+PolarCoordinateSystem::PolarCoordinateSystem(
+ const PolarCoordinateSystem & rSource ) :
+ BaseCoordinateSystem( rSource )
+{}
+
+PolarCoordinateSystem::~PolarCoordinateSystem()
+{}
+
+// ____ XCoordinateSystem ____
+::rtl::OUString SAL_CALL PolarCoordinateSystem::getCoordinateSystemType()
+ throw (RuntimeException)
+{
+ return CHART2_COOSYSTEM_POLAR_SERVICE_NAME;
+}
+
+::rtl::OUString SAL_CALL PolarCoordinateSystem::getViewServiceName()
+ throw (RuntimeException)
+{
+ return CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME;
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL PolarCoordinateSystem::createClone()
+ throw (RuntimeException)
+{
+ return Reference< util::XCloneable >( new PolarCoordinateSystem( *this ));
+}
+
+// ____ XServiceInfo ____
+Sequence< OUString > PolarCoordinateSystem::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_POLAR_SERVICE_NAME;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PolarCoordinateSystem,
+ C2U( "com.sun.star.comp.chart.PolarCoordinateSystem" ))
+
+
+// =================================
+// ==== PolarCoordinateSystem2d ====
+// =================================
+
+PolarCoordinateSystem2d::PolarCoordinateSystem2d(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ PolarCoordinateSystem( xContext, 2, sal_False )
+{}
+
+PolarCoordinateSystem2d::~PolarCoordinateSystem2d()
+{}
+
+// ____ XServiceInfo ____
+Sequence< OUString > PolarCoordinateSystem2d::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_POLAR_SERVICE_NAME;
+ aServices[ 1 ] = lcl_aServiceNamePolar2d;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PolarCoordinateSystem2d, lcl_aImplementationNamePolar2d )
+
+// =================================
+// ==== PolarCoordinateSystem3d ====
+// =================================
+
+PolarCoordinateSystem3d::PolarCoordinateSystem3d(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ PolarCoordinateSystem( xContext, 3, sal_False )
+{}
+
+PolarCoordinateSystem3d::~PolarCoordinateSystem3d()
+{}
+
+// ____ XServiceInfo ____
+Sequence< OUString > PolarCoordinateSystem3d::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_COOSYSTEM_POLAR_SERVICE_NAME;
+ aServices[ 1 ] = lcl_aServiceNamePolar3d;
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PolarCoordinateSystem3d, lcl_aImplementationNamePolar3d )
+
+} // namespace chart
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx
new file mode 100644
index 000000000000..9a3c7f8ab623
--- /dev/null
+++ b/chart2/source/model/main/StockBar.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "StockBar.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+// ____________________________________________________________
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.StockBar" ));
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ____________________________________________________________
+
+namespace chart
+{
+
+StockBar::StockBar( bool bRisingCourse ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_bRisingCourse( bRisingCourse ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ if( ! m_bRisingCourse )
+ {
+ setFastPropertyValue_NoBroadcast(
+ ::chart::FillProperties::PROP_FILL_COLOR,
+ uno::makeAny( sal_Int32( 0x000000 ))); // black
+ setFastPropertyValue_NoBroadcast(
+ ::chart::LineProperties::PROP_LINE_COLOR,
+ uno::makeAny( sal_Int32( 0xb3b3b3 ))); // gray30
+ }
+}
+
+StockBar::StockBar( const StockBar & rOther ) :
+ MutexContainer(),
+ impl::StockBar_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_bRisingCourse( rOther.m_bRisingCourse ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+StockBar::~StockBar()
+{}
+
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL StockBar::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new StockBar( *this ));
+}
+
+// ____ OPropertySet ____
+uno::Any StockBar::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+
+ // overrides a line property
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL StockBar::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ StockBar::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ lcl_getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL StockBar::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL StockBar::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL StockBar::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL StockBar::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void StockBar::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void StockBar::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > StockBar::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.StockBar" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( StockBar, lcl_aServiceName );
+
+using impl::StockBar_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( StockBar, StockBar_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
new file mode 100644
index 000000000000..d7c5691d160d
--- /dev/null
+++ b/chart2/source/model/main/Title.cxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Title.hxx"
+#include "macros.hxx"
+#include "FormattedString.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Title" ));
+
+enum
+{
+ PROP_TITLE_PARA_ADJUST,
+ PROP_TITLE_PARA_LAST_LINE_ADJUST,
+ PROP_TITLE_PARA_LEFT_MARGIN,
+ PROP_TITLE_PARA_RIGHT_MARGIN,
+ PROP_TITLE_PARA_TOP_MARGIN,
+ PROP_TITLE_PARA_BOTTOM_MARGIN,
+ PROP_TITLE_PARA_IS_HYPHENATION,
+
+ PROP_TITLE_TEXT_ROTATION,
+ PROP_TITLE_TEXT_STACKED,
+ PROP_TITLE_REL_POS,
+
+ PROP_TITLE_REF_PAGE_SIZE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ParaAdjust" ),
+ PROP_TITLE_PARA_ADJUST,
+ ::getCppuType( reinterpret_cast< ::com::sun::star::style::ParagraphAdjust * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaLastLineAdjust" ),
+ PROP_TITLE_PARA_LAST_LINE_ADJUST,
+ ::getCppuType( reinterpret_cast< sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaLeftMargin" ),
+ PROP_TITLE_PARA_LEFT_MARGIN,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaRightMargin" ),
+ PROP_TITLE_PARA_RIGHT_MARGIN,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaTopMargin" ),
+ PROP_TITLE_PARA_TOP_MARGIN,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaBottomMargin" ),
+ PROP_TITLE_PARA_BOTTOM_MARGIN,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaIsHyphenation" ),
+ PROP_TITLE_PARA_IS_HYPHENATION,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_TITLE_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "StackCharacters" ),
+ PROP_TITLE_TEXT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "RelativePosition" ),
+ PROP_TITLE_REL_POS,
+ ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReferencePageSize" ),
+ PROP_TITLE_REF_PAGE_SIZE,
+ ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ // ParagraphProperties
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_ADJUST,
+ ::com::sun::star::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 );
+
+ // 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::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace chart
+{
+
+Title::Title( uno::Reference< uno::XComponentContext > const & /* xContext */ ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+Title::Title( const Title & rOther ) :
+ MutexContainer(),
+ impl::Title_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ CloneHelper::CloneRefSequence< uno::Reference< chart2::XFormattedString > >(
+ rOther.m_aStrings, m_aStrings );
+ ModifyListenerHelper::addListenerToAllElements(
+ ContainerHelper::SequenceToVector( m_aStrings ), m_xModifyEventForwarder );
+}
+
+Title::~Title()
+{
+ ModifyListenerHelper::removeListenerFromAllElements(
+ ContainerHelper::SequenceToVector( m_aStrings ), m_xModifyEventForwarder );
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL Title::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new Title( *this ));
+}
+
+// --------------------------------------------------------------------------------
+
+// ____ XTitle ____
+uno::Sequence< uno::Reference< chart2::XFormattedString > > SAL_CALL Title::getText()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ return m_aStrings;
+}
+
+void SAL_CALL Title::setText( const uno::Sequence< uno::Reference< chart2::XFormattedString > >& rNewStrings )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< uno::Reference< chart2::XFormattedString > > aOldStrings;
+ {
+ MutexGuard aGuard( GetMutex() );
+ std::swap( m_aStrings, aOldStrings );
+ m_aStrings = rNewStrings;
+ }
+ //don't keep the mutex locked while calling out
+ ModifyListenerHelper::removeListenerFromAllElements(
+ ContainerHelper::SequenceToVector( aOldStrings ), m_xModifyEventForwarder );
+ ModifyListenerHelper::addListenerToAllElements(
+ ContainerHelper::SequenceToVector( rNewStrings ), m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any Title::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+
+ // initialize defaults
+ // Note: this should be last to override defaults of the previously
+ // added defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL Title::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ Title::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL Title::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL Title::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL Title::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL Title::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void Title::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void Title::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > Title::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.Title" );
+ aServices[ 1 ] = C2U( "com.sun.star.style.ParagraphProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ 3 ] = C2U( "com.sun.star.layout.LayoutElement" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( Title, lcl_aServiceName );
+
+// needed by MSC compiler
+using impl::Title_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( Title, Title_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( Title, Title_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/Title.hxx b/chart2/source/model/main/Title.hxx
new file mode 100644
index 000000000000..5889910018b7
--- /dev/null
+++ b/chart2/source/model/main/Title.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TITLE_HXX
+#define CHART_TITLE_HXX
+
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::chart2::XTitle,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ Title_Base;
+}
+
+class Title :
+ public MutexContainer,
+ public impl::Title_Base,
+ public ::property::OPropertySet
+{
+public:
+ Title( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~Title();
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( Title )
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ explicit Title( const Title & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XTitle ____
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > > SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setText( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > >& Strings )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > > m_aStrings;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_TITLE_HXX
+#endif
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx
new file mode 100644
index 000000000000..2ad00a4c90ae
--- /dev/null
+++ b/chart2/source/model/main/Wall.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Wall.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Wall" ));
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace chart
+{
+
+Wall::Wall() :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+Wall::Wall( const Wall & rOther ) :
+ MutexContainer(),
+ impl::Wall_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+Wall::~Wall()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new Wall( *this ));
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any Wall::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+
+ // initialize defaults
+ // Note: this should be last to override defaults of the previously
+ // added defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ Wall::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL Wall::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL Wall::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL Wall::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL Wall::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void Wall::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void Wall::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > Wall::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.Wall" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( Wall, lcl_aServiceName );
+
+using impl::Wall_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( Wall, Wall_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/main/Wall.hxx b/chart2/source/model/main/Wall.hxx
new file mode 100644
index 000000000000..8c796b4da432
--- /dev/null
+++ b/chart2/source/model/main/Wall.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WALL_HXX
+#define CHART_WALL_HXX
+
+#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/weak.hxx>
+
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ Wall_Base;
+}
+
+class Wall :
+ public MutexContainer,
+ public impl::Wall_Base,
+ public ::property::OPropertySet
+{
+public:
+ Wall();
+ virtual ~Wall();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+
+protected:
+ explicit Wall( const Wall & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ void fireModifyEvent();
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+};
+
+} // namespace chart
+
+// CHART_WALL_HXX
+#endif
diff --git a/chart2/source/model/main/_serviceregistration_model.cxx b/chart2/source/model/main/_serviceregistration_model.cxx
new file mode 100644
index 000000000000..a8b214aaf124
--- /dev/null
+++ b/chart2/source/model/main/_serviceregistration_model.cxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <cppuhelper/implementationentry.hxx>
+#ifndef _CHARTMODEL_HXX
+#include "ChartModel.hxx"
+#endif
+
+#include "Diagram.hxx"
+#include "Legend.hxx"
+#include "Axis.hxx"
+#include "GridProperties.hxx"
+#include "Title.hxx"
+#include "FormattedString.hxx"
+#include "PageBackground.hxx"
+#include "DataSeries.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "CartesianCoordinateSystem.hxx"
+
+#include "ChartTypeManager.hxx"
+#include "XMLFilter.hxx"
+
+#include "_serviceregistration_charttypes.hxx"
+
+static struct ::cppu::ImplementationEntry g_entries_chart2_model[] =
+{
+ {
+ ::chart::ChartModel::create
+ , ::chart::ChartModel::getImplementationName_Static
+ , ::chart::ChartModel::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::Diagram::create
+ , ::chart::Diagram::getImplementationName_Static
+ , ::chart::Diagram::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::Legend::create
+ , ::chart::Legend::getImplementationName_Static
+ , ::chart::Legend::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::Axis::create
+ , ::chart::Axis::getImplementationName_Static
+ , ::chart::Axis::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::GridProperties::create
+ , ::chart::GridProperties::getImplementationName_Static
+ , ::chart::GridProperties::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::Title::create
+ , ::chart::Title::getImplementationName_Static
+ , ::chart::Title::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+
+ ,{
+ ::chart::FormattedString::create
+ , ::chart::FormattedString::getImplementationName_Static
+ , ::chart::FormattedString::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+
+ ,{
+ ::chart::ChartTypeManager::create
+ , ::chart::ChartTypeManager::getImplementationName_Static
+ , ::chart::ChartTypeManager::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PageBackground::create
+ , ::chart::PageBackground::getImplementationName_Static
+ , ::chart::PageBackground::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::DataSeries::create
+ , ::chart::DataSeries::getImplementationName_Static
+ , ::chart::DataSeries::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::XMLFilter::create
+ , ::chart::XMLFilter::getImplementationName_Static
+ , ::chart::XMLFilter::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::XMLReportFilterHelper::create
+ , ::chart::XMLReportFilterHelper::getImplementationName_Static
+ , ::chart::XMLFilter::getSupportedServiceNames_Static // we support the same, because we are derived from
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PolarCoordinateSystem2d::create
+ , ::chart::PolarCoordinateSystem2d::getImplementationName_Static
+ , ::chart::PolarCoordinateSystem2d::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PolarCoordinateSystem3d::create
+ , ::chart::PolarCoordinateSystem3d::getImplementationName_Static
+ , ::chart::PolarCoordinateSystem3d::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::CartesianCoordinateSystem2d::create
+ , ::chart::CartesianCoordinateSystem2d::getImplementationName_Static
+ , ::chart::CartesianCoordinateSystem2d::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::CartesianCoordinateSystem3d::create
+ , ::chart::CartesianCoordinateSystem3d::getImplementationName_Static
+ , ::chart::CartesianCoordinateSystem3d::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pResult = ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, g_entries_chart2_model );
+
+ if( ! pResult )
+ pResult = ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey,
+ ChartTypeEntriesForServiceRegistration::getImplementationEntries() );
+
+ return pResult;
+}
+}
+//=========================================================================
diff --git a/chart2/source/model/main/makefile.mk b/chart2/source/model/main/makefile.mk
new file mode 100644
index 000000000000..8e963dfa0f5c
--- /dev/null
+++ b/chart2/source/model/main/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJNAME= chart2
+TARGET= chmodelmain
+
+PRJINC= $(PRJ)$/source
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/Axis.obj \
+ $(SLO)$/GridProperties.obj \
+ $(SLO)$/BaseCoordinateSystem.obj \
+ $(SLO)$/CartesianCoordinateSystem.obj \
+ $(SLO)$/ChartModel.obj \
+ $(SLO)$/ChartModel_Persistence.obj \
+ $(SLO)$/DataPoint.obj \
+ $(SLO)$/DataPointProperties.obj \
+ $(SLO)$/DataSeries.obj \
+ $(SLO)$/Diagram.obj \
+ $(SLO)$/DataSeriesProperties.obj \
+ $(SLO)$/FormattedString.obj \
+ $(SLO)$/Legend.obj \
+ $(SLO)$/PageBackground.obj \
+ $(SLO)$/PolarCoordinateSystem.obj \
+ $(SLO)$/StockBar.obj \
+ $(SLO)$/Title.obj \
+ $(SLO)$/Wall.obj \
+ $(SLO)$/_serviceregistration_model.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/model/makefile.mk b/chart2/source/model/makefile.mk
new file mode 100644
index 000000000000..52cc85c10904
--- /dev/null
+++ b/chart2/source/model/makefile.mk
@@ -0,0 +1,108 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..
+PRJNAME= chart2
+TARGET= chartmodel
+
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- export library -------------------------------------------------
+
+#You can use several library macros of this form to build libraries that
+#do not consist of all object files in a directory or to merge different libraries.
+LIB1TARGET= $(SLB)$/_$(TARGET).lib
+
+LIB1FILES= \
+ $(SLB)$/chmodelmain.lib \
+ $(SLB)$/chmodeltemplate.lib \
+ $(SLB)$/chmodelfilter.lib
+
+#--------
+
+#Indicates the filename of the shared library.
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+
+#indicates dependencies:
+.IF "$(COM)" == "MSC"
+SHL1DEPN = \
+ $(LB)$/icharttools.lib
+.ELSE
+SHL1DEPN =
+.ENDIF
+
+#Specifies an import library to create. For Win32 only.
+SHL1IMPLIB= i$(TARGET)
+
+#Specifies libraries from the same module to put into the shared library.
+#was created above
+SHL1LIBS= $(LIB1TARGET)
+
+#Links import libraries.
+
+SHL1STDLIBS= $(CHARTTOOLS) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(SVTOOLLIB) \
+ $(SALLIB) \
+ $(UCBHELPERLIB)
+
+#--------exports
+
+#specifies the exported symbols for Windows only:
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+SHL1VERSIONMAP = $(SOLARENV)/src/component.map
+
+#--------definition file
+
+#name of the definition file:
+DEF1NAME= $(SHL1TARGET)
+
+# --- Resources ---------------------------------------------------------------
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+ALLTAR : $(MISC)/chartmodel.component
+
+$(MISC)/chartmodel.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ chartmodel.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt chartmodel.component
diff --git a/chart2/source/model/template/AreaChartType.cxx b/chart2/source/model/template/AreaChartType.cxx
new file mode 100644
index 000000000000..003220c87dfb
--- /dev/null
+++ b/chart2/source/model/template/AreaChartType.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "AreaChartType.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+
+AreaChartType::AreaChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{}
+
+AreaChartType::AreaChartType( const AreaChartType & rOther ) :
+ ChartType( rOther )
+{}
+
+AreaChartType::~AreaChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL AreaChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new AreaChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL AreaChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_AREA;
+}
+
+uno::Sequence< ::rtl::OUString > AreaChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_AREA;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AreaChartType,
+ C2U( "com.sun.star.comp.chart.AreaChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/AreaChartType.hxx b/chart2/source/model/template/AreaChartType.hxx
new file mode 100644
index 000000000000..9955d5eb537e
--- /dev/null
+++ b/chart2/source/model/template/AreaChartType.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AREACHARTTYPE_HXX
+#define CHART_AREACHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class AreaChartType : public ChartType
+{
+public:
+ AreaChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~AreaChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( AreaChartType )
+
+protected:
+ explicit AreaChartType( const AreaChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_AREACHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
new file mode 100644
index 000000000000..5fe21cfb25e0
--- /dev/null
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "AreaChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.AreaChartTypeTemplate" ));
+
+enum
+{
+ PROP_AREA_TEMPLATE_DIMENSION
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Dimension" ),
+ PROP_AREA_TEMPLATE_DIMENSION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AREA_TEMPLATE_DIMENSION, 2 );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+AreaChartTypeTemplate::AreaChartTypeTemplate(
+ uno::Reference<
+ uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ sal_Int32 nDim /* = 2 */ ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_eStackMode( eStackMode )
+{
+ setFastPropertyValue_NoBroadcast( PROP_AREA_TEMPLATE_DIMENSION, uno::makeAny( nDim ));
+}
+
+AreaChartTypeTemplate::~AreaChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any AreaChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL AreaChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ AreaChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 AreaChartTypeTemplate::getDimension() const
+{
+ sal_Int32 nDim = 2;
+ try
+ {
+ // note: UNO-methods are never const
+ const_cast< AreaChartTypeTemplate * >( this )->
+ getFastPropertyValue( PROP_AREA_TEMPLATE_DIMENSION ) >>= nDim;
+ }
+ catch( beans::UnknownPropertyException & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return nDim;
+}
+
+StackMode AreaChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return m_eStackMode;
+}
+
+// ____ XChartTypeTemplate ____
+void SAL_CALL AreaChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+}
+
+void SAL_CALL AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::resetStyles( xDiagram );
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
+ {
+ Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xState.is() &&
+ xProp.is() &&
+ xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
+ {
+ xState->setPropertyToDefault( C2U("BorderStyle"));
+ }
+ }
+}
+
+Reference< chart2::XChartType > 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL AreaChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ return xResult;
+}
+
+
+// ----------------------------------------
+
+uno::Sequence< ::rtl::OUString > AreaChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AreaChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( AreaChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( AreaChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx
new file mode 100644
index 000000000000..a84a4b645c2a
--- /dev/null
+++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AREACHARTTYPETEMPLATE_HXX
+#define CHART_AREACHARTTYPETEMPLATE_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
+{
+public:
+ explicit AreaChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ sal_Int32 nDim = 2 );
+ virtual ~AreaChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+private:
+ StackMode m_eStackMode;
+ sal_Int32 m_nDim;
+};
+
+} // namespace chart
+
+// CHART_AREACHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/BarChartType.cxx b/chart2/source/model/template/BarChartType.cxx
new file mode 100644
index 000000000000..e877a34007de
--- /dev/null
+++ b/chart2/source/model/template/BarChartType.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BarChartType.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+
+BarChartType::BarChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{}
+
+BarChartType::BarChartType( const BarChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+BarChartType::~BarChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL BarChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new BarChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL BarChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_BAR;
+}
+
+uno::Sequence< ::rtl::OUString > BarChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_BAR;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BarChartType,
+ C2U( "com.sun.star.comp.chart.BarChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/BarChartType.hxx b/chart2/source/model/template/BarChartType.hxx
new file mode 100644
index 000000000000..884a52e3a228
--- /dev/null
+++ b/chart2/source/model/template/BarChartType.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BARCHARTTYPE_HXX
+#define CHART_BARCHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class BarChartType : public ChartType
+{
+public:
+ BarChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~BarChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( BarChartType )
+
+protected:
+ explicit BarChartType( const BarChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BARCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
new file mode 100644
index 000000000000..01dc4c253d2b
--- /dev/null
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BarChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.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 <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.BarChartTypeTemplate" ));
+
+enum
+{
+ PROP_BAR_TEMPLATE_DIMENSION,
+ PROP_BAR_TEMPLATE_GEOMETRY3D
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Dimension" ),
+ PROP_BAR_TEMPLATE_DIMENSION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Geometry3D" ),
+ PROP_BAR_TEMPLATE_GEOMETRY3D,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BarChartTypeTemplate::BarChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const OUString & rServiceName,
+ StackMode eStackMode,
+ BarDirection eDirection,
+ sal_Int32 nDim /* = 2 */ ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_eStackMode( eStackMode ),
+ m_eBarDirection( eDirection ),
+ m_nDim( nDim )
+{}
+
+BarChartTypeTemplate::~BarChartTypeTemplate()
+{}
+
+sal_Int32 BarChartTypeTemplate::getDimension() const
+{
+ return m_nDim;
+}
+
+StackMode BarChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return m_eStackMode;
+}
+
+bool BarChartTypeTemplate::isSwapXAndY() const
+{
+ return (m_eBarDirection == HORIZONTAL);
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL BarChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ //check BarDirection
+ if( bResult )
+ {
+ bool bFound = false;
+ bool bAmbiguous = false;
+ bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ if( m_eBarDirection == HORIZONTAL )
+ bResult = sal_Bool( bVertical );
+ else if( m_eBarDirection == VERTICAL )
+ bResult = sal_Bool( !bVertical );
+ }
+
+ // adapt solid-type of template according to values in series
+ if( bAdaptProperties &&
+ bResult &&
+ getDimension() == 3 )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ bool bGeomFound = false, bGeomAmbiguous = false;
+ sal_Int32 aCommonGeom = DiagramHelper::getGeometry3D( xDiagram, bGeomFound, bGeomAmbiguous );
+
+ if( !bGeomAmbiguous )
+ {
+ setFastPropertyValue_NoBroadcast(
+ PROP_BAR_TEMPLATE_GEOMETRY3D, uno::makeAny( aCommonGeom ));
+ }
+ }
+
+ 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL BarChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ return xResult;
+}
+
+
+// ____ OPropertySet ____
+uno::Any BarChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL BarChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ BarChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+void SAL_CALL BarChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ if( getDimension() == 3 )
+ {
+ try
+ {
+ //apply Geometry3D
+ uno::Any aAGeometry3D;
+ this->getFastPropertyValue( aAGeometry3D, PROP_BAR_TEMPLATE_GEOMETRY3D );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "Geometry3D" ), aAGeometry3D );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void SAL_CALL BarChartTypeTemplate::resetStyles(
+ const Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::resetStyles( xDiagram );
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
+ {
+ Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ if( xState.is())
+ {
+ if( getDimension() == 3 )
+ xState->setPropertyToDefault( C2U("Geometry3D"));
+ Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
+ if( xProp.is() &&
+ xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
+ {
+ xState->setPropertyToDefault( C2U("BorderStyle"));
+ }
+ }
+ }
+
+ DiagramHelper::setVertical( xDiagram, false );
+}
+
+
+void BarChartTypeTemplate::createCoordinateSystems(
+ const Reference< chart2::XCoordinateSystemContainer > & xCooSysCnt )
+{
+ ChartTypeTemplate::createCoordinateSystems( xCooSysCnt );
+
+ Reference< chart2::XDiagram > xDiagram( xCooSysCnt, uno::UNO_QUERY );
+ DiagramHelper::setVertical( xDiagram, m_eBarDirection == HORIZONTAL );
+}
+
+// ----------------------------------------
+
+Sequence< OUString > BarChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BarChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( BarChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BarChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx
new file mode 100644
index 000000000000..fabf7a59826c
--- /dev/null
+++ b/chart2/source/model/template/BarChartTypeTemplate.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BARCHARTTYPETEMPLATE_HXX
+#define CHART_BARCHARTTYPETEMPLATE_HXX
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+
+#include "ChartTypeTemplate.hxx"
+#include "StackMode.hxx"
+
+namespace chart
+{
+
+class BarChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ enum BarDirection
+ {
+ HORIZONTAL,
+ VERTICAL
+ };
+
+ explicit BarChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ BarDirection eDirection,
+ sal_Int32 nDim = 2 );
+ virtual ~BarChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+ virtual bool isSwapXAndY() const;
+
+ virtual void createCoordinateSystems(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystemContainer > & xCooSysCnt );
+
+private:
+ StackMode m_eStackMode;
+ BarDirection m_eBarDirection;
+ sal_Int32 m_nDim;
+};
+
+} // namespace chart
+
+// CHART_BARCHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
new file mode 100644
index 000000000000..9922ed4df5fb
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BubbleChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartType::BubbleChartType(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : ChartType( xContext )
+{
+}
+
+BubbleChartType::BubbleChartType( const BubbleChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+BubbleChartType::~BubbleChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
+}
+
+// ____ XChartType ____
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new CartesianCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+
+ if( i == 2 )
+ aScaleData.AxisType = chart2::AxisType::SERIES;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+::rtl::OUString SAL_CALL BubbleChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aMandRolesSeq;
+
+ if( aMandRolesSeq.getLength() == 0 )
+ {
+ aMandRolesSeq.realloc( 4 );
+ aMandRolesSeq[0] = C2U( "label" );
+ aMandRolesSeq[1] = C2U( "values-x" );
+ aMandRolesSeq[2] = C2U( "values-y" );
+ aMandRolesSeq[3] = C2U( "values-size" );
+ }
+
+ return aMandRolesSeq;
+}
+
+OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
+ throw (uno::RuntimeException)
+{
+ return C2U( "values-size" );
+}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > BubbleChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BubbleChartType,
+ C2U( "com.sun.star.comp.chart.BubbleChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartType.hxx b/chart2/source/model/template/BubbleChartType.hxx
new file mode 100644
index 000000000000..eea8a0e7a6ee
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLECHARTTYPE_HXX
+#define CHART_BUBBLECHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class BubbleChartType : public ChartType
+{
+public:
+ BubbleChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~BubbleChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( BubbleChartType )
+
+protected:
+ explicit BubbleChartType( const BubbleChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
new file mode 100644
index 000000000000..59b552cc8995
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "BubbleChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "BubbleDataInterpreter.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.BubbleChartTypeTemplate" ));
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartTypeTemplate::BubbleChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const OUString & rServiceName ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex )
+{
+}
+
+BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 BubbleChartTypeTemplate::getDimension() const
+{
+ return 2;
+}
+
+StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return StackMode_NONE;
+}
+
+void SAL_CALL BubbleChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL BubbleChartTypeTemplate::supportsCategories()
+ throw (uno::RuntimeException)
+{
+ return false;
+}
+
+sal_Bool SAL_CALL BubbleChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ if( bResult )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // adapt curve style, spline order and resolution
+ if( bResult && bAdaptProperties )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ 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 );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XDataInterpreter > SAL_CALL BubbleChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new BubbleDataInterpreter( GetComponentContext()) );
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > BubbleChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BubbleChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
new file mode 100644
index 000000000000..24d35c6acbb7
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLECHARTTYPETEMPLATE_HXX
+#define CHART_BUBBLECHARTTYPETEMPLATE_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
+{
+public:
+ explicit BubbleChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName );
+ virtual ~BubbleChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL supportsCategories()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
new file mode 100644
index 000000000000..1f26fff907e4
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BubbleDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+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;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+BubbleDataInterpreter::BubbleDataInterpreter(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext )
+{
+}
+
+BubbleDataInterpreter::~BubbleDataInterpreter()
+{
+}
+
+// ____ XDataInterpreter ____
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
+ const Reference< chart2::data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xValuesX;
+ vector< Reference< data::XLabeledDataSequence > > aYValuesVector;
+ vector< Reference< data::XLabeledDataSequence > > aSizeValuesVector;
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ bool bHasCategories = HasCategories( aArguments, aData );
+
+ bool bHasXValues = false;
+ sal_Int32 nDataSeqCount = aData.getLength();
+
+ bHasXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
+ :( nDataSeqCount > 2 && nDataSeqCount % 2 != 0 );
+
+ bool bCategoriesUsed = false;
+ bool bNextIsYValues = bHasCategories ? nDataSeqCount>2 : nDataSeqCount>1;
+ for( sal_Int32 nDataIdx = 0; nDataIdx < aData.getLength(); ++nDataIdx )
+ {
+ try
+ {
+ if( bHasCategories && !bCategoriesUsed )
+ {
+ xCategories.set( aData[nDataIdx] );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), C2U("categories"));
+ bCategoriesUsed = true;
+ }
+ else if( !xValuesX.is() && bHasXValues )
+ {
+ xValuesX.set( aData[nDataIdx] );
+ if( xValuesX.is())
+ SetRole( xValuesX->getValues(), C2U("values-x"));
+ }
+ else if( bNextIsYValues )
+ {
+ aYValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-y"));
+ bNextIsYValues = false;
+ }
+ else if( !bNextIsYValues )
+ {
+ aSizeValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-size"));
+ bNextIsYValues = true;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // create DataSeries
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSizeValuesVector.size());
+
+ Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
+ Reference< util::XCloneable > xCloneableX( xValuesX, uno::UNO_QUERY );
+
+ for( size_t nCount = 0; nCount < aSizeValuesVector.size(); ++nCount, ++nSeriesIndex )
+ {
+ sal_Int32 nDataSequenceCount = 2;
+ if( xValuesX.is() )
+ nDataSequenceCount = 3;
+ else if( aYValuesVector.empty() )
+ nDataSequenceCount = 1;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( nDataSequenceCount );
+ sal_Int32 nDataIndex = 0;
+ if( xValuesX.is() )
+ {
+ if( nCount > 0 && xCloneableX.is() )
+ xClonedXValues.set( xCloneableX->createClone(), uno::UNO_QUERY );
+ aNewData[nDataIndex++] = xClonedXValues;
+ }
+ if( aYValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aYValuesVector[nCount];
+ if( aSizeValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aSizeValuesVector[nCount];
+
+ Reference< XDataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.getLength())
+ xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ) );
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ }
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
+ aSeries[0] = ContainerHelper::ContainerToSequence( aSeriesVec );
+ return InterpretedData( aSeries, xCategories );
+}
+
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ InterpretedData aResult( aInterpretedData );
+
+ sal_Int32 i=0;
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.getLength();
+ for( ; i<nCount; ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+
+ Reference< data::XLabeledDataSequence > xValuesSize(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-size"), false ));
+ Reference< data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ Reference< data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-x"), false ));
+
+ if( ! xValuesX.is() ||
+ ! xValuesY.is() ||
+ ! xValuesSize.is() )
+ {
+ vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ DataSeriesHelper::getAllDataSequencesByRole(
+ xSeriesSource->getDataSequences(), C2U("values"), true ));
+ if( xValuesX.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
+ if( xValuesY.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesY ));
+ if( xValuesSize.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesSize ));
+
+ size_t nIndex = 0;
+
+ if( ! xValuesSize.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesSize.set( aValueSeqVec[nIndex++] );
+ if( xValuesSize.is())
+ SetRole( xValuesSize->getValues(), C2U("values-size"));
+ }
+
+ if( ! xValuesY.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesY.set( aValueSeqVec[nIndex++] );
+ if( xValuesY.is())
+ SetRole( xValuesY->getValues(), C2U("values-y"));
+ }
+
+ if( ! xValuesX.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesX.set( aValueSeqVec[nIndex++] );
+ if( xValuesX.is())
+ SetRole( xValuesY->getValues(), C2U("values-x"));
+ }
+ }
+ if( xValuesSize.is())
+ {
+ if( xValuesY.is() )
+ {
+ if( xValuesX.is() )
+ {
+ aNewSequences.realloc(3);
+ aNewSequences[0] = xValuesX;
+ aNewSequences[1] = xValuesY;
+ aNewSequences[2] = xValuesSize;
+ }
+ else
+ {
+ aNewSequences.realloc(2);
+ aNewSequences[0] = xValuesY;
+ aNewSequences[1] = xValuesSize;
+ }
+ }
+ else
+ {
+ aNewSequences.realloc(1);
+ aNewSequences[0] = xValuesSize;
+ }
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
+ if( aSeqs.getLength() != aNewSequences.getLength() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ sal_Int32 j=0;
+ for( ; j<aSeqs.getLength(); ++j )
+ {
+ OSL_ENSURE( aSeqs[j] == xValuesY || aSeqs[j] == xValuesX || aSeqs[j] == xValuesSize, "All sequences should be used" );
+ }
+#endif
+ Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
+ xSink->setData( aNewSequences );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+sal_Bool SAL_CALL BubbleDataInterpreter::isDataCompatible(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != 3 )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return sal_True;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleDataInterpreter.hxx b/chart2/source/model/template/BubbleDataInterpreter.hxx
new file mode 100644
index 000000000000..3eb6ebaedbf0
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_BUBBLEDATAINTERPRETER_HXX
+#define CHART_BUBBLEDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+namespace chart
+{
+
+class BubbleDataInterpreter : public DataInterpreter
+{
+public:
+ explicit BubbleDataInterpreter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~BubbleDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLEDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/CandleStickChartType.cxx b/chart2/source/model/template/CandleStickChartType.cxx
new file mode 100644
index 000000000000..22c8e058ea53
--- /dev/null
+++ b/chart2/source/model/template/CandleStickChartType.cxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "CandleStickChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "StockBar.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+enum
+{
+ PROP_CANDLESTICKCHARTTYPE_JAPANESE,
+ PROP_CANDLESTICKCHARTTYPE_WHITE_DAY,
+ PROP_CANDLESTICKCHARTTYPE_BLACK_DAY,
+
+ PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST,
+ PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Japanese" ),
+ PROP_CANDLESTICKCHARTTYPE_JAPANESE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "WhiteDay" ),
+ PROP_CANDLESTICKCHARTTYPE_WHITE_DAY,
+ ::getCppuType( reinterpret_cast< Reference< beans::XPropertySet > *>(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "BlackDay" ),
+ PROP_CANDLESTICKCHARTTYPE_BLACK_DAY,
+ ::getCppuType( reinterpret_cast< Reference< beans::XPropertySet > *>(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ShowFirst" ),
+ PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ShowHighLow" ),
+ PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap,
+ ::osl::Mutex & rMutex )
+{
+ ::osl::MutexGuard aGuard( rMutex );
+ // 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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+CandleStickChartType::CandleStickChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{
+ Reference< beans::XPropertySet > xWhiteDayProps( new ::chart::StockBar( true ));
+ Reference< beans::XPropertySet > xBlackDayProps( new ::chart::StockBar( false ));
+
+ ModifyListenerHelper::addListener( xWhiteDayProps, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( xBlackDayProps, m_xModifyEventForwarder );
+
+ setFastPropertyValue_NoBroadcast(
+ PROP_CANDLESTICKCHARTTYPE_WHITE_DAY, uno::makeAny( xWhiteDayProps ));
+ setFastPropertyValue_NoBroadcast(
+ PROP_CANDLESTICKCHARTTYPE_BLACK_DAY, uno::makeAny( xBlackDayProps ));
+}
+
+CandleStickChartType::CandleStickChartType( const CandleStickChartType & rOther ) :
+ ChartType( rOther )
+{
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, PROP_CANDLESTICKCHARTTYPE_WHITE_DAY );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, PROP_CANDLESTICKCHARTTYPE_BLACK_DAY );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::addListener( xPropertySet, m_xModifyEventForwarder );
+}
+
+CandleStickChartType::~CandleStickChartType()
+{
+ try
+ {
+ Reference< beans::XPropertySet > xPropertySet;
+ uno::Any aValue;
+
+ getFastPropertyValue( aValue, PROP_CANDLESTICKCHARTTYPE_WHITE_DAY );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+
+ getFastPropertyValue( aValue, PROP_CANDLESTICKCHARTTYPE_BLACK_DAY );
+ if( ( aValue >>= xPropertySet )
+ && xPropertySet.is())
+ ModifyListenerHelper::removeListener( xPropertySet, m_xModifyEventForwarder );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL CandleStickChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new CandleStickChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL CandleStickChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL CandleStickChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ bool bShowFirst = true;
+ bool bShowHiLow = false;
+ getFastPropertyValue( PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST ) >>= bShowFirst;
+ getFastPropertyValue( PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW ) >>= bShowHiLow;
+
+ ::std::vector< OUString > aMandRoles;
+
+ aMandRoles.push_back( C2U( "label" ));
+ if( bShowFirst )
+ aMandRoles.push_back( C2U( "values-first" ));
+
+ if( bShowHiLow )
+ {
+ aMandRoles.push_back( C2U( "values-min" ));
+ aMandRoles.push_back( C2U( "values-max" ));
+ }
+
+ aMandRoles.push_back( C2U( "values-last" ));
+
+ return ContainerHelper::ContainerToSequence( aMandRoles );
+}
+
+Sequence< OUString > SAL_CALL CandleStickChartType::getSupportedOptionalRoles()
+ throw (uno::RuntimeException)
+{
+ bool bShowFirst = true;
+ bool bShowHiLow = false;
+ getFastPropertyValue( PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST ) >>= bShowFirst;
+ getFastPropertyValue( PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW ) >>= bShowHiLow;
+
+ ::std::vector< OUString > aOptRoles;
+
+ if( ! bShowFirst )
+ aOptRoles.push_back( C2U( "values-first" ));
+
+ if( ! bShowHiLow )
+ {
+ aOptRoles.push_back( C2U( "values-min" ));
+ aOptRoles.push_back( C2U( "values-max" ));
+ }
+
+ return ContainerHelper::ContainerToSequence( aOptRoles );
+}
+
+OUString SAL_CALL CandleStickChartType::getRoleOfSequenceForSeriesLabel()
+ throw (uno::RuntimeException)
+{
+ return C2U( "values-last" );
+}
+
+// ____ OPropertySet ____
+uno::Any CandleStickChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults, GetMutex() );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL CandleStickChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ CandleStickChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+void SAL_CALL CandleStickChartType::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, const uno::Any& rValue )
+ throw (uno::Exception)
+{
+ if( nHandle == PROP_CANDLESTICKCHARTTYPE_WHITE_DAY
+ || nHandle == PROP_CANDLESTICKCHARTTYPE_BLACK_DAY )
+ {
+ uno::Any aOldValue;
+ Reference< util::XModifyBroadcaster > xBroadcaster;
+ this->getFastPropertyValue( aOldValue, nHandle );
+ if( aOldValue.hasValue() &&
+ (aOldValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::removeListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+
+ OSL_ASSERT( rValue.getValueType().getTypeClass() == uno::TypeClass_INTERFACE );
+ if( rValue.hasValue() &&
+ (rValue >>= xBroadcaster) &&
+ xBroadcaster.is())
+ {
+ ModifyListenerHelper::addListener( xBroadcaster, m_xModifyEventForwarder );
+ }
+ }
+
+ ::property::OPropertySet::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+}
+
+uno::Sequence< ::rtl::OUString > CandleStickChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( CandleStickChartType,
+ C2U( "com.sun.star.comp.chart.CandleStickChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/CandleStickChartType.hxx b/chart2/source/model/template/CandleStickChartType.hxx
new file mode 100644
index 000000000000..d32c4c455d74
--- /dev/null
+++ b/chart2/source/model/template/CandleStickChartType.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CANDLESTICKCHARTTYPE_HXX
+#define CHART_CANDLESTICKCHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class CandleStickChartType : public ChartType
+{
+public:
+ CandleStickChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~CandleStickChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( CandleStickChartType )
+
+protected:
+ explicit CandleStickChartType( const CandleStickChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedOptionalRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ OPropertySet ____
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_CANDLESTICKCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
new file mode 100644
index 000000000000..22a744769fc6
--- /dev/null
+++ b/chart2/source/model/template/ChartType.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "macros.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "CloneHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace chart
+{
+
+ChartType::ChartType(
+ const Reference< uno::XComponentContext > & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xContext( xContext ),
+ m_bNotifyChanges( true )
+{}
+
+ChartType::ChartType( const ChartType & rOther ) :
+ MutexContainer(),
+ impl::ChartType_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xContext( rOther.m_xContext ),
+ m_bNotifyChanges( true )
+{
+ CloneHelper::CloneRefVector< Reference< chart2::XDataSeries > >( rOther.m_aDataSeries, m_aDataSeries );
+ ModifyListenerHelper::addListenerToAllElements( m_aDataSeries, m_xModifyEventForwarder );
+}
+
+ChartType::~ChartType()
+{
+ ModifyListenerHelper::removeListenerFromAllElements( m_aDataSeries, m_xModifyEventForwarder );
+ m_aDataSeries.clear();
+}
+
+Reference< uno::XComponentContext > ChartType::GetComponentContext() const
+{
+ return m_xContext;
+}
+
+// ____ XChartType ____
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ ChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new CartesianCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+
+ switch( i )
+ {
+ case 0: aScaleData.AxisType = chart2::AxisType::CATEGORY; break;
+ case 2: aScaleData.AxisType = chart2::AxisType::SERIES; break;
+ default: aScaleData.AxisType = chart2::AxisType::REALNUMBER; break;
+ }
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+Sequence< OUString > SAL_CALL ChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ static Sequence< OUString > aDefaultSeq;
+
+ if( aDefaultSeq.getLength() == 0 )
+ {
+ aDefaultSeq.realloc( 2 );
+ aDefaultSeq[0] = C2U( "label" );
+ aDefaultSeq[1] = C2U( "values-y" );
+ }
+
+ return aDefaultSeq;
+}
+
+Sequence< OUString > SAL_CALL ChartType::getSupportedOptionalRoles()
+ throw (uno::RuntimeException)
+{
+ static Sequence< OUString > aDefaultOptRolesSeq;
+
+// if( aDefaultOptRolesSeq.getLength() == 0 )
+// {
+// aDefaultOptRolesSeq.realloc( 1 );
+// aDefaultOptRolesSeq[0] = C2U( "error-bars-y" );
+// }
+
+ return aDefaultOptRolesSeq;
+}
+
+OUString SAL_CALL ChartType::getRoleOfSequenceForSeriesLabel()
+ throw (uno::RuntimeException)
+{
+ return C2U( "values-y" );
+}
+
+void ChartType::impl_addDataSeriesWithoutNotification(
+ const Reference< chart2::XDataSeries >& xDataSeries )
+{
+ if( ::std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries )
+ != m_aDataSeries.end())
+ throw lang::IllegalArgumentException();
+
+ m_aDataSeries.push_back( xDataSeries );
+ ModifyListenerHelper::addListener( xDataSeries, m_xModifyEventForwarder );
+}
+
+// ____ XDataSeriesContainer ____
+void SAL_CALL ChartType::addDataSeries( const Reference< chart2::XDataSeries >& xDataSeries )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ impl_addDataSeriesWithoutNotification( xDataSeries );
+ fireModifyEvent();
+}
+
+void SAL_CALL ChartType::removeDataSeries( const Reference< chart2::XDataSeries >& xDataSeries )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ if( !xDataSeries.is())
+ throw container::NoSuchElementException();
+
+ tDataSeriesContainerType::iterator aIt(
+ ::std::find( m_aDataSeries.begin(), m_aDataSeries.end(), xDataSeries ) );
+
+ if( aIt == m_aDataSeries.end())
+ throw container::NoSuchElementException(
+ C2U( "The given series is no element of this charttype" ),
+ static_cast< uno::XWeak * >( this ));
+
+ ModifyListenerHelper::removeListener( xDataSeries, m_xModifyEventForwarder );
+ m_aDataSeries.erase( aIt );
+ fireModifyEvent();
+}
+
+Sequence< Reference< chart2::XDataSeries > > SAL_CALL ChartType::getDataSeries()
+ throw (uno::RuntimeException)
+{
+ return ContainerHelper::ContainerToSequence( m_aDataSeries );
+}
+
+void SAL_CALL ChartType::setDataSeries( const Sequence< Reference< chart2::XDataSeries > >& aDataSeries )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ m_bNotifyChanges = false;
+ try
+ {
+ Sequence< Reference< chart2::XDataSeries > > aOldSeries( this->getDataSeries() );
+ for( sal_Int32 nN=0; nN<aOldSeries.getLength(); ++nN )
+ ModifyListenerHelper::removeListener( aOldSeries[nN], m_xModifyEventForwarder );
+ m_aDataSeries.clear();
+
+ for( sal_Int32 i=0; i<aDataSeries.getLength(); ++i )
+ impl_addDataSeriesWithoutNotification( aDataSeries[i] );
+ }
+ catch( ... )
+ {
+ m_bNotifyChanges = true;
+ throw;
+ }
+ m_bNotifyChanges = true;
+ fireModifyEvent();
+}
+
+// ____ OPropertySet ____
+uno::Any ChartType::GetDefaultValue( sal_Int32 /* nHandle */ ) const
+ throw(beans::UnknownPropertyException)
+{
+ return uno::Any();
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL ChartType::getInfoHelper()
+{
+ // using assignment for broken gcc 3.3
+ static ::cppu::OPropertyArrayHelper aArrayHelper = ::cppu::OPropertyArrayHelper(
+ Sequence< beans::Property >(), /* bSorted */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL ChartType::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL ChartType::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ChartType::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL ChartType::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void ChartType::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void ChartType::fireModifyEvent()
+{
+ if( m_bNotifyChanges )
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+using impl::ChartType_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( ChartType, ChartType_Base, ::property::OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ChartType, ChartType_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/ChartType.hxx b/chart2/source/model/template/ChartType.hxx
new file mode 100644
index 000000000000..07e72ea2890b
--- /dev/null
+++ b/chart2/source/model/template/ChartType.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTTYPE_HXX
+#define CHART_CHARTTYPE_HXX
+
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/uno3.hxx>
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+#include <vector>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::chart2::XChartType,
+ ::com::sun::star::chart2::XDataSeriesContainer,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ ChartType_Base;
+}
+
+class ChartType :
+ public MutexContainer,
+ public impl::ChartType_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit ChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~ChartType();
+
+protected:
+ explicit ChartType( const ChartType & rOther );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
+ // ____ XChartType ____
+ // still abstract ! implement !
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedOptionalRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDataSeriesContainer ____
+ virtual void SAL_CALL addDataSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeDataSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& aDataSeries )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > SAL_CALL getDataSeries()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataSeries(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aDataSeries )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void fireModifyEvent();
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual void firePropertyChangeEvent();
+ using OPropertySet::disposing;
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+// virtual sal_Bool SAL_CALL convertFastPropertyValue
+// ( ::com::sun::star::uno::Any & rConvertedValue,
+// ::com::sun::star::uno::Any & rOldValue,
+// sal_Int32 nHandle,
+// const ::com::sun::star::uno::Any& rValue )
+// throw (::com::sun::star::lang::IllegalArgumentException);
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+ // not implemented
+// ____ XCloneable ____
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+// throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+
+private:
+ void impl_addDataSeriesWithoutNotification(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& aDataSeries );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ typedef
+ ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > >
+ tDataSeriesContainerType;
+
+ tDataSeriesContainerType m_aDataSeries;
+
+ bool m_bNotifyChanges;
+};
+
+} // namespace chart
+
+// CHART_CHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
new file mode 100644
index 000000000000..d34617ffce1f
--- /dev/null
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -0,0 +1,619 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartTypeManager.hxx"
+#include "macros.hxx"
+#include "StackMode.hxx"
+#include "ContainerHelper.hxx"
+
+#include "CartesianCoordinateSystem.hxx"
+
+#include "LineChartTypeTemplate.hxx"
+#include "BarChartTypeTemplate.hxx"
+#include "ColumnLineChartTypeTemplate.hxx"
+#include "AreaChartTypeTemplate.hxx"
+#include "PieChartTypeTemplate.hxx"
+#include "ScatterChartTypeTemplate.hxx"
+#include "StockChartTypeTemplate.hxx"
+#include "NetChartTypeTemplate.hxx"
+#include "BubbleChartTypeTemplate.hxx"
+#include <cppuhelper/component_context.hxx>
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/chart/ChartSolidType.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+#include <algorithm>
+#include <iterator>
+#include <functional>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+// ======================================================================
+
+namespace
+{
+
+enum TemplateId
+{
+ TEMPLATE_SYMBOL,
+ TEMPLATE_STACKEDSYMBOL,
+ TEMPLATE_PERCENTSTACKEDSYMBOL,
+ TEMPLATE_LINE,
+ TEMPLATE_STACKEDLINE,
+ TEMPLATE_PERCENTSTACKEDLINE,
+ TEMPLATE_LINESYMBOL,
+ TEMPLATE_STACKEDLINESYMBOL,
+ TEMPLATE_PERCENTSTACKEDLINESYMBOL,
+ TEMPLATE_THREEDLINE,
+ TEMPLATE_STACKEDTHREEDLINE,
+ TEMPLATE_PERCENTSTACKEDTHREEDLINE,
+ TEMPLATE_THREEDLINEDEEP,
+ TEMPLATE_COLUMN,
+ TEMPLATE_STACKEDCOLUMN,
+ TEMPLATE_PERCENTSTACKEDCOLUMN,
+ TEMPLATE_BAR,
+ TEMPLATE_STACKEDBAR,
+ TEMPLATE_PERCENTSTACKEDBAR,
+ TEMPLATE_THREEDCOLUMNDEEP,
+ TEMPLATE_THREEDCOLUMNFLAT,
+ TEMPLATE_STACKEDTHREEDCOLUMNFLAT,
+ TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT,
+ TEMPLATE_THREEDBARDEEP,
+ TEMPLATE_THREEDBARFLAT,
+ TEMPLATE_STACKEDTHREEDBARFLAT,
+ TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT,
+ TEMPLATE_COLUMNWITHLINE,
+ TEMPLATE_STACKEDCOLUMNWITHLINE,
+ TEMPLATE_AREA,
+ TEMPLATE_STACKEDAREA,
+ TEMPLATE_PERCENTSTACKEDAREA,
+ TEMPLATE_THREEDAREA,
+ TEMPLATE_STACKEDTHREEDAREA,
+ TEMPLATE_PERCENTSTACKEDTHREEDAREA,
+ TEMPLATE_PIE,
+ TEMPLATE_PIEALLEXPLODED,
+ TEMPLATE_DONUT,
+ TEMPLATE_DONUTALLEXPLODED,
+ TEMPLATE_THREEDPIE,
+ TEMPLATE_THREEDPIEALLEXPLODED,
+ TEMPLATE_THREEDDONUT,
+ TEMPLATE_THREEDDONUTALLEXPLODED,
+ TEMPLATE_SCATTERLINESYMBOL,
+ TEMPLATE_SCATTERLINE,
+ TEMPLATE_SCATTERSYMBOL,
+ TEMPLATE_THREEDSCATTER,
+ TEMPLATE_NET,
+ TEMPLATE_NETSYMBOL,
+ TEMPLATE_NETLINE,
+ TEMPLATE_STACKEDNET,
+ TEMPLATE_STACKEDNETSYMBOL,
+ TEMPLATE_STACKEDNETLINE,
+ TEMPLATE_PERCENTSTACKEDNET,
+ TEMPLATE_PERCENTSTACKEDNETSYMBOL,
+ TEMPLATE_PERCENTSTACKEDNETLINE,
+ TEMPLATE_FILLEDNET,
+ TEMPLATE_STACKEDFILLEDNET,
+ TEMPLATE_PERCENTSTACKEDFILLEDNET,
+ TEMPLATE_STOCKLOWHIGHCLOSE,
+ TEMPLATE_STOCKOPENLOWHIGHCLOSE,
+ TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
+ TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
+ TEMPLATE_BUBBLE,
+// TEMPLATE_SURFACE,
+// TEMPLATE_ADDIN,
+ TEMPLATE_NOT_FOUND = 0xffff
+};
+
+typedef ::std::map< OUString, TemplateId > tTemplateMapType;
+
+const tTemplateMapType & lcl_DefaultChartTypeMap()
+{
+ static const tTemplateMapType aMap = tTemplateMapType(
+ ::comphelper::MakeMap< tTemplateMapType::key_type, tTemplateMapType::mapped_type >
+ ( C2U( "com.sun.star.chart2.template.Symbol" ), TEMPLATE_SYMBOL )
+ ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), TEMPLATE_STACKEDSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), TEMPLATE_PERCENTSTACKEDSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.Line" ), TEMPLATE_LINE )
+ ( C2U( "com.sun.star.chart2.template.StackedLine" ), TEMPLATE_STACKEDLINE )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), TEMPLATE_PERCENTSTACKEDLINE )
+ ( C2U( "com.sun.star.chart2.template.LineSymbol" ), TEMPLATE_LINESYMBOL )
+ ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), TEMPLATE_STACKEDLINESYMBOL )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), TEMPLATE_PERCENTSTACKEDLINESYMBOL )
+ ( C2U( "com.sun.star.chart2.template.ThreeDLine" ), TEMPLATE_THREEDLINE )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), TEMPLATE_STACKEDTHREEDLINE )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), TEMPLATE_PERCENTSTACKEDTHREEDLINE )
+ ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), TEMPLATE_THREEDLINEDEEP )
+ ( C2U( "com.sun.star.chart2.template.Column" ), TEMPLATE_COLUMN )
+ ( C2U( "com.sun.star.chart2.template.StackedColumn" ), TEMPLATE_STACKEDCOLUMN )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), TEMPLATE_PERCENTSTACKEDCOLUMN )
+ ( C2U( "com.sun.star.chart2.template.Bar" ), TEMPLATE_BAR )
+ ( C2U( "com.sun.star.chart2.template.StackedBar" ), TEMPLATE_STACKEDBAR )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), TEMPLATE_PERCENTSTACKEDBAR )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), TEMPLATE_THREEDCOLUMNDEEP )
+ ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), TEMPLATE_THREEDCOLUMNFLAT )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), TEMPLATE_STACKEDTHREEDCOLUMNFLAT )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), TEMPLATE_THREEDBARDEEP )
+ ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), TEMPLATE_THREEDBARFLAT )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), TEMPLATE_STACKEDTHREEDBARFLAT )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT )
+ ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), TEMPLATE_COLUMNWITHLINE )
+ ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), TEMPLATE_STACKEDCOLUMNWITHLINE )
+ ( C2U( "com.sun.star.chart2.template.Area" ), TEMPLATE_AREA )
+ ( C2U( "com.sun.star.chart2.template.StackedArea" ), TEMPLATE_STACKEDAREA )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), TEMPLATE_PERCENTSTACKEDAREA )
+ ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), TEMPLATE_THREEDAREA )
+ ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), TEMPLATE_STACKEDTHREEDAREA )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), TEMPLATE_PERCENTSTACKEDTHREEDAREA )
+ ( C2U( "com.sun.star.chart2.template.Pie" ), TEMPLATE_PIE )
+ ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), TEMPLATE_PIEALLEXPLODED )
+ ( C2U( "com.sun.star.chart2.template.Donut" ), TEMPLATE_DONUT )
+ ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), TEMPLATE_DONUTALLEXPLODED )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), TEMPLATE_THREEDPIE )
+ ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), TEMPLATE_THREEDPIEALLEXPLODED )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), TEMPLATE_THREEDDONUT )
+ ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), TEMPLATE_THREEDDONUTALLEXPLODED )
+ ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), TEMPLATE_SCATTERLINESYMBOL )
+ ( C2U( "com.sun.star.chart2.template.ScatterLine" ), TEMPLATE_SCATTERLINE )
+ ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), TEMPLATE_SCATTERSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), TEMPLATE_THREEDSCATTER )
+ ( C2U( "com.sun.star.chart2.template.Net" ), TEMPLATE_NET )
+ ( C2U( "com.sun.star.chart2.template.NetSymbol" ), TEMPLATE_NETSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.NetLine" ), TEMPLATE_NETLINE )
+ ( C2U( "com.sun.star.chart2.template.StackedNet" ), TEMPLATE_STACKEDNET )
+ ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), TEMPLATE_STACKEDNETSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), TEMPLATE_STACKEDNETLINE )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE )
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE )
+// ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
+// ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
+ );
+
+ return aMap;
+}
+
+TemplateId lcl_GetTemplateIdForService( const OUString & rServiceName )
+{
+ TemplateId eResult = TEMPLATE_NOT_FOUND;
+ const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
+ tTemplateMapType::const_iterator aIt( rMap.find( rServiceName ));
+
+ if( aIt != rMap.end())
+ eResult = (*aIt).second;
+
+ return eResult;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ChartTypeManager::ChartTypeManager(
+ uno::Reference<
+ uno::XComponentContext > const & xContext ) :
+ m_xContext( xContext )
+{}
+
+ChartTypeManager::~ChartTypeManager()
+{}
+
+// ____ XMultiServiceFactory ____
+uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
+ const OUString& aServiceSpecifier )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xResult;
+ TemplateId nId = lcl_GetTemplateIdForService( aServiceSpecifier );
+
+ if( nId == TEMPLATE_NOT_FOUND )
+ {
+ try
+ {
+ xResult = m_xContext->getServiceManager()->createInstanceWithContext(
+ aServiceSpecifier, m_xContext );
+ }
+// catch( registry::InvalidValueException & ex )
+ catch( uno::Exception & ex )
+ {
+ // couldn't create service via factory
+
+ // 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.
+ ASSERT_EXCEPTION( ex );
+ OSL_TRACE( "Couldn't instantiate service \"%s\"", U2C( aServiceSpecifier ));
+ xResult.set( 0 );
+ }
+ }
+ 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_Y_STACKED, true, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDSYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDLINESYMBOL:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, false, true, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDLINE:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, false, true, 3 ));
+ break;
+ case TEMPLATE_THREEDLINEDEEP:
+ xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Z_STACKED, 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_Y_STACKED, BarChartTypeTemplate::VERTICAL ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDCOLUMN:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, BarChartTypeTemplate::HORIZONTAL ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDBAR:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::HORIZONTAL ));
+ break;
+ case TEMPLATE_THREEDCOLUMNDEEP:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Z_STACKED, 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_Y_STACKED, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::VERTICAL, 3 ));
+ break;
+ case TEMPLATE_THREEDBARDEEP:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Z_STACKED, 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_Y_STACKED, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT:
+ xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, BarChartTypeTemplate::HORIZONTAL, 3 ));
+ break;
+
+ // Combi-Chart Line/Column
+ case TEMPLATE_COLUMNWITHLINE:
+ case TEMPLATE_STACKEDCOLUMNWITHLINE:
+ {
+ StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE )
+ ? StackMode_NONE
+ : StackMode_Y_STACKED;
+
+ xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 ));
+ }
+ 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_Y_STACKED ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED_PERCENT ));
+ break;
+ case TEMPLATE_THREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Z_STACKED, 3 ));
+ break;
+ case TEMPLATE_STACKEDTHREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED, 3 ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDTHREEDAREA:
+ xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, true ));
+ break;
+ case TEMPLATE_STACKEDNETSYMBOL:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED, true, false ));
+ break;
+ case TEMPLATE_STACKEDNETLINE:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED, false, true ));
+ break;
+
+ case TEMPLATE_PERCENTSTACKEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDNETSYMBOL:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, true, false ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDNETLINE:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, 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_Y_STACKED, false, false, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, false, false, true ));
+ break;
+
+ case TEMPLATE_STOCKLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::LOW_HI_CLOSE, false ));
+ break;
+ case TEMPLATE_STOCKOPENLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::OPEN_LOW_HI_CLOSE, true ));
+ break;
+ case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::VOL_LOW_HI_CLOSE, false ));
+ break;
+ case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE:
+ xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE, true ));
+ break;
+
+ //BubbleChart
+ case TEMPLATE_BUBBLE:
+ xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
+ break;
+
+// case TEMPLATE_SURFACE:
+// case TEMPLATE_ADDIN:
+// break;
+
+ case TEMPLATE_NOT_FOUND:
+ OSL_ASSERT( false );
+ break;
+ }
+ xResult.set( xTemplate, uno::UNO_QUERY );
+ }
+
+ return xResult;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstanceWithArguments(
+ const OUString& ServiceSpecifier,
+ const uno::Sequence< uno::Any >& /* Arguments */ )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "createInstanceWithArguments: No arguments supported" );
+ return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< OUString > SAL_CALL ChartTypeManager::getAvailableServiceNames()
+ throw (uno::RuntimeException)
+{
+ ::std::vector< OUString > aServices;
+ const tTemplateMapType & rMap = lcl_DefaultChartTypeMap();
+ aServices.reserve( rMap.size());
+
+ // get own default templates
+ ::std::transform( rMap.begin(), rMap.end(), ::std::back_inserter( aServices ),
+ ::std::select1st< tTemplateMapType::value_type >());
+
+ // add components that were registered in the context's factory
+ uno::Reference< container::XContentEnumerationAccess > xEnumAcc(
+ m_xContext->getServiceManager(), uno::UNO_QUERY );
+ if( xEnumAcc.is())
+ {
+ uno::Reference< container::XEnumeration > xEnum(
+ xEnumAcc->createContentEnumeration( C2U( "com.sun.star.chart2.ChartTypeTemplate" ) ));
+ if( xEnum.is())
+ {
+ uno::Reference< uno::XInterface > xFactIntf;
+
+ while( xEnum->hasMoreElements())
+ {
+ if( xEnum->nextElement() >>= xFactIntf )
+ {
+ uno::Reference< lang::XServiceName > xServiceName( xFactIntf, uno::UNO_QUERY );
+ if( xServiceName.is())
+ aServices.push_back( xServiceName->getServiceName());
+ }
+ }
+ }
+ }
+
+ return ContainerHelper::ContainerToSequence( aServices );
+}
+
+// ____ XServiceInfo ____
+Sequence< OUString > ChartTypeManager::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.ChartTypeManager" );
+ aServices[ 1 ] = C2U( "com.sun.star.lang.MultiServiceFactory" );
+ return aServices;
+}
+
+// ================================================================================
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartTypeManager,
+ C2U( "com.sun.star.comp.chart.ChartTypeManager" ));
+} // namespace chart
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
new file mode 100644
index 000000000000..e3943e9eb45f
--- /dev/null
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -0,0 +1,933 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartTypeTemplate.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DataInterpreter.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "LegendHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartDebugTrace.hxx"
+#include "AxisIndexDefines.hxx"
+#include <cppuhelper/component_context.hxx>
+#include <com/sun/star/chart/ChartSolidType.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+#include <algorithm>
+#include <iterator>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+
+// ======================================================================
+
+namespace
+{
+
+void lcl_applyDefaultStyle(
+ const Reference< XDataSeries > & xSeries,
+ sal_Int32 nIndex,
+ const Reference< XDiagram > & 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(
+ C2U("Color"),
+ uno::makeAny( xColorScheme->getColorByIndex( nIndex )));
+ }
+}
+
+void lcl_ensureCorrectLabelPlacement( const Reference< beans::XPropertySet >& xProp, const uno::Sequence < sal_Int32 >& rAvailablePlacements )
+{
+ sal_Int32 nLabelPlacement=0;
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement) )
+ {
+ bool bValid = false;
+ for( sal_Int32 nN = 0; nN < rAvailablePlacements.getLength(); nN++ )
+ {
+ if( rAvailablePlacements[nN] == nLabelPlacement )
+ {
+ bValid = true;
+ break;
+ }
+ }
+ if( !bValid )
+ {
+ uno::Any aNewValue;
+ //otherwise use the first supported one
+ if( rAvailablePlacements.getLength() )
+ aNewValue <<=rAvailablePlacements[0];
+ xProp->setPropertyValue( C2U("LabelPlacement"), aNewValue );
+ }
+ }
+}
+
+void lcl_resetLabelPlacementIfDefault( const Reference< beans::XPropertySet >& xProp, sal_Int32 nDefaultPlacement )
+{
+
+ sal_Int32 nLabelPlacement=0;
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement) )
+ {
+ if( nDefaultPlacement == nLabelPlacement )
+ xProp->setPropertyValue( C2U("LabelPlacement"), uno::Any() );
+ }
+}
+
+void lcl_ensureCorrectMissingValueTreatment( const Reference< chart2::XDiagram >& xDiagram, const Reference< XChartType >& xChartType )
+{
+ Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is() )
+ {
+ uno::Sequence < sal_Int32 > aAvailableMissingValueTreatment(
+ ::chart::ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) );
+
+ if( aAvailableMissingValueTreatment.getLength() )
+ xDiaProp->setPropertyValue( C2U( "MissingValueTreatment" ), uno::makeAny( aAvailableMissingValueTreatment[0] ) );
+ else
+ xDiaProp->setPropertyValue( C2U( "MissingValueTreatment" ), uno::Any() );
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ChartTypeTemplate::ChartTypeTemplate(
+ Reference< uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName ) :
+ m_xContext( xContext ),
+ m_aServiceName( rServiceName )
+{
+}
+
+ChartTypeTemplate::~ChartTypeTemplate()
+{}
+
+// ____ XChartTypeTemplate ____
+uno::Reference< XDiagram > SAL_CALL ChartTypeTemplate::createDiagramByDataSource(
+ const uno::Reference< data::XDataSource >& xDataSource,
+ const uno::Sequence< beans::PropertyValue >& aArguments )
+ throw (uno::RuntimeException)
+{
+ Reference< XDiagram > xDia;
+
+ try
+ {
+ // create diagram
+ xDia.set(
+ GetComponentContext()->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.Diagram" ),
+ GetComponentContext() ),
+ uno::UNO_QUERY_THROW );
+
+ // modify diagram
+ Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
+ chart2::InterpretedData aData(
+ xInterpreter->interpretDataSource(
+ xDataSource, aArguments, Sequence< Reference< XDataSeries > >() ));
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries( aData.Series );
+ sal_Int32 i, j, nCount = 0;
+ for( i=0; i<aSeries.getLength(); ++i )
+ {
+ for( j=0; j<aSeries[i].getLength(); ++j, ++nCount )
+ lcl_applyDefaultStyle( aSeries[i][j], nCount, xDia );
+ }
+
+ Sequence< Reference< XChartType > > aOldChartTypesSeq;
+ FillDiagram( xDia, aData.Series, aData.Categories, aOldChartTypesSeq, true );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xDia;
+}
+
+sal_Bool SAL_CALL ChartTypeTemplate::supportsCategories()
+ throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL ChartTypeTemplate::changeDiagram( const uno::Reference< XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ 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();
+
+ // chart-type specific interpretation of existing data series
+ Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
+ chart2::InterpretedData aData;
+ aData.Series = aSeriesSeq;
+ aData.Categories = DiagramHelper::getCategoriesFromDiagram( xDiagram );
+
+ if( xInterpreter->isDataCompatible( aData ) )
+ {
+ aData = xInterpreter->reinterpretDataSeries( aData );
+ }
+ else
+ {
+ Reference< data::XDataSource > xSource( xInterpreter->mergeInterpretedData( aData ));
+ // todo: get a "range-union" from the data provider by calling
+ // OUString aRange = getRangeRepresentationByData( xSource );
+ // xSource.set( getDataByRangeRepresentation( aRange, aParam ));
+ // where aParam == ??
+ Sequence< beans::PropertyValue > aParam;
+ if( aData.Categories.is())
+ {
+ aParam.realloc( 1 );
+ aParam[0] = beans::PropertyValue( C2U("HasCategories"), -1, uno::makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE );
+ }
+ aData = xInterpreter->interpretDataSource( xSource, aParam, aFlatSeriesSeq );
+ }
+ 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 )
+ {
+ if( nIndex >= nFormerSeriesCount )
+ lcl_applyDefaultStyle( aSeriesSeq[i][j], nIndex, xDiagram );
+ }
+
+ // remove charttype groups from all coordinate systems
+ Sequence< Reference< XChartType > > aOldChartTypesSeq(
+ DiagramHelper::getChartTypesFromDiagram(xDiagram) );
+
+ Reference< XCoordinateSystemContainer > xCoordSysCnt( xDiagram, uno::UNO_QUERY );
+ OSL_ASSERT( xCoordSysCnt.is());
+ if( xCoordSysCnt.is())
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCoordSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx = 0; nCooSysIdx < aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< XChartTypeContainer > xContainer( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY );
+ if( xContainer.is() )
+ xContainer->setChartTypes( Sequence< Reference< XChartType > >() );
+ }
+ }
+
+ FillDiagram( xDiagram, aSeriesSeq, aData.Categories, aOldChartTypesSeq, false );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL ChartTypeTemplate::changeDiagramData(
+ const Reference< chart2::XDiagram >& xDiagram,
+ const Reference< chart2::data::XDataSource >& xDataSource,
+ const Sequence< beans::PropertyValue >& aArguments )
+ throw (uno::RuntimeException)
+{
+ if( ! (xDiagram.is() &&
+ xDataSource.is()) )
+ return;
+
+ try
+ {
+ // interpret new data and re-use existing series
+ Sequence< Reference< XDataSeries > > aFlatSeriesSeq(
+ ::chart::ContainerHelper::ContainerToSequence( DiagramHelper::getDataSeriesFromDiagram( xDiagram )));
+ const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.getLength();
+ Reference< chart2::XDataInterpreter > xInterpreter( getDataInterpreter());
+ chart2::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 )
+ {
+ if( nIndex >= nFormerSeriesCount )
+ {
+ lcl_applyDefaultStyle( aSeriesSeq[i][j], nIndex, xDiagram );
+ applyStyle( aSeriesSeq[i][j], i, j, aSeriesSeq[i].getLength() );
+ }
+ }
+
+ // categories
+ DiagramHelper::setCategoriesToDiagram( aData.Categories, xDiagram, true, supportsCategories() );
+
+ Sequence< Reference< XChartType > > aChartTypes(
+ DiagramHelper::getChartTypesFromDiagram( xDiagram ));
+ sal_Int32 nMax = ::std::min( aChartTypes.getLength(), aSeriesSeq.getLength());
+ for( i=0; i<nMax; ++i )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( aChartTypes[i], uno::UNO_QUERY_THROW );
+ xDSCnt->setDataSeries( aSeriesSeq[i] );
+ }
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+ OSL_TRACE( "ChartTypeTemplate::changeDiagramData: Showing Diagram structure" );
+ OSL_TRACE( "---------------------------------------------------------------" );
+ debug::ChartDebugTraceDiagram( xDiagram );
+#endif
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool /* bAdaptProperties */ )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = sal_False;
+
+ if( ! xDiagram.is())
+ return bResult;
+
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+
+ // need to have at least one coordinate system
+ bResult = (aCooSysSeq.getLength() > 0);
+ if( bResult )
+ {
+ Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
+ const OUString aChartTypeToMatch( getChartTypeForNewSeries(aFormerlyUsedChartTypes)->getChartType());
+ const sal_Int32 nDimensionToMatch = getDimension();
+ for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++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 )
+ {
+ // match chart type
+ bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType().equals( aChartTypeToMatch );
+ bool bFound=false;
+ bool bAmbiguous=false;
+ // match stacking mode
+ bResult = bResult &&
+ ( DiagramHelper::getStackModeFromChartType(
+ aChartTypeSeq[nCTIdx], bFound, bAmbiguous,
+ aCooSysSeq[nCooSysIdx] )
+ == getStackMode( nCTIdx ) );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XDataInterpreter > SAL_CALL ChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new DataInterpreter( GetComponentContext() ) );
+
+ return m_xDataInterpreter;
+}
+
+void SAL_CALL ChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 /* nSeriesIndex */,
+ ::sal_Int32 /* nSeriesCount */ )
+ throw (uno::RuntimeException)
+{
+ // sset stacking mode
+ Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ {
+ try
+ {
+ StackMode eStackMode = getStackMode( nChartTypeIndex );
+ const uno::Any aPropValue = uno::makeAny(
+ ( (eStackMode == StackMode_Y_STACKED) ||
+ (eStackMode == StackMode_Y_STACKED_PERCENT) )
+ ? chart2::StackingDirection_Y_STACKING
+ : (eStackMode == StackMode_Z_STACKED )
+ ? chart2::StackingDirection_Z_STACKING
+ : chart2::StackingDirection_NO_STACKING );
+ xSeriesProp->setPropertyValue( C2U("StackingDirection"), aPropValue );
+
+ //ensure valid label placement
+ {
+ uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ getChartTypeForIndex( nChartTypeIndex ), getDimension(), isSwapXAndY(), xSeries ) );
+ lcl_ensureCorrectLabelPlacement( xSeriesProp, aAvailablePlacements );
+
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ lcl_ensureCorrectLabelPlacement( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), aAvailablePlacements );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void SAL_CALL ChartTypeTemplate::applyStyles( const Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ // 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 )
+ {
+ const sal_Int32 nNumSeries = aNewSeriesSeq[i].getLength();
+ for( sal_Int32 j=0; j<nNumSeries; ++j )
+ applyStyle( 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 )
+ throw (uno::RuntimeException)
+{
+ // reset number format if we had percent stacking on
+ sal_Bool bPercent = (getStackMode(0) == StackMode_Y_STACKED_PERCENT);
+ if( bPercent )
+ {
+ Sequence< Reference< chart2::XAxis > > aAxisSeq( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 i=0; i<aAxisSeq.getLength(); ++i )
+ {
+ if( 1== AxisHelper::getDimensionIndexOfAxis( aAxisSeq[i], xDiagram ) )
+ {
+ Reference< beans::XPropertySet > xAxisProp( aAxisSeq[i], uno::UNO_QUERY );
+ if( xAxisProp.is())
+ {
+ // set number format to source format
+ uno::Any aValue( xAxisProp->getPropertyValue(C2U("NumberFormat")));
+ if( aValue.hasValue())
+ xAxisProp->setPropertyValue(C2U("NumberFormat"), uno::Any());
+ }
+ }
+ }
+ }
+
+ //reset label placement if default
+ {
+ uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( xCooSysContainer.is() )
+ {
+ uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; 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() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
+
+ //iterate through all series in this chart type
+ uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
+ OSL_ASSERT( xDataSeriesContainer.is());
+ if( !xDataSeriesContainer.is() )
+ continue;
+
+ uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
+ for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
+ {
+ Reference< XDataSeries > xSeries(aSeriesList[nS]);
+ Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ if(!xSeries.is() || !xSeriesProp.is() )
+ continue;
+
+ uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ xChartType, getDimension(), isSwapXAndY(), xSeries ) );
+ if(!aAvailablePlacements.getLength())
+ continue;
+
+ sal_Int32 nDefaultPlacement = aAvailablePlacements[0];
+
+ lcl_resetLabelPlacementIfDefault( xSeriesProp, nDefaultPlacement );
+
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ lcl_resetLabelPlacementIfDefault( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), nDefaultPlacement );
+ }
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+// ____ XServiceName ____
+ ::rtl::OUString SAL_CALL ChartTypeTemplate::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return m_aServiceName;
+}
+
+// ________________________________________
+
+sal_Int32 ChartTypeTemplate::getDimension() const
+{
+ return 2;
+}
+
+StackMode ChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return StackMode_NONE;
+}
+
+bool ChartTypeTemplate::isSwapXAndY() const
+{
+ return false;
+}
+
+// ________________________________________
+
+void ChartTypeTemplate::createCoordinateSystems(
+ const Reference< chart2::XCoordinateSystemContainer > & xOutCooSysCnt )
+{
+ if( ! xOutCooSysCnt.is())
+ return;
+ Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
+ Reference< XChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes));
+ if( ! xChartType.is())
+ return;
+ Reference< XCoordinateSystem > xCooSys( xChartType->createCoordinateSystem( getDimension()));
+ if( ! xCooSys.is())
+ {
+ // chart type wants no coordinate systems
+ xOutCooSysCnt->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 ));
+ if( xAxis.is())
+ AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ }
+
+ Sequence< Reference< XCoordinateSystem > > aCoordinateSystems(
+ xOutCooSysCnt->getCoordinateSystems());
+
+ if( aCoordinateSystems.getLength())
+ {
+ bool bOk = true;
+ for( sal_Int32 i=0; bOk && i<aCoordinateSystems.getLength(); ++i )
+ bOk = bOk && ( xCooSys->getCoordinateSystemType().equals( aCoordinateSystems[i]->getCoordinateSystemType()) &&
+ (xCooSys->getDimension() == aCoordinateSystems[i]->getDimension()) );
+ // coordinate systems are ok
+ if( bOk )
+ return;
+ // there are coordinate systems but they do not fit. So overwrite them.
+ }
+
+ //copy as much info from former coordinate system as possible:
+ if( aCoordinateSystems.getLength() )
+ {
+ Reference< XCoordinateSystem > xOldCooSys( aCoordinateSystems[0] );
+ sal_Int32 nMaxDimensionCount = std::min( xCooSys->getDimension(), xOldCooSys->getDimension() );
+
+ for(sal_Int32 nDimensionIndex=0; nDimensionIndex<nMaxDimensionCount; nDimensionIndex++)
+ {
+ const sal_Int32 nMaximumAxisIndex = xOldCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
+ {
+ uno::Reference< XAxis > xAxis( xOldCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ if( xAxis.is())
+ {
+ xCooSys->setAxisByDimension( nDimensionIndex, xAxis, nAxisIndex );
+ }
+ }
+ }
+ }
+
+ // set new coordinate systems
+ aCoordinateSystems.realloc( 1 );
+ aCoordinateSystems[0] = xCooSys;
+
+ xOutCooSysCnt->setCoordinateSystems( aCoordinateSystems );
+}
+
+void ChartTypeTemplate::adaptScales(
+ const Sequence< Reference< chart2::XCoordinateSystem > > & 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( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ try
+ {
+ Reference< XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIdx] );
+ if( !xCooSys.is() )
+ continue;
+
+ // attach categories to first axis
+ sal_Int32 nDim( xCooSys->getDimension());
+ if( nDim > 0 )
+ {
+ const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(0);
+ for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
+ {
+ Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,nI) );
+ if( xAxis.is())
+ {
+ ScaleData aData( xAxis->getScaleData() );
+ aData.Categories = xCategories;
+ aData.AxisType = bSupportsCategories ? AxisType::CATEGORY : AxisType::REALNUMBER;
+ if( bSupportsCategories )
+ AxisHelper::removeExplicitScaling( aData );
+ xAxis->setScaleData( aData );
+ }
+ }
+ }
+ // set percent stacking mode at second axis
+ if( nDim > 1 )
+ {
+ const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(1);
+ for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
+ {
+ Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( 1,nI ));
+ if( xAxis.is())
+ {
+ sal_Bool bPercent = (getStackMode(0) == StackMode_Y_STACKED_PERCENT);
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+
+ if( bPercent != (aScaleData.AxisType==AxisType::PERCENT) )
+ {
+ if( bPercent )
+ aScaleData.AxisType = AxisType::PERCENT;
+ else
+ aScaleData.AxisType = AxisType::REALNUMBER;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void ChartTypeTemplate::adaptDiagram( const Reference< XDiagram > & /* xDiagram */ )
+{
+ return;
+}
+
+void ChartTypeTemplate::createAxes(
+ const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
+{
+ //create missing axes
+ if( rCoordSys.getLength() > 0 )
+ {
+ sal_Int32 nCooSysIdx = 0;
+ Reference< XCoordinateSystem > xCooSys( rCoordSys[nCooSysIdx] );
+ if(!xCooSys.is())
+ return;
+
+ //create main axis in first coordinate system
+ sal_Int32 nDimCount = xCooSys->getDimension();
+ sal_Int32 nDim=0;
+ for( nDim=0; nDim<nDimCount; ++nDim )
+ {
+ sal_Int32 nAxisCount = getAxisCountByDimension( nDim );
+ if( nDim == 1 &&
+ nAxisCount < 2 && AxisHelper::isSecondaryYAxisNeeded( xCooSys ))
+ nAxisCount = 2;
+ for( sal_Int32 nAxisIndex = 0; nAxisIndex < nAxisCount; ++nAxisIndex )
+ {
+ Reference< XAxis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys );
+ if( !xAxis.is())
+ {
+ // create and add axis
+ xAxis.set( AxisHelper::createAxis(
+ nDim, nAxisIndex, xCooSys, GetComponentContext() ));
+ }
+ }
+ }
+ }
+}
+
+void ChartTypeTemplate::adaptAxes(
+ const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
+{
+ //adapt properties of exsisting axes and remove superfluous axes
+
+ if( rCoordSys.getLength() > 0 )
+ {
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx < rCoordSys.getLength(); ++nCooSysIdx )
+ {
+ Reference< XCoordinateSystem > xCooSys( rCoordSys[nCooSysIdx] );
+ if( !xCooSys.is() )
+ continue;
+ sal_Int32 nDimCount = xCooSys->getDimension();
+ for( sal_Int32 nDim=0; nDim<nDimCount; ++nDim )
+ {
+ sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension( nDim );
+ for( sal_Int32 nAxisIndex=0; nAxisIndex<=nMaxAxisIndex; nAxisIndex++ )
+ {
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ) );
+ if( !xAxis.is() )
+ continue;
+
+ if( nAxisIndex == MAIN_AXIS_INDEX || nAxisIndex == SECONDARY_AXIS_INDEX )
+ {
+ // adapt scales
+ sal_Bool bPercent = (getStackMode(0) == StackMode_Y_STACKED_PERCENT);
+ if( bPercent && nDim == 1 )
+ {
+ Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY );
+ if( xAxisProp.is())
+ {
+ // set number format to source format
+ uno::Any aValue( xAxisProp->getPropertyValue(C2U("NumberFormat")));
+ if( aValue.hasValue())
+ xAxisProp->setPropertyValue(C2U("NumberFormat"), uno::Any());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+sal_Int32 ChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
+{
+ return (nDimension < getDimension()) ? 1 : 0;
+}
+
+void ChartTypeTemplate::FillDiagram(
+ const Reference< XDiagram >& xDiagram,
+ const Sequence< Sequence< Reference< XDataSeries > > >& aSeriesSeq,
+ Reference< data::XLabeledDataSequence > xCategories,
+ const Sequence< Reference< XChartType > >& aOldChartTypesSeq,
+ bool /* bCreate */ )
+{
+ adaptDiagram( xDiagram );
+
+ try
+ {
+ // create coordinate systems and scales
+ Reference< XCoordinateSystemContainer > xCoordSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ createCoordinateSystems( xCoordSysCnt );
+ Sequence< Reference< XCoordinateSystem > > aCoordinateSystems( xCoordSysCnt->getCoordinateSystems());
+ createAxes( aCoordinateSystems );
+ adaptAxes( aCoordinateSystems );
+ adaptScales( aCoordinateSystems, xCategories );
+
+ // chart types
+ createChartTypes( aSeriesSeq, aCoordinateSystems, aOldChartTypesSeq );
+ applyStyles( xDiagram );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+ OSL_TRACE( "ChartTypeTemplate::FillDiagram: Showing Diagram structure" );
+ OSL_TRACE( "---------------------------------------------------------" );
+ debug::ChartDebugTraceDiagram( xDiagram );
+#endif
+}
+
+void ChartTypeTemplate::createChartTypes(
+ const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
+ const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
+{
+ if( rCoordSys.getLength() == 0 ||
+ ! rCoordSys[0].is() )
+ return;
+
+ try
+ {
+ sal_Int32 nCooSysIdx=0;
+ Reference< XChartType > xCT;
+ if( aSeriesSeq.getLength() == 0 )
+ {
+ // 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 );
+ }
+ else
+ {
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeriesSeq.getLength(); ++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.getLength())
+ {
+ aCTSeq[0] = xCT;
+ xCTCnt->setChartTypes( aCTSeq );
+ }
+ else
+ xCTCnt->addChartType( xCT );
+
+ Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ xDSCnt->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::copy( aSeriesSeq[nSeriesIdx].getConstArray(),
+ aSeriesSeq[nSeriesIdx].getConstArray() + aSeriesSeq[nSeriesIdx].getLength(),
+ aNewSeriesSeq.getArray() + nNewStartIndex );
+ xDSCnt->setDataSeries( aNewSeriesSeq );
+ }
+
+ // spread the series over the available coordinate systems
+ if( rCoordSys.getLength() > (nCooSysIdx + 1) )
+ ++nCooSysIdx;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//static
+void ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(
+ const Sequence< Reference< XChartType > > & rOldChartTypesSeq,
+ const Reference< XChartType > & xNewChartType )
+{
+ Reference< beans::XPropertySet > xDestination( xNewChartType, uno::UNO_QUERY );
+ if( !xDestination.is() )
+ return;
+
+ OUString aNewChartType( xNewChartType->getChartType() );
+
+ Reference< beans::XPropertySet > xSource;
+ sal_Int32 nN=0;
+ for( nN=0; nN<rOldChartTypesSeq.getLength();++nN)
+ {
+ Reference< XChartType > xOldType( rOldChartTypesSeq[nN] );
+ if( xOldType.is() && xOldType->getChartType().equals( aNewChartType ) )
+ {
+ xSource.set( Reference< beans::XPropertySet >(xOldType, uno::UNO_QUERY ) );
+ if( xSource.is() )
+ break;
+ }
+ }
+ if( xSource.is() )
+ comphelper::copyProperties( xSource, xDestination );
+}
+
+// ________
+
+Sequence< OUString > ChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ aServices[ 1 ] = C2U( "com.sun.star.layout.LayoutElement" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+Reference< uno::XComponentContext > ChartTypeTemplate::GetComponentContext() const
+{
+ return m_xContext;
+}
+
+// ================================================================================
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartTypeTemplate,
+ C2U( "com.sun.star.comp.chart.ChartTypeTemplate" ));
+} // namespace chart
diff --git a/chart2/source/model/template/ChartTypeTemplate.hxx b/chart2/source/model/template/ChartTypeTemplate.hxx
new file mode 100644
index 000000000000..3f43e0ca6038
--- /dev/null
+++ b/chart2/source/model/template/ChartTypeTemplate.hxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTTYPETEMPLATE_HXX
+#define CHART_CHARTTYPETEMPLATE_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include "ServiceMacros.hxx"
+#include "DataInterpreter.hxx"
+#include "StackMode.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+
+#include <utility>
+
+namespace chart
+{
+
+/** For creating diagrams and modifying existing diagrams. A base class that
+ implements XChartTypeTemplate and offers some tooling for classes that
+ derive from this class.
+
+ createDiagramByDataSource
+ -------------------------
+
+ This does the following steps using some virtual helper-methods, that may be
+ overloaded by derived classes:
+
+ * creates an XDiagram via service-factory.
+
+ * convert the given XDataSource to a sequence of XDataSeries using the
+ method createDataSeries(). In this class the DataInterpreter helper class
+ is used to create a standard interpretation (just y-values).
+
+ * call applyDefaultStyle() for all XDataSeries in order to apply default
+ styles. In this class the series get the system-wide default colors as
+ "Color" property.
+
+ * call applyStyle() for applying chart-type specific styles to all series.
+ The default implementation is empty.
+
+ * call createCoordinateSystems() and apply them to the diagram. As
+ default one cartesian system with Scales using a linear Scaling is
+ created.
+
+ * createChartTypes() is called in order to define the structure of the
+ diagram. For details see comment of this function. As default this
+ method creates a tree where all series appear in one branch with the chart
+ type determined by getChartTypeForNewSeries(). The stacking is determined
+ via the method getStackMode().
+
+ * create an XLegend via the global service factory, set it at the diagram.
+ */
+class ChartTypeTemplate : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::chart2::XChartTypeTemplate,
+ ::com::sun::star::lang::XServiceName >
+{
+public:
+ explicit ChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName );
+ virtual ~ChartTypeTemplate();
+
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+// APPHELPER_SERVICE_FACTORY_HELPER( ChartTypeTemplate )
+
+protected:
+ // ____ XChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > SAL_CALL createDiagramByDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ /// denotes if the chart needs categories at the first scale
+ virtual sal_Bool SAL_CALL supportsCategories()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changeDiagram(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changeDiagramData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ ::sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ // still abstract: getChartTypeForNewSeries()
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //
+ virtual void SAL_CALL applyStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Methods to overload for automatic creation
+ // ------------------------------------------
+
+ /// returns 2 by default. Supported are 2 and 3
+ virtual sal_Int32 getDimension() const;
+
+ /** returns StackMode_NONE by default. This is a global flag used for all
+ series of a specific chart type. If percent stacking is supported, the
+ percent stacking mode is retrieved from the first chart type (index 0)
+
+ @param nChartTypeIndex denotes the index of the charttype in means
+ defined by the template creation order, i.e., 0 means the first
+ chart type that a template creates.
+ */
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex ) = 0;
+
+ virtual bool isSwapXAndY() const;
+
+ // Methods for creating the diagram piecewise
+ // ------------------------------------------
+
+ /** Allows derived classes to manipulate the diagramas whole, like changing
+ the wall color. The default implementation is empty. It is called by
+ FillDiagram which is called by createDiagramByDataSource and
+ changeDiagram
+ */
+ virtual void adaptDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ /** Creates a 2d or 3d cartesian coordinate system with mathematically
+ oriented, linear scales with auto-min/max. If the given
+ CoordinateSystemContainer is not empty, those coordinate system should
+ be reused.
+
+ <p>The dimension depends on the value returned by getDimension().</p>
+ */
+ virtual void createCoordinateSystems(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystemContainer > & xOutCooSysCnt );
+
+ /** Sets categories at the scales of dimension 0 and the percent stacking at
+ the scales of dimension 1 of all given coordinate systems.
+
+ <p>Called by FillDiagram.</p>
+ */
+ virtual void adaptScales(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories );
+
+ /** create a data series tree, that fits the requirements of the chart type.
+
+ <p>As default, this creates a tree with the following structure:</p>
+
+ <pre>
+ root
+ |
+ +-- chart type (determined by getChartTypeForNewSeries())
+ |
+ +-- category (DiscreteStackableScaleGroup using scale 0)
+ |
+ +-- values (ContinuousStackableScaleGroup using scale 1)
+ |
+ +-- series 0
+ |
+ +-- series 1
+ |
+ ...
+ |
+ +.. series n-1
+ </pre>
+
+ <p>If there are less than two scales available the returned tree is
+ empty.</p>
+ */
+ virtual void createChartTypes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > > & aSeriesSeq,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq
+ );
+
+ /** create axes and add them to the given container. If there are already
+ compatible axes in the container these should be maintained.
+
+ <p>As default, this method creates as many axes as there are dimensions
+ in the given first coordinate system. Each of the axis
+ represents one of the dimensions of the coordinate systems. If there are series
+ requesting asecondary axes a secondary y axes is added</p>
+ */
+ virtual void createAxes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys );
+
+ /** Give the number of requested axis per dimension here. Default is one
+ axis for each dimension
+ */
+ virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension );
+
+ /** adapt properties of exsisting axes and remove superfluous axes
+ */
+ virtual void adaptAxes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
+ static void copyPropertiesFromOldToNewCoordianteSystem(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & rOldChartTypesSeq,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xNewChartType );
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ mutable ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataInterpreter > m_xDataInterpreter;
+
+private:
+ const ::rtl::OUString m_aServiceName;
+
+private:
+ /** modifies the given diagram
+ */
+ void FillDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > > & aSeriesSeq,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > xCategories,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq,
+ bool bCreate );
+};
+
+} // namespace chart
+
+// CHART_CHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx
new file mode 100644
index 000000000000..aa11d77e8995
--- /dev/null
+++ b/chart2/source/model/template/ColumnChartType.cxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ColumnChartType.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "PropertyHelper.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+
+//-----------------------------------------------------------------------------
+
+namespace
+{
+
+enum
+{
+ PROP_BARCHARTTYPE_OVERLAP_SEQUENCE,
+ PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "OverlapSequence" ),
+ PROP_BARCHARTTYPE_OVERLAP_SEQUENCE,
+ ::getCppuType( reinterpret_cast< const Sequence< sal_Int32 > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GapwidthSequence" ),
+ PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE,
+ ::getCppuType( reinterpret_cast< const Sequence< sal_Int32 > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ColumnChartType::ColumnChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{}
+
+ColumnChartType::ColumnChartType( const ColumnChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+ColumnChartType::~ColumnChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL ColumnChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new ColumnChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL ColumnChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_COLUMN;
+}
+
+// ____ OPropertySet ____
+uno::Any ColumnChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL ColumnChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ColumnChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+//
+
+uno::Sequence< ::rtl::OUString > ColumnChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_COLUMN;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ColumnChartType,
+ C2U( "com.sun.star.comp.chart.ColumnChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/ColumnChartType.hxx b/chart2/source/model/template/ColumnChartType.hxx
new file mode 100644
index 000000000000..3386b6a1cd40
--- /dev/null
+++ b/chart2/source/model/template/ColumnChartType.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_COLUMNCHARTTYPE_HXX
+#define CHART_COLUMNCHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class ColumnChartType : public ChartType
+{
+public:
+ ColumnChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~ColumnChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ColumnChartType )
+
+protected:
+ explicit ColumnChartType( const ColumnChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_COLUMNCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
new file mode 100644
index 000000000000..663cad4c2fe4
--- /dev/null
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ColumnLineChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ColumnLineDataInterpreter.hxx"
+#include "ContainerHelper.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/drawing/LineStyle.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star::chart2;
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ColumnLineChartTypeTemplate" ));
+
+enum
+{
+ PROP_COL_LINE_NUMBER_OF_LINES
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "NumberOfLines" ),
+ PROP_COL_LINE_NUMBER_OF_LINES,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ColumnLineChartTypeTemplate::ColumnLineChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ sal_Int32 nNumberOfLines ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_eStackMode( eStackMode )
+{
+ setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::makeAny( nNumberOfLines ));
+}
+
+ColumnLineChartTypeTemplate::~ColumnLineChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL ColumnLineChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ColumnLineChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+void ColumnLineChartTypeTemplate::createChartTypes(
+ const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
+ const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const Sequence< Reference< XChartType > >& aOldChartTypesSeq )
+{
+ if( rCoordSys.getLength() == 0 ||
+ ! rCoordSys[0].is() )
+ return;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
+ sal_Int32 nNumberOfSeries = aFlatSeriesSeq.getLength();
+ sal_Int32 nNumberOfLines = 0;
+ sal_Int32 nNumberOfColumns = 0;
+
+ getFastPropertyValue( PROP_COL_LINE_NUMBER_OF_LINES ) >>= nNumberOfLines;
+ OSL_ENSURE( nNumberOfLines>=0, "number of lines should be not negative" );
+ if( nNumberOfLines < 0 )
+ nNumberOfLines = 0;
+
+ if( nNumberOfLines >= nNumberOfSeries )
+ {
+ if( nNumberOfSeries > 0 )
+ {
+ nNumberOfLines = nNumberOfSeries - 1;
+ nNumberOfColumns = 1;
+ }
+ else
+ nNumberOfLines = 0;
+ }
+ else
+ nNumberOfColumns = nNumberOfSeries - nNumberOfLines;
+
+ // Columns
+ // -------
+ Reference< XChartType > xCT(
+ xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aOldChartTypesSeq, xCT );
+
+ Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
+ xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
+
+ if( nNumberOfColumns > 0 )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns );
+ ::std::copy( aFlatSeriesSeq.getConstArray(),
+ aFlatSeriesSeq.getConstArray() + nNumberOfColumns,
+ aColumnSeq.getArray());
+ xDSCnt->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 );
+
+ if( nNumberOfLines > 0 )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
+ ::std::copy( aFlatSeriesSeq.getConstArray() + nNumberOfColumns,
+ aFlatSeriesSeq.getConstArray() + aFlatSeriesSeq.getLength(),
+ aLineSeq.getArray());
+ xDSCnt->setDataSeries( aLineSeq );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL ColumnLineChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+
+ if( nChartTypeIndex==0 ) // columns
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ 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 );
+ }
+ }
+}
+
+StackMode ColumnLineChartTypeTemplate::getStackMode( sal_Int32 nChartTypeIndex ) const
+{
+ if( nChartTypeIndex == 0 )
+ return m_eStackMode;
+ return StackMode_NONE;
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL ColumnLineChartTypeTemplate::matchesTemplate(
+ const uno::Reference< XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = sal_False;
+
+ if( ! xDiagram.is())
+ return bResult;
+
+ try
+ {
+ Reference< chart2::XChartType > xColumnChartType;
+ Reference< XCoordinateSystem > xColumnChartCooSys;
+ Reference< chart2::XChartType > xLineChartType;
+ sal_Int32 nNumberOfChartTypes = 0;
+
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
+ {
+ if( aChartTypeSeq[j].is())
+ {
+ ++nNumberOfChartTypes;
+ if( nNumberOfChartTypes > 2 )
+ break;
+ OUString aCTService = aChartTypeSeq[j]->getChartType();
+ if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
+ {
+ xColumnChartType.set( aChartTypeSeq[j] );
+ xColumnChartCooSys.set( aCooSysSeq[i] );
+ }
+ else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
+ xLineChartType.set( aChartTypeSeq[j] );
+ }
+ }
+ if( nNumberOfChartTypes > 2 )
+ break;
+ }
+
+ if( nNumberOfChartTypes == 2 &&
+ xColumnChartType.is() &&
+ xLineChartType.is())
+ {
+ OSL_ASSERT( xColumnChartCooSys.is());
+
+ // check stackmode of bars
+ bResult = (xColumnChartCooSys->getDimension() == getDimension());
+ if( bResult )
+ {
+ bool bFound=false;
+ bool bAmbiguous=false;
+ bResult = ( DiagramHelper::getStackModeFromChartType(
+ xColumnChartType, bFound, bAmbiguous,
+ xColumnChartCooSys )
+ == getStackMode( 0 ) );
+
+ if( bResult && bAdaptProperties )
+ {
+ Reference< XDataSeriesContainer > xSeriesContainer( xLineChartType, uno::UNO_QUERY );
+ if( xSeriesContainer.is() )
+ {
+ sal_Int32 nNumberOfLines = xSeriesContainer->getDataSeries().getLength();
+ setFastPropertyValue_NoBroadcast( PROP_COL_LINE_NUMBER_OF_LINES, uno::makeAny( nNumberOfLines ));
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > 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;
+}
+
+Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > 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 );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< XDataInterpreter > SAL_CALL ColumnLineChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ {
+ sal_Int32 nNumberOfLines = 1;
+ getFastPropertyValue( PROP_COL_LINE_NUMBER_OF_LINES ) >>= nNumberOfLines;
+ m_xDataInterpreter.set( new ColumnLineDataInterpreter( nNumberOfLines, GetComponentContext() ) );
+ }
+ else
+ {
+ //todo...
+ OSL_ENSURE( false, "number of lines may not be valid anymore in the datainterpreter" );
+
+ }
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+uno::Sequence< ::rtl::OUString > ColumnLineChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ColumnLineChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( ColumnLineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ColumnLineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
new file mode 100644
index 000000000000..ce86188e2bb6
--- /dev/null
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_COLUMNLINECHARTTYPETEMPLATE_HXX
+#define CHART_COLUMNLINECHARTTYPETEMPLATE_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
+{
+public:
+ explicit ColumnLineChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ sal_Int32 nNumberOfLines );
+ virtual ~ColumnLineChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual void createChartTypes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > > & aSeriesSeq,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+private:
+ StackMode m_eStackMode;
+};
+
+} // namespace chart
+
+// CHART_COLUMNLINECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
new file mode 100644
index 000000000000..18e22f78e86e
--- /dev/null
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ColumnLineDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+// #include <deque>
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+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;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+// explicit
+ColumnLineDataInterpreter::ColumnLineDataInterpreter(
+ sal_Int32 nNumberOfLines,
+ const Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext ),
+ m_nNumberOfLines( nNumberOfLines )
+{}
+
+ColumnLineDataInterpreter::~ColumnLineDataInterpreter()
+{}
+
+// ____ XDataInterpreter ____
+InterpretedData SAL_CALL ColumnLineDataInterpreter::interpretDataSource(
+ const Reference< data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ 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 )
+ {
+ sal_Int32 nNumberOfSeries = aResult.Series[0].getLength();
+
+ // 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);
+
+ Sequence< Reference< XDataSeries > > & rColumnDataSeries = aResult.Series[0];
+ Sequence< Reference< XDataSeries > > & rLineDataSeries = aResult.Series[1];
+ rLineDataSeries.realloc( nNumOfLines );
+ ::std::copy( rColumnDataSeries.getConstArray() + nNumberOfSeries - nNumOfLines,
+ rColumnDataSeries.getConstArray() + nNumberOfSeries,
+ rLineDataSeries.getArray() );
+ rColumnDataSeries.realloc( nNumberOfSeries - nNumOfLines );
+ }
+ }
+
+ return aResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.hxx b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
new file mode 100644
index 000000000000..b9b8a62a4097
--- /dev/null
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_COLUMNLINEDATAINTERPRETER_HXX
+#define CHART_COLUMNLINEDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+namespace chart
+{
+
+class ColumnLineDataInterpreter : public DataInterpreter
+{
+public:
+ explicit ColumnLineDataInterpreter(
+ sal_Int32 nNumberOfLines,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ ~ColumnLineDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ sal_Int32 m_nNumberOfLines;
+};
+
+} // namespace chart
+
+// CHART_COLUMNLINEDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
new file mode 100644
index 000000000000..b619553ee959
--- /dev/null
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -0,0 +1,461 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "DataSourceHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::std;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+#if OSL_DEBUG_LEVEL > 1
+namespace
+{
+void lcl_ShowDataSource( const Reference< data::XDataSource > & xSource );
+}
+#endif
+
+namespace chart
+{
+
+DataInterpreter::DataInterpreter(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext )
+{}
+
+DataInterpreter::~DataInterpreter()
+{}
+
+Reference< uno::XComponentContext > DataInterpreter::GetComponentContext() const
+{
+ return m_xContext;
+}
+
+// ____ XDataInterpreter ____
+InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
+ const Reference< data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+#if OSL_DEBUG_LEVEL > 2
+ lcl_ShowDataSource( xSource );
+#endif
+
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
+
+ // check if we should use categories
+
+ bool bHasCategories( HasCategories( aArguments, aData ));
+
+ // parse data
+ bool bCategoriesUsed = false;
+ for( sal_Int32 i=0; i < aData.getLength(); ++i )
+ {
+ try
+ {
+ if( bHasCategories && ! bCategoriesUsed )
+ {
+ xCategories.set( aData[i] );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), C2U("categories"));
+ bCategoriesUsed = true;
+ }
+ else
+ {
+ aSequencesVec.push_back( aData[i] );
+ if( aData[i].is())
+ SetRole( aData[i]->getValues(), C2U("values-y"));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // create DataSeries
+ vector< Reference< data::XLabeledDataSequence > >::const_iterator
+ aSequencesVecIt = aSequencesVec.begin();
+
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSequencesVec.size());
+
+ for( ;aSequencesVecIt != aSequencesVec.end(); ++aSequencesVecIt, ++nSeriesIndex )
+ {
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( & (*aSequencesVecIt), 1 );
+ Reference< XDataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.getLength())
+ xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ));
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ }
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
+ aSeries[0] = ContainerToSequence( aSeriesVec );
+ return InterpretedData( aSeries, xCategories );
+}
+
+InterpretedData SAL_CALL DataInterpreter::reinterpretDataSeries(
+ const InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ InterpretedData aResult( aInterpretedData );
+
+ sal_Int32 i=0;
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.getLength();
+ for( ; i<nCount; ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+
+ // values-y
+ Reference< data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ // re-use values-... as values-y
+ if( ! xValuesY.is())
+ {
+ xValuesY.set(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values"), true ));
+ if( xValuesY.is())
+ SetRole( xValuesY->getValues(), C2U("values-y"));
+ }
+ if( xValuesY.is())
+ {
+ aNewSequences.realloc(1);
+ aNewSequences[0] = xValuesY;
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
+ if( aSeqs.getLength() != aNewSequences.getLength() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ sal_Int32 j=0;
+ for( ; j<aSeqs.getLength(); ++j )
+ {
+ OSL_ENSURE( aSeqs[j] == xValuesY, "All sequences should be used" );
+ }
+#endif
+ Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
+ xSink->setData( aNewSequences );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+// criterion: all series must have exactly one data::XLabeledDataSequence
+sal_Bool SAL_CALL DataInterpreter::isDataCompatible(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != 1 )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return sal_True;
+}
+
+namespace
+{
+
+struct lcl_LabeledSequenceEquals : public unary_function< Reference< data::XLabeledDataSequence >, bool >
+{
+ lcl_LabeledSequenceEquals( const Reference< data::XLabeledDataSequence > & xLSeqToCmp ) :
+ m_bHasLabels ( false ),
+ m_bHasValues ( false )
+ {
+ if( xLSeqToCmp.is())
+ {
+ Reference< data::XDataSequence > xSeq( xLSeqToCmp->getValues());
+ if( xSeq.is())
+ {
+ m_bHasValues = true;
+ m_aValuesRangeRep = xSeq->getSourceRangeRepresentation();
+ }
+
+ xSeq.set( xLSeqToCmp->getLabel());
+ if( xSeq.is())
+ {
+ m_bHasLabels = true;
+ m_aLabelRangeRep = xSeq->getSourceRangeRepresentation();
+ }
+ }
+ }
+
+ bool operator() ( const Reference< data::XLabeledDataSequence > & xSeq )
+ {
+ if( ! xSeq.is())
+ return false;
+
+ Reference< data::XDataSequence > xSeqValues( xSeq->getValues() );
+ Reference< data::XDataSequence > xSeqLabels( xSeq->getLabel() );
+ bool bHasValues = xSeqValues.is();
+ bool bHasLabels = xSeqLabels.is();
+
+ return ( ( (m_bHasValues == bHasValues) &&
+ (!bHasValues || m_aValuesRangeRep.equals( xSeqValues->getSourceRangeRepresentation())) ) &&
+ ( (m_bHasLabels == bHasLabels) &&
+ (!bHasLabels || m_aLabelRangeRep.equals( xSeqLabels->getSourceRangeRepresentation())) )
+ );
+ }
+
+private:
+ bool m_bHasLabels;
+ bool m_bHasValues;
+ OUString m_aValuesRangeRep;
+ OUString m_aLabelRangeRep;
+};
+
+} // anonymous namespace
+
+Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData(
+ const InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ vector< Reference< data::XLabeledDataSequence > > aResultVec;
+ aResultVec.reserve( aInterpretedData.Series.getLength() +
+ 1 // categories
+ );
+
+ if( aInterpretedData.Categories.is())
+ aResultVec.push_back( aInterpretedData.Categories );
+
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[nSeriesIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+
+ // add all sequences of data series
+ for( sal_Int32 nSeqIdx=0; nSeqIdx<aSeq.getLength(); ++nSeqIdx )
+ {
+ Reference< data::XLabeledDataSequence > xAdd( aSeq[nSeqIdx] );
+
+ // only add if sequence is not yet in the result
+ if( find_if( aResultVec.begin(), aResultVec.end(),
+ lcl_LabeledSequenceEquals( xAdd )) == aResultVec.end())
+ {
+ aResultVec.push_back( xAdd );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return Reference< data::XDataSource >( DataSourceHelper::createDataSource( ContainerToSequence( aResultVec ) ) );
+}
+
+// convenience methods
+
+// static
+OUString DataInterpreter::GetRole( const Reference< data::XDataSequence > & xSeq )
+{
+ OUString aResult;
+ if( ! xSeq.is())
+ return aResult;
+
+ try
+ {
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
+ xProp->getPropertyValue( C2U("Role")) >>= aResult;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aResult;
+}
+
+// static
+void DataInterpreter::SetRole( const Reference< data::XDataSequence > & xSeq, const OUString & rRole )
+{
+ if( ! xSeq.is())
+ return;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( C2U("Role"), uno::makeAny( rRole ));
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// static
+uno::Any DataInterpreter::GetProperty(
+ const Sequence< beans::PropertyValue > & aArguments,
+ const OUString & rName )
+{
+ for( sal_Int32 i=aArguments.getLength(); i--; )
+ {
+ if( aArguments[i].Name.equals( rName ))
+ return aArguments[i].Value;
+ }
+ return uno::Any();
+}
+
+// static
+bool DataInterpreter::HasCategories(
+ const Sequence< beans::PropertyValue > & rArguments,
+ const Sequence< Reference< data::XLabeledDataSequence > > & rData )
+{
+ bool bHasCategories = false;
+
+ if( rArguments.getLength() > 0 )
+ GetProperty( rArguments, C2U(("HasCategories"))) >>= bHasCategories;
+
+ for( sal_Int32 nLSeqIdx=0; ! bHasCategories && nLSeqIdx<rData.getLength(); ++nLSeqIdx )
+ bHasCategories = ( rData[nLSeqIdx].is() &&
+ GetRole( rData[nLSeqIdx]->getValues()).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("categories")));
+
+ return bHasCategories;
+}
+
+// ------------------------------------------------------------
+
+Sequence< OUString > DataInterpreter::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[0] = C2U( "com.sun.star.chart2.DataInterpreter" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DataInterpreter, C2U("com.sun.star.comp.chart2.DataInterpreter"));
+
+} // namespace chart
+
+#if OSL_DEBUG_LEVEL > 1
+namespace
+{
+
+void lcl_ShowDataSource( const Reference< data::XDataSource > & xSource )
+{
+ if( ! xSource.is())
+ return;
+
+ OSL_TRACE( "DataSource in DataInterpreter:" );
+ Sequence< Reference< data::XLabeledDataSequence > > aSequences( xSource->getDataSequences());
+ Reference< beans::XPropertySet > xProp;
+ OUString aId;
+ const sal_Int32 nMax = aSequences.getLength();
+ for( sal_Int32 k = 0; k < nMax; ++k )
+ {
+ if( aSequences[k].is())
+ {
+ OUString aSourceRepr(C2U("<none>"));
+ if( aSequences[k]->getValues().is())
+ aSourceRepr = aSequences[k]->getValues()->getSourceRangeRepresentation();
+ xProp.set( aSequences[k]->getValues(), uno::UNO_QUERY );
+ if( xProp.is() &&
+ ( xProp->getPropertyValue( C2U( "Role" )) >>= aId ))
+ {
+ OSL_TRACE( " <data sequence %d> Role: %s, Source: %s", k, U2C( aId ), U2C( aSourceRepr ));
+ }
+ else
+ {
+ OSL_TRACE( " <data sequence %d> unknown Role, Source: %s", k, U2C( aSourceRepr ) );
+ }
+
+ aSourceRepr = C2U("<none>");
+ if( aSequences[k]->getLabel().is())
+ aSourceRepr = OUString( aSequences[k]->getLabel()->getSourceRangeRepresentation());
+ xProp.set( aSequences[k]->getLabel(), uno::UNO_QUERY );
+ if( xProp.is() &&
+ ( xProp->getPropertyValue( C2U( "Role" )) >>= aId ))
+ {
+ OSL_TRACE( " <data sequence label %d> Role: %s, Source: %s", k, U2C( aId ), U2C( aSourceRepr ));
+ }
+ else
+ {
+ OSL_TRACE( " <data sequence label %d> unknown Role, Source: %s", k, U2C( aSourceRepr ) );
+ }
+ }
+ }
+}
+
+}
+#endif
diff --git a/chart2/source/model/template/DataInterpreter.hxx b/chart2/source/model/template/DataInterpreter.hxx
new file mode 100644
index 000000000000..a2d6201fc023
--- /dev/null
+++ b/chart2/source/model/template/DataInterpreter.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATAINTERPRETER_HXX
+#define CHART_DATAINTERPRETER_HXX
+
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/chart2/XDataInterpreter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace chart
+{
+
+class DataInterpreter : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::chart2::XDataInterpreter,
+ ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit DataInterpreter( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~DataInterpreter();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ GetComponentContext() const;
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // convenience methods
+ static ::rtl::OUString GetRole(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xSeq );
+
+ static void SetRole(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > & xSeq,
+ const ::rtl::OUString & rRole );
+
+ static ::com::sun::star::uno::Any GetProperty(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & aArguments,
+ const ::rtl::OUString & rName );
+
+ static bool HasCategories(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rArguments,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > & rData );
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL mergeInterpretedData(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+};
+
+} // namespace chart
+
+// CHART_DATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx
new file mode 100644
index 000000000000..d90dc8b9f7c7
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "FilledNetChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace chart
+{
+
+FilledNetChartType::FilledNetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+FilledNetChartType::FilledNetChartType( const FilledNetChartType & rOther ) :
+ NetChartType_Base( rOther )
+{
+}
+
+FilledNetChartType::~FilledNetChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new FilledNetChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL FilledNetChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET;
+}
+
+uno::Sequence< ::rtl::OUString > FilledNetChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( FilledNetChartType,
+ C2U( "com.sun.star.comp.chart.FilledNetChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx
new file mode 100644
index 000000000000..14beee021b34
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_FILLEDNETCHARTTYPE_HXX
+#define CHART_FILLEDNETCHARTTYPE_HXX
+
+#include "NetChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class FilledNetChartType : public NetChartType_Base
+{
+public:
+ FilledNetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~FilledNetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( FilledNetChartType )
+
+protected:
+ explicit FilledNetChartType( const FilledNetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_FILLEDNETCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx
new file mode 100644
index 000000000000..f96d7ed1297d
--- /dev/null
+++ b/chart2/source/model/template/LineChartType.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LineChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+enum
+{
+ PROP_LINECHARTTYPE_CURVE_STYLE,
+ PROP_LINECHARTTYPE_CURVE_RESOLUTION,
+ PROP_LINECHARTTYPE_SPLINE_ORDER
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "CurveStyle" ),
+ PROP_LINECHARTTYPE_CURVE_STYLE,
+ ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CurveResolution" ),
+ PROP_LINECHARTTYPE_CURVE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_LINECHARTTYPE_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+LineChartType::LineChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{
+}
+
+LineChartType::LineChartType( const LineChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+LineChartType::~LineChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL LineChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new LineChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL LineChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_LINE;
+}
+
+
+// ____ OPropertySet ____
+uno::Any LineChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL LineChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ LineChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > LineChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_LINE;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LineChartType,
+ C2U( "com.sun.star.comp.chart.LineChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/LineChartType.hxx b/chart2/source/model/template/LineChartType.hxx
new file mode 100644
index 000000000000..1821333a4cdc
--- /dev/null
+++ b/chart2/source/model/template/LineChartType.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LINECHARTTYPE_HXX
+#define CHART_LINECHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class LineChartType : public ChartType
+{
+public:
+ LineChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~LineChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LineChartType )
+
+protected:
+ explicit LineChartType( const LineChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_LINECHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
new file mode 100644
index 000000000000..8d582178a128
--- /dev/null
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LineChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LineChartTypeTemplate" ));
+
+enum
+{
+ PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE,
+ PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
+ PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER
+
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "CurveStyle" ),
+ PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE,
+ ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "CurveResolution" ),
+ PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+LineChartTypeTemplate::LineChartTypeTemplate(
+ uno::Reference<
+ uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ bool bSymbols,
+ bool bHasLines /* = true */,
+ sal_Int32 nDim /* = 2 */ ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_eStackMode( eStackMode ),
+ m_bHasSymbols( bSymbols ),
+ m_bHasLines( bHasLines ),
+ m_nDim( nDim )
+{
+ if( nDim == 3 )
+ m_bHasSymbols = false;
+}
+
+LineChartTypeTemplate::~LineChartTypeTemplate()
+{}
+// ____ OPropertySet ____
+uno::Any LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL LineChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ LineChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 LineChartTypeTemplate::getDimension() const
+{
+ return m_nDim;
+}
+
+StackMode LineChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return m_eStackMode;
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
+ const uno::Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( 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
+ // with symbols (or with lines)
+ if( bResult )
+ {
+ bool bSymbolFound = false;
+ bool bLineFound = false;
+
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ chart2::Symbol aSymbProp;
+ drawing::LineStyle eLineStyle;
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+
+ bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) &&
+ (aSymbProp.Style != chart2::SymbolStyle_NONE);
+
+ if( bCurrentHasSymbol )
+ bSymbolFound = true;
+
+ if( bCurrentHasSymbol && (!m_bHasSymbols) )
+ {
+ bResult = false;
+ break;
+ }
+
+ bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) &&
+ ( eLineStyle != drawing::LineStyle_NONE );
+
+ if( bCurrentHasLine )
+ bLineFound = true;
+
+ if( bCurrentHasLine && (!m_bHasLines) )
+ {
+ bResult = false;
+ break;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if(bResult)
+ {
+ if( !bLineFound && m_bHasLines && bSymbolFound )
+ bResult = false;
+ else if( !bSymbolFound && m_bHasSymbols && bLineFound )
+ bResult = false;
+ else if( !bLineFound && !bSymbolFound )
+ return m_bHasLines && m_bHasSymbols;
+ }
+ }
+
+ // adapt curve style, spline order and resolution
+ if( bResult && bAdaptProperties )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xChartTypeProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
+ uno::UNO_QUERY_THROW );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(C2U("CurveStyle" )) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(C2U("CurveResolution" )) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(C2U("SplineOrder" )) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > LineChartTypeTemplate::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_LINE ), uno::UNO_QUERY_THROW );
+
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "CurveStyle" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xCTProp->setPropertyValue(
+ C2U( "CurveResolution" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xCTProp->setPropertyValue(
+ C2U( "SplineOrder" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > 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 );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "CurveStyle" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xCTProp->setPropertyValue(
+ C2U( "CurveResolution" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xCTProp->setPropertyValue(
+ C2U( "SplineOrder" ), getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+void SAL_CALL LineChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( 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 );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ----------------------------------------
+
+Sequence< OUString > LineChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LineChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( LineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( LineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx
new file mode 100644
index 000000000000..faee9715720a
--- /dev/null
+++ b/chart2/source/model/template/LineChartTypeTemplate.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LINECHARTTYPETEMPLATE_HXX
+#define CHART_LINECHARTTYPETEMPLATE_HXX
+
+#include "ChartTypeTemplate.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include "StackMode.hxx"
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class LineChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ explicit LineChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ bool bSymbols,
+ bool bHasLines = true,
+ sal_Int32 nDim = 2 );
+ virtual ~LineChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+private:
+ StackMode m_eStackMode;
+ bool m_bHasSymbols;
+ bool m_bHasLines;
+ sal_Int32 m_nDim;
+};
+
+} // namespace chart
+
+// CHART_LINECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
new file mode 100644
index 000000000000..ddf001b2a6e4
--- /dev/null
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "NetChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace chart
+{
+
+NetChartType_Base::NetChartType_Base(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
+{}
+
+NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
+ ChartType( rOther )
+{
+}
+
+NetChartType_Base::~NetChartType_Base()
+{}
+
+Reference< XCoordinateSystem > SAL_CALL
+ NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( DimensionCount != 2 )
+ throw lang::IllegalArgumentException(
+ C2U( "NetChart must be two-dimensional" ),
+ static_cast< ::cppu::OWeakObject* >( this ), 0 );
+
+ Reference< XCoordinateSystem > xResult(
+ new PolarCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) );
+ if( xAxis.is() )
+ {
+ ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+ aScaleData.AxisType = AxisType::CATEGORY;
+ aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ xAxis = xResult->getAxisByDimension( 1, MAIN_AXIS_INDEX );
+ if( xAxis.is() )
+ {
+ ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
+ aScaleData.AxisType = AxisType::REALNUMBER;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+// ____ OPropertySet ____
+uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const
+ throw(beans::UnknownPropertyException)
+{
+ return uno::Any();
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
+{
+ uno::Sequence< beans::Property > aProps;
+ static ::cppu::OPropertyArrayHelper aArrayHelper(aProps);
+ return aArrayHelper;
+}
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ NetChartType_Base::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+//-----------------------------------------------------------------------------
+
+NetChartType::NetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+NetChartType::NetChartType( const NetChartType & rOther ) :
+ NetChartType_Base( rOther )
+{
+}
+
+NetChartType::~NetChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new NetChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL NetChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_NET;
+}
+
+uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_NET;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( NetChartType,
+ C2U( "com.sun.star.comp.chart.NetChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx
new file mode 100644
index 000000000000..ba5dc48b6881
--- /dev/null
+++ b/chart2/source/model/template/NetChartType.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_NETCHARTTYPE_HXX
+#define CHART_NETCHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class NetChartType_Base : public ChartType
+{
+public:
+ NetChartType_Base( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~NetChartType_Base();
+
+protected:
+ explicit NetChartType_Base( const NetChartType_Base & rOther );
+
+ // ____ XChartType ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+//-------------------------------------------------------------------------------------
+
+class NetChartType : public NetChartType_Base
+{
+public:
+ NetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~NetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( NetChartType )
+
+protected:
+ explicit NetChartType( const NetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_NETCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
new file mode 100644
index 000000000000..b67817e73997
--- /dev/null
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "NetChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.NetChartTypeTemplate" ));
+} // anonymous namespace
+
+namespace chart
+{
+
+NetChartTypeTemplate::NetChartTypeTemplate(
+ Reference< uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ bool bSymbols,
+ bool bHasLines ,
+ bool bHasFilledArea ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ m_eStackMode( eStackMode ),
+ m_bHasSymbols( bSymbols ),
+ m_bHasLines( bHasLines ),
+ m_bHasFilledArea( bHasFilledArea )
+{}
+
+NetChartTypeTemplate::~NetChartTypeTemplate()
+{}
+
+StackMode NetChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return m_eStackMode;
+}
+
+void SAL_CALL NetChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( 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 );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ uno::Reference< beans::XPropertySet > xChartTypeProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+
+ if( bResult )
+ {
+ //filled net chart?:
+ if( m_bHasFilledArea )
+ return sal_True;
+
+ // check symbol-style
+ // for a template with symbols it is ok, if there is at least one series
+ // with symbols, otherwise an unknown template is too easy to achieve
+ bool bSymbolFound = false;
+ bool bLineFound = false;
+
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ chart2::Symbol aSymbProp;
+ drawing::LineStyle eLineStyle;
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+
+ bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) &&
+ (aSymbProp.Style != chart2::SymbolStyle_NONE);
+
+ if( bCurrentHasSymbol )
+ bSymbolFound = true;
+
+ if( bCurrentHasSymbol && (!m_bHasSymbols) )
+ {
+ bResult = false;
+ break;
+ }
+
+ bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) &&
+ ( eLineStyle != drawing::LineStyle_NONE );
+
+ if( bCurrentHasLine )
+ bLineFound = true;
+
+ if( bCurrentHasLine && (!m_bHasLines) )
+ {
+ bResult = false;
+ break;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if(bResult)
+ {
+ if( !bLineFound && m_bHasLines && bSymbolFound )
+ bResult = false;
+ else if( !bSymbolFound && m_bHasSymbols && bLineFound )
+ bResult = false;
+ else if( !bLineFound && !bSymbolFound )
+ return m_bHasLines && m_bHasSymbols;
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL NetChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ return xResult;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > NetChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( NetChartTypeTemplate, lcl_aServiceName );
+
+} // namespace chart
diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx
new file mode 100644
index 000000000000..f66355a3576e
--- /dev/null
+++ b/chart2/source/model/template/NetChartTypeTemplate.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_NETCHARTTYPETEMPLATE_HXX
+#define CHART_NETCHARTTYPETEMPLATE_HXX
+
+#include "ChartTypeTemplate.hxx"
+#include "StackMode.hxx"
+
+namespace chart
+{
+
+class NetChartTypeTemplate : public ChartTypeTemplate
+{
+public:
+ explicit NetChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StackMode eStackMode,
+ bool bSymbols,
+ bool bHasLines = true,
+ bool bHasFilledArea = false
+ );
+ virtual ~NetChartTypeTemplate();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+
+private:
+ StackMode m_eStackMode;
+ bool m_bHasSymbols;
+ bool m_bHasLines;
+ bool m_bHasFilledArea;
+};
+
+} // namespace chart
+
+// CHART_NETCHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
new file mode 100644
index 000000000000..9c199bb23d70
--- /dev/null
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PieChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+enum
+{
+ PROP_PIECHARTTYPE_USE_RINGS
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "UseRings" ),
+ PROP_PIECHARTTYPE_USE_RINGS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS, false );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+PieChartType::PieChartType(
+ const uno::Reference< uno::XComponentContext > & xContext,
+ sal_Bool bUseRings /* = sal_False */) :
+ ChartType( xContext )
+{
+ if( bUseRings )
+ setFastPropertyValue_NoBroadcast( PROP_PIECHARTTYPE_USE_RINGS, uno::makeAny( bUseRings ));
+}
+
+PieChartType::PieChartType( const PieChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+PieChartType::~PieChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL PieChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new PieChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL PieChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_PIE;
+}
+
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ PieChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new PolarCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ //hhhh todo make axis invisible
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+
+ if( i == 0 )
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ else
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+
+ //remove explicit scalings from all axes
+ AxisHelper::removeExplicitScaling( aScaleData );
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+// ____ OPropertySet ____
+uno::Any PieChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL PieChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ PieChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > PieChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_PIE;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PieChartType,
+ C2U( "com.sun.star.comp.chart.PieChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/PieChartType.hxx b/chart2/source/model/template/PieChartType.hxx
new file mode 100644
index 000000000000..fccd4e9ee25c
--- /dev/null
+++ b/chart2/source/model/template/PieChartType.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_PIECHARTTYPE_HXX
+#define CHART_PIECHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class PieChartType : public ChartType
+{
+public:
+ PieChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ sal_Bool bUseRings = sal_False );
+ virtual ~PieChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PieChartType )
+
+protected:
+ explicit PieChartType( const PieChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_PIECHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
new file mode 100644
index 000000000000..c16682846d53
--- /dev/null
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -0,0 +1,661 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PieChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "BaseGFXHelper.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/drawing/FillStyle.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#include <rtl/math.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PieChartTypeTemplate" ));
+
+enum
+{
+ PROP_PIE_TEMPLATE_DEFAULT_OFFSET,
+ PROP_PIE_TEMPLATE_OFFSET_MODE,
+ PROP_PIE_TEMPLATE_DIMENSION,
+ PROP_PIE_TEMPLATE_USE_RINGS
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "OffsetMode" ),
+ PROP_PIE_TEMPLATE_OFFSET_MODE,
+ ::getCppuType( reinterpret_cast< const chart2::PieChartOffsetMode * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "DefaultOffset" ),
+ PROP_PIE_TEMPLATE_DEFAULT_OFFSET,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Dimension" ),
+ PROP_PIE_TEMPLATE_DIMENSION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "UseRings" ),
+ PROP_PIE_TEMPLATE_USE_RINGS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+PieChartTypeTemplate::PieChartTypeTemplate(
+ uno::Reference<
+ uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ chart2::PieChartOffsetMode eMode,
+ bool bRings /* = false */,
+ sal_Int32 nDim /* = 2 */ ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex )
+{
+ setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_OFFSET_MODE, uno::makeAny( eMode ));
+ setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DIMENSION, uno::makeAny( nDim ));
+ setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_USE_RINGS, uno::makeAny( sal_Bool( bRings )));
+}
+
+PieChartTypeTemplate::~PieChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL PieChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ PieChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+
+// ____ ChartTypeTemplate ____
+sal_Int32 PieChartTypeTemplate::getDimension() const
+{
+ sal_Int32 nDim = 2;
+ try
+ {
+ // note: UNO-methods are never const
+ const_cast< PieChartTypeTemplate * >( this )->
+ getFastPropertyValue( PROP_PIE_TEMPLATE_DIMENSION ) >>= nDim;
+ }
+ catch( beans::UnknownPropertyException & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return nDim;
+}
+
+sal_Int32 PieChartTypeTemplate::getAxisCountByDimension( sal_Int32 /*nDimension*/ )
+{
+ return 0;
+}
+
+// void PieChartTypeTemplate::createAxes(
+// const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys )
+// {
+// }
+
+void PieChartTypeTemplate::adaptAxes(
+ const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > & /*rCoordSys*/ )
+{
+ // hide existing axes
+ //hhhh todo
+}
+
+void PieChartTypeTemplate::adaptScales(
+ const Sequence< Reference< chart2::XCoordinateSystem > > & 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 )
+ )
+{
+ ChartTypeTemplate::adaptScales( aCooSysSeq, xCategories );
+
+ //remove explicit scalings from radius axis
+ //and ensure correct orientation of scales for donuts
+
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ try
+ {
+ Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1 /*nDimensionIndex*/,0 /*nAxisIndex*/
+ , aCooSysSeq[nCooSysIdx] ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ AxisHelper::removeExplicitScaling( aScaleData );
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ //------
+
+ xAxis = AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
+ , aCooSysSeq[nCooSysIdx] );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void PieChartTypeTemplate::createChartTypes(
+ const Sequence< Sequence< Reference< chart2::XDataSeries > > > & aSeriesSeq,
+ const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys,
+ const Sequence< Reference< chart2::XChartType > >& /* aOldChartTypesSeq */ )
+{
+ if( rCoordSys.getLength() == 0 ||
+ ! rCoordSys[0].is() )
+ 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())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "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.getLength() > 0 )
+ {
+ Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
+ xDSCnt->setDataSeries( aFlatSeriesSeq );
+
+ DataSeriesHelper::setStackModeAtSeries(
+ aFlatSeriesSeq, rCoordSys[0], getStackMode( 0 ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL PieChartTypeTemplate::matchesTemplate(
+ const uno::Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ sal_Bool bTemplateUsesRings = sal_False;
+ getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
+ chart2::PieChartOffsetMode ePieOffsetMode;
+ getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
+
+ //check offset-mode
+ if( bResult )
+ {
+ try
+ {
+ double fOffset=0.0;
+ bool bAllOffsetsEqual = true;
+
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ //check offset of outer series
+ if( aSeriesVec.size() )
+ {
+ sal_Int32 nOuterSeriesIndex = 0; //@todo in future this will depend on Orientation of the radius axis scale
+ Reference< chart2::XDataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] );
+ Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
+ xProp->getPropertyValue( C2U( "Offset" )) >>= fOffset;
+
+ //get AttributedDataPoints
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ uno::Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if(xPointProp.is())
+ {
+ double fPointOffset=0.0;
+ if( (xProp->getPropertyValue( C2U( "Offset" )) >>= fPointOffset ) )
+ {
+ if( ! ::rtl::math::approxEqual( fPointOffset, fOffset ) )
+ {
+ bAllOffsetsEqual = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ chart2::PieChartOffsetMode eOffsetMode = chart2::PieChartOffsetMode_NONE;
+ if( bAllOffsetsEqual && fOffset > 0.0 )
+ {
+ eOffsetMode = chart2::PieChartOffsetMode_ALL_EXPLODED;
+ if( bAdaptProperties )
+ setFastPropertyValue_NoBroadcast( PROP_PIE_TEMPLATE_DEFAULT_OFFSET, uno::makeAny( fOffset ));
+ }
+
+ bResult = ( eOffsetMode == ePieOffsetMode );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bResult = false;
+ }
+ }
+
+ //check UseRings
+ if( bResult )
+ {
+ uno::Reference< beans::XPropertySet > xCTProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+ sal_Bool bUseRings = false;
+ if( xCTProp->getPropertyValue( C2U( "UseRings" )) >>= bUseRings )
+ {
+ bResult = ( bTemplateUsesRings == bUseRings );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > PieChartTypeTemplate::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_PIE ), uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "UseRings" ), getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+ }
+
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL PieChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > 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 );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "UseRings" ), getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+ }
+
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+void SAL_CALL PieChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
+
+ sal_Bool bTemplateUsesRings = sal_False;
+ getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
+ sal_Int32 nOuterSeriesIndex = 0; //@todo in future this will depend on Orientation of the radius axis scale
+ if( nSeriesIndex == nOuterSeriesIndex )
+ {
+ const OUString aOffsetPropName( RTL_CONSTASCII_USTRINGPARAM("Offset"));
+ // get offset mode
+ chart2::PieChartOffsetMode ePieOffsetMode;
+ this->getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
+
+ // get default offset
+ double fDefaultOffset = 0.5;
+ this->getFastPropertyValue( PROP_PIE_TEMPLATE_DEFAULT_OFFSET ) >>= fDefaultOffset;
+ double fOffsetToSet = fDefaultOffset;
+
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ xProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList;
+
+ // determine whether to set the new offset
+ bool bSetOffset = ( ePieOffsetMode == chart2::PieChartOffsetMode_ALL_EXPLODED );
+ if( !bSetOffset &&
+ (ePieOffsetMode == chart2::PieChartOffsetMode_NONE) )
+ {
+ // 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) &&
+ ::rtl::math::approxEqual( fOffset, fDefaultOffset ))
+ {
+ fOffsetToSet = 0.0;
+ bSetOffset = true;
+ for( sal_Int32 nPtIdx=0; nPtIdx<aAttributedDataPointIndexList.getLength(); ++nPtIdx )
+ {
+ uno::Reference< beans::XPropertySet > xPointProp(
+ xSeries->getDataPointByIndex( aAttributedDataPointIndexList[ nPtIdx ] ));
+ uno::Reference< beans::XPropertyState > xPointState( xPointProp, uno::UNO_QUERY );
+ double fPointOffset = 0.0;
+ if( xPointState.is() &&
+ (xPointState->getPropertyState( aOffsetPropName ) == beans::PropertyState_DIRECT_VALUE) &&
+ xPointProp.is() &&
+ (xPointProp->getPropertyValue( aOffsetPropName ) >>= fPointOffset ) &&
+ ! ::rtl::math::approxEqual( fPointOffset, fDefaultOffset ) )
+ {
+ bSetOffset = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if( bSetOffset )
+ {
+ // set the offset to the series and to the attributed data points
+ xProp->setPropertyValue( aOffsetPropName, uno::makeAny( fOffsetToSet ));
+
+ // remove hard attributes from data points
+ for( sal_Int32 nPtIdx=0; nPtIdx<aAttributedDataPointIndexList.getLength(); ++nPtIdx )
+ {
+ uno::Reference< beans::XPropertyState > xPointState(
+ xSeries->getDataPointByIndex( aAttributedDataPointIndexList[ nPtIdx ] ), uno::UNO_QUERY );
+ if( xPointState.is())
+ xPointState->setPropertyToDefault( aOffsetPropName );
+ }
+ }
+ }
+
+ // line style
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+
+ // vary colors by point
+ xProp->setPropertyValue( C2U("VaryColorsByPoint"), uno::makeAny( true ));
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+
+void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ // reset axes and grids
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
+ if( xCooSysCnt.is())
+ {
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ ChartTypeTemplate::createAxes( aCooSysSeq );
+
+ //reset scale orientation
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ try
+ {
+ Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/
+ , aCooSysSeq[nCooSysIdx] ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ xAxis = AxisHelper::getAxis( 1, 0, aCooSysSeq[nCooSysIdx] );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ ChartTypeTemplate::resetStyles( xDiagram );
+
+ // vary colors by point,
+ // line style
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
+ {
+ Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ if( xState.is())
+ {
+ xState->setPropertyToDefault( C2U("VaryColorsByPoint"));
+ Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
+ if( xProp.is() &&
+ xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
+ {
+ xState->setPropertyToDefault( C2U("BorderStyle"));
+ }
+ }
+ }
+
+ //reset scene properties
+ ThreeDHelper::setDefaultRotation( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ), false );
+}
+
+// ____ XChartTypeTemplate ____
+void PieChartTypeTemplate::adaptDiagram( const uno::Reference< chart2::XDiagram >& xDiagram )
+{
+ if( !xDiagram.is() )
+ return;
+
+ //different default for scene geometry:
+ ThreeDHelper::setDefaultRotation( uno::Reference< beans::XPropertySet >( xDiagram, uno::UNO_QUERY ), true );
+}
+
+// ----------------------------------------
+
+uno::Sequence< ::rtl::OUString > PieChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PieChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( PieChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( PieChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx
new file mode 100644
index 000000000000..1634e643611f
--- /dev/null
+++ b/chart2/source/model/template/PieChartTypeTemplate.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_PIECHARTTYPETEMPLATE_HXX
+#define CHART_PIECHARTTYPETEMPLATE_HXX
+
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+
+#include "ChartTypeTemplate.hxx"
+#include <com/sun/star/chart2/PieChartOffsetMode.hpp>
+
+namespace chart
+{
+
+class PieChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ PieChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ ::com::sun::star::chart2::PieChartOffsetMode eMode,
+ bool bRings = false,
+ sal_Int32 nDim = 2 );
+ virtual ~PieChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual sal_Int32 getDimension() const;
+
+ virtual void adaptDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram );
+
+ virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension );
+// virtual void createAxes(
+// const ::com::sun::star::uno::Sequence<
+// ::com::sun::star::uno::Reference<
+// ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys );
+
+ virtual void adaptAxes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys );
+
+ virtual void adaptScales(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories );
+
+ virtual void createChartTypes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > >& aSeriesSeq,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+};
+
+} // namespace chart
+
+// CHART_PIECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
new file mode 100644
index 000000000000..8c4ab0d18415
--- /dev/null
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ScatterChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+enum
+{
+ PROP_SCATTERCHARTTYPE_CURVE_STYLE,
+ PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
+ PROP_SCATTERCHARTTYPE_SPLINE_ORDER
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "CurveStyle" ),
+ PROP_SCATTERCHARTTYPE_CURVE_STYLE,
+ ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CurveResolution" ),
+ PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ScatterChartType::ScatterChartType(
+ const uno::Reference< uno::XComponentContext > & xContext,
+ chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */ ,
+ sal_Int32 nResolution /* = 20 */,
+ sal_Int32 nOrder /* = 3 */ ) :
+ ChartType( xContext )
+{
+ if( eCurveStyle != chart2::CurveStyle_LINES )
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_STYLE,
+ uno::makeAny( eCurveStyle ));
+ if( nResolution != 20 )
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
+ uno::makeAny( nResolution ));
+ if( nOrder != 3 )
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
+ uno::makeAny( nOrder ));
+}
+
+ScatterChartType::ScatterChartType( const ScatterChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+ScatterChartType::~ScatterChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL ScatterChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new ScatterChartType( *this ));
+}
+
+// ____ XChartType ____
+// ____ XChartType ____
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ ScatterChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new CartesianCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+
+ if( i == 2 )
+ aScaleData.AxisType = chart2::AxisType::SERIES;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+::rtl::OUString SAL_CALL ScatterChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_SCATTER;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ScatterChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aMandRolesSeq;
+
+ if( aMandRolesSeq.getLength() == 0 )
+ {
+ aMandRolesSeq.realloc( 3 );
+ aMandRolesSeq[0] = C2U( "label" );
+ aMandRolesSeq[1] = C2U( "values-x" );
+ aMandRolesSeq[2] = C2U( "values-y" );
+ }
+
+ return aMandRolesSeq;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ScatterChartType::getSupportedOptionalRoles()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aOptRolesSeq;
+
+// if( aOptRolesSeq.getLength() == 0 )
+// {
+// aOptRolesSeq.realloc( 2 );
+// aOptRolesSeq[0] = C2U( "error-bars-x" );
+// aOptRolesSeq[1] = C2U( "error-bars-y" );
+// }
+
+ return aOptRolesSeq;
+}
+
+
+// ____ OPropertySet ____
+uno::Any ScatterChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ScatterChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > ScatterChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_SCATTER;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ScatterChartType,
+ C2U( "com.sun.star.comp.chart.ScatterChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/ScatterChartType.hxx b/chart2/source/model/template/ScatterChartType.hxx
new file mode 100644
index 000000000000..aed0cce2a97f
--- /dev/null
+++ b/chart2/source/model/template/ScatterChartType.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SCATTERCHARTTYPE_HXX
+#define CHART_SCATTERCHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class ScatterChartType : public ChartType
+{
+public:
+ ScatterChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ ::com::sun::star::chart2::CurveStyle eCurveStyle =
+ ::com::sun::star::chart2::CurveStyle_LINES,
+ sal_Int32 nResolution = 20,
+ sal_Int32 nOrder = 3 );
+ virtual ~ScatterChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ScatterChartType )
+
+protected:
+ explicit ScatterChartType( const ScatterChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedOptionalRoles()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
+ createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_SCATTERCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
new file mode 100644
index 000000000000..a83d9a8a4ea3
--- /dev/null
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -0,0 +1,432 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ScatterChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "XYDataInterpreter.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ScatterChartTypeTemplate" ));
+
+enum
+{
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
+ PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER
+
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "CurveStyle" ),
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
+ ::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "CurveResolution" ),
+ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+ScatterChartTypeTemplate::ScatterChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const OUString & rServiceName,
+ bool bSymbols,
+ bool bHasLines /* = true */,
+ sal_Int32 nDim /* = 2 */ ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_bHasSymbols( bSymbols ),
+ m_bHasLines( bHasLines ),
+ m_nDim( nDim )
+{
+ if( nDim == 3 )
+ m_bHasSymbols = false;
+}
+
+ScatterChartTypeTemplate::~ScatterChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ScatterChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 ScatterChartTypeTemplate::getDimension() const
+{
+ return m_nDim;
+}
+
+StackMode ScatterChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ if( m_nDim == 3 )
+ return StackMode_Z_STACKED;
+ return StackMode_NONE;
+}
+
+void SAL_CALL ScatterChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( 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 );
+ if( m_nDim==3 )
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL ScatterChartTypeTemplate::supportsCategories()
+ throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( 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
+ // with symbols (or with lines)
+ if( bResult )
+ {
+ bool bSymbolFound = false;
+ bool bLineFound = false;
+
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ chart2::Symbol aSymbProp;
+ drawing::LineStyle eLineStyle;
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+
+ bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) &&
+ (aSymbProp.Style != chart2::SymbolStyle_NONE);
+
+ if( bCurrentHasSymbol )
+ bSymbolFound = true;
+
+ if( bCurrentHasSymbol && (!m_bHasSymbols) )
+ {
+ bResult = false;
+ break;
+ }
+
+ bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) &&
+ ( eLineStyle != drawing::LineStyle_NONE );
+
+ if( bCurrentHasLine )
+ bLineFound = true;
+
+ if( bCurrentHasLine && (!m_bHasLines) )
+ {
+ bResult = false;
+ break;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if(bResult)
+ {
+ if( !bLineFound && m_bHasLines && bSymbolFound )
+ bResult = false;
+ else if( !bSymbolFound && m_bHasSymbols && bLineFound )
+ bResult = false;
+ else if( !bLineFound && !bSymbolFound )
+ return m_bHasLines && m_bHasSymbols;
+ }
+ }
+
+ // adapt curve style, spline order and resolution
+ if( bResult && bAdaptProperties )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xChartTypeProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
+ uno::UNO_QUERY_THROW );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(C2U("CurveStyle" )) );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(C2U("CurveResolution" )) );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(C2U("SplineOrder" )) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > ScatterChartTypeTemplate::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_SCATTER ), uno::UNO_QUERY_THROW );
+
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "CurveStyle" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xCTProp->setPropertyValue(
+ C2U( "CurveResolution" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xCTProp->setPropertyValue(
+ C2U( "SplineOrder" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > 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 );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+
+ Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ C2U( "CurveStyle" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xCTProp->setPropertyValue(
+ C2U( "CurveResolution" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xCTProp->setPropertyValue(
+ C2U( "SplineOrder" ), getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XDataInterpreter > SAL_CALL ScatterChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new XYDataInterpreter( GetComponentContext()) );
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > ScatterChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ScatterChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( ScatterChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScatterChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
new file mode 100644
index 000000000000..048cca73a92c
--- /dev/null
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_SCATTERCHARTTYPETEMPLATE_HXX
+#define CHART_SCATTERCHARTTYPETEMPLATE_HXX
+
+#include "ChartTypeTemplate.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class ScatterChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ explicit ScatterChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ bool bSymbols,
+ bool bHasLines = true,
+ sal_Int32 nDim = 2 );
+ virtual ~ScatterChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL supportsCategories()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+private:
+ bool m_bHasSymbols;
+ bool m_bHasLines;
+ sal_Int32 m_nDim;
+};
+
+} // namespace chart
+
+// CHART_SCATTERCHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
new file mode 100644
index 000000000000..00ace6c330ad
--- /dev/null
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -0,0 +1,560 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "StockChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "StockDataInterpreter.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "servicenames_coosystems.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+// ----------------------------------------
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.StockChartTypeTemplate" ));
+
+enum
+{
+ PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
+ PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
+ PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
+ PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Volume" ),
+ PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Open" ),
+ PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "LowHigh" ),
+ PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Japanese" ),
+ PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+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 );
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+// ----------------------------------------
+
+namespace chart
+{
+
+StockChartTypeTemplate::StockChartTypeTemplate(
+ uno::Reference<
+ uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StockVariant eVariant,
+ bool bJapaneseStyle ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex ),
+ m_eStockVariant( eVariant )
+{
+ setFastPropertyValue_NoBroadcast(
+ PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
+ uno::makeAny( ( eVariant == OPEN_LOW_HI_CLOSE ||
+ eVariant == VOL_OPEN_LOW_HI_CLOSE )));
+ setFastPropertyValue_NoBroadcast(
+ PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
+ uno::makeAny( ( eVariant == VOL_LOW_HI_CLOSE ||
+ eVariant == VOL_OPEN_LOW_HI_CLOSE )));
+ setFastPropertyValue_NoBroadcast(
+ PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
+ uno::makeAny( bJapaneseStyle ));
+}
+
+StockChartTypeTemplate::~StockChartTypeTemplate()
+{}
+// ____ OPropertySet ____
+uno::Any StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL StockChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ StockChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
+{
+ // one x-axis
+ if( nDimension <= 0 )
+ return 1;
+ // no further axes
+ if( nDimension >= 2 )
+ return 0;
+
+ // one or two y-axes depending on volume
+ OSL_ASSERT( nDimension == 1 );
+ bool bHasVolume = false;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ return bHasVolume ? 2 : 1;
+}
+
+void SAL_CALL StockChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ try
+ {
+ sal_Int32 nNewAxisIndex = 0;
+
+ bool bHasVolume = false;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ if( bHasVolume )
+ {
+ if( nChartTypeIndex != 0 )
+ nNewAxisIndex = 1;
+ }
+
+ Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U("AttachedAxisIndex"), uno::makeAny( nNewAxisIndex ) );
+
+ if( bHasVolume && nChartTypeIndex==0 )
+ {
+ //switch lines off for volume bars
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ else
+ {
+ //ensure that lines are on
+ if( xProp.is() )
+ {
+ drawing::LineStyle eStyle = drawing::LineStyle_NONE;
+ xProp->getPropertyValue( C2U("LineStyle") ) >>= eStyle;
+ if( eStyle == drawing::LineStyle_NONE )
+ xProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ));
+ }
+ }
+
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL StockChartTypeTemplate::resetStyles(
+ const Reference< chart2::XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::resetStyles( xDiagram );
+ if( getDimension() == 3 )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
+ {
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U("AttachedAxisIndex"), uno::makeAny( sal_Int32(0) ) );
+ }
+ }
+
+ DiagramHelper::setVertical( xDiagram, false );
+}
+
+Reference< XChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
+{
+ Reference< XChartType > xCT;
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
+ if(xFact.is())
+ {
+ 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 );
+ }
+ 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 );
+ }
+ }
+ return xCT;
+}
+
+void StockChartTypeTemplate::createChartTypes(
+ const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
+ const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const Sequence< Reference< XChartType > >& /* aOldChartTypesSeq */ )
+{
+ if( rCoordSys.getLength() < 1 )
+ return;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ bool bHasVolume = false;
+ bool bShowFirst = false;
+ bool bJapaneseStyle = false;
+ bool bShowHighLow = true;
+
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_OPEN ) >>= bShowFirst;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bJapaneseStyle;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH ) >>= bShowHighLow;
+
+ sal_Int32 nSeriesIndex = 0;
+
+ std::vector< Reference< chart2::XChartType > > aChartTypeVec;
+ // Bars (Volume)
+ // -------------
+ if( bHasVolume )
+ {
+ // chart type
+ Reference< XChartType > xCT(
+ xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+ aChartTypeVec.push_back( xCT );
+
+ if( aSeriesSeq.getLength() > nSeriesIndex &&
+ aSeriesSeq[nSeriesIndex].getLength() > 0 )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ }
+ ++nSeriesIndex;
+ }
+
+ Reference< XChartType > xCT(
+ xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY_THROW );
+ aChartTypeVec.push_back( xCT );
+
+ Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ xCTProp->setPropertyValue( C2U("Japanese"), uno::makeAny( bJapaneseStyle ));
+ xCTProp->setPropertyValue( C2U("ShowFirst"), uno::makeAny( bShowFirst ));
+ xCTProp->setPropertyValue( C2U("ShowHighLow"), uno::makeAny( bShowHighLow ));
+ }
+
+ if( aSeriesSeq.getLength() > nSeriesIndex &&
+ aSeriesSeq[ nSeriesIndex ].getLength() > 0 )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ }
+ ++nSeriesIndex;
+
+ // Lines (remaining series)
+ // ------------------------
+ if( aSeriesSeq.getLength() > nSeriesIndex &&
+ aSeriesSeq[ nSeriesIndex ].getLength() > 0 )
+ {
+ xCT.set(
+ xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ aChartTypeVec.push_back( xCT );
+
+ Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
+ xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ }
+
+ Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
+ xCTCnt->setChartTypes( ::chart::ContainerHelper::ContainerToSequence(aChartTypeVec) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate(
+ const uno::Reference< XDiagram >& xDiagram,
+ sal_Bool /* bAdaptProperties */ )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = sal_False;
+
+ if( ! xDiagram.is())
+ return bResult;
+
+ try
+ {
+ sal_Bool bHasVolume = false, bHasOpenValue = false, bHasJapaneseStyle = false;
+
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_OPEN ) >>= bHasOpenValue;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE ) >>= bHasJapaneseStyle;
+
+ Reference< chart2::XChartType > xVolumeChartType;
+ Reference< chart2::XChartType > xCandleStickChartType;
+ Reference< chart2::XChartType > xLineChartType;
+ sal_Int32 nNumberOfChartTypes = 0;
+
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
+ {
+ if( aChartTypeSeq[j].is())
+ {
+ ++nNumberOfChartTypes;
+ if( nNumberOfChartTypes > 3 )
+ break;
+ OUString aCTService = aChartTypeSeq[j]->getChartType();
+ if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ))
+ xVolumeChartType.set( aChartTypeSeq[j] );
+ else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ))
+ xCandleStickChartType.set( aChartTypeSeq[j] );
+ else if( aCTService.equals( CHART2_SERVICE_NAME_CHARTTYPE_LINE ))
+ xLineChartType.set( aChartTypeSeq[j] );
+ }
+ }
+ if( nNumberOfChartTypes > 3 )
+ break;
+ }
+
+ if( xCandleStickChartType.is() &&
+ ( ( bHasVolume &&
+ xVolumeChartType.is() ) ||
+ ( ! bHasVolume &&
+ ! xVolumeChartType.is() )))
+ {
+ bResult = true;
+
+ // check for japanese style
+ Reference< beans::XPropertySet > xCTProp( xCandleStickChartType, uno::UNO_QUERY );
+ if( xCTProp.is())
+ {
+ sal_Bool bJapaneseProp = sal_False;
+ xCTProp->getPropertyValue( C2U("Japanese")) >>= bJapaneseProp;
+ bResult = bResult && ( bHasJapaneseStyle == bJapaneseProp );
+
+ // in old chart japanese == showFirst
+ sal_Bool bShowFirstProp = sal_False;
+ xCTProp->getPropertyValue( C2U("ShowFirst")) >>= bShowFirstProp;
+ bResult = bResult && ( bHasOpenValue == bShowFirstProp );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bResult;
+}
+
+Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > 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 );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< XDataInterpreter > SAL_CALL StockChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new StockDataInterpreter( m_eStockVariant, GetComponentContext() ) );
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > StockChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( StockChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( StockChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( StockChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx
new file mode 100644
index 000000000000..c9347ff4e070
--- /dev/null
+++ b/chart2/source/model/template/StockChartTypeTemplate.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STOCKCHARTTYPETEMPLATE_HXX
+#define CHART_STOCKCHARTTYPETEMPLATE_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
+{
+public:
+ enum StockVariant
+ {
+ LOW_HI_CLOSE,
+ OPEN_LOW_HI_CLOSE,
+ VOL_LOW_HI_CLOSE,
+ VOL_OPEN_LOW_HI_CLOSE
+ };
+
+ /** CTOR
+
+ @param bJapaneseStyle
+ If true, the candlesticks are drawn as solid white or black boxes
+ depending on rising or falling stock-values. Otherwise the
+ open-value will be drawn as a small line at the left side of a
+ straight vertical line, and the close-value on the right hand side.
+ */
+ explicit StockChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName,
+ StockVariant eVariant,
+ bool bJapaneseStyle );
+ virtual ~StockChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartTypeTemplate ____
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetStyles(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ChartTypeTemplate
+ virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension );
+
+ // ____ ChartTypeTemplate ____
+ virtual void createChartTypes(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > >& aSeriesSeq,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+
+private:
+ // todo: deprecate this variable
+ StockVariant m_eStockVariant;
+};
+
+} // namespace chart
+
+// CHART_STOCKCHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx
new file mode 100644
index 000000000000..0d134516a1bb
--- /dev/null
+++ b/chart2/source/model/template/StockDataInterpreter.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "StockDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+// #include <deque>
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+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;
+using ::rtl::OUString;
+using namespace ::chart::ContainerHelper;
+
+namespace chart
+{
+
+// explicit
+StockDataInterpreter::StockDataInterpreter(
+ StockChartTypeTemplate::StockVariant eVariant,
+ const Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext ),
+ m_eStockVariant( eVariant )
+{}
+
+StockDataInterpreter::~StockDataInterpreter()
+{}
+
+StockChartTypeTemplate::StockVariant StockDataInterpreter::GetStockVariant() const
+{
+ return m_eStockVariant;
+}
+
+// ____ XDataInterpreter ____
+InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
+ const Reference< data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& rArguments,
+ const Sequence< Reference< XDataSeries > >& rSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+ const sal_Int32 nDataCount( aData.getLength());
+
+ // sub-type properties
+ const StockChartTypeTemplate::StockVariant eVar( GetStockVariant());
+ const bool bHasOpenValues (( eVar == StockChartTypeTemplate::OPEN_LOW_HI_CLOSE ) ||
+ ( eVar == StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE ));
+ const bool bHasVolume (( eVar == StockChartTypeTemplate::VOL_LOW_HI_CLOSE ) ||
+ ( eVar == StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE ));
+ const bool bHasCategories( HasCategories( rArguments, aData ));
+
+ // necessary roles for "full series"
+ // low/high/close
+ sal_Int32 nNumberOfNecessarySequences( 3 );
+ if( bHasOpenValues )
+ ++nNumberOfNecessarySequences;
+ if( bHasVolume )
+ ++nNumberOfNecessarySequences;
+
+ // calculate number of full series (nNumOfFullSeries) and the number of remaining
+ // sequences used for additional "incomplete series" (nRemaining)
+ sal_Int32 nNumOfFullSeries( 0 );
+ sal_Int32 nRemaining( 0 );
+ {
+ sal_Int32 nAvailableSequences( nDataCount );
+ if( bHasCategories )
+ --nAvailableSequences;
+ nNumOfFullSeries = nAvailableSequences / nNumberOfNecessarySequences;
+ nRemaining = nAvailableSequences % nNumberOfNecessarySequences;
+ }
+ sal_Int32 nCandleStickSeries = nNumOfFullSeries;
+ sal_Int32 nVolumeSeries = nNumOfFullSeries;
+
+ 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 );
+
+ // allocate space for labeled sequences
+ if( nRemaining > 0 )
+ ++nCandleStickSeries;
+ aSequences[nCandleStickGroupIndex].realloc( nCandleStickSeries );
+ if( bHasVolume )
+ {
+ // if there are remaining sequences, the first one is taken for
+ // additional close values, the second one is taken as volume, if volume
+ // is used
+ if( nRemaining > 1 )
+ ++nVolumeSeries;
+ aSequences[nBarGroupIndex].realloc( nVolumeSeries );
+ }
+
+
+ // create data
+ sal_Int32 nSourceIndex = 0; // index into aData sequence
+
+ // 1. categories
+ if( bHasCategories )
+ {
+ xCategories.set( aData[nSourceIndex] );
+ ++nSourceIndex;
+ }
+
+ // 2. create "full" series
+ for( sal_Int32 nLabeledSeqIdx=0; nLabeledSeqIdx<nNumOfFullSeries; ++nLabeledSeqIdx )
+ {
+ // bar
+ if( bHasVolume )
+ {
+ aSequences[nBarGroupIndex][nLabeledSeqIdx].realloc( 1 );
+ aSequences[nBarGroupIndex][nLabeledSeqIdx][0].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-y"));
+ ++nSourceIndex;
+ }
+
+ sal_Int32 nSeqIdx = 0;
+ if( bHasOpenValues )
+ {
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 4 );
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-first"));
+ ++nSourceIndex, ++nSeqIdx;
+ }
+ else
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx].realloc( 3 );
+
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-min"));
+ ++nSourceIndex, ++nSeqIdx;
+
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-max"));
+ ++nSourceIndex, ++nSeqIdx;
+
+ aSequences[nCandleStickGroupIndex][nLabeledSeqIdx][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-last"));
+ ++nSourceIndex, ++nSeqIdx;
+ }
+
+ // 3. create series with remaining sequences
+ if( bHasVolume && nRemaining > 1 )
+ {
+ OSL_ASSERT( nVolumeSeries > nNumOfFullSeries );
+ aSequences[nBarGroupIndex][nVolumeSeries - 1].realloc( 1 );
+ OSL_ASSERT( nDataCount > nSourceIndex );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-y"));
+ aSequences[nBarGroupIndex][nVolumeSeries - 1][0].set( 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" );
+ }
+
+ // candle-stick
+ if( nRemaining > 0 )
+ {
+ OSL_ASSERT( nCandleStickSeries > nNumOfFullSeries );
+ const sal_Int32 nSeriesIndex = nCandleStickSeries - 1;
+ aSequences[nCandleStickGroupIndex][nSeriesIndex].realloc( nRemaining );
+ OSL_ASSERT( nDataCount > nSourceIndex );
+
+ // 1. low
+ sal_Int32 nSeqIdx( 0 );
+ aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-min"));
+ ++nSourceIndex, ++nSeqIdx;
+
+ // 2. high
+ if( nSeqIdx < nRemaining )
+ {
+ aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-max"));
+ ++nSourceIndex, ++nSeqIdx;
+ }
+
+ // 3. close
+ OSL_ENSURE( bHasOpenValues || nSeqIdx >= nRemaining, "could have created full series" );
+ if( nSeqIdx < nRemaining )
+ {
+ aSequences[nCandleStickGroupIndex][nSeriesIndex][nSeqIdx].set( aData[nSourceIndex] );
+ if( aData[nSourceIndex].is())
+ SetRole( aData[nSourceIndex]->getValues(), C2U("values-last"));
+ ++nSourceIndex, ++nSeqIdx;
+ }
+
+ // 4. open
+ OSL_ENSURE( nSeqIdx >= nRemaining, "could have created full series" );
+ }
+
+ // create DataSeries
+ Sequence< Sequence< Reference< XDataSeries > > > aResultSeries( nNumberOfGroups );
+ sal_Int32 nGroupIndex, nReUsedSeriesIdx = 0;
+ for( nGroupIndex=0; nGroupIndex<nNumberOfGroups; ++nGroupIndex )
+ {
+ const sal_Int32 nNumSeriesData = aSequences[nGroupIndex].getLength();
+ aResultSeries[nGroupIndex].realloc( nNumSeriesData );
+ for( sal_Int32 nSeriesIdx = 0; nSeriesIdx < nNumSeriesData; ++nSeriesIdx, ++nReUsedSeriesIdx )
+ {
+ try
+ {
+ Reference< XDataSeries > xSeries;
+ if( nReUsedSeriesIdx < rSeriesToReUse.getLength())
+ xSeries.set( rSeriesToReUse[nReUsedSeriesIdx] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ) );
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY_THROW );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aSequences[nGroupIndex][nSeriesIdx] );
+ aResultSeries[nGroupIndex][nSeriesIdx].set( xSeries );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ return InterpretedData( aResultSeries, xCategories );
+}
+
+// criterion: there must be two groups for stock-charts with volume and all
+// series must have the correct number of data::XLabeledDataSequences
+
+// todo: skip first criterion? (to allow easy switch from stock-chart without
+// volume to one with volume)
+sal_Bool SAL_CALL StockDataInterpreter::isDataCompatible(
+ const InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ // high/low/close
+ sal_Int32 nNumberOfNecessarySequences = 3;
+ // open
+ StockChartTypeTemplate::StockVariant eVar( GetStockVariant());
+ if( ( eVar == StockChartTypeTemplate::OPEN_LOW_HI_CLOSE ) ||
+ ( eVar == StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE ))
+ ++nNumberOfNecessarySequences;
+ // volume
+ bool bHasVolume = (( eVar == StockChartTypeTemplate::VOL_LOW_HI_CLOSE ) ||
+ ( eVar == StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE ));
+
+ // 1. correct number of sub-types
+ if( aInterpretedData.Series.getLength() < (bHasVolume ? 2 : 1 ))
+ return sal_False;
+
+ // 2. a. volume -- use default check
+ if( bHasVolume )
+ {
+ if( ! DataInterpreter::isDataCompatible(
+ InterpretedData( Sequence< Sequence< Reference< XDataSeries > > >(
+ aInterpretedData.Series.getConstArray(), 1 ),
+ aInterpretedData.Categories )))
+ return sal_False;
+ }
+
+ // 2. b. candlestick
+ {
+ OSL_ASSERT( aInterpretedData.Series.getLength() > (bHasVolume ? 1 : 0));
+ Sequence< Reference< XDataSeries > > aSeries( aInterpretedData.Series[(bHasVolume ? 1 : 0)] );
+ if(!aSeries.getLength())
+ return sal_False;
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != nNumberOfNecessarySequences )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // 2. c. additional series
+ // ignore
+
+ return sal_True;
+}
+
+InterpretedData SAL_CALL StockDataInterpreter::reinterpretDataSeries(
+ const InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ // prerequisite: StockDataInterpreter::isDataCompatible() returned true
+ return aInterpretedData;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/StockDataInterpreter.hxx b/chart2/source/model/template/StockDataInterpreter.hxx
new file mode 100644
index 000000000000..bb9edf48c169
--- /dev/null
+++ b/chart2/source/model/template/StockDataInterpreter.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_STOCKDATAINTERPRETER_HXX
+#define CHART_STOCKDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+#include "StockChartTypeTemplate.hxx"
+
+namespace chart
+{
+
+class StockDataInterpreter : public DataInterpreter
+{
+public:
+ explicit StockDataInterpreter(
+ StockChartTypeTemplate::StockVariant eVariant,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~StockDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ StockChartTypeTemplate::StockVariant m_eStockVariant;
+
+ StockChartTypeTemplate::StockVariant GetStockVariant() const;
+};
+
+} // namespace chart
+
+// CHART_STOCKDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx
new file mode 100644
index 000000000000..839c0cbac510
--- /dev/null
+++ b/chart2/source/model/template/XYDataInterpreter.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "XYDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+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;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+XYDataInterpreter::XYDataInterpreter(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext )
+{
+}
+
+XYDataInterpreter::~XYDataInterpreter()
+{
+}
+
+// ____ XDataInterpreter ____
+chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
+ const Reference< chart2::data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xValuesX;
+ vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ // check for categories. If true, the the categories bet parked in the axis scale, but not used via setting the Axistype to Not CATEGORY
+ bool bHasCategories = HasCategories( aArguments, aData );
+
+ // parse data
+ bool bCategoriesUsed = false;
+ for( sal_Int32 nDataIdx= 0; nDataIdx < aData.getLength(); ++nDataIdx )
+ {
+ try
+ {
+ if( bHasCategories && ! bCategoriesUsed )
+ {
+ xCategories.set( aData[nDataIdx] );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), C2U("categories"));
+ bCategoriesUsed = true;
+ }
+ else if( !xValuesX.is() && (aData.getLength()>(bCategoriesUsed?2:1)) )
+ {
+ xValuesX.set( aData[nDataIdx] );
+ if( xValuesX.is())
+ SetRole( xValuesX->getValues(), C2U("values-x"));
+ }
+ else
+ {
+ aSequencesVec.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-y"));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // create DataSeries
+ vector< Reference< data::XLabeledDataSequence > >::const_iterator
+ aSequencesVecIt = aSequencesVec.begin();
+
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSequencesVec.size());
+
+ Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
+ Reference< util::XCloneable > xCloneable( xValuesX, uno::UNO_QUERY );
+
+ for( ;aSequencesVecIt != aSequencesVec.end(); ++aSequencesVecIt, ++nSeriesIndex )
+ {
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData(xValuesX.is()?2:1);
+ if( aSequencesVecIt != aSequencesVec.begin() &&
+ xCloneable.is() )
+ {
+ xClonedXValues.set( xCloneable->createClone(), uno::UNO_QUERY );
+ }
+
+ if( xValuesX.is() )
+ {
+ aNewData[0] = xClonedXValues;
+ aNewData[1] = (*aSequencesVecIt);
+ }
+ else
+ {
+ aNewData[0] = (*aSequencesVecIt);
+ }
+
+ Reference< XDataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.getLength())
+ xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ) );
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ }
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
+ aSeries[0] = ContainerHelper::ContainerToSequence( aSeriesVec );
+ return InterpretedData( aSeries, xCategories );
+}
+
+chart2::InterpretedData SAL_CALL XYDataInterpreter::reinterpretDataSeries(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ InterpretedData aResult( aInterpretedData );
+
+ sal_Int32 i=0;
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.getLength();
+ for( ; i<nCount; ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+
+ // values-y
+ Reference< data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ Reference< data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-x"), false ));
+ // re-use values-... as values-x/values-y
+ if( ! xValuesX.is() ||
+ ! xValuesY.is())
+ {
+ vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ DataSeriesHelper::getAllDataSequencesByRole(
+ xSeriesSource->getDataSequences(), C2U("values"), true ));
+ if( xValuesX.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
+ if( xValuesY.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesY ));
+
+ size_t nIndex = 0;
+ if( ! xValuesY.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesY.set( aValueSeqVec[nIndex++] );
+ if( xValuesY.is())
+ SetRole( xValuesY->getValues(), C2U("values-y"));
+ }
+
+ if( ! xValuesX.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesX.set( aValueSeqVec[nIndex++] );
+ if( xValuesX.is())
+ SetRole( xValuesY->getValues(), C2U("values-x"));
+ }
+ }
+ if( xValuesY.is())
+ {
+ if( xValuesX.is())
+ {
+ aNewSequences.realloc(2);
+ aNewSequences[0] = xValuesX;
+ aNewSequences[1] = xValuesY;
+ }
+ else
+ {
+ aNewSequences.realloc(1);
+ aNewSequences[0] = xValuesY;
+ }
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
+ if( aSeqs.getLength() != aNewSequences.getLength() )
+ {
+#if OSL_DEBUG_LEVEL > 1
+ sal_Int32 j=0;
+ for( ; j<aSeqs.getLength(); ++j )
+ {
+ OSL_ENSURE( aSeqs[j] == xValuesY || aSeqs[j] == xValuesX, "All sequences should be used" );
+ }
+#endif
+ Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
+ xSink->setData( aNewSequences );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+// criterion: all series must have exactly two data::XLabeledDataSequences
+sal_Bool SAL_CALL XYDataInterpreter::isDataCompatible(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != 2 )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return sal_True;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/XYDataInterpreter.hxx b/chart2/source/model/template/XYDataInterpreter.hxx
new file mode 100644
index 000000000000..c8ecb4d17778
--- /dev/null
+++ b/chart2/source/model/template/XYDataInterpreter.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_XYDATAINTERPRETER_HXX
+#define CHART_XYDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+namespace chart
+{
+
+class XYDataInterpreter : public DataInterpreter
+{
+public:
+ explicit XYDataInterpreter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~XYDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_XYDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
new file mode 100644
index 000000000000..c0ffb8f4825f
--- /dev/null
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "_serviceregistration_charttypes.hxx"
+
+#include "AreaChartType.hxx"
+#include "BarChartType.hxx"
+#include "CandleStickChartType.hxx"
+#include "ColumnChartType.hxx"
+#include "LineChartType.hxx"
+#include "NetChartType.hxx"
+#include "FilledNetChartType.hxx"
+#include "PieChartType.hxx"
+#include "ScatterChartType.hxx"
+#include "BubbleChartType.hxx"
+
+namespace
+{
+static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
+{
+ {
+ ::chart::AreaChartType::create
+ , ::chart::AreaChartType::getImplementationName_Static
+ , ::chart::AreaChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::BarChartType::create
+ , ::chart::BarChartType::getImplementationName_Static
+ , ::chart::BarChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::CandleStickChartType::create
+ , ::chart::CandleStickChartType::getImplementationName_Static
+ , ::chart::CandleStickChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ColumnChartType::create
+ , ::chart::ColumnChartType::getImplementationName_Static
+ , ::chart::ColumnChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::LineChartType::create
+ , ::chart::LineChartType::getImplementationName_Static
+ , ::chart::LineChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::NetChartType::create
+ , ::chart::NetChartType::getImplementationName_Static
+ , ::chart::NetChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::FilledNetChartType::create
+ , ::chart::FilledNetChartType::getImplementationName_Static
+ , ::chart::FilledNetChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PieChartType::create
+ , ::chart::PieChartType::getImplementationName_Static
+ , ::chart::PieChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ScatterChartType::create
+ , ::chart::ScatterChartType::getImplementationName_Static
+ , ::chart::ScatterChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::BubbleChartType::create
+ , ::chart::BubbleChartType::getImplementationName_Static
+ , ::chart::BubbleChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+} // anonymous namespace
+
+// static
+struct ::cppu::ImplementationEntry *
+ ChartTypeEntriesForServiceRegistration::getImplementationEntries()
+{
+ return g_entries_chart2_charttypes;
+}
diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk
new file mode 100644
index 000000000000..5599aed50256
--- /dev/null
+++ b/chart2/source/model/template/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJNAME= chart2
+TARGET= chmodeltemplate
+
+PRJINC= $(PRJ)$/source
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# i26518 the gcc-3.0.4 requires to enhance the template-depth
+# this seems to be a compiler issue, so we recommend not to use 3.0.x anymore
+.IF "$(COM)"=="GCC"
+ CFLAGS+=-ftemplate-depth-128
+.ENDIF
+
+# --- export library -------------------------------------------------
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/AreaChartType.obj \
+ $(SLO)$/AreaChartTypeTemplate.obj \
+ $(SLO)$/BarChartType.obj \
+ $(SLO)$/BarChartTypeTemplate.obj \
+ $(SLO)$/CandleStickChartType.obj \
+ $(SLO)$/ChartType.obj \
+ $(SLO)$/ChartTypeManager.obj \
+ $(SLO)$/ChartTypeTemplate.obj \
+ $(SLO)$/ColumnChartType.obj \
+ $(SLO)$/ColumnLineChartTypeTemplate.obj \
+ $(SLO)$/DataInterpreter.obj \
+ $(SLO)$/FilledNetChartType.obj \
+ $(SLO)$/LineChartType.obj \
+ $(SLO)$/LineChartTypeTemplate.obj \
+ $(SLO)$/NetChartType.obj \
+ $(SLO)$/NetChartTypeTemplate.obj \
+ $(SLO)$/PieChartType.obj \
+ $(SLO)$/PieChartTypeTemplate.obj \
+ $(SLO)$/ScatterChartType.obj \
+ $(SLO)$/ScatterChartTypeTemplate.obj \
+ $(SLO)$/BubbleChartType.obj \
+ $(SLO)$/BubbleChartTypeTemplate.obj \
+ $(SLO)$/BubbleDataInterpreter.obj \
+ $(SLO)$/StockChartTypeTemplate.obj \
+ $(SLO)$/StockDataInterpreter.obj \
+ $(SLO)$/XYDataInterpreter.obj \
+ $(SLO)$/ColumnLineDataInterpreter.obj \
+ $(SLO)$/_serviceregistration_charttypes.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
new file mode 100644
index 000000000000..8cdd24e4dc05
--- /dev/null
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -0,0 +1,976 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "macros.hxx"
+#include "AxisIndexDefines.hxx"
+#include "LineProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "servicenames_coosystems.hxx"
+#include "DataSeriesHelper.hxx"
+#include "Scaling.hxx"
+
+#include <unotools/saveopt.hxx>
+
+#include <com/sun/star/chart/ChartAxisPosition.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>
+
+// header for class OUStringBuffer
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+#include <map>
+
+//.............................................................................
+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;
+
+//static
+Reference< chart2::XScaling > AxisHelper::createLinearScaling()
+{
+ return new LinearScaling( 1.0, 0.0 );
+}
+
+//static
+Reference< chart2::XScaling > AxisHelper::createLogarithmicScaling( double fBase )
+{
+ return new LogarithmicScaling( fBase );
+}
+
+//static
+ScaleData AxisHelper::createDefaultScale()
+{
+ ScaleData aScaleData;
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ Sequence< SubIncrement > aSubIncrements(1);
+ aSubIncrements[0] = SubIncrement();
+ aScaleData.IncrementData.SubIncrements = aSubIncrements;
+ return aScaleData;
+}
+
+//static
+void AxisHelper::removeExplicitScaling( ScaleData& rScaleData )
+{
+ uno::Any aEmpty;
+ rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = aEmpty;
+ rScaleData.Scaling = 0;
+}
+
+//static
+bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
+{
+ bool bReturn = false;
+ Reference< lang::XServiceName > xServiceName( xScaling, uno::UNO_QUERY );
+ bReturn =( xServiceName.is() && (xServiceName->getServiceName()).equals(
+ C2U( "com.sun.star.chart2.LogarithmicScaling" )));
+ return bReturn;
+}
+
+//static
+Reference< XAxis > AxisHelper::createAxis(
+ sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
+ , const Reference< XCoordinateSystem >& xCooSys
+ , const Reference< uno::XComponentContext > & xContext
+ , ReferenceSizeProvider * pRefSizeProvider )
+{
+ if( !xContext.is() || !xCooSys.is() )
+ return NULL;
+ if( nDimensionIndex >= xCooSys->getDimension() )
+ return NULL;
+
+ Reference< XAxis > xAxis( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.Axis" ), xContext ), uno::UNO_QUERY );
+
+ 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
+ {
+ ::com::sun::star::chart::ChartAxisPosition eNewAxisPos( ::com::sun::star::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.Categories = aMainScale.Categories;
+ aScale.Orientation = aMainScale.Orientation;
+
+ 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() )
+ {
+ ::com::sun::star::chart::ChartAxisPosition eMainAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ xMainProp->getPropertyValue(C2U( "CrossoverPosition" )) >>= eMainAxisPos;
+ if( ::com::sun::star::chart::ChartAxisPosition_END == eMainAxisPos )
+ eNewAxisPos = ::com::sun::star::chart::ChartAxisPosition_START;
+ }
+ }
+
+ Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue(C2U( "CrossoverPosition" ), uno::makeAny(eNewAxisPos) );
+ }
+
+ Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is() ) try
+ {
+ // set correct initial AutoScale
+ if( pRefSizeProvider )
+ pRefSizeProvider->setValuesAtPropertySet( xProp );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xAxis;
+}
+
+//static
+Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const Reference< chart2::XDiagram >& xDiagram
+ , const Reference< uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider )
+{
+ OSL_ENSURE( xContext.is(), "need a context to create an axis" );
+ if( !xContext.is() )
+ return NULL;
+
+ sal_Int32 nAxisIndex = bMainAxis ? MAIN_AXIS_INDEX : SECONDARY_AXIS_INDEX;
+ sal_Int32 nCooSysIndex = 0;
+ Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+
+ // create axis
+ return AxisHelper::createAxis(
+ nDimensionIndex, nAxisIndex, xCooSys, xContext, pRefSizeProvider );
+}
+
+//static
+void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const Reference< chart2::XDiagram >& xDiagram
+ , const Reference< uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider )
+{
+ if( !xDiagram.is() )
+ return;
+
+ bool bNewAxisCreated = false;
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+ if( !xAxis.is() && xContext.is() )
+ {
+ // create axis
+ bNewAxisCreated = true;
+ xAxis.set( AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, xContext, pRefSizeProvider ) );
+ }
+
+ OSL_ASSERT( xAxis.is());
+ if( !bNewAxisCreated ) //default is true already if created
+ AxisHelper::makeAxisVisible( xAxis );
+}
+
+//static
+void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const Reference< XDiagram >& xDiagram
+ , const Reference< uno::XComponentContext >& /*xContext*/ )
+{
+ if( !xDiagram.is() )
+ return;
+
+ Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ if(!xCooSys.is())
+ return;
+
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ if(!xAxis.is())
+ {
+ //hhhh todo create axis without axis visibility
+ }
+ if(!xAxis.is())
+ return;
+
+ if( bMainGrid )
+ AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ else
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridVisible( aSubGrids[nN] );
+ }
+}
+
+//static
+void AxisHelper::makeAxisVisible( const Reference< XAxis >& xAxis )
+{
+ Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ xProps->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_True ) );
+ LineProperties::SetLineVisible( xProps );
+ xProps->setPropertyValue( C2U( "DisplayLabels" ), uno::makeAny( sal_True ) );
+ }
+}
+
+//static
+void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridProperties )
+{
+ if( xGridProperties.is() )
+ {
+ xGridProperties->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_True ) );
+ LineProperties::SetLineVisible( xGridProperties );
+ }
+}
+
+//static
+void AxisHelper::hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ AxisHelper::makeAxisInvisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+}
+
+//static
+void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis )
+{
+ Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ xProps->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+}
+
+//static
+void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& 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< Reference< chart2::XDataSeries > >::const_iterator aIt = aSeriesVector.begin();
+ for( ; aIt != aSeriesVector.end(); ++aIt)
+ {
+ uno::Reference< chart2::XAxis > xCurrentAxis( DiagramHelper::getAttachedAxis( *aIt, xDiagram ), uno::UNO_QUERY );
+ if( xCurrentAxis==xAxis )
+ {
+ bOtherSeriesAttachedToThisAxis = true;
+ break;
+ }
+ }
+ if(!bOtherSeriesAttachedToThisAxis && !aSeriesVector.empty() )
+ AxisHelper::makeAxisInvisible( xAxis );
+}
+
+void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const Reference< XDiagram >& xDiagram )
+{
+ if( !xDiagram.is() )
+ return;
+
+ Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ if(!xCooSys.is())
+ return;
+
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ if(!xAxis.is())
+ return;
+
+ if( bMainGrid )
+ AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
+ else
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridInvisible( aSubGrids[nN] );
+ }
+}
+
+//static
+void AxisHelper::makeGridInvisible( const Reference< beans::XPropertySet >& xGridProperties )
+{
+ if( xGridProperties.is() )
+ {
+ xGridProperties->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+}
+
+sal_Bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
+ , const Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
+{
+ sal_Bool bRet = false;
+
+ Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, nCooSysIndex );
+ if(!xCooSys.is())
+ return bRet;
+
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys ) );
+ if(!xAxis.is())
+ return bRet;
+
+ if( bMainGrid )
+ bRet = AxisHelper::isGridVisible( xAxis->getGridProperties() );
+ else
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ if( aSubGrids.getLength() )
+ bRet = AxisHelper::isGridVisible( aSubGrids[0] );
+ }
+
+ return bRet;
+}
+
+//static
+Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemByIndex(
+ const Reference< XDiagram >& xDiagram, sal_Int32 nIndex )
+{
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if(!xCooSysContainer.is())
+ return NULL;
+ Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
+ if(0<=nIndex && nIndex<aCooSysList.getLength())
+ return aCooSysList[nIndex];
+ return NULL;
+}
+
+//static
+Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ Reference< XAxis > xRet;
+ try
+ {
+ Reference< XCoordinateSystem > xCooSys = AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 );
+ xRet.set( AxisHelper::getAxis( nDimensionIndex, bMainAxis ? 0 : 1, xCooSys ) );
+ }
+ catch( const uno::Exception & )
+ {
+ }
+ return xRet;
+}
+
+//static
+Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
+ , const Reference< XCoordinateSystem >& xCooSys )
+{
+ Reference< XAxis > xRet;
+ try
+ {
+ if( xCooSys.is() )
+ xRet.set( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ }
+ catch( const uno::Exception & )
+ {
+ }
+ return xRet;
+}
+
+//static
+Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xAxis
+ , const Reference< XCoordinateSystem >& xCooSys )
+{
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ if( 2==nDimensionIndex )
+ {
+ nDimensionIndex=1;
+ bool bSwapXY = false;
+ Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
+ if( xCooSysProp.is() && (xCooSysProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bSwapXY) && bSwapXY )
+ nDimensionIndex=0;
+ }
+ else if( 1==nDimensionIndex )
+ nDimensionIndex=0;
+ else
+ nDimensionIndex=1;
+ return AxisHelper::getAxis( nDimensionIndex, 0, xCooSys );
+}
+
+//static
+Reference< XAxis > AxisHelper::getParallelAxis( const Reference< XAxis >& xAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ try
+ {
+ sal_Int32 nCooSysIndex=-1;
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ if( getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
+ {
+ sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
+ return getAxis( nDimensionIndex, nParallelAxisIndex, getCoordinateSystemByIndex( xDiagram, nCooSysIndex ) );
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+ return 0;
+}
+
+sal_Bool AxisHelper::isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ return AxisHelper::isAxisVisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
+}
+
+//static
+sal_Bool AxisHelper::isAxisVisible( const Reference< XAxis >& xAxis )
+{
+ sal_Bool bRet = false;
+
+ Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ xProps->getPropertyValue( C2U( "Show" ) ) >>= bRet;
+ bRet = bRet && ( LineProperties::IsLineVisible( xProps )
+ || areAxisLabelsVisible( xProps ) );
+ }
+
+ return bRet;
+}
+
+sal_Bool AxisHelper::areAxisLabelsVisible( const Reference< beans::XPropertySet >& xAxisProperties )
+{
+ sal_Bool bRet = false;
+ if( xAxisProperties.is() )
+ {
+ xAxisProperties->getPropertyValue( C2U( "DisplayLabels" ) ) >>= bRet;
+ }
+ return bRet;
+}
+
+//static
+sal_Bool AxisHelper::isGridVisible( const Reference< beans::XPropertySet >& xGridProperies )
+{
+ sal_Bool bRet = false;
+
+ if( xGridProperies.is() )
+ {
+ xGridProperies->getPropertyValue( C2U( "Show" ) ) >>= bRet;
+ bRet = bRet && LineProperties::IsLineVisible( xGridProperies );
+ }
+
+ return bRet;
+}
+
+//static
+Reference< beans::XPropertySet > AxisHelper::getGridProperties(
+ const Reference< XCoordinateSystem >& xCooSys
+ , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex, sal_Int32 nSubGridIndex )
+{
+ Reference< beans::XPropertySet > xRet;
+
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
+ if( xAxis.is() )
+ {
+ if( nSubGridIndex<0 )
+ xRet.set( xAxis->getGridProperties() );
+ else
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ if( nSubGridIndex >= 0 && nSubGridIndex < aSubGrids.getLength() )
+ xRet.set( aSubGrids[nSubGridIndex] );
+ }
+ }
+
+ return xRet;
+}
+
+//static
+sal_Int32 AxisHelper::getDimensionIndexOfAxis(
+ const Reference< XAxis >& xAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex , nDimensionIndex, nAxisIndex );
+ return nDimensionIndex;
+}
+
+//static
+bool AxisHelper::getIndicesForAxis(
+ const Reference< XAxis >& xAxis
+ , const Reference< XCoordinateSystem >& xCooSys
+ , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
+{
+ //returns true if indices are found
+
+ rOutDimensionIndex = -1;
+ rOutAxisIndex = -1;
+
+ if( xCooSys.is() && xAxis.is() )
+ {
+ 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++ )
+ {
+ xCurrentAxis = xCooSys->getAxisByDimension(nDimensionIndex,nAxisIndex);
+ if( xCurrentAxis == xAxis )
+ {
+ rOutDimensionIndex = nDimensionIndex;
+ rOutAxisIndex = nAxisIndex;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+//static
+bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram
+ , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
+{
+ //returns true if indices are found
+
+ rOutCooSysIndex = -1;
+ rOutDimensionIndex = -1;
+ rOutAxisIndex = -1;
+
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if(xCooSysContainer.is())
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
+ for( sal_Int32 nC=0; nC<aCooSysList.getLength(); ++nC )
+ {
+ if( AxisHelper::getIndicesForAxis( xAxis, aCooSysList[nC], rOutDimensionIndex, rOutAxisIndex ) )
+ {
+ rOutCooSysIndex = nC;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//static
+std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem(
+ const Reference< XCoordinateSystem >& xCooSys
+ , bool bOnlyVisible /* = false */ )
+{
+ std::vector< Reference< XAxis > > aAxisVector;
+
+ if(xCooSys.is())
+ {
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nMaxDimensionIndex = xCooSys->getDimension() -1;
+ if( nMaxDimensionIndex>=0 )
+ {
+ for(nDimensionIndex=0; nDimensionIndex<=nMaxDimensionIndex; ++nDimensionIndex)
+ {
+ const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
+ {
+ try
+ {
+ Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ bool bAddAxis = true;
+ if( xAxis.is() )
+ {
+ if( bOnlyVisible )
+ {
+ Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY );
+ if( !xAxisProp.is() ||
+ !(xAxisProp->getPropertyValue( C2U("Show")) >>= bAddAxis) )
+ bAddAxis = false;
+ }
+ if( bAddAxis )
+ aAxisVector.push_back( xAxis );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ }
+
+ return aAxisVector;
+}
+
+//static
+Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram(
+ const Reference< XDiagram >& xDiagram
+ , bool bOnlyVisible )
+{
+ std::vector< Reference< XAxis > > aAxisVector;
+
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if(xCooSysContainer.is())
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems();
+ sal_Int32 nC = 0;
+ for( nC=0; nC<aCooSysList.getLength(); ++nC )
+ {
+ std::vector< Reference< XAxis > > aAxesPerCooSys( AxisHelper::getAllAxesOfCoordinateSystem( aCooSysList[nC], bOnlyVisible ) );
+ aAxisVector.insert( aAxisVector.end(), aAxesPerCooSys.begin(), aAxesPerCooSys.end() );
+ }
+ }
+
+ return ContainerHelper::ContainerToSequence( aAxisVector );
+}
+
+//static
+Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Reference< XDiagram >& xDiagram )
+{
+ Sequence< Reference< XAxis > > aAllAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ std::vector< Reference< beans::XPropertySet > > aGridVector;
+
+ sal_Int32 nA = 0;
+ for( nA=0; nA<aAllAxes.getLength(); ++nA )
+ {
+ Reference< XAxis > xAxis( aAllAxes[nA] );
+ if(!xAxis.is())
+ continue;
+ Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
+ if( xGridProperties.is() )
+ aGridVector.push_back( xGridProperties );
+
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );;
+ sal_Int32 nSubGrid = 0;
+ for( nSubGrid = 0; nSubGrid < aSubGrids.getLength(); ++nSubGrid )
+ {
+ Reference< beans::XPropertySet > xSubGrid( aSubGrids[nSubGrid] );
+ if( xSubGrid.is() )
+ aGridVector.push_back( xSubGrid );
+ }
+ }
+
+ return ContainerHelper::ContainerToSequence( aGridVector );
+}
+
+//static
+void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityList
+ , const Reference< XDiagram>& xDiagram, sal_Bool bAxis )
+{
+ rPossibilityList.realloc(6);
+
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+
+ //set possibilities:
+ sal_Int32 nIndex=0;
+ Reference< XChartType > xChartType = DiagramHelper::getChartTypeByIndex( xDiagram, 0 );
+ for(nIndex=0;nIndex<3;nIndex++)
+ rPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex);
+ for(nIndex=3;nIndex<6;nIndex++)
+ if( bAxis )
+ rPossibilityList[nIndex]=ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount,nIndex-3);
+ else
+ rPossibilityList[nIndex] = rPossibilityList[nIndex-3];
+}
+
+//static
+bool AxisHelper::isSecondaryYAxisNeeded( const Reference< XCoordinateSystem >& xCooSys )
+{
+ Reference< chart2::XChartTypeContainer > xCTCnt( xCooSys, uno::UNO_QUERY );
+ if( xCTCnt.is() )
+ {
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes() );
+ for( sal_Int32 i=0; i<aChartTypes.getLength(); ++i )
+ {
+ Reference< XDataSeriesContainer > xSeriesContainer( aChartTypes[i] , 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( C2U( "AttachedAxisIndex" ) ) >>= nAttachedAxisIndex ) && nAttachedAxisIndex>0 )
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+//static
+bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis
+ , const Reference< XCoordinateSystem >& xCooSys )
+{
+ bool bRet = false;
+
+ if( xAxis.is() && xCooSys.is() )
+ {
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
+ {
+ sal_Int32 nDimensionCount = xCooSys->getDimension();
+ Reference< XChartType > xChartType( AxisHelper::getChartTypeByIndex( xCooSys, 0 ) );
+
+ bool bMainAxis = (nAxisIndex==MAIN_AXIS_INDEX);
+ if( bMainAxis )
+ bRet = ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nDimensionIndex);
+ else
+ bRet = ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount,nDimensionIndex);
+ }
+ }
+
+ return bRet;
+}
+
+//static
+void AxisHelper::getAxisOrGridExcistence( Sequence< sal_Bool >& rExistenceList
+ , const Reference< XDiagram>& xDiagram, sal_Bool bAxis )
+{
+ rExistenceList.realloc(6);
+
+ if(bAxis)
+ {
+ sal_Int32 nN;
+ Reference< XAxis > xAxis;
+ for(nN=0;nN<3;nN++)
+ rExistenceList[nN] = AxisHelper::isAxisShown( nN, true, xDiagram );
+ for(nN=3;nN<6;nN++)
+ rExistenceList[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 );
+ for(nN=3;nN<6;nN++)
+ rExistenceList[nN] = AxisHelper::isGridShown( nN%3, 0, false, xDiagram );
+ }
+}
+
+//static
+bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram
+ , const Sequence< sal_Bool >& rOldExistenceList
+ , const Sequence< sal_Bool >& rNewExistenceList
+ , const Reference< uno::XComponentContext >& xContext
+ , ReferenceSizeProvider * pRefSizeProvider )
+{
+ bool bChanged = false;
+ for(sal_Int32 nN=0;nN<6;nN++)
+ {
+ if(rOldExistenceList[nN]!=rNewExistenceList[nN])
+ {
+ bChanged = true;
+ if(rNewExistenceList[nN])
+ {
+ AxisHelper::showAxis( nN%3, nN<3, xDiagram, xContext, pRefSizeProvider );
+ }
+ else
+ AxisHelper::hideAxis( nN%3, nN<3, xDiagram );
+ }
+ }
+ return bChanged;
+}
+
+//static
+bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram
+ , const Sequence< sal_Bool >& rOldExistenceList
+ , const Sequence< sal_Bool >& rNewExistenceList
+ , const Reference< uno::XComponentContext >& xContext )
+{
+ bool bChanged = false;
+ for(sal_Int32 nN=0;nN<6;nN++)
+ {
+ if(rOldExistenceList[nN]!=rNewExistenceList[nN])
+ {
+ bChanged = true;
+ if(rNewExistenceList[nN])
+ AxisHelper::showGrid( nN%3, 0, nN<3, xDiagram, xContext );
+ else
+ AxisHelper::hideGrid( nN%3, 0, nN<3, xDiagram );
+ }
+ }
+ return bChanged;
+}
+
+//static
+Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis(
+ const Reference< XAxis >& xAxis
+ , const Reference< XDiagram >& xDiagram )
+{
+ Reference< XCoordinateSystem > xRet;
+
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( xCooSysContainer.is() )
+ {
+ Reference< XCoordinateSystem > xCooSys;
+ Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCooSysIndex = 0; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
+ {
+ xCooSys = aCooSysList[nCooSysIndex];
+ std::vector< Reference< XAxis > > 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;
+ }
+ }
+ }
+ return xRet;
+}
+
+Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoordinateSystem >& xCooSys, sal_Int32 nIndex )
+{
+ Reference< XChartType > xChartType;
+
+ Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
+ if( xChartTypeContainer.is() )
+ {
+ Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+ if( nIndex >= 0 && nIndex < aChartTypeList.getLength() )
+ xChartType.set( aChartTypeList[nIndex] );
+ }
+
+ return xChartType;
+}
+
+void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys )
+{
+ if( xCooSys.is() )
+ {
+ bool bCartesian = xCooSys->getViewServiceName().equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME );
+ if( bCartesian )
+ {
+ bool bVertical = false;
+ Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
+ if( xCooSysProp.is() )
+ xCooSysProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bVertical;
+
+ sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0;
+ sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1;
+
+ try
+ {
+ //reverse direction for horizontal main axis
+ Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) );
+ if( xHorizontalMainAxis.is() )
+ {
+ chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData();
+ aScale.Orientation = chart2::AxisOrientation_REVERSE;
+ xHorizontalMainAxis->setScaleData(aScale);
+ }
+
+ //mathematical direction for vertical main axis
+ Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) );
+ if( xVerticalMainAxis.is() )
+ {
+ chart2::ScaleData aScale = xVerticalMainAxis->getScaleData();
+ aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xVerticalMainAxis->setScaleData(aScale);
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ try
+ {
+ //reverse direction for horizontal secondary axis
+ Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) );
+ if( xHorizontalSecondaryAxis.is() )
+ {
+ chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData();
+ aScale.Orientation = chart2::AxisOrientation_REVERSE;
+ xHorizontalSecondaryAxis->setScaleData(aScale);
+ }
+
+ //mathematical direction for vertical secondary axis
+ Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) );
+ if( xVerticalSecondaryAxis.is() )
+ {
+ chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData();
+ aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xVerticalSecondaryAxis->setScaleData(aScale);
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex )
+{
+ Reference< XChartType > xChartType;
+ ::std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ ::std::vector< Reference< XDataSeries > >::const_iterator aIter = aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex( *aIter );
+ if( nAttachedAxisIndex == nCurrentIndex )
+ {
+ xChartType = DiagramHelper::getChartTypeOfSeries( xDiagram, *aIter );
+ if(xChartType.is())
+ break;
+ }
+ }
+ return xChartType;
+}
+
+bool AxisHelper::isAxisPositioningEnabled()
+{
+ const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ return nCurrentVersion >= SvtSaveOptions::ODFVER_012;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/BaseGFXHelper.cxx b/chart2/source/tools/BaseGFXHelper.cxx
new file mode 100644
index 000000000000..0ec7df9b7d71
--- /dev/null
+++ b/chart2/source/tools/BaseGFXHelper.cxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BaseGFXHelper.hxx"
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::drawing;
+using namespace ::basegfx;
+
+namespace chart
+{
+namespace BaseGFXHelper
+{
+
+::basegfx::B3DRange getBoundVolume( const drawing::PolyPolygonShape3D& rPolyPoly )
+{
+ ::basegfx::B3DRange aRet;
+
+ bool bInited = false;
+ sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
+ for(sal_Int32 nPoly = 0; nPoly < nPolyCount; nPoly++)
+ {
+ sal_Int32 nPointCount = rPolyPoly.SequenceX[nPoly].getLength();
+ for( sal_Int32 nPoint = 0; nPoint < nPointCount; nPoint++)
+ {
+ if(!bInited)
+ {
+ aRet = ::basegfx::B3DRange(::basegfx::B3DTuple(
+ rPolyPoly.SequenceX[nPoly][nPoint]
+ , rPolyPoly.SequenceY[nPoly][nPoint]
+ , rPolyPoly.SequenceZ[nPoly][nPoint]));
+ bInited = true;
+ }
+ else
+ {
+ aRet.expand( ::basegfx::B3DTuple(
+ rPolyPoly.SequenceX[nPoly][nPoint]
+ , rPolyPoly.SequenceY[nPoly][nPoint]
+ , rPolyPoly.SequenceZ[nPoly][nPoint]));
+ }
+ }
+ }
+
+ 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);
+}
+
+awt::Point B2IRectangleToAWTPoint( const ::basegfx::B2IRectangle& rB2IRectangle )
+{
+ return awt::Point( rB2IRectangle.getMinX(), rB2IRectangle.getMinY() );
+}
+
+awt::Size B2IRectangleToAWTSize( const ::basegfx::B2IRectangle& rB2IRectangle )
+{
+ return awt::Size( static_cast< sal_Int32 >( rB2IRectangle.getWidth()),
+ static_cast< sal_Int32 >( rB2IRectangle.getHeight()));
+}
+
+awt::Rectangle B2IRectangleToAWTRectangle(
+ const ::basegfx::B2IRectangle& rB2IRectangle )
+{
+ return awt::Rectangle( rB2IRectangle.getMinX(), rB2IRectangle.getMinY(),
+ static_cast< sal_Int32 >( rB2IRectangle.getWidth()),
+ static_cast< sal_Int32 >( rB2IRectangle.getHeight()));
+}
+
+B3DVector Direction3DToB3DVector( const Direction3D& rDirection )
+{
+ return B3DVector(
+ rDirection.DirectionX
+ , rDirection.DirectionY
+ , rDirection.DirectionZ
+ );
+}
+
+Direction3D B3DVectorToDirection3D( const B3DVector& rB3DVector )
+{
+ return Direction3D(
+ rB3DVector.getX()
+ , rB3DVector.getY()
+ , rB3DVector.getZ()
+ );
+}
+
+B3DVector Position3DToB3DVector( const Position3D& rPosition )
+{
+ return B3DVector(
+ rPosition.PositionX
+ , rPosition.PositionY
+ , rPosition.PositionZ
+ );
+}
+
+Position3D B3DVectorToPosition3D( const B3DVector& rB3DVector )
+{
+ return Position3D(
+ rB3DVector.getX()
+ , rB3DVector.getY()
+ , rB3DVector.getZ()
+ );
+}
+
+B3DHomMatrix HomogenMatrixToB3DHomMatrix( const HomogenMatrix & rHomogenMatrix )
+{
+ B3DHomMatrix aResult;
+
+ aResult.set( 0, 0, rHomogenMatrix.Line1.Column1 );
+ aResult.set( 0, 1, rHomogenMatrix.Line1.Column2 );
+ aResult.set( 0, 2, rHomogenMatrix.Line1.Column3 );
+ aResult.set( 0, 3, rHomogenMatrix.Line1.Column4 );
+
+ aResult.set( 1, 0, rHomogenMatrix.Line2.Column1 );
+ aResult.set( 1, 1, rHomogenMatrix.Line2.Column2 );
+ aResult.set( 1, 2, rHomogenMatrix.Line2.Column3 );
+ aResult.set( 1, 3, rHomogenMatrix.Line2.Column4 );
+
+ aResult.set( 2, 0, rHomogenMatrix.Line3.Column1 );
+ aResult.set( 2, 1, rHomogenMatrix.Line3.Column2 );
+ aResult.set( 2, 2, rHomogenMatrix.Line3.Column3 );
+ aResult.set( 2, 3, rHomogenMatrix.Line3.Column4 );
+
+ aResult.set( 3, 0, rHomogenMatrix.Line4.Column1 );
+ aResult.set( 3, 1, rHomogenMatrix.Line4.Column2 );
+ aResult.set( 3, 2, rHomogenMatrix.Line4.Column3 );
+ aResult.set( 3, 3, rHomogenMatrix.Line4.Column4 );
+
+ return aResult;
+}
+
+HomogenMatrix B3DHomMatrixToHomogenMatrix( const B3DHomMatrix & rB3DMatrix )
+{
+ HomogenMatrix aResult;
+
+ aResult.Line1.Column1 = rB3DMatrix.get( 0, 0 );
+ aResult.Line1.Column2 = rB3DMatrix.get( 0, 1 );
+ aResult.Line1.Column3 = rB3DMatrix.get( 0, 2 );
+ aResult.Line1.Column4 = rB3DMatrix.get( 0, 3 );
+
+ aResult.Line2.Column1 = rB3DMatrix.get( 1, 0 );
+ aResult.Line2.Column2 = rB3DMatrix.get( 1, 1 );
+ aResult.Line2.Column3 = rB3DMatrix.get( 1, 2 );
+ aResult.Line2.Column4 = rB3DMatrix.get( 1, 3 );
+
+ aResult.Line3.Column1 = rB3DMatrix.get( 2, 0 );
+ aResult.Line3.Column2 = rB3DMatrix.get( 2, 1 );
+ aResult.Line3.Column3 = rB3DMatrix.get( 2, 2 );
+ aResult.Line3.Column4 = rB3DMatrix.get( 2, 3 );
+
+ aResult.Line4.Column1 = rB3DMatrix.get( 3, 0 );
+ aResult.Line4.Column2 = rB3DMatrix.get( 3, 1 );
+ aResult.Line4.Column3 = rB3DMatrix.get( 3, 2 );
+ aResult.Line4.Column4 = rB3DMatrix.get( 3, 3 );
+
+ return aResult;
+}
+
+B3DTuple GetRotationFromMatrix( const B3DHomMatrix & rB3DMatrix )
+{
+ B3DTuple aScale, aTranslation, aRotation, aShearing;
+ rB3DMatrix.decompose( aScale, aTranslation, aRotation, aShearing );
+ return aRotation;
+}
+
+B3DTuple GetScaleFromMatrix( const B3DHomMatrix & rB3DMatrix )
+{
+ B3DTuple aScale, aTranslation, aRotation, aShearing;
+ rB3DMatrix.decompose( aScale, aTranslation, aRotation, aShearing );
+ return aScale;
+}
+
+void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix )
+{
+ B3DTuple aR( GetRotationFromMatrix( rB3DMatrix ) );
+ ::basegfx::B3DHomMatrix aRotationMatrix;
+ aRotationMatrix.rotate(aR.getX(),aR.getY(),aR.getZ());
+ rB3DMatrix = aRotationMatrix;
+}
+
+double Deg2Rad( double fDegrees )
+{
+ return fDegrees * ( F_PI / 180.0 );
+}
+
+double Rad2Deg( double fRadians )
+{
+ return fRadians * ( 180.0 / F_PI );
+}
+
+} // namespace BaseGFXHelper
+} // namespace chart
diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx
new file mode 100644
index 000000000000..678cd8ba8314
--- /dev/null
+++ b/chart2/source/tools/CachedDataSequence.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "CachedDataSequence.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ModifyListenerHelper.hxx"
+
+#include <comphelper/sequenceashashmap.hxx>
+
+#include <algorithm>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// necessary for MS compiler
+using ::comphelper::OPropertyContainer;
+using ::comphelper::OMutexAndBroadcastHelper;
+using ::comphelper::OPropertyArrayUsageHelper;
+using ::chart::impl::CachedDataSequence_Base;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.CachedDataSequence" ));
+
+enum
+{
+// PROP_SOURCE_IDENTIFIER,
+ PROP_NUMBERFORMAT_KEY,
+ PROP_PROPOSED_ROLE
+};
+} // anonymous namespace
+
+
+// ____________________
+namespace chart
+{
+
+CachedDataSequence::CachedDataSequence()
+ : OPropertyContainer( GetBroadcastHelper()),
+ CachedDataSequence_Base( GetMutex()),
+ m_eCurrentDataType( NUMERICAL ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ registerProperties();
+}
+CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ )
+ : OPropertyContainer( GetBroadcastHelper()),
+ CachedDataSequence_Base( GetMutex()),
+ m_eCurrentDataType( MIXED ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder( ))
+{
+ registerProperties();
+}
+
+CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
+ : OPropertyContainer( GetBroadcastHelper()),
+ CachedDataSequence_Base( GetMutex()),
+ m_eCurrentDataType( TEXTUAL ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ m_aTextualSequence.realloc(1);
+ m_aTextualSequence[0] = rSingleText;
+ registerProperties();
+}
+
+CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
+ : OMutexAndBroadcastHelper(),
+ OPropertyContainer( GetBroadcastHelper()),
+ OPropertyArrayUsageHelper< CachedDataSequence >(),
+ CachedDataSequence_Base( GetMutex()),
+ m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
+ m_sRole( rSource.m_sRole ),
+ m_eCurrentDataType( rSource.m_eCurrentDataType ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ switch( m_eCurrentDataType )
+ {
+ case TEXTUAL:
+ m_aTextualSequence = rSource.m_aTextualSequence;
+ break;
+ case NUMERICAL:
+ m_aNumericalSequence = rSource.m_aNumericalSequence;
+ break;
+ case MIXED:
+ m_aMixedSequence = rSource.m_aMixedSequence;
+ break;
+ }
+
+ registerProperties();
+}
+
+CachedDataSequence::~CachedDataSequence()
+{}
+
+void CachedDataSequence::registerProperties()
+{
+ registerProperty( C2U( "NumberFormatKey" ),
+ PROP_NUMBERFORMAT_KEY,
+ 0, // PropertyAttributes
+ & m_nNumberFormatKey,
+ ::getCppuType( & m_nNumberFormatKey ) );
+
+ registerProperty( C2U( "Role" ),
+ PROP_PROPOSED_ROLE,
+ 0, // PropertyAttributes
+ & m_sRole,
+ ::getCppuType( & m_sRole ) );
+}
+
+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;
+}
+
+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 aResult;
+}
+
+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 aResult;
+}
+
+// ================================================================================
+
+Sequence< OUString > CachedDataSequence::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.data.DataSequence" );
+ aServices[ 2 ] = C2U( "com.sun.star.chart2.data.NumericalDataSequence" );
+ aServices[ 3 ] = C2U( "com.sun.star.chart2.data.TextualDataSequence" );
+ return aServices;
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( CachedDataSequence, CachedDataSequence_Base, OPropertyContainer )
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL CachedDataSequence::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ return Reference< beans::XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) );
+}
+
+// ____ ::comphelper::OPropertySetHelper ____
+// __________________________________________
+::cppu::IPropertyArrayHelper& CachedDataSequence::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+// ____ ::comphelper::OPropertyArrayHelper ____
+// ____________________________________________
+::cppu::IPropertyArrayHelper* CachedDataSequence::createArrayHelper() const
+{
+ Sequence< beans::Property > aProps;
+ // describes all properties which have been registered in the ctor
+ describeProperties( aProps );
+
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( CachedDataSequence, lcl_aServiceName )
+
+// ================================================================================
+
+// ________ XNumericalDataSequence ________
+Sequence< double > SAL_CALL CachedDataSequence::getNumericalData()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+
+ if( m_eCurrentDataType == NUMERICAL )
+ return m_aNumericalSequence;
+ else
+ return Impl_getNumericalData();
+ // \--
+}
+
+// ________ XTextualDataSequence ________
+Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+
+ if( m_eCurrentDataType == TEXTUAL )
+ return m_aTextualSequence;
+ else
+ return Impl_getTextualData();
+ // \--
+}
+
+// void SAL_CALL CachedDataSequence::setTextualData( const Sequence< OUString >& aData )
+// throw (uno::RuntimeException)
+// {
+// // /--
+// MutexGuard aGuard( GetMutex() );
+// Impl_setTextualData( aData );
+// // \--
+// }
+
+// ________ XDataSequence ________
+Sequence< Any > SAL_CALL CachedDataSequence::getData()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return Impl_getMixedData();
+ // \--
+}
+
+OUString SAL_CALL CachedDataSequence::getSourceRangeRepresentation()
+ throw (uno::RuntimeException)
+{
+ return m_sRole;
+}
+
+Sequence< OUString > SAL_CALL CachedDataSequence::generateLabel( chart2::data::LabelOrigin /*eLabelOrigin*/ )
+ throw (uno::RuntimeException)
+{
+ // return empty label, as we have no range representaions to determine something useful
+ return Sequence< OUString >();
+}
+
+::sal_Int32 SAL_CALL CachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 /*nIndex*/ )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ return 0;
+}
+
+Reference< util::XCloneable > SAL_CALL CachedDataSequence::createClone()
+ throw (uno::RuntimeException)
+{
+ CachedDataSequence * pNewSeq = new CachedDataSequence( *this );
+
+ return Reference< util::XCloneable >( pNewSeq );
+}
+
+void SAL_CALL CachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL CachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// lang::XInitialization:
+void SAL_CALL CachedDataSequence::initialize(const uno::Sequence< uno::Any > & _aArguments) throw (uno::RuntimeException, uno::Exception)
+{
+ ::comphelper::SequenceAsHashMap aMap(_aArguments);
+ m_aNumericalSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aNumericalSequence);
+ if ( m_aNumericalSequence.getLength() )
+ m_eCurrentDataType = NUMERICAL;
+ else
+ {
+ m_aTextualSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aTextualSequence);
+ if ( m_aTextualSequence.getLength() )
+ m_eCurrentDataType = TEXTUAL;
+ else
+ {
+ m_aMixedSequence = aMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSequence")),m_aMixedSequence);
+ if ( m_aMixedSequence.getLength() )
+ m_eCurrentDataType = MIXED;
+ }
+ }
+}
+} // namespace chart
diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx
new file mode 100644
index 000000000000..cca655780a79
--- /dev/null
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -0,0 +1,608 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "CharacterProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <com/sun/star/awt/FontFamily.hpp>
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/style/CaseMap.hpp>
+#include <com/sun/star/text/FontRelief.hpp>
+#include <com/sun/star/text/FontEmphasis.hpp>
+#include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#include <comphelper/InlineContainer.hxx>
+
+
+// header for struct SvtLinguConfig
+#ifndef _SVTOOLS_LINGUCFG_HXX_
+#include <unotools/lingucfg.hxx>
+#endif
+#ifndef INCLUDED_I18NPOOL_MSLANGID_HXX
+#include <i18npool/mslangid.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <vcl/outdev.hxx>
+#endif
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+using ::rtl::OUString;
+
+namespace chart
+{
+
+void CharacterProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ // CharacterProperties
+ rOutProperties.push_back(
+ Property( C2U( "CharFontName" ),
+ PROP_CHAR_FONT_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "CharFontStyleName" ),
+ PROP_CHAR_FONT_STYLE_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharFontFamily (see awt.FontFamily)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontFamily" ),
+ PROP_CHAR_FONT_FAMILY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontCharSet (see awt.CharSet)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontCharSet" ),
+ PROP_CHAR_FONT_CHAR_SET,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontPitch (see awt.FontPitch)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontPitch" ),
+ PROP_CHAR_FONT_PITCH,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharColor
+ rOutProperties.push_back(
+ Property( C2U( "CharColor" ),
+ PROP_CHAR_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharBackColor
+// rOutProperties.push_back(
+// Property( C2U( "CharBackColor" ),
+// PROP_CHAR_BACKGROUND_COLOR,
+// ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT));
+ // CharEscapement
+ rOutProperties.push_back(
+ Property( C2U( "CharEscapement" ),
+ PROP_CHAR_ESCAPEMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharHeight
+ rOutProperties.push_back(
+ Property( C2U( "CharHeight" ),
+ PROP_CHAR_CHAR_HEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharUnderline (see awt.FontUnderline)
+ rOutProperties.push_back(
+ Property( C2U( "CharUnderline" ),
+ PROP_CHAR_UNDERLINE,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharUnderlineColor
+ rOutProperties.push_back(
+ Property( C2U( "CharUnderlineColor" ),
+ PROP_CHAR_UNDERLINE_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharUnderlineHasColor
+ rOutProperties.push_back(
+ Property( C2U( "CharUnderlineHasColor" ),
+ PROP_CHAR_UNDERLINE_HAS_COLOR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharWeight (see awt.FontWeight)
+ rOutProperties.push_back(
+ Property( C2U( "CharWeight" ),
+ PROP_CHAR_WEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharPosture
+ rOutProperties.push_back(
+ Property( C2U( "CharPosture" ),
+ PROP_CHAR_POSTURE,
+ ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "CharAutoKerning" ),
+ PROP_CHAR_AUTO_KERNING,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "CharKerning" ),
+ PROP_CHAR_KERNING,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharCaseMap (see style.CaseMap)
+// rOutProperties.push_back(
+// Property( C2U( "CharCaseMap" ),
+// PROP_CHAR_CASE_MAPPING,
+// ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ // CharRotation
+// rOutProperties.push_back(
+// Property( C2U( "CharRotation" ),
+// PROP_CHAR_ROTATION,
+// ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+// // CharScaleWidth
+// rOutProperties.push_back(
+// Property( C2U( "CharScaleWidth" ),
+// PROP_CHAR_SCALE_WIDTH,
+// ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharEscapementHeight
+ rOutProperties.push_back(
+ Property( C2U( "CharEscapementHeight" ),
+ PROP_CHAR_ESCAPEMENT_HEIGHT,
+ ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // CharCrossedOut
+// rOutProperties.push_back(
+// Property( C2U( "CharCrossedOut" ),
+// PROP_CHAR_CROSSED_OUT,
+// ::getBooleanCppuType(),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharStrikeout (see awt.FontStrikeout)
+ rOutProperties.push_back(
+ Property( C2U( "CharStrikeout" ),
+ PROP_CHAR_STRIKE_OUT,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharWordMode
+ rOutProperties.push_back(
+ Property( C2U( "CharWordMode" ),
+ PROP_CHAR_WORD_MODE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFlash
+// rOutProperties.push_back(
+// Property( C2U( "CharFlash" ),
+// PROP_CHAR_FLASH,
+// ::getBooleanCppuType(),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharLocale
+ rOutProperties.push_back(
+ Property( C2U( "CharLocale" ),
+ PROP_CHAR_LOCALE,
+ ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharShadowed
+ rOutProperties.push_back(
+ Property( C2U( "CharShadowed" ),
+ PROP_CHAR_SHADOWED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharContoured
+ rOutProperties.push_back(
+ Property( C2U( "CharContoured" ),
+ PROP_CHAR_CONTOURED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharRelief (see text.FontRelief)
+ rOutProperties.push_back(
+ Property( C2U( "CharRelief" ),
+ PROP_CHAR_RELIEF,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // CharEmphasize (see text.FontEmphasis)
+ rOutProperties.push_back(
+ Property( C2U( "CharEmphasis" ),
+ PROP_CHAR_EMPHASIS,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+// // RubyText
+// rOutProperties.push_back(
+// Property( C2U( "RubyText" ),
+// PROP_CHAR_RUBY_TEXT,
+// ::getCppuType( reinterpret_cast< const OUString * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+// // RubyAdjust (see text.RubyAdjust)
+// rOutProperties.push_back(
+// Property( C2U( "RubyAdjust" ),
+// PROP_CHAR_RUBY_ADJUST,
+// ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+// // RubyCharStyleName
+// rOutProperties.push_back(
+// Property( C2U( "RubyStyleName" ),
+// PROP_CHAR_RUBY_STYLE_NAME,
+// ::getCppuType( reinterpret_cast< const OUString * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+// // RubyIsAbove
+// rOutProperties.push_back(
+// Property( C2U( "RubyIsAbove" ),
+// PROP_CHAR_RUBY_IS_ABOVE,
+// ::getBooleanCppuType(),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+// // CharNoHyphenation
+// rOutProperties.push_back(
+// Property( C2U( "InhibitHyphenation" ),
+// PROP_CHAR_INHIBIT_HYPHENATION,
+// ::getBooleanCppuType(),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // CharacterPropertiesAsian
+ // =====
+ // CharFontNameAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharFontNameAsian" ),
+ PROP_CHAR_ASIAN_FONT_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontStyleNameAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharFontStyleNameAsian" ),
+ PROP_CHAR_ASIAN_FONT_STYLE_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharFontFamilyAsian (see awt.FontFamily)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontFamilyAsian" ),
+ PROP_CHAR_ASIAN_FONT_FAMILY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontCharSetAsian (see awt.CharSet)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontCharSetAsian" ),
+ PROP_CHAR_ASIAN_CHAR_SET,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontPitchAsian (see awt.FontPitch)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontPitchAsian" ),
+ PROP_CHAR_ASIAN_FONT_PITCH,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharHeightAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharHeightAsian" ),
+ PROP_CHAR_ASIAN_CHAR_HEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharWeightAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharWeightAsian" ),
+ PROP_CHAR_ASIAN_WEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharPostureAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharPostureAsian" ),
+ PROP_CHAR_ASIAN_POSTURE,
+ ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharLocaleAsian
+ rOutProperties.push_back(
+ Property( C2U( "CharLocaleAsian" ),
+ PROP_CHAR_ASIAN_LOCALE,
+ ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // CharacterPropertiesComplex
+ // ===
+ // CharFontNameComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharFontNameComplex" ),
+ PROP_CHAR_COMPLEX_FONT_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontStyleNameComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharFontStyleNameComplex" ),
+ PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
+ ::getCppuType( reinterpret_cast< const OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // CharFontFamilyComplex (see awt.FontFamily)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontFamilyComplex" ),
+ PROP_CHAR_COMPLEX_FONT_FAMILY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontCharSetComplex (see awt.CharSet)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontCharSetComplex" ),
+ PROP_CHAR_COMPLEX_CHAR_SET,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharFontPitchComplex (see awt.FontPitch)
+ rOutProperties.push_back(
+ Property( C2U( "CharFontPitchComplex" ),
+ PROP_CHAR_COMPLEX_FONT_PITCH,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharHeightComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharHeightComplex" ),
+ PROP_CHAR_COMPLEX_CHAR_HEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharWeightComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharWeightComplex" ),
+ PROP_CHAR_COMPLEX_WEIGHT,
+ ::getCppuType( reinterpret_cast< const float * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharPostureComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharPostureComplex" ),
+ PROP_CHAR_COMPLEX_POSTURE,
+ ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // CharLocaleComplex
+ rOutProperties.push_back(
+ Property( C2U( "CharLocaleComplex" ),
+ PROP_CHAR_COMPLEX_LOCALE,
+ ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // Writing Mode left to right vs right to left
+ rOutProperties.push_back(
+ Property( C2U( "WritingMode" ),
+ PROP_WRITING_MODE,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ParaIsCharacterDistance" ),
+ PROP_PARA_IS_CHARACTER_DISTANCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void CharacterProperties::AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ const float fDefaultFontHeight = 13.0;
+
+ SvtLinguConfig aLinguConfig;
+ lang::Locale aDefaultLocale;
+ aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
+ lang::Locale aDefaultLocale_CJK;
+ aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
+ lang::Locale aDefaultLocale_CTL;
+ aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
+
+ using namespace ::com::sun::star::i18n::ScriptType;
+ LanguageType nLang;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aDefaultLocale), LATIN);
+ Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK), ASIAN);
+ Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL), COMPLEX);
+ Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//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_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_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( rOutMap, PROP_CHAR_CASE_MAPPING, style::CaseMap::NONE );
+// ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_ROTATION, 0 );
+// ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_SCALE_WIDTH, 71 );
+
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CROSSED_OUT, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FLASH, false );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
+
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_ADJUST, text::RubyAdjust_INDENT_BLOCK );
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_STYLE_NAME, ?? );
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_IS_ABOVE, true );
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_INHIBIT_HYPHENATION, false );
+
+ // Asian (com.sun.star.style.CharacterPropertiesAsian)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
+
+ // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
+}
+
+bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
+{
+ return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
+ nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
+}
+
+// static
+awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
+ const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
+{
+ awt::FontDescriptor aResult;
+ // Note: keep this sorted!
+ ::comphelper::MakeVector< OUString > aPropNames
+ ( C2U("CharFontCharSet")); // CharSet
+ aPropNames
+ ( C2U("CharFontFamily")) // Family
+ ( C2U("CharFontName")) // Name
+ ( C2U("CharFontPitch")) // Pitch
+ ( C2U("CharFontStyleName")) // StyleName
+ ( C2U("CharHeight")) // Height
+ ( C2U("CharPosture")) // Slant
+ ( C2U("CharStrikeout")) // Strikeout
+ ( C2U("CharUnderline")) // Underline
+ ( C2U("CharWeight")) // Weight
+ ( C2U("CharWordMode")) // WordLineMode
+ ;
+
+ uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
+ uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
+
+ sal_Int32 i=0;
+ // Note keep this sorted according to the list above (comments are the fieldnames)
+ aValues[ i++ ] >>= aResult.CharSet;
+ aValues[ i++ ] >>= aResult.Family;
+ aValues[ i++ ] >>= aResult.Name;
+ aValues[ i++ ] >>= aResult.Pitch;
+ aValues[ i++ ] >>= aResult.StyleName;
+ float fCharHeight = 0;
+ aValues[ i++ ] >>= fCharHeight;
+ aResult.Height = static_cast< sal_Int16 >( fCharHeight );
+ aValues[ i++ ] >>= aResult.Slant;
+ aValues[ i++ ] >>= aResult.Strikeout;
+ aValues[ i++ ] >>= aResult.Underline;
+ aValues[ i++ ] >>= aResult.Weight;
+ aValues[ i++ ] >>= aResult.WordLineMode;
+ OSL_ASSERT( i == aValues.getLength());
+
+ return aResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/ChartDebugTrace.cxx b/chart2/source/tools/ChartDebugTrace.cxx
new file mode 100644
index 000000000000..9629138cb2be
--- /dev/null
+++ b/chart2/source/tools/ChartDebugTrace.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartDebugTrace.hxx"
+#include "macros.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.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/StackingDirection.hpp>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+
+namespace
+{
+/*
+const char lcl_aSpace=' ';
+
+void lcl_IndentedTrace( int nIndent, char* pStr )
+{
+ if( nIndent > 0 )
+ {
+ OSL_TRACE( "%*c%s", nIndent, lcl_aSpace, pStr );
+ }
+ else
+ {
+ OSL_TRACE( pStr );
+ }
+}
+
+void lcl_TraceException( const uno::Exception & aEx )
+{
+ OSL_TRACE(
+ U2C( C2U( "*** Exception caught during trace. Type: " ) +
+ OUString::createFromAscii( typeid( aEx ).name()) +
+ C2U( ", Message: " ) +
+ aEx.Message ));
+}
+
+void lcl_TraceCategories( const Reference< data::XLabeledDataSequence > & xCat, int nIndent )
+{
+ if( ! xCat.is())
+ return;
+ try
+ {
+ Reference< data::XDataSequence > xValues( xCat->getValues());
+ if( xValues.is())
+ {
+ OSL_TRACE( "%*ccategories: source: %s", nIndent, lcl_aSpace,
+ U2C( xValues->getSourceRangeRepresentation()));
+ }
+ Reference< data::XDataSequence > xLabel( xCat->getLabel());
+ if( xLabel.is())
+ {
+ OSL_TRACE( "%*ccategories' label: source: %s", nIndent, lcl_aSpace,
+ U2C( xLabel->getSourceRangeRepresentation()));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ lcl_TraceException( ex );
+ }
+}
+
+void lcl_TraceDataSeriesSeq( const Sequence< Reference< XDataSeries > > & aSeries, int nIndent )
+{
+ for( sal_Int32 j = 0; j < aSeries.getLength(); ++j )
+ {
+ Reference< beans::XPropertySet > xProp( aSeries[j], uno::UNO_QUERY );
+ OUString aId;
+
+ OSL_TRACE( "%*cindex %ld", nIndent, lcl_aSpace, j );
+
+ StackingDirection aStDir;
+ if( xProp.is() &&
+ ( xProp->getPropertyValue( C2U( "StackingDirection" )) >>= aStDir ) &&
+ aStDir != StackingDirection_NO_STACKING )
+ {
+ OSL_TRACE( "%*cstacking in %s", nIndent + 2, lcl_aSpace,
+ (aStDir == StackingDirection_Y_STACKING)
+ ? "y-direction" : "z-direction" );
+ }
+
+ Reference< data::XDataSource > xSource( aSeries[j], uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< data::XLabeledDataSequence > > aSequences( xSource->getDataSequences());
+ const sal_Int32 nMax = aSequences.getLength();
+ for( sal_Int32 k = 0; k < nMax; ++k )
+ {
+ if( aSequences[k].is())
+ {
+ OUString aSourceId(C2U("<none>"));
+ if( aSequences[k]->getValues().is())
+ aSourceId = aSequences[k]->getValues()->getSourceRangeRepresentation();
+ xProp.set( aSequences[k]->getValues(), uno::UNO_QUERY );
+ if( xProp.is() &&
+ ( xProp->getPropertyValue( C2U( "Role" )) >>= aId ))
+ {
+ OSL_TRACE( "%*cdata sequence %d: role: %s, source: %s",
+ nIndent + 2, lcl_aSpace, k, U2C( aId ), U2C( aSourceId ));
+ }
+ else
+ {
+ OSL_TRACE( "%*cdata sequence %d, unknown role, source: %s",
+ nIndent + 2, lcl_aSpace, k, U2C( aSourceId ) );
+ }
+
+ aSourceId = C2U("<none>");
+ if( aSequences[k]->getLabel().is())
+ aSourceId = OUString( aSequences[k]->getLabel()->getSourceRangeRepresentation());
+ xProp.set( aSequences[k]->getLabel(), uno::UNO_QUERY );
+ if( xProp.is() &&
+ ( xProp->getPropertyValue( C2U( "Role" )) >>= aId ))
+ {
+ OSL_TRACE( "%*cdata sequence label %d: role: %s, source: %s",
+ nIndent + 2, lcl_aSpace, k, U2C( aId ), U2C( aSourceId ));
+ }
+ else
+ {
+ OSL_TRACE( "%*cdata sequence label %d: unknown role, source: %s",
+ nIndent + 2, lcl_aSpace, k, U2C( aSourceId ) );
+ }
+ }
+ }
+ }
+ }
+}
+
+void lcl_TraceChartType( const Reference< XChartType > & xChartType, int nIndent )
+{
+ if( xChartType.is())
+ {
+ OSL_TRACE( "%*c* type: %s", nIndent, lcl_aSpace, U2C( xChartType->getChartType()) );
+
+ lcl_IndentedTrace( nIndent + 2, "Supported Roles" );
+ sal_Int32 i=0;
+ Sequence< OUString > aMandRoles( xChartType->getSupportedMandatoryRoles());
+ if( aMandRoles.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent + 4, "mandatory" );
+ for( i=0; i<aMandRoles.getLength(); ++i )
+ {
+ OSL_TRACE( "%*c%s", nIndent + 6, lcl_aSpace, U2C( aMandRoles[i] ));
+ }
+ }
+ Sequence< OUString > aOptRoles( xChartType->getSupportedOptionalRoles());
+ if( aOptRoles.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent + 4, "optional" );
+ for( i=0; i<aOptRoles.getLength(); ++i )
+ {
+ OSL_TRACE( "%*c%s", nIndent + 6, lcl_aSpace, U2C( aOptRoles[i] ));
+ }
+ }
+ OSL_TRACE( "%*crole of sequence for label: %s", nIndent + 2, lcl_aSpace,
+ U2C( xChartType->getRoleOfSequenceForSeriesLabel()));
+
+ Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
+ if( xDSCnt.is())
+ {
+ lcl_IndentedTrace( nIndent + 2, "Data Series" );
+ lcl_TraceDataSeriesSeq( xDSCnt->getDataSeries(), nIndent + 4 );
+ }
+ }
+}
+
+void lcl_TraceCoordinateSystem( const Reference< XCoordinateSystem > & xCooSys, int nIndent )
+{
+ if( xCooSys.is()) try
+ {
+ sal_Int32 nDim = xCooSys->getDimension();
+ OSL_TRACE( "%*c* dim: %ld, type: %s", nIndent, lcl_aSpace,
+ nDim, U2C( xCooSys->getCoordinateSystemType() ));
+ nIndent += 2;
+ OSL_TRACE( "%*cview service-name: %s", nIndent, lcl_aSpace,
+ U2C( xCooSys->getViewServiceName() ));
+
+ Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo(), uno::UNO_QUERY );
+ sal_Bool bSwap;
+ if( xInfo.is() &&
+ xInfo->hasPropertyByName( C2U("SwapXAndYAxis")) &&
+ (xProp->getPropertyValue( C2U("SwapXAndYAxis")) >>= bSwap) &&
+ bSwap )
+ {
+ lcl_IndentedTrace( nIndent, "swap x-axis and y-axis" );
+ }
+ }
+
+ if( nDim >= 2 )
+ {
+ const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(1);
+ for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
+ {
+ Reference< XScale > xScale( xCooSys->getAxisByDimension( 1, nI ));
+ if( xScale.is())
+ {
+ ScaleData aData( xScale->getScaleData());
+ if( aData.AxisType==AxisType::PERCENT )
+ lcl_IndentedTrace( nIndent, "percent stacking at y-scale" );
+ }
+ }
+ }
+
+ Sequence< uno::Any > aOrigin( xCooSys->getOrigin());
+ double x, y, z;
+ ::rtl::math::setNan( &x ), ::rtl::math::setNan( &y ), ::rtl::math::setNan( &z );
+ if( aOrigin.getLength() > 0 &&
+ aOrigin[0].hasValue() )
+ aOrigin[0] >>= x;
+ if( aOrigin.getLength() > 1 &&
+ aOrigin[1].hasValue() )
+ aOrigin[1] >>= y;
+ if( aOrigin.getLength() > 2 &&
+ aOrigin[2].hasValue() )
+ aOrigin[2] >>= z;
+ OSL_TRACE( "%*corigin: (%f, %f, %f)", nIndent, lcl_aSpace, x, y, z );
+
+ Reference< XChartTypeContainer > xCTCnt( xCooSys, uno::UNO_QUERY );
+ if( xCTCnt.is())
+ {
+ Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ if( aChartTypes.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent, "Chart Types" );
+ for( sal_Int32 i=0; i<aChartTypes.getLength(); ++i )
+ {
+ lcl_TraceChartType( aChartTypes[i], nIndent + 2 );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ lcl_TraceException( ex );
+ }
+}
+
+void lcl_TraceMeter(
+ const Reference< XMeter > & xMeter,
+ const Sequence< Reference< XCoordinateSystem > > & aCooSys,
+ bool bWithCategories,
+ int nIndent )
+{
+ try
+ {
+ Reference< XCoordinateSystem > xCooSys( xMeter->getCoordinateSystem());
+ for( sal_Int32 i=0; i<aCooSys.getLength(); ++i )
+ if( aCooSys[i] == xCooSys )
+ {
+ OSL_TRACE( "%*cbelongs to Coordinate System %ld.", nIndent + 2, lcl_aSpace, i );
+ }
+ OSL_TRACE( "%*crepresents Dimension %ld.", nIndent + 2, lcl_aSpace, xMeter->getRepresentedDimension());
+ if( bWithCategories )
+ {
+ Reference< XScale > xScale( xCooSys->getAxisByDimension( xMeter->getRepresentedDimension(), xMeter->getIndex() ));
+ if( xScale.is())
+ {
+ ScaleData aData = xScale->getScaleData();
+ if( aData.Categories.is())
+ {
+ lcl_TraceCategories( aData.Categories, nIndent + 2 );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ lcl_TraceException( ex );
+ }
+}
+*/
+} // anonymous namespace
+#endif
+
+
+namespace chart
+{
+namespace debug
+{
+
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+
+void ChartDebugTraceDocument(
+ const Reference< XChartDocument > & /*xDoc*/,
+ int /*nIndent*/ )
+{
+ /*
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+ try
+ {
+ OSL_TRACE( "%*cas %sternal data", nIndent, 'h',
+ xDoc->hasInternalDataProvider() ? "in": "ex" );
+
+ Reference< lang::XMultiServiceFactory > xCTManager( xDoc->getChartTypeManager(), uno::UNO_QUERY );
+ if( xCTManager.is())
+ {
+ Sequence< OUString > aServiceNames( xCTManager->getAvailableServiceNames());
+ OSL_TRACE( "%*c ChartTypeManager has %ld entries", nIndent, '*', aServiceNames.getLength());
+# if OSL_DEBUG_LEVEL >= (CHART_TRACE_OSL_DEBUG_LEVEL + 1)
+ for( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ {
+ OSL_TRACE( "%*c%s", nIndent + 2, lcl_aSpace, U2C( aServiceNames[i] ));
+ }
+# endif
+ }
+ Reference< XDiagram > xDiagram( xDoc->getFirstDiagram());
+ lcl_IndentedTrace( nIndent, "* Diagram" );
+ ChartDebugTraceDiagram( xDiagram, nIndent + 2 );
+ }
+ catch( uno::Exception & ex )
+ {
+ lcl_TraceException( ex );
+ }
+#endif
+ */
+}
+
+void ChartDebugTraceDiagram(
+ const Reference< XDiagram > & /*xDiagram*/,
+ int /*nIndent*/ )
+{
+ /*
+#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSys( xCooSysCnt->getCoordinateSystems() );
+ if( aCooSys.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent, "CoordinateSystems" );
+ for( sal_Int32 i=0; i<aCooSys.getLength(); ++i )
+ lcl_TraceCoordinateSystem( aCooSys[i], nIndent + 2 );
+ }
+ else
+ {
+ lcl_IndentedTrace( nIndent, "<No Coordinate Systems>" );
+ }
+
+ Reference< XAxisContainer > xAxisCnt( xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XAxis > > aAxes( xAxisCnt->getAxes() );
+ if( aAxes.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent, "Axes" );
+ for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ lcl_TraceMeter( Reference< XMeter >( aAxes[i], uno::UNO_QUERY ), aCooSys, true, nIndent + 2 );
+ }
+ else
+ {
+ lcl_IndentedTrace( nIndent, "<No Axes>" );
+ }
+
+ Reference< XGridContainer > xGridCnt( xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XGrid > > aGrids( xGridCnt->getGrids() );
+ if( aGrids.getLength() > 0 )
+ {
+ lcl_IndentedTrace( nIndent, "Grids" );
+ for( sal_Int32 i=0; i<aGrids.getLength(); ++i )
+ lcl_TraceMeter( Reference< XMeter >( aGrids[i], uno::UNO_QUERY ), aCooSys, false, nIndent + 2 );
+ }
+ else
+ {
+ lcl_IndentedTrace( nIndent, "<No Grids>" );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ lcl_TraceException( ex );
+ }
+
+#endif
+
+*/
+}
+#endif
+
+} // namespace debug
+} // namespace chart
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
new file mode 100644
index 000000000000..a49b2abeac98
--- /dev/null
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "RangeHighlighter.hxx"
+#include "InternalDataProvider.hxx"
+
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//static
+uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeHighlighter(
+ const uno::Reference< view::XSelectionSupplier > & xSelectionSupplier )
+{
+ return new RangeHighlighter( xSelectionSupplier );
+}
+
+//static
+uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider(
+ const uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, bool bConnectToModel )
+{
+ return new InternalDataProvider( xChartDoc, bConnectToModel );
+}
+
+//static
+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 NULL;
+}
+
+// static
+uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< chart2::XChartDocument >& xChartDoc )
+{
+ try
+ {
+ if( xChartDoc.is())
+ return xChartDoc->getFirstDiagram();
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return NULL;
+}
+
+//static
+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.getLength() )
+ XCooSys = aCooSysSeq[0];
+ }
+ return XCooSys;
+}
+
+// static
+::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
+ const uno::Reference< XChartDocument > & xChartDoc )
+{
+ ::std::vector< uno::Reference< XDataSeries > > aResult;
+
+ uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc );
+ if( xDiagram.is())
+ aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
+
+ return aResult;
+}
+
+// static
+::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 )
+{
+ return DiagramHelper::getChartTypeOfSeries( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries );
+}
+
+awt::Size ChartModelHelper::getDefaultPageSize()
+{
+ return awt::Size( 16000, 9000 );
+}
+
+awt::Size ChartModelHelper::getPageSize( const uno::Reference< frame::XModel >& xModel )
+{
+ awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() );
+ uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY);
+ DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size");
+ if( xVisualObject.is() )
+ aPageSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+ return aPageSize;
+}
+
+void ChartModelHelper::setPageSize( const awt::Size& rSize, const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY);
+ DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size");
+ if( xVisualObject.is() )
+ xVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, rSize );
+}
+
+void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xModel, uno::UNO_QUERY );
+ if( xDataReceiver.is() )
+ {
+ uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xDataReceiver->getRangeHighlighter(), uno::UNO_QUERY );
+ //trigger selection of cell range
+ if( xSelectionChangeListener.is() )
+ {
+ lang::EventObject aEvent( xSelectionChangeListener );
+ xSelectionChangeListener->selectionChanged( aEvent );
+ }
+ }
+}
+
+bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bIncluded = true; // hidden cells are included by default.
+
+ uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
+ if (!xDiagram.is())
+ return bIncluded;
+
+ uno::Reference< beans::XPropertySet > xProp( xDiagram, uno::UNO_QUERY );
+ if (!xProp.is())
+ return bIncluded;
+
+ try
+ {
+ xProp->getPropertyValue(C2U("IncludeHiddenCells")) >>= bIncluded;
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ }
+
+ return bIncluded;
+}
+
+bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bChanged = false;
+ try
+ {
+ ControllerLockGuard aLockedControllers( xChartModel );
+
+ uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(xChartModel), uno::UNO_QUERY );
+ if (xDiagramProperties.is())
+ {
+ bool bOldValue = bIncludeHiddenCells;
+ xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= bOldValue;
+ if( bOldValue == bIncludeHiddenCells )
+ bChanged = true;
+
+ //set the property on all instances in all cases to get the different objects in sync!
+
+ uno::Any aNewValue = uno::makeAny(bIncludeHiddenCells);
+
+ try
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is() )
+ {
+ uno::Reference< beans::XPropertySet > xDataProviderProperties( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xDataProviderProperties.is() )
+ xDataProviderProperties->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ }
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ //the property is optional!
+ }
+
+ try
+ {
+ uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xChartModel ) );
+ if( xUsedData.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProp;
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences());
+ for( sal_Int32 i=0; i<aData.getLength(); ++i )
+ {
+ xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getValues(), uno::UNO_QUERY ) );
+ if(xProp.is())
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getLabel(), uno::UNO_QUERY ) );
+ if(xProp.is())
+ xProp->setPropertyValue(C2U("IncludeHiddenCells"), aNewValue );
+ }
+ }
+ }
+ catch( const beans::UnknownPropertyException& )
+ {
+ //the property is optional!
+ }
+
+ xDiagramProperties->setPropertyValue( C2U("IncludeHiddenCells"), aNewValue);
+ }
+ }
+ catch (uno::Exception& e)
+ {
+ ASSERT_EXCEPTION(e);
+ }
+ return bChanged;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
new file mode 100644
index 000000000000..b851a3864b97
--- /dev/null
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -0,0 +1,685 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartTypeHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//.............................................................................
+namespace chart
+{
+
+bool ChartTypeHelper::isSupportingAxisSideBySide(
+ const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ bool bResult = false;
+
+ if( xChartType.is() &&
+ nDimensionCount < 3 )
+ {
+ bool bFound=false;
+ bool bAmbiguous=false;
+ StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, 0 );
+ if( eStackMode == StackMode_NONE && !bAmbiguous )
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ bResult = ( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) );
+ }
+ }
+
+ return bResult;
+}
+
+sal_Bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //form tab only for 3D-bar and 3D-column charts.
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.equals(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return sal_True;
+ if( aChartTypeName.equals(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //3D charts, pie, net and stock do not support statistic properties
+
+ //@todo ask charttype itself (and series? --> stock chart?) --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines
+ return sal_False;
+ }
+ return sal_True;
+}
+
+sal_Bool ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ // note: old chart: only scatter chart
+ return isSupportingStatisticProperties( xChartType, nDimensionCount );
+}
+
+sal_Bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartType >& 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)
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //2D line charts, 2D scatter charts and 2D net charts do support symbols
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
+{
+ //pie charts do not support axis at all
+ //no 3rd axis for 2D charts
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return sal_False;
+
+ if( nDimensionIndex == 2 )
+ return nDimensionCount == 3;
+ }
+ return sal_True;
+}
+
+sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 /*nDimensionIndex*/ )
+{
+ //3D, pie and net charts do not support a secondary axis at all
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+sal_Bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
+ const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //2D bar charts do support a this special properties
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool ChartTypeHelper::isSupportingBarConnectors(
+ const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //2D bar charts with stacked series support this
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ bool bFound=false;
+ bool bAmbiguous=false;
+ StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, 0 );
+ if( eStackMode != StackMode_Y_STACKED || bAmbiguous )
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return sal_True; // note: old chart was false here
+ }
+ return sal_False;
+}
+
+uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const uno::Reference< chart2::XChartType >& xChartType
+ , sal_Int32 nDimensionCount, sal_Bool bSwapXAndY
+ , const uno::Reference< chart2::XDataSeries >& xSeries )
+{
+ (void)nDimensionCount;
+
+ uno::Sequence < sal_Int32 > aRet;
+ if( !xChartType.is() )
+ return aRet;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ {
+ bool bDonut = false;
+ uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW );
+ if(xChartTypeProp.is())
+ xChartTypeProp->getPropertyValue( C2U("UseRings")) >>= bDonut;
+
+ if(!bDonut)
+ {
+ aRet.realloc(4);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::INSIDE;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
+ }
+ else
+ {
+ aRet.realloc(1);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
+ }
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE)
+ )
+ {
+ aRet.realloc(5);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ {
+
+ bool bStacked = false;
+ {
+ uno::Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
+ xSeriesProp->getPropertyValue( C2U("StackingDirection") ) >>= eStacking;
+ bStacked = (chart2::StackingDirection_Y_STACKING == eStacking);
+ }
+
+ aRet.realloc( bStacked ? 3 : 6 );
+ sal_Int32* pSeq = aRet.getArray();
+ if(!bStacked)
+ {
+ if(bSwapXAndY)
+ {
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT;
+ }
+ else
+ {
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM;
+ }
+ }
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
+ if(!bStacked)
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::INSIDE;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
+ {
+ aRet.realloc(1);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ {
+ aRet.realloc(6);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT;
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ {
+ aRet.realloc(1);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ aRet.realloc( 1 );
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ }
+ else
+ {
+ OSL_ENSURE( false, "unknown charttype" );
+ }
+
+ return aRet;
+}
+
+sal_Bool ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return true;
+ }
+ return false;
+}
+bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ rtl::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_AREA)
+ )
+ return true;
+ }
+ return false;
+}
+
+bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
+{
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return false;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
+ }
+ if( nDimensionCount==3 )
+ return nDimensionIndex<2;
+ return true;
+}
+
+bool ChartTypeHelper::shiftTicksAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return true;
+ }
+ return false;
+}
+
+bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ if(xChartType.is())
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//static
+sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
+{
+ sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey
+ if( xChartType .is() )
+ {
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ {
+ if( bSimple )
+ nRet = static_cast< sal_Int32 >( 0x333333 ); // grey80
+ else
+ nRet = static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30
+ }
+ else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
+ }
+ return nRet;
+}
+
+//static
+sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
+{
+ sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
+ if( xChartType .is() )
+ {
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ {
+ if( bSimple )
+ nRet = static_cast< sal_Int32 >( 0xcccccc ); // grey20
+ else
+ nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
+ }
+ }
+ return nRet;
+}
+
+drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ drawing::Direction3D aRet(0.0, 0.0, 1.0);
+ if( xChartType .is() )
+ {
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ aRet = drawing::Direction3D(0.0, 0.8, 0.5);
+ else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ aRet = drawing::Direction3D(0.9, 0.5, 0.05);
+ }
+ return aRet;
+}
+
+drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
+{
+ drawing::Direction3D aRet(0.0, 0.0, 1.0);
+ if( xChartType .is() )
+ {
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ aRet = drawing::Direction3D(0.6, 0.6, 0.6);
+ else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ aRet = drawing::Direction3D(0.9, 0.5, 0.05);
+ }
+ return aRet;
+}
+
+sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
+ XChartType >& xChartType, sal_Int32 nDimensionIndex )
+{
+ //retruned is a constant from constant group ::com::sun::star::chart2::AxisType
+
+ //@todo ask charttype itself --> need model change first
+ if(!xChartType.is())
+ return AxisType::CATEGORY;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if(2==nDimensionIndex)//z-axis
+ return AxisType::SERIES;
+ if(1==nDimensionIndex)//y-axis
+ return AxisType::REALNUMBER;
+ if(0==nDimensionIndex)//x-axis
+ {
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ return AxisType::REALNUMBER;
+ return AxisType::CATEGORY;
+ }
+ return AxisType::CATEGORY;
+}
+
+sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries(
+ const uno::Reference< XChartType >& xChartType,
+ sal_Int32 nNumberOfSeries )
+{
+ if( xChartType.is() )
+ {
+ try
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE))
+ {
+ uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW );
+ bool bDonut = false;
+ if( (xChartTypeProp->getPropertyValue( C2U("UseRings")) >>= bDonut)
+ && !bDonut )
+ {
+ return nNumberOfSeries>0 ? 1 : 0;
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return nNumberOfSeries;
+}
+
+uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const uno::Reference< XChartType >& xChartType )
+{
+ uno::Sequence < sal_Int32 > aRet;
+ if( !xChartType.is() )
+ return aRet;
+
+ bool bStacked = false;
+ bool bFound=false;
+ bool bAmbiguous=false;
+ StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, 0 );
+ bStacked = bFound && (StackMode_Y_STACKED == eStackMode);
+
+ rtl::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_BUBBLE) )
+ {
+ aRet.realloc( 2 );
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP;
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
+ {
+ aRet.realloc( bStacked ? 1 : 2 );
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO;
+ if( !bStacked )
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ {
+ aRet.realloc( bStacked ? 2 : 3 );
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP;
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO;
+ if( !bStacked )
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ {
+ aRet.realloc( 3 );
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE;
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP;
+ *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO;
+ }
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ aRet.realloc( 0 );
+ }
+ else
+ {
+ OSL_ENSURE( false, "unknown charttype" );
+ }
+
+ return aRet;
+}
+
+bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType )
+{
+ if( xChartType.is() )
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
+ return false;
+ }
+ return true;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = true;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ bRet = false;
+ return bRet;
+}
+
+bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = false;
+ if( !xChartType.is() )
+ return bRet;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
+ {
+ bRet = true;
+ }
+ return bRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx
new file mode 100644
index 000000000000..55fbd368426a
--- /dev/null
+++ b/chart2/source/tools/ChartViewHelper.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartViewHelper.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+//static
+void ChartViewHelper::setViewToDirtyState( const uno::Reference< frame::XModel >& xChartModel )
+{
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFact( xChartModel, uno::UNO_QUERY );
+ if( xFact.is() )
+ {
+ Reference< util::XModifyListener > xModifyListener(
+ xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if( xModifyListener.is() )
+ {
+ lang::EventObject aEvent( Reference< lang::XComponent >( xChartModel, uno::UNO_QUERY ) );
+ xModifyListener->modified( aEvent );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ColorPerPointHelper.cxx b/chart2/source/tools/ColorPerPointHelper.cxx
new file mode 100644
index 000000000000..762cb436a9a7
--- /dev/null
+++ b/chart2/source/tools/ColorPerPointHelper.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ColorPerPointHelper.hxx"
+#include "macros.hxx"
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+#include <algorithm>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//static
+bool ColorPerPointHelper::hasPointOwnColor(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xDataSeriesProperties
+ , sal_Int32 nPointIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance
+ )
+{
+ if( !xDataSeriesProperties.is() )
+ return false;
+
+ if( hasPointOwnProperties( xDataSeriesProperties, 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 );
+ }
+ if( !xPointState.is() )
+ return false;
+
+ return (xPointState->getPropertyState( C2U("Color")) != beans::PropertyState_DEFAULT_VALUE );
+ }
+
+ return false;
+}
+
+// static
+bool ColorPerPointHelper::hasPointOwnProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSeriesProperties
+ , sal_Int32 nPointIndex )
+{
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aIndexList )
+ {
+ const sal_Int32 * pBegIt = aIndexList.getConstArray();
+ const sal_Int32 * pEndIt = pBegIt + aIndexList.getLength();
+ return ( ::std::find( pBegIt, pEndIt, nPointIndex ) != pEndIt );
+ }
+ }
+
+ return false;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
new file mode 100644
index 000000000000..e9d90248ce84
--- /dev/null
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "CommonConverters.hxx"
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <rtl/math.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+#include <cstdarg>
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// diverse methods for class conversions; e.g. ::basegfx::B3DHomMatrix to HomogenMatrix
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM )
+{
+ drawing::HomogenMatrix aHM;
+ aHM.Line1.Column1 = rM.get(0, 0);
+ aHM.Line1.Column2 = rM.get(0, 1);
+ aHM.Line1.Column3 = rM.get(0, 2);
+ aHM.Line1.Column4 = rM.get(0, 3);
+ aHM.Line2.Column1 = rM.get(1, 0);
+ aHM.Line2.Column2 = rM.get(1, 1);
+ aHM.Line2.Column3 = rM.get(1, 2);
+ aHM.Line2.Column4 = rM.get(1, 3);
+ aHM.Line3.Column1 = rM.get(2, 0);
+ aHM.Line3.Column2 = rM.get(2, 1);
+ aHM.Line3.Column3 = rM.get(2, 2);
+ aHM.Line3.Column4 = rM.get(2, 3);
+ aHM.Line4.Column1 = rM.get(3, 0);
+ aHM.Line4.Column2 = rM.get(3, 1);
+ aHM.Line4.Column3 = rM.get(3, 2);
+ aHM.Line4.Column4 = rM.get(3, 3);
+ return aHM;
+}
+
+::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const drawing::HomogenMatrix& rHM )
+{
+ ::basegfx::B3DHomMatrix aM;
+ aM.set(0, 0, rHM.Line1.Column1);
+ aM.set(0, 1, rHM.Line1.Column2);
+ aM.set(0, 2, rHM.Line1.Column3);
+ aM.set(0, 3, rHM.Line1.Column4);
+ aM.set(1, 0, rHM.Line2.Column1);
+ aM.set(1, 1, rHM.Line2.Column2);
+ aM.set(1, 2, rHM.Line2.Column3);
+ aM.set(1, 3, rHM.Line2.Column4);
+ aM.set(2, 0, rHM.Line3.Column1);
+ aM.set(2, 1, rHM.Line3.Column2);
+ aM.set(2, 2, rHM.Line3.Column3);
+ aM.set(2, 3, rHM.Line3.Column4);
+ aM.set(3, 0, rHM.Line4.Column1);
+ aM.set(3, 1, rHM.Line4.Column2);
+ aM.set(3, 2, rHM.Line4.Column3);
+ aM.set(3, 3, rHM.Line4.Column4);
+ return aM;
+}
+
+::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM )
+{
+ ::basegfx::B2DHomMatrix aM;
+ aM.set(0, 0, rM.get(0, 0));
+ aM.set(0, 1, rM.get(0, 1));
+ aM.set(0, 2, rM.get(0, 3));
+ 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));
+ return aM;
+}
+
+
+drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM )
+{
+ drawing::HomogenMatrix3 aHM;
+ aHM.Line1.Column1 = rM.get(0, 0);
+ aHM.Line1.Column2 = rM.get(0, 1);
+ aHM.Line1.Column3 = rM.get(0, 2);
+ 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);
+ return aHM;
+}
+
+::basegfx::B3DPoint Position3DToB3DPoint( const drawing::Position3D& rPosition )
+{
+ return ::basegfx::B3DPoint(
+ rPosition.PositionX ,
+ rPosition.PositionY ,
+ rPosition.PositionZ );
+}
+
+drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector)
+{
+ return drawing::Direction3D(
+ rVector.getX()
+ , rVector.getY()
+ , rVector.getZ()
+ );
+}
+
+drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint)
+{
+ return drawing::Position3D(
+ rPoint.getX()
+ , rPoint.getY()
+ , rPoint.getZ()
+ );
+}
+
+::basegfx::B3DVector Direction3DToB3DVector( const drawing::Direction3D& rDirection)
+{
+ return ::basegfx::B3DVector(
+ rDirection.DirectionX
+ , rDirection.DirectionY
+ , rDirection.DirectionZ
+ );
+}
+
+void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
+{
+ if(nPolygonIndex<0)
+ {
+ OSL_ENSURE( false, "The polygon index needs to be > 0");
+ nPolygonIndex=0;
+ }
+
+ //make sure that we have enough polygons
+ if(nPolygonIndex >= rPoly.SequenceX.getLength() )
+ {
+ rPoly.SequenceX.realloc(nPolygonIndex+1);
+ rPoly.SequenceY.realloc(nPolygonIndex+1);
+ rPoly.SequenceZ.realloc(nPolygonIndex+1);
+ }
+
+ drawing::DoubleSequence* pOuterSequenceX = &rPoly.SequenceX.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceY = &rPoly.SequenceY.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceZ = &rPoly.SequenceZ.getArray()[nPolygonIndex];
+
+ sal_Int32 nOldPointCount = pOuterSequenceX->getLength();
+
+ pOuterSequenceX->realloc(nOldPointCount+1);
+ pOuterSequenceY->realloc(nOldPointCount+1);
+ pOuterSequenceZ->realloc(nOldPointCount+1);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ pInnerSequenceX[nOldPointCount] = rPos.PositionX;
+ pInnerSequenceY[nOldPointCount] = rPos.PositionY;
+ pInnerSequenceZ[nOldPointCount] = rPos.PositionZ;
+}
+
+drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygon, sal_Int32 nPointIndex, sal_Int32 nPolyIndex )
+{
+ drawing::Position3D aRet(0.0,0.0,0.0);
+
+ if( nPolyIndex>=0 && nPolyIndex<rPolygon.SequenceX.getLength())
+ {
+ if(nPointIndex<rPolygon.SequenceX[nPolyIndex].getLength())
+ {
+ aRet.PositionX = rPolygon.SequenceX[nPolyIndex][nPointIndex];
+ aRet.PositionY = rPolygon.SequenceY[nPolyIndex][nPointIndex];
+ aRet.PositionZ = rPolygon.SequenceZ[nPolyIndex][nPointIndex];
+ }
+ else
+ {
+ ;DBG_ERROR("polygon was accessed with a wrong index");
+ }
+ }
+ else
+ {
+ ;DBG_ERROR("polygon was accessed with a wrong index");
+ }
+ return aRet;
+}
+
+void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& 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 nIndex = 0;
+ sal_Int32 nOuter = nOuterCount - nAddOuterCount;
+ for( ; nOuter < nOuterCount; nOuter++ )
+ {
+ if( nIndex >= nAddOuterCount )
+ break;
+
+ rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex];
+ rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex];
+ rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex];
+
+ nIndex++;
+ }
+}
+
+void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+{
+ sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
+ rRet.SequenceX.realloc(nOuterCount);
+ rRet.SequenceY.realloc(nOuterCount);
+ rRet.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
+ {
+ sal_Int32 nOldPointCount = rRet.SequenceX[nOuter].getLength();
+ sal_Int32 nAddPointCount = 0;
+ if(nOuter<rAdd.SequenceX.getLength())
+ nAddPointCount = rAdd.SequenceX[nOuter].getLength();
+ if(!nAddPointCount)
+ continue;
+
+ sal_Int32 nNewPointCount = nOldPointCount + nAddPointCount;
+
+ rRet.SequenceX[nOuter].realloc(nNewPointCount);
+ rRet.SequenceY[nOuter].realloc(nNewPointCount);
+ rRet.SequenceZ[nOuter].realloc(nNewPointCount);
+
+ 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];
+ }
+ }
+}
+
+drawing::PolyPolygonShape3D BezierToPoly(
+ const drawing::PolyPolygonBezierCoords& rBezier )
+{
+ const drawing::PointSequenceSequence& rPointSequence = rBezier.Coordinates;
+// const drawing::FlagSequenceSequence& rFlags = rBezier.Flags;
+
+ drawing::PolyPolygonShape3D aRet;
+ aRet.SequenceX.realloc( rPointSequence.getLength() );
+ aRet.SequenceY.realloc( rPointSequence.getLength() );
+ aRet.SequenceZ.realloc( rPointSequence.getLength() );
+
+ 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 );
+
+ bool bHasOuterFlags = nN < rBezier.Flags.getLength();
+
+ sal_Int32 nRealInner = 0;
+ for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
+ {
+ bool bHasInnerFlags = bHasOuterFlags && (nM < rBezier.Flags[nN].getLength());
+
+ 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;
+ nRealInner++;
+ }
+ }
+
+ aRet.SequenceX[nRealOuter].realloc( nRealInner );
+ aRet.SequenceY[nRealOuter].realloc( nRealInner );
+ aRet.SequenceZ[nRealOuter].realloc( nRealInner );
+
+ if( nRealInner>0 )
+ nRealOuter++;
+ }
+
+ aRet.SequenceX.realloc( nRealOuter );
+ aRet.SequenceY.realloc( nRealOuter );
+ aRet.SequenceZ.realloc( nRealOuter );
+
+ return aRet;
+}
+
+drawing::PointSequenceSequence PolyToPointSequence(
+ const drawing::PolyPolygonShape3D& rPolyPolygon )
+{
+ drawing::PointSequenceSequence aRet;
+ aRet.realloc( rPolyPolygon.SequenceX.getLength() );
+
+ for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++)
+ {
+ sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
+ aRet[nN].realloc( nInnerLength );
+ 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]);
+ }
+ }
+ return aRet;
+}
+
+void appendPointSequence( drawing::PointSequenceSequence& rTarget
+ , drawing::PointSequenceSequence& rAdd )
+{
+ sal_Int32 nAddCount = rAdd.getLength();
+ if(!nAddCount)
+ return;
+ sal_Int32 nOldCount = rTarget.getLength();
+
+ rTarget.realloc(nOldCount+nAddCount);
+ for(sal_Int32 nS=0; nS<nAddCount; nS++ )
+ rTarget[nOldCount+nS]=rAdd[nS];
+}
+
+drawing::Position3D operator+( const drawing::Position3D& rPos
+ , const drawing::Direction3D& rDirection)
+{
+ return drawing::Position3D(
+ rPos.PositionX + rDirection.DirectionX
+ , rPos.PositionY + rDirection.DirectionY
+ , rPos.PositionZ + rDirection.DirectionZ
+ );
+}
+
+drawing::Direction3D operator-( const drawing::Position3D& rPos1
+ , const drawing::Position3D& rPos2)
+{
+ return drawing::Direction3D(
+ rPos1.PositionX - rPos2.PositionX
+ , rPos1.PositionY - rPos2.PositionY
+ , rPos1.PositionZ - rPos2.PositionZ
+ );
+}
+
+bool operator==( const drawing::Position3D& rPos1
+ , const drawing::Position3D& rPos2)
+{
+ return rPos1.PositionX == rPos2.PositionX
+ && rPos1.PositionY == rPos2.PositionY
+ && rPos1.PositionZ == rPos2.PositionZ;
+}
+
+awt::Point Position3DToAWTPoint( const drawing::Position3D& rPos )
+{
+ awt::Point aRet;
+ aRet.X = static_cast<sal_Int32>(rPos.PositionX);
+ aRet.Y = static_cast<sal_Int32>(rPos.PositionY);
+ return aRet;
+}
+
+awt::Point ToPoint( const awt::Rectangle& rRectangle )
+{
+ return awt::Point( rRectangle.X, rRectangle.Y );
+}
+
+awt::Size ToSize( const awt::Rectangle& rRectangle )
+{
+ return awt::Size( rRectangle.Width, rRectangle.Height );
+}
+
+awt::Size Direction3DToAWTSize( const drawing::Direction3D& rDirection )
+{
+ awt::Size aRet;
+ aRet.Width = static_cast<sal_Int32>(rDirection.DirectionX);
+ aRet.Height = static_cast<sal_Int32>(rDirection.DirectionY);
+ 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");
+
+ drawing::Position3D aRet;
+ aRet.PositionX = rSeq.getLength()>0?rSeq[0]:0.0;
+ aRet.PositionY = rSeq.getLength()>1?rSeq[1]:0.0;
+ aRet.PositionZ = rSeq.getLength()>2?rSeq[2]:0.0;
+ 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(
+ const uno::Reference< data::XDataSequence >& xDataSequence )
+{
+ uno::Sequence< double > aResult;
+ OSL_ASSERT( xDataSequence.is());
+ if(!xDataSequence.is())
+ return aResult;
+
+ uno::Reference< data::XNumericalDataSequence > xNumericalDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xNumericalDataSequence.is() )
+ {
+ aResult = xNumericalDataSequence->getNumericalData();
+ }
+ else
+ {
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ aResult.realloc(aValues.getLength());
+ for(sal_Int32 nN=aValues.getLength();nN--;)
+ {
+ if( !(aValues[nN] >>= aResult[nN]) )
+ ::rtl::math::setNan( &aResult[nN] );
+ }
+ }
+
+ return aResult;
+}
+
+uno::Sequence< rtl::OUString > DataSequenceToStringSequence(
+ const uno::Reference< data::XDataSequence >& xDataSequence )
+{
+ uno::Sequence< rtl::OUString > aResult;
+ OSL_ASSERT( xDataSequence.is());
+ if(!xDataSequence.is())
+ return aResult;
+
+ uno::Reference< data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xTextualDataSequence.is() )
+ {
+ aResult = xTextualDataSequence->getTextualData();
+ }
+ else
+ {
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ aResult.realloc(aValues.getLength());
+
+ for(sal_Int32 nN=aValues.getLength();nN--;)
+ aValues[nN] >>= aResult[nN];
+ }
+
+ return aResult;
+}
+
+sal_Bool hasDoubleValue( const uno::Any& rAny )
+{
+ sal_Bool bRet = sal_False;
+ double fValue = 0.0;
+ if( rAny >>= fValue )
+ bRet = sal_True;
+ return bRet;
+}
+
+sal_Bool hasLongOrShortValue( const uno::Any& rAny )
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 n32 = 0;
+ if( rAny >>= n32 )
+ bRet = sal_True;
+ else
+ {
+ sal_Int16 n16 = 0;
+ if( rAny >>= n16 )
+ bRet = sal_True;
+ }
+ return bRet;
+}
+sal_Int16 getShortForLongAlso( const uno::Any& rAny )
+{
+ sal_Int16 nRet = 0;
+
+ if( !(rAny >>= nRet) )
+ {
+ sal_Int32 n32 = 0;
+ if( rAny >>= n32 )
+ nRet = static_cast<sal_Int16>(n32);
+ }
+ return nRet;
+}
+
+bool replaceParamterInString( rtl::OUString & rInOutResourceString,
+ const rtl::OUString & rParamToReplace,
+ const rtl::OUString & rReplaceWith )
+{
+ sal_Int32 nPos = rInOutResourceString.indexOf( rParamToReplace );
+ if( nPos == -1 )
+ return false;
+
+ rInOutResourceString = rInOutResourceString.replaceAt( nPos
+ , rParamToReplace.getLength(), rReplaceWith );
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx
new file mode 100644
index 000000000000..fb7106d87096
--- /dev/null
+++ b/chart2/source/tools/ConfigColorScheme.cxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ConfigColorScheme.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+
+#include <unotools/configitem.hxx>
+
+#include <set>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+static const OUString aSeriesPropName( RTL_CONSTASCII_USTRINGPARAM("Series"));
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+
+uno::Reference< chart2::XColorScheme > createConfigColorScheme( const uno::Reference< uno::XComponentContext > & xContext )
+{
+ return new ConfigColorScheme( xContext );
+}
+
+namespace impl
+{
+class ChartConfigItem : public ::utl::ConfigItem
+{
+public:
+ explicit ChartConfigItem( ConfigItemListener & rListener );
+ virtual ~ChartConfigItem();
+
+ void addPropertyNotification( const OUString & rPropertyName );
+
+ uno::Any getProperty( const OUString & aPropertyName );
+
+protected:
+ // ____ ::utl::ConfigItem ____
+ virtual void Commit();
+ virtual void Notify( const Sequence< OUString > & aPropertyNames );
+
+private:
+ ConfigItemListener & m_rListener;
+ ::std::set< OUString > m_aPropertiesToNotify;
+};
+
+ChartConfigItem::ChartConfigItem( ConfigItemListener & rListener ) :
+ ::utl::ConfigItem( C2U("Office.Chart/DefaultColor")),
+ m_rListener( rListener )
+{}
+
+ChartConfigItem::~ChartConfigItem()
+{}
+
+void ChartConfigItem::Notify( const Sequence< OUString > & aPropertyNames )
+{
+ for( sal_Int32 nIdx=0; nIdx<aPropertyNames.getLength(); ++nIdx )
+ {
+ if( m_aPropertiesToNotify.find( aPropertyNames[nIdx] ) != m_aPropertiesToNotify.end())
+ m_rListener.notify( aPropertyNames[nIdx] );
+ }
+}
+
+void ChartConfigItem::Commit()
+{}
+
+void ChartConfigItem::addPropertyNotification( const OUString & rPropertyName )
+{
+ m_aPropertiesToNotify.insert( rPropertyName );
+ EnableNotification( ContainerHelper::ContainerToSequence( m_aPropertiesToNotify ));
+}
+
+uno::Any ChartConfigItem::getProperty( const OUString & aPropertyName )
+{
+ Sequence< uno::Any > aValues(
+ GetProperties( Sequence< OUString >( &aPropertyName, 1 )));
+ if( ! aValues.getLength())
+ return uno::Any();
+ return aValues[0];
+}
+
+} // namespace impl
+
+// --------------------------------------------------------------------------------
+
+// explicit
+ConfigColorScheme::ConfigColorScheme(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext ),
+ m_nNumberOfColors( 0 ),
+ m_bNeedsUpdate( true )
+{
+}
+
+ConfigColorScheme::~ConfigColorScheme()
+{}
+
+void ConfigColorScheme::retrieveConfigColors()
+{
+ if( ! m_xContext.is())
+ return;
+
+ // create config item if necessary
+ if( ! m_apChartConfigItem.get())
+ {
+ m_apChartConfigItem.reset(
+ new impl::ChartConfigItem( *this ));
+ m_apChartConfigItem->addPropertyNotification( aSeriesPropName );
+ }
+ OSL_ASSERT( m_apChartConfigItem.get());
+ if( ! m_apChartConfigItem.get())
+ return;
+
+ // retrieve colors
+ uno::Any aValue(
+ m_apChartConfigItem->getProperty( aSeriesPropName ));
+ if( aValue >>= m_aColorSequence )
+ m_nNumberOfColors = m_aColorSequence.getLength();
+ m_bNeedsUpdate = false;
+}
+
+// ____ XColorScheme ____
+::sal_Int32 SAL_CALL ConfigColorScheme::getColorByIndex( ::sal_Int32 nIndex )
+ throw (uno::RuntimeException)
+{
+ if( m_bNeedsUpdate )
+ retrieveConfigColors();
+
+ if( m_nNumberOfColors > 0 )
+ return static_cast< sal_Int32 >( m_aColorSequence[ nIndex % m_nNumberOfColors ] );
+
+ // fall-back: hard-coded standard colors
+ static sal_Int32 nDefaultColors[] = {
+ 0x9999ff, 0x993366, 0xffffcc,
+ 0xccffff, 0x660066, 0xff8080,
+ 0x0066cc, 0xccccff, 0x000080,
+ 0xff00ff, 0x00ffff, 0xffff00
+ };
+
+ static const sal_Int32 nMaxDefaultColors = sizeof( nDefaultColors ) / sizeof( sal_Int32 );
+ return nDefaultColors[ nIndex % nMaxDefaultColors ];
+}
+
+void ConfigColorScheme::notify( const OUString & rPropertyName )
+{
+ if( rPropertyName.equals( aSeriesPropName ))
+ m_bNeedsUpdate = true;
+}
+
+// ================================================================================
+
+Sequence< OUString > ConfigColorScheme::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.ColorScheme" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ConfigColorScheme,
+ C2U( "com.sun.star.comp.chart2.ConfigDefaultColorScheme" ))
+
+// ================================================================================
+
+} // namespace chart
diff --git a/chart2/source/tools/ControllerLockGuard.cxx b/chart2/source/tools/ControllerLockGuard.cxx
new file mode 100644
index 000000000000..4ef430c5e483
--- /dev/null
+++ b/chart2/source/tools/ControllerLockGuard.cxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ControllerLockGuard.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+ControllerLockGuard::ControllerLockGuard( const Reference< frame::XModel > & xModel ) :
+ m_xModel( xModel )
+{
+ if( m_xModel.is())
+ m_xModel->lockControllers();
+}
+
+ControllerLockGuard::~ControllerLockGuard()
+{
+ if( m_xModel.is())
+ m_xModel->unlockControllers();
+}
+
+// ================================================================================
+
+ControllerLockHelper::ControllerLockHelper( const Reference< frame::XModel > & xModel ) :
+ m_xModel( xModel )
+{}
+
+ControllerLockHelper::~ControllerLockHelper()
+{}
+
+void ControllerLockHelper::lockControllers()
+{
+ if( m_xModel.is())
+ m_xModel->lockControllers();
+}
+
+void ControllerLockHelper::unlockControllers()
+{
+ if( m_xModel.is())
+ m_xModel->unlockControllers();
+}
+
+// ================================================================================
+
+ControllerLockHelperGuard::ControllerLockHelperGuard( ControllerLockHelper & rHelper ) :
+ m_rHelper( rHelper )
+{
+ m_rHelper.lockControllers();
+}
+
+ControllerLockHelperGuard::~ControllerLockHelperGuard()
+{
+ m_rHelper.unlockControllers();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
new file mode 100644
index 000000000000..acff332d4229
--- /dev/null
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -0,0 +1,918 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSource.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.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/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 <rtl/ustrbuf.hxx>
+
+#include <functional>
+#include <algorithm>
+#include <iterator>
+#include <vector>
+#include <set>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ----------------------------------------
+namespace
+{
+
+class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
+{
+public:
+ explicit lcl_MatchesRole( const OUString & aRole, bool bMatchPrefix ) :
+ m_aRole( aRole ),
+ m_bMatchPrefix( bMatchPrefix )
+ {}
+
+ bool operator () ( const Reference< chart2::data::XLabeledDataSequence > & xSeq ) const
+ {
+ if(!xSeq.is())
+ return false;
+ Reference< beans::XPropertySet > xProp( xSeq->getValues(), uno::UNO_QUERY );
+ OUString aRole;
+
+ if( m_bMatchPrefix )
+ return ( xProp.is() &&
+ (xProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" )) ) >>= aRole ) &&
+ aRole.match( m_aRole ));
+
+ return ( xProp.is() &&
+ (xProp->getPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" )) ) >>= aRole ) &&
+ m_aRole.equals( aRole ));
+ }
+
+private:
+ OUString m_aRole;
+ bool m_bMatchPrefix;
+};
+
+Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
+ const Reference< chart2::data::XDataSource > & xDataSource )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
+
+ for( sal_Int32 i=0; i<aSequences.getLength(); ++i )
+ {
+ OSL_ENSURE( aSequences[i].is(), "empty LabeledDataSequence" );
+ // no values are set but a label exists
+ if( aSequences[i].is() &&
+ ( ! aSequences[i]->getValues().is() &&
+ aSequences[i]->getLabel().is()))
+ {
+ xResult.set( aSequences[i] );
+ break;
+ }
+ }
+
+ return xResult;
+}
+
+void lcl_getCooSysAndChartTypeOfSeries(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XDiagram > & xDiagram,
+ Reference< chart2::XCoordinateSystem > & xOutCooSys,
+ Reference< chart2::XChartType > & xOutChartType )
+{
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY );
+ if( xCooSysCnt.is())
+ {
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ {
+ Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
+ if( xSeriesCnt.is())
+ {
+ Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
+ {
+ if( aSeries[nSeriesIdx] == xSeries )
+ {
+ xOutCooSys.set( aCooSysSeq[nCooSysIdx] );
+ xOutChartType.set( aChartTypes[nCTIdx] );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries, bool bInsert )
+{
+ try
+ {
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ DataPointLabel aLabelAtSeries;
+ xSeriesProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabelAtSeries;
+ aLabelAtSeries.ShowNumber = bInsert;
+ if( !bInsert )
+ {
+ aLabelAtSeries.ShowNumberInPercent = false;
+ aLabelAtSeries.ShowCategoryName = false;
+ }
+ xSeriesProperties->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabelAtSeries ) );
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = bInsert;
+ if( !bInsert )
+ {
+ aLabel.ShowNumberInPercent = false;
+ aLabel.ShowCategoryName = false;
+ }
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+} // anonymous namespace
+// ----------------------------------------
+
+namespace chart
+{
+
+namespace DataSeriesHelper
+{
+
+OUString GetRole( const uno::Reference< chart2::data::XLabeledDataSequence >& xLabeledDataSequence )
+{
+ OUString aRet;
+ if( xLabeledDataSequence.is() )
+ {
+ Reference< beans::XPropertySet > xProp( xLabeledDataSequence->getValues(), uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->getPropertyValue( C2U("Role") ) >>= aRet;
+ }
+ return aRet;
+}
+
+Reference< chart2::data::XLabeledDataSequence >
+ getDataSequenceByRole(
+ const Reference< chart2::data::XDataSource > & xSource, OUString aRole,
+ bool bMatchPrefix /* = false */ )
+{
+ 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;
+
+ return aNoResult;
+}
+
+::std::vector< Reference< chart2::data::XLabeledDataSequence > >
+ getAllDataSequencesByRole( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aDataSequences,
+ OUString aRole, bool bMatchPrefix /* = false */ )
+{
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVec;
+ ::std::remove_copy_if( aDataSequences.getConstArray(), aDataSequences.getConstArray() + aDataSequences.getLength(),
+ ::std::back_inserter( aResultVec ),
+ ::std::not1( lcl_MatchesRole( aRole, bMatchPrefix )));
+ return aResultVec;
+}
+
+Reference< chart2::data::XDataSource >
+ getDataSource( const Sequence< Reference< chart2::XDataSeries > > & aSeries )
+{
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
+
+ for( sal_Int32 i = 0; i < aSeries.getLength(); ++i )
+ {
+ Reference< chart2::data::XDataSource > xSource( aSeries[ i ], uno::UNO_QUERY );
+ if( xSource.is())
+ {
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
+ ::std::copy( aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength(),
+ ::std::back_inserter( aSeqVec ));
+ }
+ }
+
+ return Reference< chart2::data::XDataSource >(
+ new DataSource( ContainerHelper::ContainerToSequence( aSeqVec )));
+}
+
+namespace
+{
+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;
+ OUString aVal;
+ OUStringBuffer aBuf;
+
+ for( sal_Int32 i = 0; i <= nMax; ++i )
+ {
+ aBuf.append( aSeq[i] );
+ if( i < nMax )
+ aBuf.append( sal_Unicode( ' ' ));
+ }
+ 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( sal_Unicode( ' ' ));
+ }
+ else if( aSeq[ i ] >>= fNum )
+ {
+ aBuf.append( fNum );
+ if( i < nMax )
+ aBuf.append( sal_Unicode( ' ' ));
+ }
+ }
+ 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.getLength() )
+ {
+ // 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.getLength() )
+ 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 getDataSeriesLabel(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const OUString & rLabelSequenceRole )
+{
+ 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;
+}
+
+void setStackModeAtSeries(
+ const Sequence< Reference< chart2::XDataSeries > > & aSeries,
+ const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ StackMode eStackMode )
+{
+ if( eStackMode == StackMode_AMBIGUOUS )
+ return;
+
+ const OUString aPropName( RTL_CONSTASCII_USTRINGPARAM( "StackingDirection" ));
+ const uno::Any aPropValue = uno::makeAny(
+ ( (eStackMode == StackMode_Y_STACKED) ||
+ (eStackMode == StackMode_Y_STACKED_PERCENT) )
+ ? chart2::StackingDirection_Y_STACKING
+ : (eStackMode == StackMode_Z_STACKED )
+ ? chart2::StackingDirection_Z_STACKING
+ : chart2::StackingDirection_NO_STACKING );
+
+ std::set< sal_Int32 > aAxisIndexSet;
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aSeries[i], uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ xProp->setPropertyValue( aPropName, aPropValue );
+
+ sal_Int32 nAxisIndex;
+ xProp->getPropertyValue( C2U("AttachedAxisIndex") ) >>= nAxisIndex;
+ aAxisIndexSet.insert(nAxisIndex);
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if( xCorrespondingCoordinateSystem.is() &&
+ 1 < xCorrespondingCoordinateSystem->getDimension() )
+ {
+ sal_Int32 nAxisIndexCount = aAxisIndexSet.size();
+ if( !nAxisIndexCount )
+ {
+ aAxisIndexSet.insert(0);
+ nAxisIndexCount = aAxisIndexSet.size();
+ }
+
+ for( ::std::set< sal_Int32 >::const_iterator aIt = aAxisIndexSet.begin();
+ aIt != aAxisIndexSet.end(); ++aIt )
+ {
+ sal_Int32 nAxisIndex = *aIt;
+ Reference< chart2::XAxis > xAxis(
+ xCorrespondingCoordinateSystem->getAxisByDimension( 1, nAxisIndex ));
+ if( xAxis.is())
+ {
+ sal_Bool bPercent = (eStackMode == StackMode_Y_STACKED_PERCENT);
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+
+ if( bPercent != (aScaleData.AxisType==chart2::AxisType::PERCENT) )
+ {
+ if( bPercent )
+ aScaleData.AxisType = chart2::AxisType::PERCENT;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ xAxis->setScaleData( aScaleData );
+ }
+ }
+ }
+ }
+}
+
+sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries )
+{
+ sal_Int32 nRet = 0;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ xProp->getPropertyValue( C2U("AttachedAxisIndex") ) >>= nRet;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return nRet;
+}
+
+sal_Int32 getNumberFormatKeyFromAxis(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem,
+ sal_Int32 nDimensionIndex,
+ sal_Int32 nAxisIndex /* = -1 */ )
+{
+ sal_Int32 nResult = 0;
+ if( nAxisIndex == -1 )
+ nAxisIndex = getAttachedAxisIndex( xSeries );
+ try
+ {
+ Reference< beans::XPropertySet > xAxisProp(
+ xCorrespondingCoordinateSystem->getAxisByDimension( nDimensionIndex, nAxisIndex ), uno::UNO_QUERY );
+ if( xAxisProp.is())
+ xAxisProp->getPropertyValue( C2U("NumberFormat")) >>= nResult;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return nResult;
+}
+
+Reference< chart2::XCoordinateSystem > getCoordinateSystemOfSeries(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ Reference< chart2::XCoordinateSystem > xResult;
+ Reference< chart2::XChartType > xDummy;
+ lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy );
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > getChartTypeOfSeries(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XDiagram > & xDiagram )
+{
+ Reference< chart2::XChartType > xResult;
+ Reference< chart2::XCoordinateSystem > xDummy;
+ lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xDummy, xResult );
+
+ return xResult;
+}
+
+void deleteSeries(
+ const Reference< chart2::XDataSeries > & xSeries,
+ const Reference< chart2::XChartType > & xChartType )
+{
+ try
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY_THROW );
+ ::std::vector< Reference< chart2::XDataSeries > > aSeries(
+ ContainerHelper::SequenceToVector( xSeriesCnt->getDataSeries()));
+ ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt =
+ ::std::find( aSeries.begin(), aSeries.end(), xSeries );
+ if( aIt != aSeries.end())
+ {
+ aSeries.erase( aIt );
+ xSeriesCnt->setDataSeries( ContainerHelper::ContainerToSequence( aSeries ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties,
+ bool bSymbolsOn, sal_Int32 nSeriesIndex )
+{
+ if( !xSeriesProperties.is() )
+ return;
+
+ chart2::Symbol aSymbProp;
+ if( (xSeriesProperties->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp ) )
+ {
+ if( !bSymbolsOn )
+ aSymbProp.Style = chart2::SymbolStyle_NONE;
+ else if( aSymbProp.Style == chart2::SymbolStyle_NONE )
+ {
+ aSymbProp.Style = chart2::SymbolStyle_STANDARD;
+ aSymbProp.StandardSymbol = nSeriesIndex;
+ }
+ xSeriesProperties->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbProp ));
+ }
+ //todo: check attributed data points
+}
+
+void switchLinesOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties, bool bLinesOn )
+{
+ if( !xSeriesProperties.is() )
+ return;
+
+ if( bLinesOn )
+ {
+ // keep line-styles that are not NONE
+ drawing::LineStyle eLineStyle;
+ if( (xSeriesProperties->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle ) &&
+ eLineStyle == drawing::LineStyle_NONE )
+ {
+ xSeriesProperties->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) );
+ }
+ }
+ else
+ xSeriesProperties->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+}
+
+void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesProperties, bool bThick )
+{
+ if( !xSeriesProperties.is() )
+ return;
+
+ sal_Int32 nNewValue = bThick ? 80 : 0;
+ sal_Int32 nOldValue = 0;
+ if( (xSeriesProperties->getPropertyValue( C2U( "LineWidth" )) >>= nOldValue ) &&
+ nOldValue != nNewValue )
+ {
+ if( !(bThick && nOldValue>0))
+ xSeriesProperties->setPropertyValue( C2U( "LineWidth" ), uno::makeAny( nNewValue ) );
+ }
+}
+
+void setPropertyAlsoToAllAttributedDataPoints( const Reference< chart2::XDataSeries >& xSeries,
+ const OUString& rPropertyName, const uno::Any& rPropertyValue )
+{
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( !xSeriesProperties.is() )
+ return;
+
+ xSeriesProperties->setPropertyValue( rPropertyName, rPropertyValue );
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if(!xPointProp.is())
+ continue;
+ xPointProp->setPropertyValue( rPropertyName, rPropertyValue );
+ }
+ }
+}
+
+bool hasAttributedDataPointDifferentValue( const Reference< chart2::XDataSeries >& xSeries,
+ const OUString& rPropertyName, const uno::Any& rPropertyValue )
+{
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( !xSeriesProperties.is() )
+ return false;
+
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if(!xPointProp.is())
+ continue;
+ uno::Any aPointValue( xPointProp->getPropertyValue( rPropertyName ) );
+ if( !( rPropertyValue==aPointValue ) )
+ return true;
+ }
+ }
+ return false;
+}
+
+bool areAllSeriesAttachedToSameAxis( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 & rOutAxisIndex )
+{
+ try
+ {
+ uno::Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDataSeriesContainer->getDataSeries());
+
+ const sal_Int32 nSeriesCount( aSeriesSeq.getLength());
+ // AxisIndex can only be 0 or 1
+ sal_Int32 nSeriesAtFirstAxis = 0;
+ sal_Int32 nSeriesAtSecondAxis = 0;
+
+ for( sal_Int32 nI = 0; nI < nSeriesCount; ++nI )
+ {
+ uno::Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nI], uno::UNO_QUERY );
+ sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex( xSeries );
+ if( nAxisIndex == 0 )
+ ++nSeriesAtFirstAxis;
+ else if( nAxisIndex == 1 )
+ ++nSeriesAtSecondAxis;
+ }
+ OSL_ENSURE( nSeriesAtFirstAxis + nSeriesAtSecondAxis == nSeriesCount, "Invalid axis index found" );
+
+ if( nSeriesAtFirstAxis == nSeriesCount )
+ rOutAxisIndex = 0;
+ else if( nSeriesAtSecondAxis == nSeriesCount )
+ rOutAxisIndex = 1;
+
+ return ( nSeriesAtFirstAxis == nSeriesCount ||
+ nSeriesAtSecondAxis == nSeriesCount );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ return false;
+ }
+}
+
+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( C2U( "HiddenValues" ) ) >>= aHiddenValues;
+ if( !aHiddenValues.getLength() )
+ return true;
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e; // avoid warning
+ return true;
+ }
+ }
+ if( xDataSequence->getData().getLength() )
+ return true;
+ return false;
+}
+
+}
+
+bool hasUnhiddenData( const uno::Reference< chart2::XDataSeries >& xSeries )
+{
+ uno::Reference< chart2::data::XDataSource > xDataSource =
+ uno::Reference< chart2::data::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;
+}
+
+struct lcl_LessIndex
+{
+ inline bool operator() ( const sal_Int32& first, const sal_Int32& second )
+ {
+ return ( first < second );
+ }
+};
+
+sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Reference< chart2::data::XDataSequence >& xDataSequence, bool bTranslate )
+{
+ if( !bTranslate )
+ return nIndex;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ Sequence<sal_Int32> aHiddenIndicesSeq;
+ xProp->getPropertyValue( C2U("HiddenValues") ) >>= aHiddenIndicesSeq;
+ if( aHiddenIndicesSeq.getLength() )
+ {
+ ::std::vector< sal_Int32 > aHiddenIndices( ContainerHelper::SequenceToVector( aHiddenIndicesSeq ) );
+ ::std::sort( aHiddenIndices.begin(), aHiddenIndices.end(), lcl_LessIndex() );
+
+ sal_Int32 nHiddenCount = static_cast<sal_Int32>(aHiddenIndices.size());
+ for( sal_Int32 nN = 0; nN < nHiddenCount; ++nN)
+ {
+ if( aHiddenIndices[nN] <= nIndex )
+ nIndex += 1;
+ else
+ break;
+ }
+ }
+ }
+ }
+ catch (const beans::UnknownPropertyException&)
+ {
+ }
+ return nIndex;
+}
+
+bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ if( bRet )
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp;
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
+ ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
+ if( aIt != aIndices.end())
+ xProp = xSeries->getDataPointByIndex(nPointIndex);
+ else
+ xProp = xSeriesProperties;
+ }
+ if( xProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+void insertDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, true /*bInsert*/ );
+}
+
+void deleteDataLabelsFromSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, false /*bInsert*/ );
+}
+
+
+void insertDataLabelToPoint( const Reference< beans::XPropertySet >& xPointProp )
+{
+ try
+ {
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = true;
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointProp )
+{
+ try
+ {
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = false;
+ aLabel.ShowNumberInPercent = false;
+ aLabel.ShowCategoryName = false;
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+} // namespace DataSeriesHelper
+} // namespace chart
diff --git a/chart2/source/tools/DataSource.cxx b/chart2/source/tools/DataSource.cxx
new file mode 100644
index 000000000000..edbf4dfacfeb
--- /dev/null
+++ b/chart2/source/tools/DataSource.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DataSource.hxx"
+#include "LabeledDataSequence.hxx"
+
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.DataSource" ));
+} // anonymous namespace
+
+namespace chart
+{
+
+DataSource::DataSource(
+ const Reference< uno::XComponentContext > & /*xContext*/ )
+{}
+
+DataSource::DataSource(
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > & rSequences ) :
+ m_aDataSeq( rSequences )
+{}
+
+DataSource::~DataSource()
+{}
+
+// ____ XDataSource ____
+Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSource::getDataSequences()
+ throw (uno::RuntimeException)
+{
+ return m_aDataSeq;
+}
+
+// ____ XDataSink ____
+void SAL_CALL DataSource::setData( const Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData )
+ throw (uno::RuntimeException)
+{
+ m_aDataSeq = aData;
+}
+
+// ================================================================================
+
+Sequence< OUString > DataSource::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.data.DataSource" ));
+ return aServices;
+}
+
+// ================================================================================
+
+APPHELPER_XSERVICEINFO_IMPL( DataSource, lcl_aServiceName );
+
+} // namespace chart
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
new file mode 100644
index 000000000000..0cc6ef4a4315
--- /dev/null
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -0,0 +1,552 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "DataSourceHelper.hxx"
+#include "macros.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "DataSource.hxx"
+#include "ContainerHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "PropertyHelper.hxx"
+#include "CachedDataSequence.hxx"
+#include "LabeledDataSequence.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>
+
+//.............................................................................
+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 ::rtl::OUString;
+
+namespace
+{
+void lcl_addRanges( ::std::vector< ::rtl::OUString > & rOutResult,
+ const uno::Reference< data::XLabeledDataSequence > & xLabeledSeq )
+{
+ if( ! xLabeledSeq.is())
+ return;
+ uno::Reference< data::XDataSequence > xSeq( xLabeledSeq->getLabel());
+ if( xSeq.is())
+ rOutResult.push_back( xSeq->getSourceRangeRepresentation());
+ xSeq.set( xLabeledSeq->getValues());
+ if( xSeq.is())
+ rOutResult.push_back( xSeq->getSourceRangeRepresentation());
+}
+
+void lcl_addDataSourceRanges(
+ ::std::vector< ::rtl::OUString > & rOutResult,
+ const uno::Reference< data::XDataSource > & xDataSource )
+{
+ if( xDataSource.is() )
+ {
+ uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ for( sal_Int32 i=0; i<aDataSequences.getLength(); ++i)
+ lcl_addRanges( rOutResult, aDataSequences[i] );
+ }
+}
+
+void lcl_addErrorBarRanges(
+ ::std::vector< ::rtl::OUString > & rOutResult,
+ const uno::Reference< XDataSeries > & xDataSeries )
+{
+ uno::Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
+ if( !xSeriesProp.is())
+ return;
+
+ try
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp;
+ if( ( xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp ) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 eStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= eStyle ) &&
+ eStyle == ::com::sun::star::chart::ErrorBarStyle::FROM_DATA )
+ {
+ uno::Reference< data::XDataSource > xErrorBarDataSource( xErrorBarProp, uno::UNO_QUERY );
+ if( xErrorBarDataSource.is() )
+ lcl_addDataSourceRanges( rOutResult, xErrorBarDataSource );
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // 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();
+}
+
+Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSequence( const ::rtl::OUString& rSingleText )
+{
+ return new ::chart::CachedDataSequence( rSingleText );
+}
+
+Reference< chart2::data::XLabeledDataSequence > 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(
+ const Reference< chart2::data::XDataSequence >& xValues )
+{
+ return new ::chart::LabeledDataSequence( xValues );
+}
+
+Reference< chart2::data::XLabeledDataSequence > DataSourceHelper::createLabeledDataSequence(
+ const Reference< uno::XComponentContext >& xContext )
+{
+ return new ::chart::LabeledDataSequence( xContext );
+}
+
+uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
+ bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories )
+{
+ ::com::sun::star::chart::ChartDataRowSource eRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if( bUseColumns )
+ eRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+
+ uno::Sequence< beans::PropertyValue > aArguments(3);
+ aArguments[0] = beans::PropertyValue( C2U("DataRowSource")
+ , -1, uno::makeAny( eRowSource )
+ , beans::PropertyState_DIRECT_VALUE );
+ aArguments[1] = beans::PropertyValue( C2U("FirstCellAsLabel")
+ , -1, uno::makeAny( bFirstCellAsLabel )
+ , beans::PropertyState_DIRECT_VALUE );
+ aArguments[2] = beans::PropertyValue( C2U("HasCategories")
+ , -1, uno::makeAny( bHasCategories )
+ , beans::PropertyState_DIRECT_VALUE );
+
+ return aArguments;
+}
+
+uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments(
+ const ::rtl::OUString & rRangeRepresentation,
+ const uno::Sequence< sal_Int32 >& rSequenceMapping,
+ bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories )
+{
+ uno::Sequence< beans::PropertyValue > aArguments( createArguments( bUseColumns, bFirstCellAsLabel, bHasCategories ));
+ aArguments.realloc( aArguments.getLength() + 1 );
+ aArguments[aArguments.getLength() - 1] =
+ beans::PropertyValue( C2U("CellRangeRepresentation")
+ , -1, uno::makeAny( rRangeRepresentation )
+ , beans::PropertyState_DIRECT_VALUE );
+ if( rSequenceMapping.getLength() )
+ {
+ aArguments.realloc( aArguments.getLength() + 1 );
+ aArguments[aArguments.getLength() - 1] =
+ beans::PropertyValue( C2U("SequenceMapping")
+ , -1, uno::makeAny( rSequenceMapping )
+ , beans::PropertyState_DIRECT_VALUE );
+ }
+ return aArguments;
+}
+
+void DataSourceHelper::readArguments( const uno::Sequence< beans::PropertyValue >& rArguments
+ , ::rtl::OUString & rRangeRepresentation, uno::Sequence< sal_Int32 >& rSequenceMapping
+ , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories )
+{
+ const beans::PropertyValue* pArguments = rArguments.getConstArray();
+ for(sal_Int32 i=0; i<rArguments.getLength(); ++i, ++pArguments)
+ {
+ const beans::PropertyValue& aProperty = *pArguments;
+ if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DataRowSource" ) ))
+ {
+ ::com::sun::star::chart::ChartDataRowSource eRowSource;
+ if( aProperty.Value >>= eRowSource )
+ bUseColumns = (eRowSource==::com::sun::star::chart::ChartDataRowSource_COLUMNS);
+ }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstCellAsLabel" ) ))
+ {
+ aProperty.Value >>= bFirstCellAsLabel;
+ }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasCategories" ) ))
+ {
+ aProperty.Value >>= bHasCategories;
+ }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CellRangeRepresentation" ) ))
+ {
+ aProperty.Value >>= rRangeRepresentation;
+ }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SequenceMapping" ) ))
+ {
+ aProperty.Value >>= rSequenceMapping;
+ }
+ }
+}
+
+uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat(
+ const uno::Reference< chart2::XChartDocument >& xChartDoc, bool bWithCategories )
+{
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVector;
+
+ //categories are always the first sequence
+ Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
+
+ if( bWithCategories )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ if( xCategories.is() )
+ aResultVector.push_back( xCategories );
+ }
+
+ ::std::vector< Reference< chart2::XDataSeries > > xSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ uno::Reference< chart2::data::XDataSource > xSeriesSource(
+ DataSeriesHelper::getDataSource( ContainerHelper::ContainerToSequence(xSeriesVector) ) );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSeqences( xSeriesSource->getDataSequences() );
+
+ //the first x-values is always the next sequence //todo ... other x-values get lost for old format
+ Reference< chart2::data::XLabeledDataSequence > xXValues(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-x") ) );
+ if( xXValues.is() )
+ aResultVector.push_back( xXValues );
+
+ //add all other sequences now without x-values
+ for( sal_Int32 nN=0; nN<aDataSeqences.getLength(); nN++ )
+ {
+ OUString aRole( DataSeriesHelper::GetRole( aDataSeqences[nN] ) );
+ if( !aRole.equals(C2U("values-x")) )
+ aResultVector.push_back( aDataSeqences[nN] );
+ }
+
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aResultSequence( aResultVector.size() );
+ ::std::copy( aResultVector.begin(), aResultVector.end(), aResultSequence.getArray() );
+
+ return new DataSource( aResultSequence );
+}
+
+uno::Sequence< ::rtl::OUString > DataSourceHelper::getUsedDataRanges(
+ const uno::Reference< chart2::XDiagram > & xDiagram )
+{
+ ::std::vector< ::rtl::OUString > aResult;
+
+ if( xDiagram.is())
+ {
+ uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ if( xCategories.is() )
+ lcl_addRanges( aResult, xCategories );
+
+ ::std::vector< uno::Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ for( ::std::vector< uno::Reference< XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
+ ; aSeriesIt != aSeriesVector.end(); ++aSeriesIt )
+ {
+ uno::Reference< data::XDataSource > xDataSource( *aSeriesIt, uno::UNO_QUERY );
+ lcl_addDataSourceRanges( aResult, xDataSource );
+ lcl_addErrorBarRanges( aResult, *aSeriesIt );
+ }
+ }
+
+ return ContainerHelper::ContainerToSequence( aResult );
+}
+
+uno::Sequence< ::rtl::OUString > DataSourceHelper::getUsedDataRanges( const uno::Reference< frame::XModel > & xChartModel )
+{
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ 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( ::std::vector< uno::Reference< XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
+ ; aSeriesIt != aSeriesVector.end(); ++aSeriesIt )
+ {
+ uno::Reference< data::XDataSource > xDataSource( *aSeriesIt, uno::UNO_QUERY );
+ if( !xDataSource.is() )
+ continue;
+ uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ ::std::copy( aDataSequences.getConstArray(), aDataSequences.getConstArray() + aDataSequences.getLength(),
+ ::std::back_inserter( aResult ));
+ }
+
+ return uno::Reference< chart2::data::XDataSource >(
+ new DataSource( ContainerHelper::ContainerToSequence( aResult )));
+}
+
+bool DataSourceHelper::detectRangeSegmentation(
+ const uno::Reference<
+ frame::XModel >& xChartModel
+ , ::rtl::OUString& rOutRangeString
+ , ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
+ , bool& rOutUseColumns
+ , bool& rOutFirstCellAsLabel
+ , bool& rOutHasCategories )
+{
+ bool bSomethingDetected = false;
+
+ uno::Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
+ if( !xChartDocument.is() )
+ return bSomethingDetected;
+ uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ if( !xDataProvider.is() )
+ return bSomethingDetected;
+
+ try
+ {
+ DataSourceHelper::readArguments(
+ xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument ) ),
+ rOutRangeString, rSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
+ bSomethingDetected = (rOutRangeString.getLength() > 0);
+
+ uno::Reference< chart2::data::XLabeledDataSequence > xCategories(
+ DiagramHelper::getCategoriesFromDiagram( xChartDocument->getFirstDiagram() ));
+ rOutHasCategories = xCategories.is();
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return bSomethingDetected;
+}
+
+bool DataSourceHelper::allArgumentsForRectRangeDetected(
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ bool bHasDataRowSource = false;
+ bool bHasFirstCellAsLabel = false;
+// bool bHasHasCategories = false;
+ bool bHasCellRangeRepresentation = false;
+// bool bHasSequenceMapping = false;
+
+ uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ if( !xDataProvider.is() )
+ return false;
+
+ try
+ {
+ const uno::Sequence< beans::PropertyValue > aArguments(
+ xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument )));
+ const beans::PropertyValue* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ const beans::PropertyValue& aProperty = *pArguments;
+ if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DataRowSource" ) ))
+ {
+ bHasDataRowSource =
+ (aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(
+ ::getCppuType( reinterpret_cast<
+ const ::com::sun::star::chart::ChartDataRowSource * >(0))));
+ }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstCellAsLabel" ) ))
+ {
+ bHasFirstCellAsLabel =
+ (aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(::getBooleanCppuType()));
+ }
+// else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasCategories" ) ))
+// {
+// bHasHasCategories =
+// (aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(::getBooleanCppuType()));
+// }
+ else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CellRangeRepresentation" ) ))
+ {
+ ::rtl::OUString aRange;
+ bHasCellRangeRepresentation =
+ (aProperty.Value.hasValue() && (aProperty.Value >>= aRange) && aRange.getLength() > 0);
+ }
+// else if( aProperty.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SequenceMapping" ) ))
+// {
+// bHasSequenceMapping =
+// (aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(
+// ::getCppuType( reinterpret_cast<
+// const uno::Sequence< sal_Int32 > * >(0))));
+// }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return (bHasCellRangeRepresentation && bHasDataRowSource && bHasFirstCellAsLabel);
+}
+
+void DataSourceHelper::setRangeSegmentation(
+ const uno::Reference< frame::XModel >& xChartModel
+ , const ::com::sun::star::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() );
+ if( !xDataProvider.is() )
+ return;
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ if( !xDiagram.is() )
+ return;
+ uno::Reference< chart2::XChartTypeManager > xChartTypeManager( xChartDocument->getChartTypeManager() );
+ if( !xChartTypeManager.is() )
+ return;
+ uno::Reference< lang::XMultiServiceFactory > xTemplateFactory( xChartTypeManager, uno::UNO_QUERY );
+ if( !xTemplateFactory.is() )
+ return;
+
+ ::rtl::OUString aRangeString;
+ bool bDummy;
+ uno::Sequence< sal_Int32 > aDummy;
+ readArguments( xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument )),
+ aRangeString, aDummy, bDummy, bDummy, bDummy );
+
+ uno::Sequence< beans::PropertyValue > aArguments(
+ createArguments( aRangeString, rSequenceMapping, bUseColumns, bFirstCellAsLabel, bUseCategories ) );
+
+ uno::Reference< chart2::data::XDataSource > xDataSource( xDataProvider->createDataSource(
+ aArguments ) );
+ if( !xDataSource.is() )
+ return;
+
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateFactory );
+
+ rtl::OUString aServiceName( aTemplateAndService.second );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first;
+
+ if( !xTemplate.is() )
+ {
+ if( aServiceName.getLength() == 0 )
+ aServiceName = C2U("com.sun.star.chart2.template.Column");
+ xTemplate.set( xTemplateFactory->createInstance( aServiceName ), uno::UNO_QUERY );
+ }
+ if( !xTemplate.is() )
+ return;
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( xChartModel );
+ xTemplate->changeDiagramData( xDiagram, xDataSource, aArguments );
+ // \-- locked controllers
+}
+
+Sequence< OUString > DataSourceHelper::getRangesFromLabeledDataSequence(
+ const Reference< data::XLabeledDataSequence > & xLSeq )
+{
+ Sequence< OUString > aResult;
+ if( xLSeq.is())
+ {
+ Reference< data::XDataSequence > xLabel( xLSeq->getLabel());
+ Reference< data::XDataSequence > xValues( xLSeq->getValues());
+
+ if( xLabel.is())
+ {
+ if( xValues.is())
+ {
+ aResult.realloc( 2 );
+ aResult[0] = xLabel->getSourceRangeRepresentation();
+ aResult[1] = xValues->getSourceRangeRepresentation();
+ }
+ else
+ {
+ aResult.realloc( 1 );
+ aResult[0] = xLabel->getSourceRangeRepresentation();
+ }
+ }
+ else if( xValues.is())
+ {
+ aResult.realloc( 1 );
+ aResult[0] = xValues->getSourceRangeRepresentation();
+ }
+ }
+ return aResult;
+}
+
+OUString DataSourceHelper::getRangeFromValues(
+ const Reference< data::XLabeledDataSequence > & xLSeq )
+{
+ OUString aResult;
+ if( xLSeq.is() )
+ {
+ Reference< data::XDataSequence > xValues( xLSeq->getValues() );
+ if( xValues.is() )
+ aResult = xValues->getSourceRangeRepresentation();
+ }
+ return aResult;
+}
+
+Sequence< OUString > DataSourceHelper::getRangesFromDataSource( const Reference< data::XDataSource > & xSource )
+{
+ ::std::vector< OUString > aResult;
+ if( xSource.is())
+ {
+ Sequence< Reference< data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences());
+ for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i )
+ {
+ Reference< data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel());
+ Reference< data::XDataSequence > xValues( aLSeqSeq[i]->getValues());
+
+ if( xLabel.is())
+ aResult.push_back( xLabel->getSourceRangeRepresentation());
+ if( xValues.is())
+ aResult.push_back( xValues->getSourceRangeRepresentation());
+ }
+ }
+ return ContainerHelper::ContainerToSequence( aResult );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
new file mode 100644
index 000000000000..36afef60a6d4
--- /dev/null
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -0,0 +1,1559 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DiagramHelper.hxx"
+#include "LegendHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ChartModelHelper.hxx"
+#include "RelativePositionHelper.hxx"
+#include "ControllerLockGuard.hxx"
+
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/chart/XDiagramPositioning.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/InterpretedData.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 <unotools/saveopt.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/util/XModifiable.hpp>
+
+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;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+// static
+DiagramHelper::tTemplateWithServiceName
+ DiagramHelper::getTemplateForDiagram(
+ const Reference< XDiagram > & xDiagram,
+ const Reference< lang::XMultiServiceFactory > & xChartTypeManager,
+ const OUString & rPreferredTemplateName )
+{
+ DiagramHelper::tTemplateWithServiceName aResult;
+
+ if( ! (xChartTypeManager.is() && xDiagram.is()))
+ return aResult;
+
+ Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames());
+ const sal_Int32 nLength = aServiceNames.getLength();
+
+ bool bHasPreferredTemplate = (rPreferredTemplateName.getLength() > 0);
+ bool bTemplateFound = false;
+
+ if( bHasPreferredTemplate )
+ {
+ Reference< XChartTypeTemplate > xTempl(
+ xChartTypeManager->createInstance( rPreferredTemplateName ), uno::UNO_QUERY );
+
+ if( xTempl.is() &&
+ xTempl->matchesTemplate( xDiagram, sal_True ))
+ {
+ aResult.first = xTempl;
+ aResult.second = rPreferredTemplateName;
+ bTemplateFound = true;
+ }
+ }
+
+ for( sal_Int32 i = 0; ! bTemplateFound && i < nLength; ++i )
+ {
+ try
+ {
+ if( ! bHasPreferredTemplate ||
+ ! rPreferredTemplateName.equals( aServiceNames[ i ] ))
+ {
+ Reference< XChartTypeTemplate > xTempl(
+ xChartTypeManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
+
+ if( xTempl->matchesTemplate( xDiagram, sal_True ))
+ {
+ aResult.first = xTempl;
+ aResult.second = aServiceNames[ i ];
+ bTemplateFound = true;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+// static
+void DiagramHelper::setVertical(
+ const Reference< XDiagram > & xDiagram,
+ bool bVertical /* = true */ )
+{
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCnt( xDiagram, uno::UNO_QUERY );
+ if( xCnt.is())
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSys(
+ xCnt->getCoordinateSystems());
+ uno::Any aValue;
+ aValue <<= bVertical;
+ for( sal_Int32 i=0; i<aCooSys.getLength(); ++i )
+ {
+ uno::Reference< XCoordinateSystem > xCooSys( aCooSys[i] );
+ Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY );
+ bool bChanged = false;
+ if( xProp.is() )
+ {
+ bool bOldSwap = sal_False;
+ if( !(xProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bOldSwap)
+ || bVertical != bOldSwap )
+ bChanged = true;
+
+ if( bChanged )
+ xProp->setPropertyValue( C2U("SwapXAndYAxis"), aValue );
+ }
+ if( xCooSys.is() )
+ {
+ 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() )
+ {
+ //adapt title rotation only when axis swapping has changed
+ if( bChanged )
+ {
+ Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
+ if( xTitled.is())
+ {
+ Reference< beans::XPropertySet > xTitleProps( xTitled->getTitleObject(), uno::UNO_QUERY );
+ if( !xTitleProps.is() )
+ continue;
+ double fAngleDegree = 0.0;
+ xTitleProps->getPropertyValue( C2U( "TextRotation" ) ) >>= fAngleDegree;
+ if( !::rtl::math::approxEqual( 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( C2U( "TextRotation" ), uno::makeAny( fNewAngleDegree ));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//static
+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())
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSys(
+ xCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSys.getLength(); ++i )
+ {
+ Reference< beans::XPropertySet > xProp( aCooSys[i], uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ bool bCurrent = false;
+ if( xProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bCurrent )
+ {
+ if( !rbFound )
+ {
+ bValue = bCurrent;
+ rbFound = true;
+ }
+ else if( bCurrent != bValue )
+ {
+ // ambiguous -> choose always first found
+ rbAmbiguous = true;
+ }
+ }
+ }
+ }
+ }
+ return bValue;
+}
+
+//static
+void DiagramHelper::setStackMode(
+ const Reference< XDiagram > & xDiagram,
+ StackMode eStackMode,
+ bool bOnlyAtFirstChartType /* = true */
+)
+{
+ try
+ {
+ if( eStackMode == StackMode_AMBIGUOUS )
+ return;
+
+ 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_Y_STACKED || eStackMode == StackMode_Y_STACKED_PERCENT )
+ eNewDirection = StackingDirection_Y_STACKING;
+ else if( eStackMode == StackMode_Z_STACKED )
+ eNewDirection = StackingDirection_Z_STACKING;
+
+ uno::Any aNewDirection( uno::makeAny(eNewDirection) );
+
+ sal_Bool bPercent = sal_False;
+ if( eStackMode == StackMode_Y_STACKED_PERCENT )
+ bPercent = sal_True;
+
+ //iterate through all coordinate systems
+ uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( !xCooSysContainer.is() )
+ return;
+ uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
+ //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() );
+ sal_Int32 nMax = aChartTypeList.getLength();
+ if( bOnlyAtFirstChartType
+ && nMax >= 1 )
+ nMax = 1;
+ for( sal_Int32 nT = 0; nT < nMax; ++nT )
+ {
+ uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
+
+ //iterate through all series in this chart type
+ uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
+ OSL_ASSERT( xDataSeriesContainer.is());
+ if( !xDataSeriesContainer.is() )
+ continue;
+
+ uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
+ for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
+ {
+ Reference< beans::XPropertySet > xProp( aSeriesList[nS], uno::UNO_QUERY );
+ if(xProp.is())
+ xProp->setPropertyValue( C2U( "StackingDirection" ), aNewDirection );
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//static
+
+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;
+ uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; 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 );
+ 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;
+}
+
+// static
+StackMode DiagramHelper::getStackModeFromChartType(
+ const Reference< XChartType > & xChartType,
+ bool& rbFound, bool& rbAmbiguous,
+ const Reference< XCoordinateSystem > & xCorrespondingCoordinateSystem )
+{
+ StackMode eStackMode = StackMode_NONE;
+ rbFound = false;
+ rbAmbiguous = false;
+
+ try
+ {
+ Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XDataSeries > > aSeries( xDSCnt->getDataSeries());
+
+ chart2::StackingDirection eCommonDirection = chart2::StackingDirection_NO_STACKING;
+ bool bDirectionInitialized = false;
+
+ // first series is irrelvant for stacking, start with second, unless
+ // there is only one series
+ const sal_Int32 nSeriesCount = aSeries.getLength();
+ 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( C2U("StackingDirection") ) >>= eCurrentDirection );
+ OSL_ASSERT( bSuccess );
+ (void)(bSuccess); // avoid warning in non-debug builds
+ if( ! bDirectionInitialized )
+ {
+ eCommonDirection = eCurrentDirection;
+ bDirectionInitialized = true;
+ }
+ else
+ {
+ if( eCommonDirection != eCurrentDirection )
+ {
+ rbAmbiguous = true;
+ break;
+ }
+ }
+ }
+
+ if( rbFound )
+ {
+ if( eCommonDirection == chart2::StackingDirection_Z_STACKING )
+ eStackMode = StackMode_Z_STACKED;
+ else if( eCommonDirection == chart2::StackingDirection_Y_STACKING )
+ {
+ eStackMode = StackMode_Y_STACKED;
+
+ // percent stacking
+ if( xCorrespondingCoordinateSystem.is() )
+ {
+ if( 1 < xCorrespondingCoordinateSystem->getDimension() )
+ {
+ sal_Int32 nAxisIndex = 0;
+ if( nSeriesCount )
+ nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(aSeries[0]);
+
+ Reference< chart2::XAxis > xAxis(
+ xCorrespondingCoordinateSystem->getAxisByDimension( 1,nAxisIndex ));
+ if( xAxis.is())
+ {
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ if( aScaleData.AxisType==chart2::AxisType::PERCENT )
+ eStackMode = StackMode_Y_STACKED_PERCENT;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return eStackMode;
+}
+
+// static
+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() )
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] );
+ if(xCooSys.is())
+ {
+ nResult = xCooSys->getDimension();
+ break;
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return nResult;
+}
+
+// static
+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 );
+ Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ Reference< XCoordinateSystem > xOldCooSys( aCooSysList[nCS], uno::UNO_QUERY );
+ Reference< XCoordinateSystem > xNewCooSys;
+
+ Reference< XChartTypeContainer > xChartTypeContainer( xOldCooSys, uno::UNO_QUERY );
+ if( !xChartTypeContainer.is() )
+ continue;
+
+ Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ Reference< XChartType > xChartType( aChartTypeList[nT], uno::UNO_QUERY );
+ 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_Z_STACKED && bIsSupportingOnlyDeepStackingFor3D )
+ DiagramHelper::setStackMode( xDiagram, StackMode_Z_STACKED );
+ else if( nNewDimensionCount==2 && eStackMode == StackMode_Z_STACKED )
+ DiagramHelper::setStackMode( xDiagram, StackMode_NONE );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// static
+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())
+ {
+ 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+//static
+bool DiagramHelper::isSeriesAttachedToMainAxis(
+ const uno::Reference< chart2::XDataSeries >& xDataSeries )
+{
+ sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ return (nAxisIndex==0);
+}
+
+//static
+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 );
+ if( !xProp.is() )
+ return bChanged;
+
+ 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( C2U("AttachedAxisIndex"), uno::makeAny( nNewAxisIndex ) );
+ bChanged = true;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ 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;
+}
+
+//static
+uno::Reference< XAxis > DiagramHelper::getAttachedAxis(
+ const uno::Reference< XDataSeries >& xSeries,
+ const uno::Reference< XDiagram >& xDiagram )
+{
+ return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), xDiagram );
+}
+
+//static
+uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries(
+ const uno::Reference< chart2::XDiagram >& xDiagram
+ , const uno::Reference< XDataSeries >& xGivenDataSeries )
+{
+ if( !xGivenDataSeries.is() )
+ return 0;
+ if(!xDiagram.is())
+ return 0;
+
+ //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 0;
+
+ uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; 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() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
+
+ //iterate through all series in this chart type
+ uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
+ OSL_ASSERT( xDataSeriesContainer.is());
+ if( !xDataSeriesContainer.is() )
+ continue;
+
+ uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
+ for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
+ {
+ if( xGivenDataSeries==aSeriesList[nS] )
+ return xChartType;
+ }
+ }
+ }
+ return 0;
+}
+
+// static
+::std::vector< Reference< XDataSeries > >
+ DiagramHelper::getDataSeriesFromDiagram(
+ const Reference< XDiagram > & xDiagram )
+{
+ ::std::vector< Reference< XDataSeries > > aResult;
+
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j )
+ {
+ Reference< XDataSeriesContainer > xDSCnt( aChartTypeSeq[j], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
+ ::std::copy( aSeriesSeq.getConstArray(), aSeriesSeq.getConstArray() + aSeriesSeq.getLength(),
+ ::std::back_inserter( aResult ));
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ 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() )
+ {
+ Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ //iterate through all chart types in the current coordinate system
+ Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY );
+ if( !xChartTypeContainer.is() )
+ continue;
+ Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ Reference< XDataSeriesContainer > xDataSeriesContainer( aChartTypeList[nT], uno::UNO_QUERY );
+ if( !xDataSeriesContainer.is() )
+ continue;
+ aResult.push_back( xDataSeriesContainer->getDataSeries() );
+ }
+ }
+ }
+ return ContainerHelper::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;
+
+ Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ sal_Int32 nTypesSoFar = 0;
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], 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;
+
+ Reference< XAxis > xResult;
+ // return first x-axis as fall-back
+ Reference< XAxis > xFallBack;
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] );
+ 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( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( aRet.empty() )
+ aRet.push_back(xFallBack);
+
+ return aRet;
+}
+
+} // anonymous namespace
+
+//static
+bool DiagramHelper::isCategoryDiagram(
+ const Reference< XDiagram >& xDiagram )
+{
+ try
+ {
+ Reference< XCoordinateSystemContainer > xCooSysCnt(
+ xDiagram, uno::UNO_QUERY_THROW );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] );
+ 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 )
+ return true;
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return false;
+}
+
+// static
+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 ));
+
+ std::vector< Reference< chart2::XAxis > >::iterator aIt( aCatAxes.begin() );
+ std::vector< Reference< chart2::XAxis > >::const_iterator aEnd( aCatAxes.end() );
+
+ for( aIt = aCatAxes.begin(); aIt != aEnd; ++aIt )
+ {
+ Reference< chart2::XAxis > xCatAxis(*aIt);
+ 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::REALNUMBER;
+ }
+ xCatAxis->setScaleData( aScaleData );
+ }
+ }
+}
+
+// static
+Reference< data::XLabeledDataSequence >
+ DiagramHelper::getCategoriesFromDiagram(
+ const Reference< XDiagram > & xDiagram )
+{
+ Reference< data::XLabeledDataSequence > xResult;
+
+ try
+ {
+ std::vector< Reference< chart2::XAxis > > aCatAxes(
+ lcl_getAxisHoldingCategoriesFromDiagram( xDiagram ));
+ std::vector< Reference< chart2::XAxis > >::iterator aIt( aCatAxes.begin() );
+ std::vector< Reference< chart2::XAxis > >::const_iterator aEnd( aCatAxes.end() );
+ //search for first categories
+ if( aIt != aEnd )
+ {
+ Reference< chart2::XAxis > xCatAxis(*aIt);
+ 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( C2U( "Role" ), uno::makeAny( C2U("categories") ) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+void lcl_generateAutomaticCategoriesFromChartType(
+ Sequence< rtl::OUString >& rRet,
+ const Reference< XChartType >& xChartType )
+{
+ if(!xChartType.is())
+ return;
+ rtl::OUString aMainSeq( xChartType->getRoleOfSequenceForSeriesLabel() );
+ Reference< XDataSeriesContainer > xSeriesCnt( xChartType, uno::UNO_QUERY );
+ if( xSeriesCnt.is() )
+ {
+ Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() );
+ for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ )
+ {
+ Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY );
+ if( !xDataSource.is() )
+ continue;
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
+ ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, aMainSeq ));
+ if( !xLabeledSeq.is() )
+ continue;
+ Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() );
+ if( !xValueSeq.is() )
+ continue;
+ rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE );
+ if( rRet.getLength() )
+ return;
+ }
+ }
+}
+
+Sequence< rtl::OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Reference< XCoordinateSystem > & xCooSys )
+{
+ Sequence< rtl::OUString > aRet;
+
+ Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY );
+ if( xTypeCntr.is() )
+ {
+ Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() );
+ for( sal_Int32 nN=0; nN<aChartTypes.getLength(); nN++ )
+ {
+ lcl_generateAutomaticCategoriesFromChartType( aRet, aChartTypes[nN] );
+ if( aRet.getLength() )
+ return aRet;
+ }
+ }
+ return aRet;
+}
+
+//static
+Sequence< rtl::OUString > DiagramHelper::getExplicitSimpleCategories(
+ const Reference< XChartDocument >& xChartDoc )
+{
+ Sequence< rtl::OUString > aRet;
+ uno::Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+ if(xChartModel.is())
+ {
+ uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
+ aRet = aExplicitCategoriesProvider.getSimpleCategories();
+ }
+ return aRet;
+}
+
+// static
+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 );
+ Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
+ xCooSysCnt->getCoordinateSystems());
+ for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
+ {
+ Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
+ ::std::copy( aChartTypeSeq.getConstArray(), aChartTypeSeq.getConstArray() + aChartTypeSeq.getLength(),
+ ::std::back_inserter( aResult ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return ContainerHelper::ContainerToSequence( aResult );
+}
+
+//static
+bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartType >& xFirstType,
+ const Reference< ::chart2::XChartType >& xSecondType )
+{
+ if( !xFirstType.is() || !xSecondType.is() )
+ return false;
+
+ ::std::vector< ::rtl::OUString > aFirstRoles( ContainerHelper::SequenceToVector( xFirstType->getSupportedMandatoryRoles() ) );
+ ::std::vector< ::rtl::OUString > aSecondRoles( ContainerHelper::SequenceToVector( xSecondType->getSupportedMandatoryRoles() ) );
+ ::std::sort( aFirstRoles.begin(), aFirstRoles.end() );
+ ::std::sort( aSecondRoles.begin(), aSecondRoles.end() );
+ 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 );
+
+ //find position of series.
+ bool bFound = false;
+
+ if( xGivenDataSeries.is() && xCooSysContainer.is() )
+ {
+ 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 interrested in !
+ if( xGivenDataSeries==aSeriesList[nS] )
+ {
+ sal_Int32 nOldSeriesIndex = nS;
+ bFound = true;
+
+ try
+ {
+ sal_Int32 nNewSeriesIndex = nS;
+
+ 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() );
+ sal_Int32 nOtherSeriesIndex = 0;
+ if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
+ {
+ uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
+ aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
+ xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
+
+ aSeriesList[nOldSeriesIndex]=xExchangeSeries;
+ xDataSeriesContainer->setDataSeries(aSeriesList);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( util::CloseVetoException& )
+ {
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+ }
+ }
+ xFormerChartType = xCurrentChartType;
+ }
+ }
+ }
+ }
+ catch( util::CloseVetoException& )
+ {
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+ return bMovedOrMoveAllowed;
+}
+} // anonymous namespace
+
+
+bool DiagramHelper::isSeriesMoveable(
+ const Reference< XDiagram >& xDiagram,
+ const Reference< XDataSeries >& xGivenDataSeries,
+ bool bForward )
+{
+ bool bIsMoveable = false;
+ const bool bDoMove = false;
+
+ bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed(
+ xDiagram, xGivenDataSeries, bForward, bDoMove );
+
+ return bIsMoveable;
+}
+
+
+bool DiagramHelper::moveSeries( const Reference< XDiagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward )
+{
+ bool bMoved = false;
+ const bool bDoMove = true;
+
+ 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 are available for ole objects (metastream)
+ //thus the wrong bottom can be removed on import
+
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ 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 ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram )
+{
+ uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex(
+ xDiagram, 0 ) );
+
+ if( xChartType .is() )
+ {
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return true;
+ }
+ return false;
+}
+
+// static
+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( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ sal_Int32 nGeom = 0;
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+ if( xProp->getPropertyValue( C2U( "Geometry3D" )) >>= nGeom )
+ {
+ if( ! rbFound )
+ {
+ // first series
+ nCommonGeom = nGeom;
+ rbFound = true;
+ }
+ // further series: compare for uniqueness
+ else if( nCommonGeom != nGeom )
+ {
+ rbAmbiguous = true;
+ break;
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return nCommonGeom;
+}
+
+// static
+void DiagramHelper::setGeometry3D(
+ const Reference< chart2::XDiagram > & xDiagram,
+ sal_Int32 nNewGeometry )
+{
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(
+ *aIt, C2U( "Geometry3D" ), uno::makeAny( nNewGeometry ));
+ }
+}
+
+//static
+sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment(
+ const Reference< chart2::XDiagram > & xDiagram,
+ const Reference< chart2::XChartType >& xChartType )
+{
+ sal_Int32 nResult = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP;
+ uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments(
+ ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) );
+
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+ if( xDiaProp.is() && (xDiaProp->getPropertyValue( C2U( "MissingValueTreatment" ) ) >>= nResult) )
+ {
+ //ensure that the set value is supported by this charttype
+ for( sal_Int32 nN = 0; nN < aAvailableMissingValueTreatments.getLength(); nN++ )
+ if( aAvailableMissingValueTreatments[nN] == nResult )
+ return nResult; //ok
+ }
+
+ //otherwise use the first supported one
+ if( aAvailableMissingValueTreatments.getLength() )
+ {
+ nResult = aAvailableMissingValueTreatments[0];
+ return nResult;
+ }
+
+ return nResult;
+}
+
+//static
+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(C2U("RelativePosition")) >>= aRelPos ) &&
+ (xDiaProps->getPropertyValue(C2U("RelativeSize")) >>= aRelSize ) )
+ {
+ bool bPosSizeExcludeAxes=false;
+ xDiaProps->getPropertyValue(C2U("PosSizeExcludeAxes")) >>= bPosSizeExcludeAxes;
+ if( bPosSizeExcludeAxes )
+ eMode = DiagramPositioningMode_EXCLUDING;
+ else
+ eMode = DiagramPositioningMode_INCLUDING;
+ }
+ }
+ return eMode;
+}
+
+void lcl_ensureRange0to1( double& rValue )
+{
+ if(rValue<0.0)
+ rValue=0.0;
+ if(rValue>1.0)
+ rValue=1.0;
+}
+
+//static
+bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel,
+ const awt::Rectangle& rPosRect /*100th mm*/ )
+{
+ ControllerLockGuard 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() )
+ return bChanged;
+
+ RelativePosition aOldPos;
+ RelativeSize aOldSize;
+ xDiaProps->getPropertyValue(C2U("RelativePosition") ) >>= aOldPos;
+ xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aOldSize;
+
+ RelativePosition aNewPos;
+ aNewPos.Anchor = drawing::Alignment_TOP_LEFT;
+ aNewPos.Primary = double(rPosRect.X)/double(aPageSize.Width);
+ aNewPos.Secondary = double(rPosRect.Y)/double(aPageSize.Height);
+
+ chart2::RelativeSize aNewSize;
+ aNewSize.Primary = double(rPosRect.Width)/double(aPageSize.Width);
+ aNewSize.Secondary = double(rPosRect.Height)/double(aPageSize.Height);
+
+ lcl_ensureRange0to1( aNewPos.Primary );
+ lcl_ensureRange0to1( aNewPos.Secondary );
+ lcl_ensureRange0to1( aNewSize.Primary );
+ lcl_ensureRange0to1( aNewSize.Secondary );
+ if( (aNewPos.Primary + aNewSize.Primary) > 1.0 )
+ aNewPos.Primary = 1.0 - aNewSize.Primary;
+ if( (aNewPos.Secondary + aNewSize.Secondary) > 1.0 )
+ aNewPos.Secondary = 1.0 - aNewSize.Secondary;
+
+ xDiaProps->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aNewPos) );
+ xDiaProps->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aNewSize) );
+
+ bChanged = (aOldPos.Anchor!=aNewPos.Anchor) ||
+ (aOldPos.Primary!=aNewPos.Primary) ||
+ (aOldPos.Secondary!=aNewPos.Secondary) ||
+ (aOldSize.Primary!=aNewSize.Primary) ||
+ (aOldSize.Secondary!=aNewSize.Secondary);
+ return bChanged;
+}
+
+//static
+awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference< frame::XModel >& xChartModel )
+{
+ awt::Rectangle aRet(-1,-1,-1,-1);
+
+ uno::Reference< beans::XPropertySet > xDiaProps( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
+ if( !xDiaProps.is() )
+ return aRet;
+
+ awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) );
+
+ RelativePosition aRelPos;
+ RelativeSize aRelSize;
+ xDiaProps->getPropertyValue(C2U("RelativePosition") ) >>= aRelPos;
+ xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aRelSize;
+
+ awt::Size aAbsSize(
+ aRelSize.Primary * aPageSize.Width,
+ aRelSize.Secondary * aPageSize.Height );
+
+ awt::Point aAbsPos(
+ static_cast< sal_Int32 >( aRelPos.Primary * aPageSize.Width ),
+ static_cast< sal_Int32 >( aRelPos.Secondary * aPageSize.Height ));
+
+ awt::Point aAbsPosLeftTop = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( aAbsPos, aAbsSize, aRelPos.Anchor );
+
+ aRet = awt::Rectangle(aAbsPosLeftTop.X, aAbsPosLeftTop.Y, aAbsSize.Width, aAbsSize.Height );
+
+ return aRet;
+}
+
+//static
+bool DiagramHelper::switchDiagramPositioningToExcludingPositioning(
+ const uno::Reference< frame::XModel >& xChartModel
+ , bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning )
+{
+ //return true if something was changed
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//#i100778# todo: change this dependent on fileformat evolution
+ {
+ uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartModel, uno::UNO_QUERY ) ;
+ if( xOldDoc.is() )
+ {
+ uno::Reference< ::com::sun::star::chart::XDiagramPositioning > xDiagramPositioning( xOldDoc->getDiagram(), uno::UNO_QUERY );
+ if( xDiagramPositioning.is() && ( bConvertAlsoFromAutoPositioning || !xDiagramPositioning->isAutomaticDiagramPositioning() )
+ && !xDiagramPositioning->isExcludingDiagramPositioning() )
+ {
+ ControllerLockGuard aCtrlLockGuard( xChartModel );
+ uno::Reference< util::XModifiable > xModifiable( xChartModel, uno::UNO_QUERY );
+ bool bModelWasModified = xModifiable.is() && xModifiable->isModified();
+ xDiagramPositioning->setDiagramPositionExcludingAxes( xDiagramPositioning->calculateDiagramPositionExcludingAxes() );
+ if(bResetModifiedState && !bModelWasModified && xModifiable.is() )
+ xModifiable->setModified(sal_False);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
new file mode 100644
index 000000000000..7468d8bb7896
--- /dev/null
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ErrorBar.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "ContainerHelper.hxx"
+#include "EventListenerHelper.hxx"
+#include "PropertyHelper.hxx"
+#include "CloneHelper.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ErrorBar" ));
+
+enum
+{
+ PROP_ERROR_BAR_STYLE,
+ PROP_ERROR_BAR_POS_ERROR,
+ PROP_ERROR_BAR_NEG_ERROR,
+ PROP_ERROR_BAR_WEIGHT,
+ PROP_ERROR_BAR_SHOW_POS_ERROR,
+ PROP_ERROR_BAR_SHOW_NEG_ERROR
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarStyle" ),
+ PROP_ERROR_BAR_STYLE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "PositiveError" ),
+ PROP_ERROR_BAR_POS_ERROR,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "NegativeError" ),
+ PROP_ERROR_BAR_NEG_ERROR,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Weight" ),
+ PROP_ERROR_BAR_WEIGHT,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ShowPositiveError" ),
+ PROP_ERROR_BAR_SHOW_POS_ERROR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ShowNegativeError" ),
+ PROP_ERROR_BAR_SHOW_NEG_ERROR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_STYLE, ::com::sun::star::chart::ErrorBarStyle::NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_POS_ERROR, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_NEG_ERROR, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_WEIGHT, 1.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_POS_ERROR, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_NEG_ERROR, true );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq )
+{
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xLSeq, uno::UNO_QUERY );
+ return ( xServiceInfo.is() && xServiceInfo->getImplementationName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.chart2.LabeledDataSequence")));
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+uno::Reference< beans::XPropertySet > createErrorBar( const uno::Reference< uno::XComponentContext > & xContext )
+{
+ return new ErrorBar( xContext );
+}
+
+ErrorBar::ErrorBar(
+ uno::Reference< uno::XComponentContext > const & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+ErrorBar::ErrorBar( const ErrorBar & rOther ) :
+ MutexContainer(),
+ impl::ErrorBar_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xContext( rOther.m_xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ if( ! rOther.m_aDataSequences.empty())
+ {
+ if( lcl_isInternalData( rOther.m_aDataSequences.front()))
+ CloneHelper::CloneRefVector< tDataSequenceContainer::value_type >(
+ rOther.m_aDataSequences, m_aDataSequences );
+ else
+ m_aDataSequences = rOther.m_aDataSequences;
+ ModifyListenerHelper::addListenerToAllElements( m_aDataSequences, m_xModifyEventForwarder );
+ }
+}
+
+ErrorBar::~ErrorBar()
+{}
+
+uno::Reference< util::XCloneable > SAL_CALL ErrorBar::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new ErrorBar( *this ));
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any ErrorBar::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL ErrorBar::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ ErrorBar::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL ErrorBar::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL ErrorBar::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ErrorBar::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL ErrorBar::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ XDataSink ____
+void SAL_CALL ErrorBar::setData( const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > >& aData )
+ throw (uno::RuntimeException)
+{
+ ModifyListenerHelper::removeListenerFromAllElements( m_aDataSequences, m_xModifyEventForwarder );
+ EventListenerHelper::removeListenerFromAllElements( m_aDataSequences, this );
+ m_aDataSequences = ContainerHelper::SequenceToVector( aData );
+ EventListenerHelper::addListenerToAllElements( m_aDataSequences, this );
+ ModifyListenerHelper::addListenerToAllElements( m_aDataSequences, m_xModifyEventForwarder );
+}
+
+// ____ XDataSource ____
+uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ErrorBar::getDataSequences()
+ throw (uno::RuntimeException)
+{
+ return ContainerHelper::ContainerToSequence( m_aDataSequences );
+}
+
+// ____ XChild ____
+uno::Reference< uno::XInterface > SAL_CALL ErrorBar::getParent()
+ throw (uno::RuntimeException)
+{
+ return m_xParent;
+}
+
+void SAL_CALL ErrorBar::setParent(
+ const uno::Reference< uno::XInterface >& Parent )
+ throw (lang::NoSupportException,
+ uno::RuntimeException)
+{
+ m_xParent.set( Parent );
+}
+
+// ____ OPropertySet ____
+void ErrorBar::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void ErrorBar::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > ErrorBar::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ErrorBar" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ErrorBar, lcl_aServiceName );
+
+// needed by MSC compiler
+using impl::ErrorBar_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( ErrorBar, ErrorBar_Base, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ErrorBar, ErrorBar_Base, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
new file mode 100644
index 000000000000..bd1c1bb79813
--- /dev/null
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ExplicitCategoriesProvider.hxx"
+#include "DiagramHelper.hxx"
+#include "CommonConverters.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+
+//.............................................................................
+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 ::rtl::OUString;
+using ::std::vector;
+
+
+ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2::XCoordinateSystem >& xCooSysModel
+ , const uno::Reference< frame::XModel >& xChartModel )
+ : m_bDirty(true)
+ , m_xCooSysModel( xCooSysModel )
+ , m_xOriginalCategories()
+{
+ try
+ {
+ if( xCooSysModel.is() )
+ {
+ uno::Reference< XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
+ if( xAxis.is() )
+ m_xOriginalCategories = xAxis->getScaleData().Categories;
+ }
+
+ if( m_xOriginalCategories.is() )
+ {
+ Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is() )
+ {
+ uno::Reference< data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+
+ if( xDataProvider.is() )
+ {
+ OUString aCatgoriesRange( DataSourceHelper::getRangeFromValues( m_xOriginalCategories ) );
+ const bool bFirstCellAsLabel = false;
+ const bool bHasCategories = false;
+ const uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ uno::Reference< data::XDataSource > xColumnCategoriesSource( xDataProvider->createDataSource(
+ DataSourceHelper::createArguments( aCatgoriesRange, aSequenceMapping, true /*bUseColumns*/
+ , bFirstCellAsLabel, bHasCategories ) ) );
+
+ uno::Reference< data::XDataSource > xRowCategoriesSource( xDataProvider->createDataSource(
+ DataSourceHelper::createArguments( aCatgoriesRange, aSequenceMapping, false /*bUseColumns*/
+ , bFirstCellAsLabel, bHasCategories ) ) );
+
+ if( xColumnCategoriesSource.is() && xRowCategoriesSource.is() )
+ {
+ Sequence< Reference< data::XLabeledDataSequence> > aColumns = xColumnCategoriesSource->getDataSequences();
+ Sequence< Reference< data::XLabeledDataSequence> > aRows = xRowCategoriesSource->getDataSequences();
+
+ sal_Int32 nColumnCount = aColumns.getLength();
+ sal_Int32 nRowCount = aRows.getLength();
+ if( nColumnCount>1 && nRowCount>1 )
+ {
+ //we have complex categories
+ //->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( xChartModel ) );
+ if( !aSeries.empty() )
+ {
+ uno::Reference< data::XDataSource > xSeriesSource( aSeries.front(), uno::UNO_QUERY );
+ ::rtl::OUString aStringDummy;
+ bool bDummy;
+ uno::Sequence< sal_Int32 > aSeqDummy;
+ DataSourceHelper::readArguments( xDataProvider->detectArguments( xSeriesSource),
+ aStringDummy, aSeqDummy, bSeriesUsesColumns, bDummy, bDummy );
+ }
+ if( bSeriesUsesColumns )
+ m_aSplitCategoriesList=aColumns;
+ else
+ m_aSplitCategoriesList=aRows;
+ }
+ }
+ }
+ }
+ if( !m_aSplitCategoriesList.getLength() )
+ {
+ m_aSplitCategoriesList.realloc(1);
+ m_aSplitCategoriesList[0]=m_xOriginalCategories;
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+ExplicitCategoriesProvider::~ExplicitCategoriesProvider()
+{
+}
+
+const Sequence< Reference< data::XLabeledDataSequence> >& ExplicitCategoriesProvider::getSplitCategoriesList()
+{
+ return m_aSplitCategoriesList;
+}
+
+bool ExplicitCategoriesProvider::hasComplexCategories() const
+{
+ return m_aSplitCategoriesList.getLength() > 1;
+}
+
+sal_Int32 ExplicitCategoriesProvider::getCategoryLevelCount() const
+{
+ sal_Int32 nCount = m_aSplitCategoriesList.getLength();
+ if(!nCount)
+ nCount = 1;
+ return nCount;
+}
+
+std::vector<sal_Int32> lcl_getLimitingBorders( const std::vector< ComplexCategory >& rComplexCategories )
+{
+ std::vector<sal_Int32> aLimitingBorders;
+ std::vector< ComplexCategory >::const_iterator aIt( rComplexCategories.begin() );
+ std::vector< ComplexCategory >::const_iterator aEnd( rComplexCategories.end() );
+ sal_Int32 nBorderIndex = 0; /*border below the index*/
+ for( ; aIt != aEnd; ++aIt )
+ {
+ ComplexCategory aComplexCategory(*aIt);
+ nBorderIndex += aComplexCategory.Count;
+ aLimitingBorders.push_back(nBorderIndex);
+ }
+ return aLimitingBorders;
+}
+
+uno::Sequence< rtl::OUString > lcl_DataToStringSequence( const uno::Reference< data::XDataSequence >& xDataSequence )
+{
+ uno::Sequence< rtl::OUString > aStrings;
+
+ OSL_ASSERT( xDataSequence.is());
+ if( !xDataSequence.is() )
+ return aStrings;
+
+
+ uno::Reference< data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xTextualDataSequence.is() )
+ {
+ aStrings = xTextualDataSequence->getTextualData();
+ }
+ else
+ {
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ aStrings.realloc(aValues.getLength());
+
+ for(sal_Int32 nN=aValues.getLength();nN--;)
+ aValues[nN] >>= aStrings[nN];
+ }
+
+ return aStrings;
+}
+
+SplitCategoriesProvider::~SplitCategoriesProvider()
+{
+}
+
+class SplitCategoriesProvider_ForLabeledDataSequences : public SplitCategoriesProvider
+{
+public:
+
+ explicit SplitCategoriesProvider_ForLabeledDataSequences( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> >& rSplitCategoriesList )
+ : m_rSplitCategoriesList( rSplitCategoriesList )
+ {}
+ virtual ~SplitCategoriesProvider_ForLabeledDataSequences()
+ {}
+
+ virtual sal_Int32 getLevelCount() const;
+ virtual uno::Sequence< rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const;
+
+private:
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> >& m_rSplitCategoriesList;
+};
+
+sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const
+{
+ return m_rSplitCategoriesList.getLength();
+}
+uno::Sequence< rtl::OUString > SplitCategoriesProvider_ForLabeledDataSequences::getStringsForLevel( sal_Int32 nLevel ) const
+{
+ uno::Sequence< rtl::OUString > aRet;
+ Reference< data::XLabeledDataSequence > xLabeledDataSequence( m_rSplitCategoriesList[nLevel] );
+ if( xLabeledDataSequence.is() )
+ aRet = lcl_DataToStringSequence( xLabeledDataSequence->getValues() );
+ return aRet;
+}
+
+std::vector< ComplexCategory > lcl_DataSequenceToComplexCategoryVector(
+ const uno::Sequence< rtl::OUString >& rStrings
+ , const std::vector<sal_Int32>& rLimitingBorders, bool bCreateSingleCategories )
+{
+ std::vector< ComplexCategory > aResult;
+
+ sal_Int32 nMaxCount = rStrings.getLength();
+ OUString aPrevious;
+ sal_Int32 nCurrentCount=0;
+ for( sal_Int32 nN=0; nN<nMaxCount; nN++ )
+ {
+ OUString aCurrent = rStrings[nN];
+ if( bCreateSingleCategories || ::std::find( rLimitingBorders.begin(), rLimitingBorders.end(), nN ) != rLimitingBorders.end() )
+ {
+ aResult.push_back( ComplexCategory(aPrevious,nCurrentCount) );
+ nCurrentCount=1;
+ aPrevious = aCurrent;
+ }
+ else
+ {
+ if( aCurrent.getLength() && aPrevious != aCurrent )
+ {
+ aResult.push_back( ComplexCategory(aPrevious,nCurrentCount) );
+ nCurrentCount=1;
+ aPrevious = aCurrent;
+ }
+ else
+ nCurrentCount++;
+ }
+ }
+ if( nCurrentCount )
+ aResult.push_back( ComplexCategory(aPrevious,nCurrentCount) );
+
+ return aResult;
+}
+
+sal_Int32 lcl_getCategoryCount( std::vector< ComplexCategory >& rComplexCategories )
+{
+ sal_Int32 nCount = 0;
+ std::vector< ComplexCategory >::iterator aIt( rComplexCategories.begin() );
+ std::vector< ComplexCategory >::const_iterator aEnd( rComplexCategories.end() );
+ for( ; aIt != aEnd; ++aIt )
+ nCount+=aIt->Count;
+ return nCount;
+}
+
+Sequence< OUString > lcl_getExplicitSimpleCategories(
+ const SplitCategoriesProvider& rSplitCategoriesProvider,
+ ::std::vector< ::std::vector< ComplexCategory > >& rComplexCats )
+{
+ Sequence< OUString > aRet;
+
+ rComplexCats.clear();
+ sal_Int32 nLCount = rSplitCategoriesProvider.getLevelCount();
+ for( sal_Int32 nL = 0; nL < nLCount; nL++ )
+ {
+ std::vector<sal_Int32> aLimitingBorders;
+ if(nL>0)
+ aLimitingBorders = lcl_getLimitingBorders( rComplexCats.back() );
+ rComplexCats.push_back( lcl_DataSequenceToComplexCategoryVector(
+ rSplitCategoriesProvider.getStringsForLevel(nL), aLimitingBorders, nL==(nLCount-1) ) );
+ }
+
+ std::vector< std::vector< ComplexCategory > >::iterator aOuterIt( rComplexCats.begin() );
+ std::vector< std::vector< ComplexCategory > >::const_iterator aOuterEnd( rComplexCats.end() );
+
+ //ensure that the category count is the same on each level
+ sal_Int32 nMaxCategoryCount = 0;
+ {
+ for( aOuterIt=rComplexCats.begin(); aOuterIt != aOuterEnd; ++aOuterIt )
+ {
+ sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
+ nMaxCategoryCount = std::max( nCurrentCount, nMaxCategoryCount );
+ }
+ for( aOuterIt=rComplexCats.begin(); aOuterIt != aOuterEnd; ++aOuterIt )
+ {
+ sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
+ if( nCurrentCount< nMaxCategoryCount )
+ {
+ ComplexCategory& rComplexCategory = aOuterIt->back();
+ rComplexCategory.Count += (nMaxCategoryCount-nCurrentCount);
+ }
+ }
+ }
+
+ //create a list with an element for every index
+ std::vector< std::vector< ComplexCategory > > aComplexCatsPerIndex;
+ for( aOuterIt=rComplexCats.begin() ; aOuterIt != aOuterEnd; ++aOuterIt )
+ {
+ std::vector< ComplexCategory > aSingleLevel;
+ std::vector< ComplexCategory >::iterator aIt( aOuterIt->begin() );
+ std::vector< ComplexCategory >::const_iterator aEnd( aOuterIt->end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ ComplexCategory aComplexCategory( *aIt );
+ sal_Int32 nCount = aComplexCategory.Count;
+ while( nCount-- )
+ aSingleLevel.push_back(aComplexCategory);
+ }
+ aComplexCatsPerIndex.push_back( aSingleLevel );
+ }
+
+ if(nMaxCategoryCount)
+ {
+ aRet.realloc(nMaxCategoryCount);
+ aOuterEnd = aComplexCatsPerIndex.end();
+ OUString aSpace(C2U(" "));
+ for(sal_Int32 nN=0; nN<nMaxCategoryCount; nN++)
+ {
+ OUString aText;
+ for( aOuterIt=aComplexCatsPerIndex.begin() ; aOuterIt != aOuterEnd; ++aOuterIt )
+ {
+ OUString aAddText = (*aOuterIt)[nN].Text;
+ if( aAddText.getLength() )
+ {
+ if(aText.getLength())
+ aText += aSpace;
+ aText += aAddText;
+ }
+ }
+ aRet[nN]=aText;
+ }
+ }
+ return aRet;
+}
+
+//static
+Sequence< OUString > ExplicitCategoriesProvider::getExplicitSimpleCategories(
+ const SplitCategoriesProvider& rSplitCategoriesProvider )
+{
+ vector< vector< ComplexCategory > > aComplexCats;
+ return lcl_getExplicitSimpleCategories( rSplitCategoriesProvider, aComplexCats );
+}
+
+void ExplicitCategoriesProvider::init()
+{
+ if( m_bDirty )
+ {
+ m_aExplicitCategories.realloc(0);
+ m_aComplexCats.clear();//not one per index
+
+ if( m_xOriginalCategories.is() )
+ {
+ if( !hasComplexCategories() )
+ m_aExplicitCategories = DataSequenceToStringSequence(m_xOriginalCategories->getValues());
+ else
+ m_aExplicitCategories = lcl_getExplicitSimpleCategories(
+ SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList ), m_aComplexCats );
+ }
+ if(!m_aExplicitCategories.getLength())
+ m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel );
+ m_bDirty = false;
+ }
+}
+
+
+Sequence< ::rtl::OUString > ExplicitCategoriesProvider::getSimpleCategories()
+{
+ init();
+ return m_aExplicitCategories;
+}
+
+std::vector< ComplexCategory > ExplicitCategoriesProvider::getCategoriesByLevel( sal_Int32 nLevel )
+{
+ std::vector< ComplexCategory > aRet;
+ init();
+ sal_Int32 nMaxIndex = m_aComplexCats.size()-1;
+ if( nLevel >= 0 && nLevel <= nMaxIndex )
+ aRet = m_aComplexCats[nMaxIndex-nLevel];
+ return aRet;
+}
+
+// static
+OUString ExplicitCategoriesProvider::getCategoryByIndex(
+ const Reference< XCoordinateSystem >& xCooSysModel
+ , const uno::Reference< frame::XModel >& xChartModel
+ , sal_Int32 nIndex )
+{
+ if( xCooSysModel.is())
+ {
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSysModel, xChartModel );
+ Sequence< OUString > aCategories( aExplicitCategoriesProvider.getSimpleCategories());
+ if( nIndex < aCategories.getLength())
+ return aCategories[ nIndex ];
+ }
+ return OUString();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..d7bb86174323
--- /dev/null
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ExponentialRegressionCurveCalculator.hxx"
+#include "macros.hxx"
+#include "RegressionCalculationHelper.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+ExponentialRegressionCurveCalculator::ExponentialRegressionCurveCalculator() :
+ m_fSlope( 0.0 ),
+ m_fIntercept( 0.0 )
+{
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+}
+
+ExponentialRegressionCurveCalculator::~ExponentialRegressionCurveCalculator()
+{}
+
+// ____ XRegressionCurveCalculator ____
+void SAL_CALL ExponentialRegressionCurveCalculator::recalculateRegression(
+ const uno::Sequence< double >& aXValues,
+ const uno::Sequence< double >& aYValues )
+ throw (uno::RuntimeException)
+{
+ RegressionCalculationHelper::tDoubleVectorPair aValues(
+ RegressionCalculationHelper::cleanup(
+ aXValues, aYValues,
+ RegressionCalculationHelper::isValidAndYPositive()));
+
+ const size_t nMax = aValues.first.size();
+ if( nMax == 0 )
+ {
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+ return;
+ }
+
+ double fAverageX = 0.0, fAverageY = 0.0;
+ size_t i = 0;
+ for( i = 0; i < nMax; ++i )
+ {
+ fAverageX += aValues.first[i];
+ fAverageY += log( aValues.second[i] );
+ }
+
+ const double fN = static_cast< double >( nMax );
+ fAverageX /= fN;
+ fAverageY /= fN;
+
+ double fQx = 0.0, fQy = 0.0, fQxy = 0.0;
+ for( i = 0; i < nMax; ++i )
+ {
+ double fDeltaX = aValues.first[i] - fAverageX;
+ double fDeltaY = log( aValues.second[i] ) - fAverageY;
+
+ fQx += fDeltaX * fDeltaX;
+ fQy += fDeltaY * fDeltaY;
+ fQxy += fDeltaX * fDeltaY;
+ }
+
+ m_fSlope = fQxy / fQx;
+ m_fIntercept = fAverageY - m_fSlope * fAverageX;
+ m_fCorrelationCoeffitient = fQxy / sqrt( fQx * fQy );
+
+ m_fSlope = exp( m_fSlope );
+ m_fIntercept = exp( m_fIntercept );
+}
+
+double SAL_CALL ExponentialRegressionCurveCalculator::getCurveValue( double x )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if( ! ( ::rtl::math::isNan( m_fSlope ) ||
+ ::rtl::math::isNan( m_fIntercept )))
+ {
+ fResult = m_fIntercept * pow( m_fSlope, x );
+ }
+
+ return fResult;
+}
+
+uno::Sequence< geometry::RealPoint2D > SAL_CALL ExponentialRegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const uno::Reference< chart2::XScaling >& xScalingX,
+ const uno::Reference< chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( bMaySkipPointsInCalculation &&
+ isLinearScaling( xScalingX ) &&
+ isLogarithmicScaling( xScalingY ))
+ {
+ // optimize result
+ uno::Sequence< geometry::RealPoint2D > aResult( 2 );
+ aResult[0].X = min;
+ aResult[0].Y = this->getCurveValue( min );
+ aResult[1].X = max;
+ aResult[1].Y = this->getCurveValue( max );
+
+ return aResult;
+ }
+
+ return RegressionCurveCalculator::getCurveValues( min, max, nPointCount, xScalingX, xScalingY, bMaySkipPointsInCalculation );
+}
+
+
+OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
+ const uno::Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const
+{
+ OUStringBuffer aBuf( C2U( "f(x) = " ));
+
+ if( m_fIntercept == 0.0 ||
+ m_fSlope == 0.0 )
+ {
+ aBuf.append( sal_Unicode( '0' ));
+ }
+ else if( rtl::math::approxEqual( m_fSlope, 1.0 ) )
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+ else
+ {
+ if( ! rtl::math::approxEqual( m_fIntercept, 1.0 ) )
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ aBuf.append( sal_Unicode( 0x00b7 ));
+ }
+
+ if( m_fSlope < 0.0 )
+ aBuf.append( sal_Unicode( '(' ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope ));
+ if( m_fSlope < 0.0 )
+ aBuf.append( sal_Unicode( ')' ));
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "^x" ));
+ }
+
+ return aBuf.makeStringAndClear();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx
new file mode 100644
index 000000000000..ee23727c321b
--- /dev/null
+++ b/chart2/source/tools/FillProperties.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "FillProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+namespace chart
+{
+
+namespace
+{
+
+void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "FillStyle" ),
+ FillProperties::PROP_FILL_STYLE,
+ ::getCppuType( reinterpret_cast< const drawing::FillStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillColor" ),
+ FillProperties::PROP_FILL_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillTransparence" ),
+ FillProperties::PROP_FILL_TRANSPARENCE,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillTransparenceGradientName" ),
+ FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //optional
+// rOutProperties.push_back(
+// Property( C2U( "FillTransparenceGradient" ),
+// FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT,
+// ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT
+// | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillGradientName" ),
+ FillProperties::PROP_FILL_GRADIENT_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ beans::Property( C2U( "FillGradientStepCount" ),
+ FillProperties::PROP_FILL_GRADIENT_STEPCOUNT,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //optional
+// rOutProperties.push_back(
+// Property( C2U( "FillGradient" ),
+// FillProperties::PROP_FILL_GRADIENT,
+// ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT
+// | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillHatchName" ),
+ FillProperties::PROP_FILL_HATCH_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //optional
+// rOutProperties.push_back(
+// Property( C2U( "FillHatch" ),
+// FillProperties::PROP_FILL_HATCH,
+// ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT
+// | beans::PropertyAttribute::MAYBEVOID ));
+
+ //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBackground" ),
+ FillProperties::PROP_FILL_BACKGROUND,
+ ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//static
+void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapName" ),
+ FillProperties::PROP_FILL_BITMAP_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //optional
+// rOutProperties.push_back(
+// Property( C2U( "FillBitmap" ),
+// FillProperties::PROP_FILL_BITMAP,
+// ::getCppuType( reinterpret_cast< const uno::Reference< awt::XBitmap > * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //optional
+// rOutProperties.push_back(
+// Property( C2U( "FillBitmapURL" ),
+// FillProperties::PROP_FILL_BITMAP_URL,
+// ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapOffsetX" ),
+ FillProperties::PROP_FILL_BITMAP_OFFSETX,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapOffsetY" ),
+ FillProperties::PROP_FILL_BITMAP_OFFSETY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapPositionOffsetX" ),
+ FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapPositionOffsetY" ),
+ FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapRectanglePoint" ),
+ FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
+ ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapLogicalSize" ),
+ FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
+ ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapSizeX" ),
+ FillProperties::PROP_FILL_BITMAP_SIZEX,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapSizeY" ),
+ FillProperties::PROP_FILL_BITMAP_SIZEY,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapMode" ),
+ FillProperties::PROP_FILL_BITMAP_MODE,
+ ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+
+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_BACKGROUND, false );
+}
+
+void lcl_AddDefaultsToMap_only_BitmapProperties(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ uno::Any aSalInt16Zero = uno::makeAny( sal_Int16( 0 ));
+ uno::Any aSalInt32SizeDefault = uno::makeAny( sal_Int32( 0 ));
+
+ ::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_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_MODE, drawing::BitmapMode_REPEAT );
+}
+
+}//end anonymous namespace
+
+void FillProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ // Fill Properties see service drawing::FillProperties
+ // ---------------
+ lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties );
+ lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties );
+}
+
+void FillProperties::AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap );
+ lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap );
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/FormattedStringHelper.cxx b/chart2/source/tools/FormattedStringHelper.cxx
new file mode 100644
index 000000000000..c13c87d45931
--- /dev/null
+++ b/chart2/source/tools/FormattedStringHelper.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "FormattedStringHelper.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+
+//.............................................................................
+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 rtl::OUString;
+
+Sequence< Reference< chart2::XFormattedString > >
+ FormattedStringHelper::createFormattedStringSequence(
+ const Reference< uno::XComponentContext > & xContext
+ , const OUString & rString
+ , const Reference< beans::XPropertySet > & xTextProperties ) throw()
+{
+ Reference< XFormattedString > xFormStr;
+ try
+ {
+ if( xContext.is() )
+ {
+ xFormStr.set(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.chart2.FormattedString"), xContext ),
+ uno::UNO_QUERY_THROW );
+
+ xFormStr->setString( rString );
+
+ // set character properties
+ comphelper::copyProperties(
+ xTextProperties, Reference< beans::XPropertySet >( xFormStr, uno::UNO_QUERY ) );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return Sequence< Reference< XFormattedString > >( & xFormStr, 1 );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/tools/ImplOPropertySet.cxx b/chart2/source/tools/ImplOPropertySet.cxx
new file mode 100644
index 000000000000..faf1defd20ac
--- /dev/null
+++ b/chart2/source/tools/ImplOPropertySet.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ImplOPropertySet.hxx"
+#include "CloneHelper.hxx"
+
+#include <algorithm>
+#include <functional>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+
+namespace
+{
+
+struct lcl_getPropertyStateByHandle :
+ public ::std::unary_function< sal_Int32, beans::PropertyState >
+{
+ lcl_getPropertyStateByHandle(
+ const ::property::impl::ImplOPropertySet::tPropertyMap & rMap )
+ : m_rMap( rMap )
+ {}
+
+ inline 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 :
+ public ::std::unary_function< K, void >
+{
+ lcl_eraseMapEntry( ::std::map< K, V > & rMap )
+ : m_rMap( rMap )
+ {}
+
+ inline void operator() ( const K & aKey )
+ {
+ m_rMap.erase( aKey );
+ }
+
+private:
+ ::std::map< K, V > m_rMap;
+};
+
+struct lcl_replaceInterfacePropertiesByClones :
+ public ::std::unary_function< ::property::impl::ImplOPropertySet::tPropertyMap::value_type, void >
+{
+ inline 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
+{
+namespace impl
+{
+
+ImplOPropertySet::ImplOPropertySet()
+{}
+
+ImplOPropertySet::ImplOPropertySet( const ImplOPropertySet & rOther )
+{
+ ::std::copy( rOther.m_aProperties.begin(), rOther.m_aProperties.end(),
+ ::std::inserter( m_aProperties, m_aProperties.begin() ));
+ cloneInterfaceProperties();
+ m_xStyle.set( ::chart::CloneHelper::CreateRefClone< Reference< 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, Any * pOldValue )
+{
+ if( pOldValue != NULL )
+ {
+ tPropertyMap::const_iterator aFoundIter( m_aProperties.find( nHandle ) );
+ if( m_aProperties.end() != aFoundIter )
+ (*pOldValue) = (*aFoundIter).second;
+ }
+
+ m_aProperties[ nHandle ] = rValue;
+}
+
+bool ImplOPropertySet::SetStyle( const Reference< style::XStyle > & xStyle )
+{
+ if( ! xStyle.is())
+ return false;
+
+ m_xStyle = xStyle;
+ return true;
+}
+
+Reference< style::XStyle > ImplOPropertySet::GetStyle() const
+{
+ return m_xStyle;
+}
+
+void ImplOPropertySet::cloneInterfaceProperties()
+{
+ ::std::for_each( m_aProperties.begin(), m_aProperties.end(),
+ lcl_replaceInterfacePropertiesByClones());
+}
+
+
+} // namespace impl
+} // namespace chart
diff --git a/chart2/source/tools/ImplOPropertySet.hxx b/chart2/source/tools/ImplOPropertySet.hxx
new file mode 100644
index 000000000000..505ab598d7da
--- /dev/null
+++ b/chart2/source/tools/ImplOPropertySet.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_IMPLOPROPERTYSET_HXX
+#define CHART_IMPLOPROPERTYSET_HXX
+
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+
+#include <map>
+#include <vector>
+
+namespace property
+{
+namespace impl
+{
+
+class ImplOPropertySet
+{
+public:
+ ImplOPropertySet();
+ explicit ImplOPropertySet( const ImplOPropertySet & rOther );
+
+ /** supports states DIRECT_VALUE and DEFAULT_VALUE
+ */
+ ::com::sun::star::beans::PropertyState
+ GetPropertyStateByHandle( sal_Int32 nHandle ) const;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::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(
+ ::com::sun::star::uno::Any & rValue,
+ sal_Int32 nHandle ) const;
+
+ void SetPropertyValueByHandle( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any & rValue,
+ ::com::sun::star::uno::Any * pOldValue = NULL );
+
+ bool SetStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & xStyle );
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
+ GetStyle() const;
+
+ typedef
+ ::std::map< sal_Int32, ::com::sun::star::uno::Any >
+ tPropertyMap;
+
+private:
+ void cloneInterfaceProperties();
+
+ tPropertyMap m_aProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
+ m_xStyle;
+};
+
+} // namespace impl
+} // namespace chart
+
+// CHART_IMPLOPROPERTYSET_HXX
+#endif
diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx
new file mode 100755
index 000000000000..65fc97a04b38
--- /dev/null
+++ b/chart2/source/tools/InternalData.cxx
@@ -0,0 +1,530 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "InternalData.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "macros.hxx"
+
+#include <rtl/math.hxx>
+
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+using namespace ::std;
+
+namespace chart
+{
+
+// ----------------------------------------
+namespace
+{
+struct lcl_NumberedStringGenerator
+{
+ lcl_NumberedStringGenerator( const OUString & rStub, const OUString & rWildcard ) :
+ m_aStub( rStub ),
+ m_nCounter( 0 ),
+ m_nStubStartIndex( rStub.indexOf( rWildcard )),
+ m_nWildcardLength( rWildcard.getLength())
+ {
+ }
+ vector< OUString > operator()()
+ {
+ vector< OUString > aRet(1);
+ aRet[0] = m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::valueOf( ++m_nCounter ));
+ return aRet;
+ }
+private:
+ OUString m_aStub;
+ sal_Int32 m_nCounter;
+ const sal_Int32 m_nStubStartIndex;
+ const sal_Int32 m_nWildcardLength;
+};
+
+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;
+}
+
+} // anonymous namespace
+// ----------------------------------------
+
+InternalData::InternalData()
+ : m_nColumnCount( 0 )
+ , m_nRowCount( 0 )
+ , m_aRowLabels( 0 )
+ , m_aColumnLabels( 0 )
+{}
+
+void InternalData::createDefaultData()
+{
+ const sal_Int32 nRowCount = 4;
+ const sal_Int32 nColumnCount = 3;
+
+ m_nRowCount = nRowCount;
+ m_nColumnCount = nColumnCount;
+ const sal_Int32 nSize = nColumnCount * nRowCount;
+ // @todo: localize this!
+ const OUString aRowName( ::chart::SchResId::getResString( STR_ROW_LABEL ));
+ const OUString aColName( ::chart::SchResId::getResString( STR_COLUMN_LABEL ));
+
+ const double fDefaultData[ nSize ] =
+ { 9.10, 3.20, 4.54,
+ 2.40, 8.80, 9.65,
+ 3.10, 1.50, 3.70,
+ 4.30, 9.02, 6.20 };
+
+ m_aData.resize( nSize );
+ for( sal_Int32 i=0; i<nSize; ++i )
+ m_aData[i] = fDefaultData[i];
+
+ m_aRowLabels.clear();
+ m_aRowLabels.reserve( m_nRowCount );
+ generate_n( back_inserter( m_aRowLabels ), m_nRowCount,
+ lcl_NumberedStringGenerator( aRowName, C2U("%ROWNUMBER") ));
+
+ m_aColumnLabels.clear();
+ m_aColumnLabels.reserve( m_nColumnCount );
+ generate_n( back_inserter( m_aColumnLabels ), m_nColumnCount,
+ lcl_NumberedStringGenerator( aColName, C2U("%COLUMNNUMBER") ));
+}
+
+void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
+{
+ m_nRowCount = rDataInRows.getLength();
+ m_nColumnCount = (m_nRowCount ? rDataInRows[0].getLength() : 0);
+
+ if( m_aRowLabels.size() != static_cast< sal_uInt32 >( m_nRowCount ))
+ m_aRowLabels.resize( m_nRowCount );
+ if( m_aColumnLabels.size() != static_cast< sal_uInt32 >( m_nColumnCount ))
+ 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;
+
+ for( sal_Int32 nRow=0; nRow<m_nRowCount; ++nRow )
+ {
+ int nDataIdx = nRow*m_nColumnCount;
+ const sal_Int32 nMax = ::std::min( rDataInRows[nRow].getLength(), m_nColumnCount );
+ for( sal_Int32 nCol=0; nCol < nMax; ++nCol )
+ {
+ m_aData[nDataIdx] = rDataInRows[nRow][nCol];
+ nDataIdx += 1;
+ }
+ }
+}
+
+Sequence< Sequence< double > > InternalData::getData() const
+{
+ Sequence< Sequence< double > > aResult( m_nRowCount );
+
+ for( sal_Int32 i=0; i<m_nRowCount; ++i )
+ aResult[i] = lcl_ValarrayToSequence< tDataType::value_type >(
+ m_aData[ ::std::slice( i*m_nColumnCount, m_nColumnCount, 1 ) ] );
+
+ return aResult;
+}
+
+Sequence< double > InternalData::getColumnValues( sal_Int32 nColumnIndex ) const
+{
+ if( nColumnIndex >= 0 && nColumnIndex < m_nColumnCount )
+ return lcl_ValarrayToSequence< tDataType::value_type >(
+ m_aData[ ::std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ] );
+ return Sequence< double >();
+}
+Sequence< double > InternalData::getRowValues( sal_Int32 nRowIndex ) const
+{
+ if( nRowIndex >= 0 && nRowIndex < m_nRowCount )
+ return lcl_ValarrayToSequence< tDataType::value_type >(
+ m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ] );
+ return Sequence< double >();
+}
+
+void InternalData::setColumnValues( sal_Int32 nColumnIndex, const 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 )
+ aSlice[i] = rNewData[i];
+ m_aData[ ::std::slice( nColumnIndex, m_nRowCount, m_nColumnCount ) ] = aSlice;
+}
+
+void InternalData::setRowValues( sal_Int32 nRowIndex, const 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 )
+ aSlice[i] = rNewData[i];
+ m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ]= aSlice;
+}
+
+void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector< OUString >& rComplexLabel )
+{
+ if( nColumnIndex < 0 )
+ return;
+ if( nColumnIndex >= static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
+ {
+ m_aColumnLabels.resize(nColumnIndex+1);
+ enlargeData( nColumnIndex+1, 0 );
+ }
+
+ m_aColumnLabels[nColumnIndex]=rComplexLabel;
+}
+void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< OUString >& rComplexLabel )
+{
+ if( nRowIndex < 0 )
+ return;
+ if( nRowIndex >= static_cast< sal_Int32 >( m_aRowLabels.size() ) )
+ {
+ m_aRowLabels.resize(nRowIndex+1);
+ enlargeData( 0, nRowIndex+1 );
+ }
+
+ m_aRowLabels[nRowIndex] = rComplexLabel;
+}
+
+vector< OUString > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
+{
+ if( nColumnIndex < static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
+ return m_aColumnLabels[nColumnIndex];
+ else
+ return vector< OUString >();
+}
+vector< OUString > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
+{
+ if( nRowIndex < static_cast< sal_Int32 >( m_aRowLabels.size() ) )
+ return m_aRowLabels[nRowIndex];
+ else
+ return vector< OUString >();
+}
+
+void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
+{
+ if( nRowIndex < m_nRowCount - 1 )
+ {
+ const sal_Int32 nMax = m_nColumnCount;
+ for( sal_Int32 nColIdx=0; nColIdx<nMax; ++nColIdx )
+ {
+ 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;
+ }
+
+ vector< OUString > aTemp( m_aRowLabels[nRowIndex] );
+ m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1];
+ m_aRowLabels[nRowIndex + 1] = aTemp;
+ }
+}
+
+void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex )
+{
+ if( nColumnIndex < m_nColumnCount - 1 )
+ {
+ const sal_Int32 nMax = m_nRowCount;
+ for( sal_Int32 nRowIdx=0; nRowIdx<nMax; ++nRowIdx )
+ {
+ 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;
+ }
+
+ vector< OUString > aTemp( m_aColumnLabels[nColumnIndex] );
+ m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1];
+ m_aColumnLabels[nColumnIndex + 1] = aTemp;
+ }
+}
+
+bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
+{
+ sal_Int32 nNewColumnCount( ::std::max<sal_Int32>( m_nColumnCount, nColumnCount ) );
+ sal_Int32 nNewRowCount( ::std::max<sal_Int32>( m_nRowCount, nRowCount ) );
+ sal_Int32 nNewSize( nNewColumnCount*nNewRowCount );
+
+ bool bGrow = (nNewSize > m_nColumnCount*m_nRowCount);
+
+ if( bGrow )
+ {
+ double fNan;
+ ::rtl::math::setNan( &fNan );
+ tDataType aNewData( fNan, nNewSize );
+ // copy old data
+ for( int nCol=0; nCol<m_nColumnCount; ++nCol )
+ static_cast< tDataType >(
+ aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] ) =
+ m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ];
+
+ m_aData.resize( nNewSize );
+ m_aData = aNewData;
+ }
+ m_nColumnCount = nNewColumnCount;
+ m_nRowCount = nNewRowCount;
+ return bGrow;
+}
+
+void InternalData::insertColumn( sal_Int32 nAfterIndex )
+{
+ // note: -1 is allowed, as we insert after the given index
+ OSL_ASSERT( nAfterIndex < m_nColumnCount && nAfterIndex >= -1 );
+ if( nAfterIndex >= m_nColumnCount || nAfterIndex < -1 )
+ return;
+ sal_Int32 nNewColumnCount = m_nColumnCount + 1;
+ sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
+
+ double fNan;
+ ::rtl::math::setNan( &fNan );
+ tDataType aNewData( fNan, nNewSize );
+
+ // copy old data
+ int nCol=0;
+ for( ; nCol<=nAfterIndex; ++nCol )
+ aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ] );
+ for( ++nCol; nCol<nNewColumnCount; ++nCol )
+ aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( nCol - 1, m_nRowCount, m_nColumnCount ) ] );
+
+ m_nColumnCount = nNewColumnCount;
+ m_aData.resize( nNewSize );
+ m_aData = aNewData;
+
+ // labels
+ if( nAfterIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
+ m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), vector< OUString >(1) );
+
+#if OSL_DEBUG_LEVEL > 2
+ traceData();
+#endif
+}
+
+sal_Int32 InternalData::appendColumn()
+{
+ insertColumn( getColumnCount() - 1 );
+ return getColumnCount() - 1;
+}
+
+sal_Int32 InternalData::appendRow()
+{
+ insertRow( getRowCount() - 1 );
+ return getRowCount() - 1;
+}
+
+void InternalData::insertRow( sal_Int32 nAfterIndex )
+{
+ // note: -1 is allowed, as we insert after the given index
+ OSL_ASSERT( nAfterIndex < m_nRowCount && nAfterIndex >= -1 );
+ if( nAfterIndex >= m_nRowCount || nAfterIndex < -1 )
+ return;
+ sal_Int32 nNewRowCount = m_nRowCount + 1;
+ sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
+
+ double fNan;
+ ::rtl::math::setNan( &fNan );
+ tDataType aNewData( fNan, nNewSize );
+
+ // copy old data
+ sal_Int32 nIndex = nAfterIndex + 1;
+ aNewData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] );
+
+ if( nIndex < m_nRowCount )
+ {
+ sal_Int32 nRemainingCount = m_nColumnCount * (m_nRowCount - nIndex);
+ aNewData[ ::std::slice( (nIndex + 1) * m_nColumnCount, nRemainingCount, 1 ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( nIndex * m_nColumnCount, nRemainingCount, 1 ) ] );
+ }
+
+ m_nRowCount = nNewRowCount;
+ m_aData.resize( nNewSize );
+ m_aData = aNewData;
+
+ // labels
+ if( nAfterIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
+ m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, vector< OUString> (1));
+
+#if OSL_DEBUG_LEVEL > 2
+ traceData();
+#endif
+}
+
+void InternalData::deleteColumn( sal_Int32 nAtIndex )
+{
+ OSL_ASSERT( nAtIndex < m_nColumnCount && nAtIndex >= 0 );
+ if( nAtIndex >= m_nColumnCount || m_nColumnCount < 1 || nAtIndex < 0 )
+ return;
+ sal_Int32 nNewColumnCount = m_nColumnCount - 1;
+ sal_Int32 nNewSize( nNewColumnCount * m_nRowCount );
+
+ double fNan;
+ ::rtl::math::setNan( &fNan );
+ tDataType aNewData( fNan, nNewSize );
+
+ // copy old data
+ int nCol=0;
+ for( ; nCol<nAtIndex; ++nCol )
+ aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( nCol, m_nRowCount, m_nColumnCount ) ] );
+ for( ; nCol<nNewColumnCount; ++nCol )
+ aNewData[ ::std::slice( nCol, m_nRowCount, nNewColumnCount ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( nCol + 1, m_nRowCount, m_nColumnCount ) ] );
+
+ m_nColumnCount = nNewColumnCount;
+ m_aData.resize( nNewSize );
+ m_aData = aNewData;
+
+ // labels
+ if( nAtIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
+ m_aColumnLabels.erase( m_aColumnLabels.begin() + nAtIndex );
+
+#if OSL_DEBUG_LEVEL > 2
+ traceData();
+#endif
+}
+
+void InternalData::deleteRow( sal_Int32 nAtIndex )
+{
+ OSL_ASSERT( nAtIndex < m_nRowCount && nAtIndex >= 0 );
+ if( nAtIndex >= m_nRowCount || m_nRowCount < 1 || nAtIndex < 0 )
+ return;
+ sal_Int32 nNewRowCount = m_nRowCount - 1;
+ sal_Int32 nNewSize( m_nColumnCount * nNewRowCount );
+
+ double fNan;
+ ::rtl::math::setNan( &fNan );
+ tDataType aNewData( fNan, nNewSize );
+
+ // copy old data
+ sal_Int32 nIndex = nAtIndex;
+ if( nIndex )
+ aNewData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( 0, nIndex * m_nColumnCount, 1 ) ] );
+
+ if( nIndex < nNewRowCount )
+ {
+ sal_Int32 nRemainingCount = m_nColumnCount * (nNewRowCount - nIndex);
+ aNewData[ ::std::slice( nIndex * m_nColumnCount, nRemainingCount, 1 ) ] =
+ static_cast< tDataType >(
+ m_aData[ ::std::slice( (nIndex + 1) * m_nColumnCount, nRemainingCount, 1 ) ] );
+ }
+
+ m_nRowCount = nNewRowCount;
+ m_aData.resize( nNewSize );
+ m_aData = aNewData;
+
+ // labels
+ if( nAtIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
+ m_aRowLabels.erase( m_aRowLabels.begin() + nAtIndex );
+
+#if OSL_DEBUG_LEVEL > 2
+ traceData();
+#endif
+}
+
+sal_Int32 InternalData::getRowCount() const
+{
+ return m_nRowCount;
+}
+
+sal_Int32 InternalData::getColumnCount() const
+{
+ return m_nColumnCount;
+}
+
+void InternalData::setComplexRowLabels( const vector< vector< OUString > >& rNewRowLabels )
+{
+ m_aRowLabels = rNewRowLabels;
+ sal_Int32 nNewRowCount = static_cast< sal_Int32 >( m_aRowLabels.size() );
+ if( nNewRowCount < m_nRowCount )
+ m_aRowLabels.resize( m_nRowCount );
+ else
+ enlargeData( 0, nNewRowCount );
+}
+
+vector< vector< OUString > > InternalData::getComplexRowLabels() const
+{
+ return m_aRowLabels;
+}
+
+void InternalData::setComplexColumnLabels( const vector< vector< OUString > >& rNewColumnLabels )
+{
+ m_aColumnLabels = rNewColumnLabels;
+ sal_Int32 nNewColumnCount = static_cast< sal_Int32 >( m_aColumnLabels.size() );
+ if( nNewColumnCount < m_nColumnCount )
+ m_aColumnLabels.resize( m_nColumnCount );
+ else
+ enlargeData( nNewColumnCount, 0 );
+}
+
+vector< vector< OUString > > InternalData::getComplexColumnLabels() const
+{
+ return m_aColumnLabels;
+}
+
+#if OSL_DEBUG_LEVEL > 2
+void InternalData::traceData() const
+{
+ OSL_TRACE( "InternalData: Data in rows\n" );
+
+ for( sal_Int32 i=0; i<m_nRowCount; ++i )
+ {
+ tDataType aSlice( m_aData[ ::std::slice( i*m_nColumnCount, m_nColumnCount, 1 ) ] );
+ for( sal_Int32 j=0; j<m_nColumnCount; ++j )
+ OSL_TRACE( "%lf ", aSlice[j] );
+ OSL_TRACE( "\n" );
+ }
+ OSL_TRACE( "\n" );
+}
+#endif
+
+} // namespace chart
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
new file mode 100644
index 000000000000..4abc51be31af
--- /dev/null
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -0,0 +1,1314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <rtl/math.hxx>
+
+#include <valarray>
+
+#include "InternalDataProvider.hxx"
+#include "LabeledDataSequence.hxx"
+#include "DataSource.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "XMLRangeHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonConverters.hxx"
+#include "CommonFunctors.hxx"
+#include "UncachedDataSequence.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <unotools/charclass.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::std;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+// ================================================================================
+
+namespace
+{
+
+// note: in xmloff this name is used to indicate usage of own data
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.InternalDataProvider" ));
+
+static const ::rtl::OUString lcl_aCategoriesRangeName(
+ RTL_CONSTASCII_USTRINGPARAM( "categories" ));
+static const ::rtl::OUString lcl_aCategoriesLevelRangeNamePrefix(
+ RTL_CONSTASCII_USTRINGPARAM( "categoriesL " )); //L <-> level
+static const ::rtl::OUString lcl_aCategoriesPointRangeNamePrefix(
+ RTL_CONSTASCII_USTRINGPARAM( "categoriesP " )); //P <-> point
+static const ::rtl::OUString lcl_aCategoriesRoleName(
+ RTL_CONSTASCII_USTRINGPARAM( "categories" ));
+static const ::rtl::OUString lcl_aLabelRangePrefix(
+ RTL_CONSTASCII_USTRINGPARAM( "label " ));
+static const ::rtl::OUString lcl_aCompleteRange(
+ RTL_CONSTASCII_USTRINGPARAM( "all" ));
+
+typedef ::std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > >
+ lcl_tSequenceMap;
+
+struct lcl_setModified : public ::std::unary_function< lcl_tSequenceMap, void >
+{
+ void operator() ( const lcl_tSequenceMap::value_type & rMapEntry )
+ {
+ // convert weak reference to reference
+ Reference< chart2::data::XDataSequence > xSeq( rMapEntry.second );
+ if( xSeq.is())
+ {
+ Reference< util::XModifiable > xMod( xSeq, uno::UNO_QUERY );
+ if( xMod.is())
+ xMod->setModified( sal_True );
+ }
+ }
+};
+
+struct lcl_internalizeSeries : public ::std::unary_function< Reference< chart2::XDataSeries >, void >
+{
+ lcl_internalizeSeries( InternalData & rInternalData,
+ InternalDataProvider & rProvider,
+ bool bConnectToModel, bool bDataInColumns ) :
+ m_rInternalData( rInternalData ),
+ m_rProvider( rProvider ),
+ m_bConnectToModel( bConnectToModel ),
+ m_bDataInColumns( bDataInColumns )
+ {}
+ void operator() ( const Reference< chart2::XDataSeries > & xSeries )
+ {
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ Reference< chart2::data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ if( xSource.is() && xSink.is() )
+ {
+ 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 )
+ {
+ sal_Int32 nNewIndex( m_bDataInColumns ? m_rInternalData.appendColumn() : m_rInternalData.appendRow() );
+ OUString aIdentifier( OUString::valueOf( nNewIndex ));
+ //@todo: deal also with genericXDataSequence
+ Reference< chart2::data::XNumericalDataSequence > xValues( aOldSeriesData[i]->getValues(), uno::UNO_QUERY );
+ Reference< chart2::data::XTextualDataSequence > xLabel( aOldSeriesData[i]->getLabel(), uno::UNO_QUERY );
+ Reference< chart2::data::XDataSequence > xNewValues;
+
+ if( xValues.is() )
+ {
+ ::std::vector< double > aValues( ContainerHelper::SequenceToVector( xValues->getNumericalData()));
+ if( m_bDataInColumns )
+ m_rInternalData.setColumnValues( nNewIndex, aValues );
+ else
+ m_rInternalData.setRowValues( nNewIndex, aValues );
+ if( m_bConnectToModel )
+ {
+ xNewValues.set( m_rProvider.createDataSequenceByRangeRepresentation( aIdentifier ));
+ comphelper::copyProperties(
+ Reference< beans::XPropertySet >( xValues, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xNewValues, uno::UNO_QUERY ));
+ }
+ }
+
+ if( xLabel.is() )
+ {
+ if( m_bDataInColumns )
+ m_rInternalData.setComplexColumnLabel( nNewIndex, ContainerHelper::SequenceToVector( xLabel->getTextualData() ) );
+ else
+ m_rInternalData.setComplexRowLabel( nNewIndex, ContainerHelper::SequenceToVector( xLabel->getTextualData() ) );
+ if( m_bConnectToModel )
+ {
+ Reference< chart2::data::XDataSequence > xNewLabel(
+ m_rProvider.createDataSequenceByRangeRepresentation( lcl_aLabelRangePrefix + aIdentifier ));
+ comphelper::copyProperties(
+ Reference< beans::XPropertySet >( xLabel, uno::UNO_QUERY ),
+ Reference< beans::XPropertySet >( xNewLabel, uno::UNO_QUERY ));
+ aNewSeriesData[i] = Reference< chart2::data::XLabeledDataSequence >(
+ new LabeledDataSequence( xNewValues, xNewLabel ));
+ }
+ }
+ else
+ {
+ if( m_bConnectToModel )
+ aNewSeriesData[i] = Reference< chart2::data::XLabeledDataSequence >(
+ new LabeledDataSequence( xNewValues ));
+ }
+ }
+ if( m_bConnectToModel )
+ xSink->setData( aNewSeriesData );
+ }
+ }
+
+private:
+ InternalData & m_rInternalData;
+ InternalDataProvider & m_rProvider;
+ bool m_bConnectToModel;
+ bool m_bDataInColumns;
+};
+
+struct lcl_makeAnyFromLevelVector : public ::std::unary_function< vector< OUString >, uno::Any >
+{
+public:
+
+ explicit lcl_makeAnyFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ uno::Any operator() ( const vector< OUString >& rVector )
+ {
+ OUString aString;
+ if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
+ aString = rVector[m_nLevel];
+ return uno::makeAny( aString );
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+struct lcl_getStringFromLevelVector : public ::std::unary_function< vector< OUString >, OUString >
+{
+public:
+
+ explicit lcl_getStringFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ OUString operator() ( const vector< OUString >& rVector )
+ {
+ OUString aString;
+ if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
+ aString = rVector[m_nLevel];
+ return aString;
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+
+struct lcl_setStringAtLevel : public ::std::binary_function< vector< OUString >, OUString, vector< OUString > >
+{
+public:
+
+ explicit lcl_setStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ vector< OUString > operator() ( const vector< OUString >& rVector, const OUString& rNewText )
+ {
+ vector< OUString > aRet( rVector );
+ if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
+ aRet.resize( m_nLevel+1 );
+ aRet[ m_nLevel ]=rNewText;
+ return aRet;
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+struct lcl_insertStringAtLevel : public ::std::unary_function< vector< OUString >, void >
+{
+public:
+
+ explicit lcl_insertStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ void operator() ( vector< OUString >& rVector )
+ {
+ if( m_nLevel > static_cast< sal_Int32 >(rVector.size()) )
+ rVector.resize( m_nLevel );
+
+ vector< OUString >::iterator aIt( rVector.begin() );
+ for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
+ {
+ if( nN==m_nLevel )
+ break;
+ }
+ rVector.insert( aIt, OUString() );
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+struct lcl_removeStringAtLevel : public ::std::unary_function< vector< OUString >, void >
+{
+public:
+
+ explicit lcl_removeStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ void operator() ( vector< OUString >& rVector )
+ {
+ vector< OUString >::iterator aIt( rVector.begin() );
+ for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
+ {
+ if( nN==m_nLevel )
+ {
+ rVector.erase( aIt );
+ break;
+ }
+ }
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+vector< OUString > lcl_AnyToStringVector( const Sequence< uno::Any >& aAnySeq )
+{
+ vector< OUString > aStringVec;
+ transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
+ back_inserter( aStringVec ), CommonFunctors::AnyToString() );
+ return aStringVec;
+}
+
+Sequence< OUString > lcl_AnyToStringSequence( const Sequence< uno::Any >& aAnySeq )
+{
+ Sequence< OUString > aResult;
+ aResult.realloc( aAnySeq.getLength() );
+ transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
+ aResult.getArray(), CommonFunctors::AnyToString() );
+ return aResult;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+InternalDataProvider::InternalDataProvider( const Reference< uno::XComponentContext > & /*_xContext*/)
+ : m_bDataInColumns( true )
+{}
+
+InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocument > & xChartDoc, bool bConnectToModel )
+ : m_bDataInColumns( true )
+{
+ try
+ {
+ Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ) );
+ if( xDiagram.is())
+ {
+ Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+
+ //data in columns?
+ {
+ ::rtl::OUString aRangeString;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+ DataSourceHelper::detectRangeSegmentation( xChartModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories );
+ }
+
+ // categories
+ {
+ vector< vector< OUString > > aNewCategories;//inner count is level
+ {
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
+ const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
+ sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+ for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLDS( rSplitCategoriesList[nL] );
+ if( !xLDS.is() )
+ continue;
+ Reference< chart2::data::XTextualDataSequence > xSeq( xLDS->getValues(), uno::UNO_QUERY );
+ Sequence< OUString > aStringSeq;
+ if( xSeq.is() )
+ aStringSeq = xSeq->getTextualData(); // @todo: be able to deal with XDataSequence, too
+ sal_Int32 nLength = aStringSeq.getLength();
+ if( static_cast< sal_Int32 >(aNewCategories.size()) < nLength )
+ aNewCategories.resize( nLength );
+
+ transform( aNewCategories.begin(), aNewCategories.end(), aStringSeq.getConstArray(),
+ aNewCategories.begin(), lcl_setStringAtLevel(nL) );
+ }
+ if( !nLevelCount )
+ {
+ Sequence< OUString > aSimplecategories = aExplicitCategoriesProvider.getSimpleCategories();
+ sal_Int32 nLength = aSimplecategories.getLength();
+ aNewCategories.reserve( nLength );
+ for( sal_Int32 nN=0; nN<nLength; nN++)
+ {
+ vector< OUString > aStringVector(1);
+ aStringVector[0] = aSimplecategories[nN];
+ aNewCategories.push_back( aStringVector );
+ }
+ }
+ }
+
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabels( aNewCategories );
+ else
+ m_aInternalData.setComplexColumnLabels( aNewCategories );
+ if( bConnectToModel )
+ DiagramHelper::setCategoriesToDiagram( new LabeledDataSequence(
+ createDataSequenceByRangeRepresentation( lcl_aCategoriesRangeName )), xDiagram );
+ }
+
+ // data series
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartDoc ));
+ ::std::for_each( aSeriesVector.begin(), aSeriesVector.end(), lcl_internalizeSeries( m_aInternalData, *this, bConnectToModel, m_bDataInColumns ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// copy-CTOR
+InternalDataProvider::InternalDataProvider( const InternalDataProvider & rOther ) :
+ impl::InternalDataProvider_Base(),
+ m_aSequenceMap( rOther.m_aSequenceMap ),
+ m_aInternalData( rOther.m_aInternalData ),
+ m_bDataInColumns( rOther.m_bDataInColumns )
+{}
+
+InternalDataProvider::~InternalDataProvider()
+{}
+
+void InternalDataProvider::lcl_addDataSequenceToMap(
+ const OUString & rRangeRepresentation,
+ const Reference< chart2::data::XDataSequence > & xSequence )
+{
+ m_aSequenceMap.insert(
+ tSequenceMap::value_type(
+ rRangeRepresentation,
+ uno::WeakReference< chart2::data::XDataSequence >( xSequence )));
+}
+
+void InternalDataProvider::lcl_deleteMapReferences( const OUString & rRangeRepresentation )
+{
+ // set sequence to deleted by setting its range to an empty string
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( rRangeRepresentation ));
+ for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
+ {
+ Reference< chart2::data::XDataSequence > xSeq( aIt->second );
+ if( xSeq.is())
+ {
+ Reference< container::XNamed > xNamed( xSeq, uno::UNO_QUERY );
+ if( xNamed.is())
+ xNamed->setName( OUString());
+ }
+ }
+ // remove from map
+ m_aSequenceMap.erase( aRange.first, aRange.second );
+}
+
+void InternalDataProvider::lcl_adaptMapReferences(
+ const OUString & rOldRangeRepresentation,
+ const OUString & rNewRangeRepresentation )
+{
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( rOldRangeRepresentation ));
+ tSequenceMap aNewElements;
+ for( tSequenceMap::iterator aIt( aRange.first ); aIt != aRange.second; ++aIt )
+ {
+ Reference< chart2::data::XDataSequence > xSeq( aIt->second );
+ if( xSeq.is())
+ {
+ Reference< container::XNamed > xNamed( xSeq, uno::UNO_QUERY );
+ if( xNamed.is())
+ xNamed->setName( rNewRangeRepresentation );
+ }
+ aNewElements.insert( tSequenceMap::value_type( rNewRangeRepresentation, aIt->second ));
+ }
+ // erase map values for old index
+ m_aSequenceMap.erase( aRange.first, aRange.second );
+ // add new entries for values with new index
+ ::std::copy( aNewElements.begin(), aNewElements.end(),
+ ::std::inserter( m_aSequenceMap,
+ m_aSequenceMap.upper_bound( rNewRangeRepresentation )));
+}
+
+void InternalDataProvider::lcl_increaseMapReferences(
+ sal_Int32 nBegin, sal_Int32 nEnd )
+{
+ for( sal_Int32 nIndex = nEnd - 1; nIndex >= nBegin; --nIndex )
+ {
+ lcl_adaptMapReferences( OUString::valueOf( nIndex ),
+ OUString::valueOf( nIndex + 1 ));
+ lcl_adaptMapReferences( lcl_aLabelRangePrefix + OUString::valueOf( nIndex ),
+ lcl_aLabelRangePrefix + OUString::valueOf( nIndex + 1 ));
+ }
+}
+
+void InternalDataProvider::lcl_decreaseMapReferences(
+ sal_Int32 nBegin, sal_Int32 nEnd )
+{
+ for( sal_Int32 nIndex = nBegin; nIndex < nEnd; ++nIndex )
+ {
+ lcl_adaptMapReferences( OUString::valueOf( nIndex ),
+ OUString::valueOf( nIndex - 1 ));
+ lcl_adaptMapReferences( lcl_aLabelRangePrefix + OUString::valueOf( nIndex ),
+ lcl_aLabelRangePrefix + OUString::valueOf( nIndex - 1 ));
+ }
+}
+
+Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
+ const OUString & rRangeRepresentation )
+{
+ Reference< chart2::data::XDataSequence > xSeq(
+ new UncachedDataSequence( this, rRangeRepresentation ));
+ lcl_addDataSequenceToMap( rRangeRepresentation, xSeq );
+ return xSeq;
+}
+
+Reference< chart2::data::XDataSequence > InternalDataProvider::lcl_createDataSequenceAndAddToMap(
+ const OUString & rRangeRepresentation,
+ const OUString & rRole )
+{
+ Reference< chart2::data::XDataSequence > xSeq(
+ new UncachedDataSequence( this, rRangeRepresentation, rRole ));
+ lcl_addDataSequenceToMap( rRangeRepresentation, xSeq );
+ return xSeq;
+}
+
+void InternalDataProvider::createDefaultData()
+{
+ m_aInternalData.createDefaultData();
+}
+
+// ____ XDataProvider ____
+::sal_Bool SAL_CALL InternalDataProvider::createDataSourcePossible( const Sequence< beans::PropertyValue >& /* aArguments */ )
+ throw (uno::RuntimeException)
+{
+ return true;
+}
+
+namespace
+{
+
+sal_Int32 lcl_getInnerLevelCount( const vector< vector< OUString > >& rLabels )
+{
+ sal_Int32 nCount = 1;//minimum is 1!
+ vector< vector< OUString > >::const_iterator aLevelIt( rLabels.begin() );
+ vector< vector< OUString > >::const_iterator aLevelEnd( rLabels.end() );
+ for( ;aLevelIt!=aLevelEnd; ++aLevelIt )
+ {
+ const vector< ::rtl::OUString >& rCurrentLevelLabels = *aLevelIt;
+ nCount = std::max<sal_Int32>( rCurrentLevelLabels.size(), nCount );
+ }
+ return nCount;
+}
+
+}//end anonymous namespace
+
+Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createDataSource(
+ const Sequence< beans::PropertyValue >& aArguments )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ OUString aRangeRepresentation;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+ DataSourceHelper::readArguments( aArguments, aRangeRepresentation, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
+
+ if( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) )
+ {
+ //return split complex categories if we have any:
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aComplexCategories;
+ vector< vector< OUString > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ if( bUseColumns==m_bDataInColumns )
+ {
+ sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
+ for( sal_Int32 nL=0; nL<nLevelCount; nL++ )
+ aComplexCategories.push_back( new LabeledDataSequence(
+ new UncachedDataSequence( this
+ , lcl_aCategoriesLevelRangeNamePrefix + OUString::valueOf( nL )
+ , lcl_aCategoriesRoleName ) ) );
+ }
+ else
+ {
+ sal_Int32 nPointCount = m_bDataInColumns ? m_aInternalData.getRowCount() : m_aInternalData.getColumnCount();
+ for( sal_Int32 nP=0; nP<nPointCount; nP++ )
+ aComplexCategories.push_back( new LabeledDataSequence(
+ new UncachedDataSequence( this
+ , lcl_aCategoriesPointRangeNamePrefix + OUString::valueOf( nP )
+ , lcl_aCategoriesRoleName ) ) );
+ }
+ //don't add the created sequences to the map as they are used temporarily only ...
+ return new DataSource( ContainerHelper::ContainerToSequence(aComplexCategories) );
+ }
+
+ OSL_ASSERT( aRangeRepresentation.equals( lcl_aCompleteRange ));
+
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultLSeqVec;
+
+ // categories
+ if( bHasCategories )
+ aResultLSeqVec.push_back(
+ new LabeledDataSequence( lcl_createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName ) ) );
+
+ // data with labels
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aDataVec;
+ const sal_Int32 nCount = (bUseColumns ? m_aInternalData.getColumnCount() : m_aInternalData.getRowCount());
+ for( sal_Int32 nIdx=0; nIdx<nCount; ++nIdx )
+ {
+ aDataVec.push_back(
+ new LabeledDataSequence(
+ lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIdx )),
+ lcl_createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::valueOf( nIdx ))));
+ }
+
+ // attention: this data provider has the limitation that it stores
+ // internally if data comes from columns or rows. It is intended for
+ // creating only one used data source.
+ // @todo: add this information in the range representation strings
+ m_bDataInColumns = bUseColumns;
+
+ //reorder labeled sequences according to aSequenceMapping; ignore categories
+ for( sal_Int32 nNewIndex = 0; nNewIndex < aSequenceMapping.getLength(); nNewIndex++ )
+ {
+ std::vector< LabeledDataSequence* >::size_type nOldIndex = aSequenceMapping[nNewIndex];
+ if( nOldIndex < aDataVec.size() )
+ {
+ if( aDataVec[nOldIndex].is() )
+ {
+ aResultLSeqVec.push_back( aDataVec[nOldIndex] );
+ aDataVec[nOldIndex] = 0;
+ }
+ }
+ }
+
+ //add left over data sequences to result
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::iterator aIt(aDataVec.begin());
+ const ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aEndIt(aDataVec.end());
+ for( ;aIt!=aEndIt; ++aIt)
+ {
+ if( aIt->is() )
+ aResultLSeqVec.push_back( *aIt );
+ }
+
+ return new DataSource( ContainerHelper::ContainerToSequence(aResultLSeqVec) );
+}
+
+Sequence< beans::PropertyValue > SAL_CALL InternalDataProvider::detectArguments(
+ const Reference< chart2::data::XDataSource >& /* xDataSource */ )
+ throw (uno::RuntimeException)
+{
+ Sequence< beans::PropertyValue > aArguments( 4 );
+ aArguments[0] = beans::PropertyValue(
+ C2U("CellRangeRepresentation"), -1, uno::makeAny( lcl_aCompleteRange ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArguments[1] = beans::PropertyValue(
+ C2U("DataRowSource"), -1, uno::makeAny(
+ m_bDataInColumns
+ ? ::com::sun::star::chart::ChartDataRowSource_COLUMNS
+ : ::com::sun::star::chart::ChartDataRowSource_ROWS ),
+ beans::PropertyState_DIRECT_VALUE );
+ // internal data always contains labels and categories
+ aArguments[2] = beans::PropertyValue(
+ C2U("FirstCellAsLabel"), -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
+ aArguments[3] = beans::PropertyValue(
+ C2U("HasCategories"), -1, uno::makeAny( 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.
+
+ return aArguments;
+}
+
+::sal_Bool SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentationPossible( const OUString& /* aRangeRepresentation */ )
+ throw (uno::RuntimeException)
+{
+ return true;
+}
+
+Reference< chart2::data::XDataSequence > SAL_CALL InternalDataProvider::createDataSequenceByRangeRepresentation(
+ const OUString& aRangeRepresentation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
+ {
+ OSL_ASSERT( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
+
+ // categories
+ return lcl_createDataSequenceAndAddToMap( lcl_aCategoriesRangeName, lcl_aCategoriesRoleName );
+ }
+ else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
+ {
+ // label
+ sal_Int32 nIndex = aRangeRepresentation.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
+ return lcl_createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + OUString::valueOf( nIndex ));
+ }
+ else if( aRangeRepresentation.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "last" )))
+ {
+ sal_Int32 nIndex = (m_bDataInColumns
+ ? m_aInternalData.getColumnCount()
+ : m_aInternalData.getRowCount()) - 1;
+ return lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIndex ));
+ }
+ else if( aRangeRepresentation.getLength())
+ {
+ // data
+ sal_Int32 nIndex = aRangeRepresentation.toInt32();
+ return lcl_createDataSequenceAndAddToMap( OUString::valueOf( nIndex ));
+ }
+
+ return Reference< chart2::data::XDataSequence >();
+}
+
+Reference< sheet::XRangeSelection > SAL_CALL InternalDataProvider::getRangeSelection()
+ throw (uno::RuntimeException)
+{
+ // there is no range selection component
+ return Reference< sheet::XRangeSelection >();
+}
+
+// ____ XInternalDataProvider ____
+::sal_Bool SAL_CALL InternalDataProvider::hasDataByRangeRepresentation( const OUString& aRange )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = false;
+
+ if( aRange.match( lcl_aCategoriesRangeName ))
+ {
+ OSL_ASSERT( aRange.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
+ bResult = true;
+ }
+ else if( aRange.match( lcl_aLabelRangePrefix ))
+ {
+ sal_Int32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
+ bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
+ }
+ else
+ {
+ sal_Int32 nIndex = aRange.toInt32();
+ bResult = (nIndex < (m_bDataInColumns ? m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
+ }
+
+ return bResult;
+}
+
+Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation( const OUString& aRange )
+ throw (uno::RuntimeException)
+{
+ Sequence< uno::Any > aResult;
+
+ if( aRange.match( lcl_aLabelRangePrefix ) )
+ {
+ sal_Int32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
+ vector< OUString > aComplexLabel = m_bDataInColumns
+ ? m_aInternalData.getComplexColumnLabel( nIndex )
+ : m_aInternalData.getComplexRowLabel( nIndex );
+ if( !aComplexLabel.empty() )
+ {
+ aResult.realloc( aComplexLabel.size() );
+ transform( aComplexLabel.begin(), aComplexLabel.end(),
+ aResult.getArray(), CommonFunctors::makeAny< OUString >());
+ }
+ }
+ else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
+ {
+ sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesPointRangeNamePrefix.getLength() ).toInt32();
+ vector< OUString > aComplexCategory = m_bDataInColumns
+ ? m_aInternalData.getComplexRowLabel( nPointIndex )
+ : m_aInternalData.getComplexColumnLabel( nPointIndex );
+ if( !aComplexCategory.empty() )
+ {
+ aResult.realloc( aComplexCategory.size() );
+ transform( aComplexCategory.begin(), aComplexCategory.end(),
+ aResult.getArray(), CommonFunctors::makeAny< OUString >());
+ }
+ }
+ else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
+ {
+ sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength() ).toInt32();
+ vector< vector< OUString > > 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_makeAnyFromLevelVector(nLevel) );
+ }
+ }
+ else if( aRange.equals( lcl_aCategoriesRangeName ) )
+ {
+ Sequence< OUString > aLabels = m_bDataInColumns ? this->getRowDescriptions() : this->getColumnDescriptions();
+ aResult.realloc( aLabels.getLength() );
+ transform( aLabels.getConstArray(), aLabels.getConstArray() + aLabels.getLength(),
+ aResult.getArray(), CommonFunctors::makeAny< OUString >() );
+ }
+ else
+ {
+ 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);
+ if( aData.getLength() )
+ {
+ aResult.realloc( aData.getLength());
+ transform( aData.getConstArray(), aData.getConstArray() + aData.getLength(),
+ aResult.getArray(), CommonFunctors::makeAny< double >());
+ }
+ }
+ }
+
+ return aResult;
+}
+
+void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
+ const OUString& aRange, const Sequence< uno::Any >& aNewData )
+ throw (uno::RuntimeException)
+{
+ if( aRange.match( lcl_aLabelRangePrefix ) )
+ {
+ vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
+ sal_uInt32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexColumnLabel( nIndex, aNewStrings );
+ else
+ m_aInternalData.setComplexRowLabel( nIndex, aNewStrings );
+ }
+ else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
+ {
+ vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
+ sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabel( nPointIndex, aNewStrings );
+ else
+ m_aInternalData.setComplexColumnLabel( nPointIndex, aNewStrings );
+ }
+ else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
+ {
+ vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
+ sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
+ vector< vector< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+
+ //ensure equal length
+ if( aNewStrings.size() > aComplexCategories.size() )
+ aComplexCategories.resize( aNewStrings.size() );
+ else if( aNewStrings.size() < aComplexCategories.size() )
+ aNewStrings.resize( aComplexCategories.size() );
+
+ transform( aComplexCategories.begin(), aComplexCategories.end(), aNewStrings.begin(),
+ aComplexCategories.begin(), lcl_setStringAtLevel(nLevel) );
+
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabels( aComplexCategories );
+ else
+ m_aInternalData.setComplexColumnLabels( aComplexCategories );
+ }
+ else if( aRange.equals( lcl_aCategoriesRangeName ) )
+ {
+ if( m_bDataInColumns )
+ this->setRowDescriptions( lcl_AnyToStringSequence(aNewData) );
+ else
+ this->setColumnDescriptions( lcl_AnyToStringSequence(aNewData) );
+ }
+ else
+ {
+ sal_Int32 nIndex = aRange.toInt32();
+ if( nIndex>=0 )
+ {
+ vector< double > aNewDataVec;
+ transform( aNewData.getConstArray(), aNewData.getConstArray() + aNewData.getLength(),
+ back_inserter( aNewDataVec ), CommonFunctors::AnyToDouble());
+ if( m_bDataInColumns )
+ m_aInternalData.setColumnValues( nIndex, aNewDataVec );
+ else
+ m_aInternalData.setRowValues( nIndex, aNewDataVec );
+ }
+ }
+}
+
+void SAL_CALL InternalDataProvider::insertSequence( ::sal_Int32 nAfterIndex )
+ throw (uno::RuntimeException)
+{
+ if( m_bDataInColumns )
+ {
+ lcl_increaseMapReferences( nAfterIndex + 1, m_aInternalData.getColumnCount());
+ m_aInternalData.insertColumn( nAfterIndex );
+ }
+ else
+ {
+ lcl_increaseMapReferences( nAfterIndex + 1, m_aInternalData.getRowCount());
+ m_aInternalData.insertRow( nAfterIndex );
+ }
+}
+
+void SAL_CALL InternalDataProvider::deleteSequence( ::sal_Int32 nAtIndex )
+ throw (uno::RuntimeException)
+{
+ lcl_deleteMapReferences( OUString::valueOf( nAtIndex ));
+ lcl_deleteMapReferences( lcl_aLabelRangePrefix + OUString::valueOf( nAtIndex ));
+ if( m_bDataInColumns )
+ {
+ lcl_decreaseMapReferences( nAtIndex + 1, m_aInternalData.getColumnCount());
+ m_aInternalData.deleteColumn( nAtIndex );
+ }
+ else
+ {
+ lcl_decreaseMapReferences( nAtIndex + 1, m_aInternalData.getRowCount());
+ m_aInternalData.deleteRow( nAtIndex );
+ }
+}
+
+void SAL_CALL InternalDataProvider::appendSequence()
+ throw (uno::RuntimeException)
+{
+ if( m_bDataInColumns )
+ m_aInternalData.appendColumn();
+ else
+ m_aInternalData.appendRow();
+}
+
+void SAL_CALL InternalDataProvider::insertComplexCategoryLevel( sal_Int32 nLevel )
+ throw (uno::RuntimeException)
+{
+ 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< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertStringAtLevel(nLevel) );
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabels( aComplexCategories );
+ else
+ m_aInternalData.setComplexColumnLabels( aComplexCategories );
+
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
+ ::std::for_each( aRange.first, aRange.second, lcl_setModified());
+ }
+}
+void SAL_CALL InternalDataProvider::deleteComplexCategoryLevel( sal_Int32 nLevel )
+ throw (uno::RuntimeException)
+{
+ 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< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeStringAtLevel(nLevel) );
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabels( aComplexCategories );
+ else
+ m_aInternalData.setComplexColumnLabels( aComplexCategories );
+
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
+ ::std::for_each( aRange.first, aRange.second, lcl_setModified());
+ }
+}
+
+void SAL_CALL InternalDataProvider::insertDataPointForAllSequences( ::sal_Int32 nAfterIndex )
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nMaxRep = 0;
+ if( m_bDataInColumns )
+ {
+ m_aInternalData.insertRow( nAfterIndex );
+ nMaxRep = m_aInternalData.getColumnCount();
+ }
+ else
+ {
+ m_aInternalData.insertColumn( nAfterIndex );
+ nMaxRep = m_aInternalData.getRowCount();
+ }
+
+ // notify change to all affected ranges
+ tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( C2U("0")));
+ tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::valueOf( nMaxRep )));
+ ::std::for_each( aBegin, aEnd, lcl_setModified());
+
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
+ ::std::for_each( aRange.first, aRange.second, lcl_setModified());
+}
+
+void SAL_CALL InternalDataProvider::deleteDataPointForAllSequences( ::sal_Int32 nAtIndex )
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nMaxRep = 0;
+ if( m_bDataInColumns )
+ {
+ m_aInternalData.deleteRow( nAtIndex );
+ nMaxRep = m_aInternalData.getColumnCount();
+ }
+ else
+ {
+ m_aInternalData.deleteColumn( nAtIndex );
+ nMaxRep = m_aInternalData.getRowCount();
+ }
+
+ // notify change to all affected ranges
+ tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( C2U("0")));
+ tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::valueOf( nMaxRep )));
+ ::std::for_each( aBegin, aEnd, lcl_setModified());
+
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
+ ::std::for_each( aRange.first, aRange.second, lcl_setModified());
+}
+
+void SAL_CALL InternalDataProvider::swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex )
+ throw (uno::RuntimeException)
+{
+ if( m_bDataInColumns )
+ m_aInternalData.swapRowWithNext( nAtIndex );
+ else
+ m_aInternalData.swapColumnWithNext( nAtIndex );
+ sal_Int32 nMaxRep = (m_bDataInColumns
+ ? m_aInternalData.getColumnCount()
+ : m_aInternalData.getRowCount());
+
+ // notify change to all affected ranges
+ tSequenceMap::const_iterator aBegin( m_aSequenceMap.lower_bound( C2U("0")));
+ tSequenceMap::const_iterator aEnd( m_aSequenceMap.upper_bound( OUString::valueOf( nMaxRep )));
+ ::std::for_each( aBegin, aEnd, lcl_setModified());
+
+ tSequenceMapRange aRange( m_aSequenceMap.equal_range( lcl_aCategoriesRangeName ));
+ ::std::for_each( aRange.first, aRange.second, lcl_setModified());
+}
+
+void SAL_CALL InternalDataProvider::registerDataSequenceForChanges( const Reference< chart2::data::XDataSequence >& xSeq )
+ throw (uno::RuntimeException)
+{
+ if( xSeq.is())
+ lcl_addDataSequenceToMap( xSeq->getSourceRangeRepresentation(), xSeq );
+}
+
+
+// ____ XRangeXMLConversion ____
+OUString SAL_CALL InternalDataProvider::convertRangeToXML( const OUString& aRangeRepresentation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ XMLRangeHelper::CellRange aRange;
+ aRange.aTableName = OUString(RTL_CONSTASCII_USTRINGPARAM("local-table"));
+
+ // attention: this data provider has the limitation that it stores
+ // internally if data comes from columns or rows. It is intended for
+ // creating only one used data source.
+ // @todo: add this information in the range representation strings
+ if( aRangeRepresentation.match( lcl_aCategoriesRangeName ))
+ {
+ OSL_ASSERT( aRangeRepresentation.equals( lcl_aCategoriesRangeName ) );//it is not expected nor implmented that only parts of the categories are really requested
+ aRange.aUpperLeft.bIsEmpty = false;
+ if( m_bDataInColumns )
+ {
+ aRange.aUpperLeft.nColumn = 0;
+ aRange.aUpperLeft.nRow = 1;
+ aRange.aLowerRight = aRange.aUpperLeft;
+ aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
+ }
+ else
+ {
+ aRange.aUpperLeft.nColumn = 1;
+ aRange.aUpperLeft.nRow = 0;
+ aRange.aLowerRight = aRange.aUpperLeft;
+ aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
+ }
+ }
+ else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
+ {
+ sal_Int32 nIndex = aRangeRepresentation.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
+ aRange.aUpperLeft.bIsEmpty = false;
+ aRange.aLowerRight.bIsEmpty = true;
+ if( m_bDataInColumns )
+ {
+ aRange.aUpperLeft.nColumn = nIndex + 1;
+ aRange.aUpperLeft.nRow = 0;
+ }
+ else
+ {
+ aRange.aUpperLeft.nColumn = 0;
+ aRange.aUpperLeft.nRow = nIndex + 1;
+ }
+ }
+ else if( aRangeRepresentation.equals( lcl_aCompleteRange ))
+ {
+ aRange.aUpperLeft.bIsEmpty = false;
+ aRange.aLowerRight.bIsEmpty = false;
+ aRange.aUpperLeft.nColumn = 0;
+ aRange.aUpperLeft.nRow = 0;
+ aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
+ aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
+ }
+ else
+ {
+ sal_Int32 nIndex = aRangeRepresentation.toInt32();
+ aRange.aUpperLeft.bIsEmpty = false;
+ if( m_bDataInColumns )
+ {
+ aRange.aUpperLeft.nColumn = nIndex + 1;
+ aRange.aUpperLeft.nRow = 1;
+ aRange.aLowerRight = aRange.aUpperLeft;
+ aRange.aLowerRight.nRow = m_aInternalData.getRowCount();
+ }
+ else
+ {
+ aRange.aUpperLeft.nColumn = 1;
+ aRange.aUpperLeft.nRow = nIndex + 1;
+ aRange.aLowerRight = aRange.aUpperLeft;
+ aRange.aLowerRight.nColumn = m_aInternalData.getColumnCount();
+ }
+ }
+
+ return XMLRangeHelper::getXMLStringFromCellRange( aRange );
+}
+
+OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXMLRange )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ XMLRangeHelper::CellRange aRange( XMLRangeHelper::getCellRangeFromXMLString( aXMLRange ));
+ if( aRange.aUpperLeft.bIsEmpty )
+ {
+ OSL_ENSURE( aRange.aLowerRight.bIsEmpty, "Weird Range" );
+ return OUString();
+ }
+
+ // "all"
+ if( !aRange.aLowerRight.bIsEmpty &&
+ ( aRange.aUpperLeft.nColumn != aRange.aLowerRight.nColumn ) &&
+ ( aRange.aUpperLeft.nRow != aRange.aLowerRight.nRow ) )
+ return lcl_aCompleteRange;
+
+ // attention: this data provider has the limitation that it stores
+ // internally if data comes from columns or rows. It is intended for
+ // creating only one used data source.
+ // @todo: add this information in the range representation strings
+
+ // data in columns
+ if( m_bDataInColumns )
+ {
+ if( aRange.aUpperLeft.nColumn == 0 )
+ return lcl_aCategoriesRangeName;
+ if( aRange.aUpperLeft.nRow == 0 )
+ return lcl_aLabelRangePrefix + OUString::valueOf( aRange.aUpperLeft.nColumn - 1 );
+
+ return OUString::valueOf( aRange.aUpperLeft.nColumn - 1 );
+ }
+
+ // data in rows
+ if( aRange.aUpperLeft.nRow == 0 )
+ return lcl_aCategoriesRangeName;
+ if( aRange.aUpperLeft.nColumn == 0 )
+ return lcl_aLabelRangePrefix + OUString::valueOf( aRange.aUpperLeft.nRow - 1 );
+
+ return OUString::valueOf( aRange.aUpperLeft.nRow - 1 );
+}
+
+namespace
+{
+Sequence< Sequence< OUString > > lcl_convertComplexVectorToSequence( const vector< vector< OUString > >& rIn )
+{
+ Sequence< Sequence< OUString > > aRet;
+ sal_Int32 nOuterCount = rIn.size();
+ if( nOuterCount )
+ {
+ aRet.realloc(nOuterCount);
+ for( sal_Int32 nN=0; nN<nOuterCount; nN++)
+ aRet[nN]=ContainerHelper::ContainerToSequence( rIn[nN] );
+ }
+ return aRet;
+}
+
+vector< vector< OUString > > lcl_convertComplexSequenceToVector( const Sequence< Sequence< OUString > >& rIn )
+{
+ vector< vector< OUString > > aRet;
+ sal_Int32 nOuterCount = rIn.getLength();
+ for( sal_Int32 nN=0; nN<nOuterCount; nN++)
+ aRet.push_back( ContainerHelper::SequenceToVector( rIn[nN] ) );
+ return aRet;
+}
+
+class SplitCategoriesProvider_ForComplexDescriptions : public SplitCategoriesProvider
+{
+public:
+
+ explicit SplitCategoriesProvider_ForComplexDescriptions( const ::std::vector< ::std::vector< ::rtl::OUString > >& rComplexDescriptions )
+ : m_rComplexDescriptions( rComplexDescriptions )
+ {}
+ virtual ~SplitCategoriesProvider_ForComplexDescriptions()
+ {}
+
+ virtual sal_Int32 getLevelCount() const;
+ virtual uno::Sequence< rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const;
+
+private:
+ const ::std::vector< ::std::vector< ::rtl::OUString > >& m_rComplexDescriptions;
+};
+
+sal_Int32 SplitCategoriesProvider_ForComplexDescriptions::getLevelCount() const
+{
+ return lcl_getInnerLevelCount( m_rComplexDescriptions );
+}
+uno::Sequence< rtl::OUString > SplitCategoriesProvider_ForComplexDescriptions::getStringsForLevel( sal_Int32 nLevel ) const
+{
+ uno::Sequence< rtl::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;
+}
+
+}//anonymous namespace
+
+// ____ XComplexDescriptionAccess ____
+Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
+{
+ return lcl_convertComplexVectorToSequence( m_aInternalData.getComplexRowLabels() );
+}
+void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_aInternalData.setComplexRowLabels( lcl_convertComplexSequenceToVector(aRowDescriptions) );
+}
+Sequence< Sequence< ::rtl::OUString > > SAL_CALL InternalDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException)
+{
+ return lcl_convertComplexVectorToSequence( m_aInternalData.getComplexColumnLabels() );
+}
+void SAL_CALL InternalDataProvider::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_aInternalData.setComplexColumnLabels( lcl_convertComplexSequenceToVector(aColumnDescriptions) );
+}
+
+// ____ XChartDataArray ____
+Sequence< Sequence< double > > SAL_CALL InternalDataProvider::getData()
+ throw (uno::RuntimeException)
+{
+ return m_aInternalData.getData();
+}
+
+void SAL_CALL InternalDataProvider::setData( const Sequence< Sequence< double > >& rDataInRows )
+ throw (uno::RuntimeException)
+{
+ return m_aInternalData.setData( rDataInRows );
+}
+
+void SAL_CALL InternalDataProvider::setRowDescriptions( const Sequence< OUString >& aRowDescriptions )
+ throw (uno::RuntimeException)
+{
+ vector< vector< OUString > > aComplexDescriptions( aRowDescriptions.getLength() );
+ transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.getConstArray(),
+ aComplexDescriptions.begin(), lcl_setStringAtLevel(0) );
+ m_aInternalData.setComplexRowLabels( aComplexDescriptions );
+}
+
+void SAL_CALL InternalDataProvider::setColumnDescriptions( const Sequence< OUString >& aColumnDescriptions )
+ throw (uno::RuntimeException)
+{
+ vector< vector< OUString > > aComplexDescriptions( aColumnDescriptions.getLength() );
+ transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.getConstArray(),
+ aComplexDescriptions.begin(), lcl_setStringAtLevel(0) );
+ m_aInternalData.setComplexColumnLabels( aComplexDescriptions );
+}
+
+Sequence< OUString > SAL_CALL InternalDataProvider::getRowDescriptions()
+ throw (uno::RuntimeException)
+{
+ vector< vector< OUString > > aComplexLabels( m_aInternalData.getComplexRowLabels() );
+ SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
+ return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
+}
+
+Sequence< OUString > SAL_CALL InternalDataProvider::getColumnDescriptions()
+ throw (uno::RuntimeException)
+{
+ vector< vector< OUString > > aComplexLabels( m_aInternalData.getComplexColumnLabels() );
+ SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
+ return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
+}
+
+// ____ XChartData (base of XChartDataArray) ____
+void SAL_CALL InternalDataProvider::addChartDataChangeEventListener(
+ const Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& )
+ throw (uno::RuntimeException)
+{
+}
+
+void SAL_CALL InternalDataProvider::removeChartDataChangeEventListener(
+ const Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& )
+ throw (uno::RuntimeException)
+{
+}
+
+double SAL_CALL InternalDataProvider::getNotANumber()
+ throw (uno::RuntimeException)
+{
+ double fNan;
+ ::rtl::math::setNan( & fNan );
+ return fNan;
+}
+
+::sal_Bool SAL_CALL InternalDataProvider::isNotANumber( double nNumber )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::math::isNan( nNumber )
+ || ::rtl::math::isInf( nNumber );
+}
+// lang::XInitialization:
+void SAL_CALL InternalDataProvider::initialize(const uno::Sequence< uno::Any > & _aArguments) throw (uno::RuntimeException, uno::Exception)
+{
+ comphelper::SequenceAsHashMap aArgs(_aArguments);
+ if ( aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),sal_False) )
+ createDefaultData();
+}
+// ____ XCloneable ____
+Reference< util::XCloneable > SAL_CALL InternalDataProvider::createClone()
+ throw (uno::RuntimeException)
+{
+ return Reference< util::XCloneable >( new InternalDataProvider( *this ));
+}
+
+
+// ================================================================================
+
+Sequence< OUString > InternalDataProvider::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.data.DataProvider" ));
+ return aServices;
+}
+
+// ================================================================================
+
+APPHELPER_XSERVICEINFO_IMPL( InternalDataProvider, lcl_aServiceName );
+
+} // namespace chart
diff --git a/chart2/source/tools/LabeledDataSequence.cxx b/chart2/source/tools/LabeledDataSequence.cxx
new file mode 100644
index 000000000000..21ade3aefadc
--- /dev/null
+++ b/chart2/source/tools/LabeledDataSequence.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "LabeledDataSequence.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "macros.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+LabeledDataSequence::LabeledDataSequence( const Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{}
+
+LabeledDataSequence::LabeledDataSequence(
+ const uno::Reference< chart2::data::XDataSequence > & rValues ) :
+ m_xData( rValues ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ 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())
+{
+ ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
+ ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder );
+}
+
+LabeledDataSequence::~LabeledDataSequence()
+{
+ if( m_xModifyEventForwarder.is())
+ {
+ if( m_xData.is())
+ ModifyListenerHelper::removeListener( m_xData, m_xModifyEventForwarder );
+ if( m_xLabel.is())
+ ModifyListenerHelper::removeListener( m_xLabel, m_xModifyEventForwarder );
+ }
+}
+
+// ____ XLabeledDataSequence ____
+uno::Reference< chart2::data::XDataSequence > SAL_CALL LabeledDataSequence::getValues()
+ throw (uno::RuntimeException)
+{
+ return m_xData;
+}
+
+void SAL_CALL LabeledDataSequence::setValues(
+ const uno::Reference< chart2::data::XDataSequence >& xSequence )
+ throw (uno::RuntimeException)
+{
+ if( m_xData != xSequence )
+ {
+ ModifyListenerHelper::removeListener( m_xData, m_xModifyEventForwarder );
+ m_xData = xSequence;
+ ModifyListenerHelper::addListener( m_xData, m_xModifyEventForwarder );
+ }
+}
+
+uno::Reference< chart2::data::XDataSequence > SAL_CALL LabeledDataSequence::getLabel()
+ throw (uno::RuntimeException)
+{
+ return m_xLabel;
+}
+
+void SAL_CALL LabeledDataSequence::setLabel(
+ const uno::Reference< chart2::data::XDataSequence >& xSequence )
+ throw (uno::RuntimeException)
+{
+ if( m_xLabel != xSequence )
+ {
+ ModifyListenerHelper::removeListener( m_xLabel, m_xModifyEventForwarder );
+ m_xLabel = xSequence;
+ ModifyListenerHelper::addListener( m_xLabel, m_xModifyEventForwarder );
+ }
+}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL LabeledDataSequence::createClone()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< chart2::data::XDataSequence > xNewValues( m_xData );
+ uno::Reference< chart2::data::XDataSequence > xNewLabel( m_xLabel );
+
+ uno::Reference< util::XCloneable > xLabelCloneable( m_xLabel, uno::UNO_QUERY );
+ if( xLabelCloneable.is())
+ xNewLabel.set( xLabelCloneable->createClone(), uno::UNO_QUERY );
+
+ uno::Reference< util::XCloneable > xValuesCloneable( m_xData, uno::UNO_QUERY );
+ if( xValuesCloneable.is())
+ xNewValues.set( xValuesCloneable->createClone(), uno::UNO_QUERY );
+
+ return uno::Reference< util::XCloneable >(
+ new LabeledDataSequence( xNewValues, xNewLabel ) );
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL LabeledDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL LabeledDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ================================================================================
+
+Sequence< OUString > LabeledDataSequence::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 1 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart2.data.LabeledDataSequence" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LabeledDataSequence,
+ C2U( "com.sun.star.comp.chart2.LabeledDataSequence" ))
+
+// ================================================================================
+
+} // namespace chart
diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx
new file mode 100644
index 000000000000..4e778db1a68c
--- /dev/null
+++ b/chart2/source/tools/LegendHelper.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LegendHelper.hxx"
+#include "macros.hxx"
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+
+//static
+Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::XModel >& xModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+{
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, xContext, true );
+ uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_True) );
+
+ chart2::RelativePosition aRelativePosition;
+ if( !(xProp->getPropertyValue( C2U( "RelativePosition" )) >>= aRelativePosition) )
+ {
+ chart2::LegendPosition ePos = chart2::LegendPosition_LINE_END;
+ if( !(xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos ) )
+ xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( ePos ));
+
+ chart2::LegendExpansion eExpansion =
+ ( ePos == chart2::LegendPosition_LINE_END ||
+ ePos == chart2::LegendPosition_LINE_START )
+ ? chart2::LegendExpansion_HIGH
+ : chart2::LegendExpansion_WIDE;
+ if( !(xProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion ) )
+ xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExpansion ));
+
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::Any());
+ }
+
+ }
+ return xLegend;
+}
+
+//static
+void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel )
+{
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, 0, false );
+ uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_False) );
+ }
+}
+
+// static
+uno::Reference< chart2::XLegend > LegendHelper::getLegend(
+ const uno::Reference< frame::XModel >& xModel
+ , const uno::Reference< uno::XComponentContext >& xContext
+ , bool bCreate )
+{
+ uno::Reference< chart2::XLegend > xResult;
+
+ uno::Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ if( xChartDoc.is())
+ {
+ try
+ {
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ if( xDia.is() )
+ {
+ xResult.set( xDia->getLegend() );
+ if( bCreate && !xResult.is() && xContext.is() )
+ {
+ xResult.set( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.Legend" ), xContext ), uno::UNO_QUERY );
+ xDia->setLegend( xResult );
+ }
+ }
+ else if(bCreate)
+ {
+ DBG_ERROR("need diagram for creation of legend");
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return xResult;
+}
+
+// static
+bool LegendHelper::hasLegend( const uno::Reference< chart2::XDiagram > & xDiagram )
+{
+ bool bReturn = false;
+ if( xDiagram.is())
+ {
+ uno::Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ xLegendProp->getPropertyValue( C2U("Show")) >>= bReturn;
+ }
+
+ return bReturn;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx
new file mode 100644
index 000000000000..444e894a101d
--- /dev/null
+++ b/chart2/source/tools/LifeTime.cxx
@@ -0,0 +1,546 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LifeTime.hxx"
+#include "macros.hxx"
+#include <osl/diagnose.h>
+
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+
+using namespace ::com::sun::star;
+
+namespace apphelper
+{
+//--------------------------
+
+LifeTimeManager::LifeTimeManager( lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable )
+ : m_aListenerContainer( m_aAccessMutex )
+ , m_pComponent(pComponent)
+ , m_bLongLastingCallsCancelable(bLongLastingCallsCancelable)
+{
+ impl_init();
+}
+
+void LifeTimeManager::impl_init()
+{
+ m_bDisposed = sal_False;
+ m_bInDispose = sal_False;
+ m_nAccessCount = 0;
+ m_nLongLastingCallCount = 0;
+ m_aNoAccessCountCondition.set();
+ m_aNoLongLastingCallCountCondition.set();
+}
+
+LifeTimeManager::~LifeTimeManager()
+{
+}
+
+bool LifeTimeManager::impl_isDisposed( bool bAssert )
+{
+ if( m_bDisposed || m_bInDispose )
+ {
+ if( bAssert )
+ {
+ OSL_ENSURE( sal_False, "This component is already disposed " );
+ (void)(bAssert);
+ }
+ return sal_True;
+ }
+ return sal_False;
+}
+ sal_Bool LifeTimeManager
+::impl_canStartApiCall()
+{
+ if( impl_isDisposed() )
+ return sal_False; //behave passive if already disposed
+
+ //mutex is acquired
+ return sal_True;
+}
+
+ void LifeTimeManager
+::impl_registerApiCall(sal_Bool bLongLastingCall)
+{
+ //only allowed if not disposed
+ //do not acquire the mutex here because it will be acquired already
+ m_nAccessCount++;
+ if(m_nAccessCount==1)
+ //@todo? is it ok to wake some threads here while we have acquired the mutex?
+ m_aNoAccessCountCondition.reset();
+
+ if(bLongLastingCall)
+ m_nLongLastingCallCount++;
+ if(m_nLongLastingCallCount==1)
+ m_aNoLongLastingCallCountCondition.reset();
+}
+ void LifeTimeManager
+::impl_unregisterApiCall(sal_Bool bLongLastingCall)
+{
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+
+ OSL_ENSURE( m_nAccessCount>0, "access count mismatch" );
+ m_nAccessCount--;
+ if(bLongLastingCall)
+ m_nLongLastingCallCount--;
+ if( m_nLongLastingCallCount==0 )
+ {
+ m_aNoLongLastingCallCountCondition.set();
+ }
+ if( m_nAccessCount== 0)
+ {
+ m_aNoAccessCountCondition.set();
+ impl_apiCallCountReachedNull();
+
+ }
+}
+
+ sal_Bool LifeTimeManager
+::dispose() throw(uno::RuntimeException)
+{
+ //hold no mutex
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+
+ if( m_bDisposed || m_bInDispose )
+ {
+ OSL_TRACE( "This component is already disposed " );
+ return sal_False; //behave passive if already disposed
+ }
+
+ m_bInDispose = true;
+ //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 =
+ uno::Reference< lang::XComponent >(m_pComponent);;
+ if(xComponent.is())
+ {
+ // notify XCLoseListeners
+ lang::EventObject aEvent( xComponent );
+ m_aListenerContainer.disposeAndClear( aEvent );
+ }
+ }
+
+ //no mutex is acquired
+ {
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+ OSL_ENSURE( !m_bDisposed, "dispose was called already" );
+ m_bDisposed = sal_True;
+ aGuard.clear();
+ }
+ //no mutex is acquired
+
+ //wait until all still running calls have finished
+ //the accessCount cannot grow anymore, because all calls will return after checking m_bDisposed
+ m_aNoAccessCountCondition.wait();
+
+ //we are the only ones working on our data now
+
+ return sal_True;
+ //--release all resources and references after calling this method successful
+}
+
+//-----------------------------------------------------------------
+
+CloseableLifeTimeManager::CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable
+ , ::com::sun::star::lang::XComponent* pComponent
+ , sal_Bool bLongLastingCallsCancelable )
+ : LifeTimeManager( pComponent, bLongLastingCallsCancelable )
+ , m_pCloseable(pCloseable)
+{
+ impl_init();
+}
+
+CloseableLifeTimeManager::~CloseableLifeTimeManager()
+{
+}
+
+bool CloseableLifeTimeManager::impl_isDisposedOrClosed( bool bAssert )
+{
+ if( impl_isDisposed( bAssert ) )
+ return sal_True;
+
+ if( m_bClosed )
+ {
+ if( bAssert )
+ {
+ OSL_ENSURE( sal_False, "This object is already closed" );
+ (void)(bAssert);//avoid warnings
+ }
+ return sal_True;
+ }
+ return sal_False;
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_close_startTryClose(sal_Bool bDeliverOwnership)
+ throw ( uno::Exception )
+{
+ //no mutex is allowed to be acquired
+ {
+ osl::ResettableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+ if( impl_isDisposedOrClosed(false) )
+ return sal_False;
+
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ //not closed already -> we try to close again
+ m_bInTryClose = sal_True;
+ m_aEndTryClosingCondition.reset();
+
+ impl_registerApiCall(sal_False);
+ }
+
+ //------------------------------------------------
+ //no mutex is acquired
+
+ //only remove listener calls will be worked on until end of tryclose
+ //all other new calls will wait till end of try close // @todo? is that really ok
+
+ //?? still running calls have the freedom to finish their work without crash
+
+ try
+ {
+ uno::Reference< util::XCloseable > xCloseable =
+ uno::Reference< util::XCloseable >(m_pCloseable);;
+ if(xCloseable.is())
+ {
+ //--call queryClosing on all registered close listeners
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
+ ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );;
+ if( pIC )
+ {
+ //lang::EventObject aEvent( static_cast< util::XCloseable*>(xCloseable) );
+ 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 );
+ }
+ }
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ //no mutex is acquired
+ g_close_endTryClose(bDeliverOwnership, sal_False);
+ (void)(ex);
+ throw;
+ }
+ return sal_True;
+}
+
+ void CloseableLifeTimeManager
+::g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool /* bMyVeto */ )
+{
+ //this method is called, if the try to close was not successfull
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+ impl_setOwnership( bDeliverOwnership, sal_False );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, util::CloseVetoException& ex )
+ throw ( util::CloseVetoException )
+{
+ //this method is called when no closelistener has had a veto during queryclosing
+ //the method returns false, if nothing stands against closing anymore
+ //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::Guard< osl::Mutex > 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 sal_False;
+
+ if(m_bLongLastingCallsCancelable)
+ return sal_True;
+
+ impl_setOwnership( bDeliverOwnership, sal_True );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+
+ throw ex;
+}
+
+ void CloseableLifeTimeManager
+::g_close_endTryClose_doClose()
+{
+ //this method is called, if the try to close was successfull
+ osl::ResettableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+ impl_doClose();
+}
+
+ void CloseableLifeTimeManager
+::impl_setOwnership( sal_Bool bDeliverOwnership, sal_Bool bMyVeto )
+{
+ m_bOwnership = bDeliverOwnership && bMyVeto;
+ m_bOwnershipIsWellKnown = sal_True;
+}
+ sal_Bool CloseableLifeTimeManager
+::impl_shouldCloseAtNextChance()
+{
+ return m_bOwnership;
+}
+
+ void CloseableLifeTimeManager
+::impl_apiCallCountReachedNull()
+{
+ //Mutex needs to be acquired exactly ones
+ //mutex will be released inbetween in impl_doClose()
+ if( m_pCloseable && impl_shouldCloseAtNextChance() )
+ impl_doClose();
+}
+
+ void CloseableLifeTimeManager
+::impl_doClose()
+{
+ //Mutex needs to be acquired exactly ones before calling impl_doClose()
+
+ if(m_bClosed)
+ return; //behave as passive as possible, if disposed or closed already
+ if( m_bDisposed || m_bInDispose )
+ return; //behave as passive as possible, if disposed or closed already
+
+ //--------
+ m_bClosed = sal_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=NULL;
+ try
+ {
+ xCloseable = uno::Reference< util::XCloseable >(m_pCloseable);;
+ if(xCloseable.is())
+ {
+ //--call notifyClosing on all registered close listeners
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
+ ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );;
+ if( pIC )
+ {
+ //lang::EventObject aEvent( static_cast< util::XCloseable*>(xCloseable) );
+ 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 );
+ }
+ }
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if(xCloseable.is())
+ {
+ uno::Reference< lang::XComponent > xComponent =
+ uno::Reference< lang::XComponent >( xCloseable, uno::UNO_QUERY );
+ if(xComponent.is())
+ {
+ OSL_ENSURE( m_bClosed, "a not closed component will be disposed " );
+ xComponent->dispose();
+ }
+ }
+ //mutex will be reacquired in destructor of aNegativeGuard
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_addCloseListener( const uno::Reference< util::XCloseListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< util::XCloseListener >*)0),xListener );
+ m_bOwnership = sal_False;
+ return sal_True;
+}
+
+ sal_Bool CloseableLifeTimeManager
+::impl_canStartApiCall()
+{
+ //Mutex needs to be acquired exactly ones before calling this method
+ //the mutex will be released inbetween and reacquired
+
+ if( impl_isDisposed() )
+ return sal_False; //behave passive if already disposed
+ if( m_bClosed )
+ return sal_False; //behave passive if closing is already done
+
+ //during try-close most calls need to wait for the decision
+ while( m_bInTryClose )
+ {
+ //if someone tries to close this object at the moment
+ //we need to wait for his end because the result of the preceding call
+ //is relevant for our behaviour here
+
+ m_aAccessMutex.release();
+ m_aEndTryClosingCondition.wait(); //@todo??? this may block??? try closing
+ m_aAccessMutex.acquire();
+ if( m_bDisposed || m_bInDispose || m_bClosed )
+ return sal_False; //return if closed already
+ }
+ //mutex is acquired
+ return sal_True;
+}
+
+//--------------------------
+
+ sal_Bool LifeTimeGuard
+::startApiCall(sal_Bool bLongLastingCall)
+{
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ //mutex is requiered due to constructor of LifeTimeGuard
+
+ OSL_ENSURE( !m_bCallRegistered, "this method is only allowed ones" );
+ if(m_bCallRegistered)
+ return sal_False;
+
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !m_rManager.impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ m_bCallRegistered = sal_True;
+ m_bLongLastingCallRegistered = bLongLastingCall;
+ m_rManager.impl_registerApiCall(bLongLastingCall);
+ return sal_True;
+}
+
+LifeTimeGuard::~LifeTimeGuard()
+{
+ try
+ {
+ //do acquire the mutex if it was cleared before
+ osl::MutexGuard g(m_rManager.m_aAccessMutex);
+ if(m_bCallRegistered)
+ {
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ m_rManager.impl_unregisterApiCall(m_bLongLastingCallRegistered);
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ //@todo ? allow a uno::RuntimeException from dispose to travel through??
+ ex.Context.is(); //to avoid compilation warnings
+ }
+}
+
+/*
+the XCloseable::close method has to be implemented in the following way:
+::close
+{
+ //hold no mutex
+
+ if( !m_aLifeTimeManager.g_close_startTryClose( bDeliverOwnership ) )
+ return;
+ //no mutex is acquired
+
+ // At the end of this method may we must dispose ourself ...
+ // and may nobody from outside hold a reference to us ...
+ // then it's a good idea to do that by ourself.
+ uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
+
+ //the listeners have had no veto
+ //check wether we self can close
+ {
+ util::CloseVetoException aVetoException = util::CloseVetoException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "the model itself could not be closed" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ if( m_aLifeTimeManager.g_close_isNeedToCancelLongLastingCalls( bDeliverOwnership, aVetoException ) )
+ {
+ ////you can empty this block, if you never start longlasting calls or
+ ////if your longlasting calls are per default not cancelable (check how you have constructed your LifeTimeManager)
+
+ sal_Bool bLongLastingCallsAreCanceled = sal_False;
+ try
+ {
+ //try to cancel running longlasting calls
+ //// @todo
+ }
+ catch( uno::Exception& ex )
+ {
+ //// @todo
+ //do not throw anything here!! (without endTryClose)
+ }
+ //if not successful canceled
+ if(!bLongLastingCallsAreCanceled)
+ {
+ m_aLifeTimeManager.g_close_endTryClose( bDeliverOwnership, sal_True );
+ throw aVetoException;
+ }
+ }
+
+ }
+ m_aLifeTimeManager.g_close_endTryClose_doClose();
+}
+*/
+
+}//end namespace apphelper
diff --git a/chart2/source/tools/LineProperties.cxx b/chart2/source/tools/LineProperties.cxx
new file mode 100644
index 000000000000..95cf95e21a86
--- /dev/null
+++ b/chart2/source/tools/LineProperties.cxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LineProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+namespace chart
+{
+
+void LineProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ // Line Properties see service drawing::LineProperties
+ // ---------------
+ rOutProperties.push_back(
+ Property( C2U( "LineStyle" ),
+ PROP_LINE_STYLE,
+ ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineDash" ),
+ PROP_LINE_DASH,
+ ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+//not in service description
+ rOutProperties.push_back(
+ Property( C2U( "LineDashName" ),
+ PROP_LINE_DASH_NAME,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineColor" ),
+ PROP_LINE_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineTransparence" ),
+ PROP_LINE_TRANSPARENCE,
+ ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineWidth" ),
+ PROP_LINE_WIDTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineJoint" ),
+ PROP_LINE_JOINT,
+ ::getCppuType( reinterpret_cast< const drawing::LineJoint * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void LineProperties::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_JOINT, drawing::LineJoint_ROUND );
+}
+
+//static
+bool LineProperties::IsLineVisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties )
+{
+ bool bRet = false;
+ try
+ {
+ if( xLineProperties.is() )
+ {
+ drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
+ xLineProperties->getPropertyValue( C2U( "LineStyle" ) ) >>= aLineStyle;
+ if( aLineStyle != drawing::LineStyle_NONE )
+ {
+ sal_Int16 nLineTransparence=0;
+ xLineProperties->getPropertyValue( C2U( "LineTransparence" ) ) >>= nLineTransparence;
+ if(100!=nLineTransparence)
+ {
+ bRet = true;
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return bRet;
+}
+
+//static
+void LineProperties::SetLineVisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties )
+{
+ try
+ {
+ if( xLineProperties.is() )
+ {
+ drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
+ xLineProperties->getPropertyValue( C2U( "LineStyle" ) ) >>= aLineStyle;
+ if( aLineStyle == drawing::LineStyle_NONE )
+ xLineProperties->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) );
+
+ sal_Int16 nLineTransparence=0;
+ xLineProperties->getPropertyValue( C2U( "LineTransparence" ) ) >>= nLineTransparence;
+ if(100==nLineTransparence)
+ xLineProperties->setPropertyValue( C2U( "LineTransparence" ), uno::makeAny( sal_Int16(0) ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//static
+void LineProperties::SetLineInvisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xLineProperties )
+{
+ try
+ {
+ if( xLineProperties.is() )
+ {
+ drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
+ xLineProperties->getPropertyValue( C2U( "LineStyle" ) ) >>= aLineStyle;
+ if( aLineStyle != drawing::LineStyle_NONE )
+ xLineProperties->setPropertyValue( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/LinearRegressionCurveCalculator.cxx b/chart2/source/tools/LinearRegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..7a372cff4f51
--- /dev/null
+++ b/chart2/source/tools/LinearRegressionCurveCalculator.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LinearRegressionCurveCalculator.hxx"
+#include "macros.hxx"
+#include "RegressionCalculationHelper.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+LinearRegressionCurveCalculator::LinearRegressionCurveCalculator() :
+ m_fSlope( 0.0 ),
+ m_fIntercept( 0.0 )
+{
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+}
+
+LinearRegressionCurveCalculator::~LinearRegressionCurveCalculator()
+{}
+
+// ____ XRegressionCurveCalculator ____
+void SAL_CALL LinearRegressionCurveCalculator::recalculateRegression(
+ const uno::Sequence< double >& aXValues,
+ const uno::Sequence< double >& aYValues )
+ throw (uno::RuntimeException)
+{
+ RegressionCalculationHelper::tDoubleVectorPair aValues(
+ RegressionCalculationHelper::cleanup(
+ aXValues, aYValues,
+ RegressionCalculationHelper::isValid()));
+
+ const size_t nMax = aValues.first.size();
+ if( nMax == 0 )
+ {
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+ return;
+ }
+
+ const double fN = static_cast< double >( nMax );
+ double fSumX = 0.0, fSumY = 0.0, fSumXSq = 0.0, fSumYSq = 0.0, fSumXY = 0.0;
+ for( size_t i = 0; i < nMax; ++i )
+ {
+ fSumX += aValues.first[i];
+ fSumY += aValues.second[i];
+ fSumXSq += aValues.first[i] * aValues.first[i];
+ fSumYSq += aValues.second[i] * aValues.second[i];
+ fSumXY += aValues.first[i] * aValues.second[i];
+ }
+
+ m_fSlope = (fN * fSumXY - fSumX * fSumY) / ( fN * fSumXSq - fSumX * fSumX );
+ m_fIntercept = (fSumY - m_fSlope * fSumX) / fN;
+
+ m_fCorrelationCoeffitient = ( fN * fSumXY - fSumX * fSumY ) /
+ sqrt( ( fN * fSumXSq - fSumX * fSumX ) *
+ ( fN * fSumYSq - fSumY * fSumY ) );
+}
+
+double SAL_CALL LinearRegressionCurveCalculator::getCurveValue( double x )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if( ! ( ::rtl::math::isNan( m_fSlope ) ||
+ ::rtl::math::isNan( m_fIntercept )))
+ {
+ fResult = m_fSlope * x + m_fIntercept;
+ }
+
+ return fResult;
+}
+
+uno::Sequence< geometry::RealPoint2D > SAL_CALL LinearRegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const uno::Reference< chart2::XScaling >& xScalingX,
+ const uno::Reference< chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( bMaySkipPointsInCalculation &&
+ isLinearScaling( xScalingX ) &&
+ isLinearScaling( xScalingY ))
+ {
+ // optimize result
+ uno::Sequence< geometry::RealPoint2D > aResult( 2 );
+ aResult[0].X = min;
+ aResult[0].Y = this->getCurveValue( min );
+ aResult[1].X = max;
+ aResult[1].Y = this->getCurveValue( max );
+
+ return aResult;
+ }
+ return RegressionCurveCalculator::getCurveValues( min, max, nPointCount, xScalingX, xScalingY, bMaySkipPointsInCalculation );
+}
+
+OUString LinearRegressionCurveCalculator::ImplGetRepresentation(
+ const uno::Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const
+{
+ OUStringBuffer aBuf( C2U( "f(x) = " ));
+
+ bool bHaveSlope = false;
+
+ if( m_fSlope != 0.0 )
+ {
+ if( ::rtl::math::approxEqual( fabs( m_fSlope ), 1.0 ))
+ {
+ if( m_fSlope < 0 )
+ aBuf.append( UC_MINUS_SIGN );
+ }
+ else
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope ));
+ aBuf.append( sal_Unicode( 'x' ));
+ bHaveSlope = true;
+ }
+
+ if( bHaveSlope )
+ {
+ if( m_fIntercept < 0.0 )
+ {
+ aBuf.append( UC_SPACE );
+ aBuf.append( UC_MINUS_SIGN );
+ aBuf.append( UC_SPACE );
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, fabs( m_fIntercept )));
+ }
+ else if( m_fIntercept > 0.0 )
+ {
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " + " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+ }
+ else
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+
+ return aBuf.makeStringAndClear();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..c7c2db60431c
--- /dev/null
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LogarithmicRegressionCurveCalculator.hxx"
+#include "macros.hxx"
+#include "RegressionCalculationHelper.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+LogarithmicRegressionCurveCalculator::LogarithmicRegressionCurveCalculator() :
+ m_fSlope( 0.0 ),
+ m_fIntercept( 0.0 )
+{
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+}
+
+LogarithmicRegressionCurveCalculator::~LogarithmicRegressionCurveCalculator()
+{}
+
+// ____ XRegressionCurve ____
+void SAL_CALL LogarithmicRegressionCurveCalculator::recalculateRegression(
+ const uno::Sequence< double >& aXValues,
+ const uno::Sequence< double >& aYValues )
+ throw (uno::RuntimeException)
+{
+ RegressionCalculationHelper::tDoubleVectorPair aValues(
+ RegressionCalculationHelper::cleanup(
+ aXValues, aYValues,
+ RegressionCalculationHelper::isValidAndXPositive()));
+
+ const size_t nMax = aValues.first.size();
+ if( nMax == 0 )
+ {
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+ return;
+ }
+
+ double fAverageX = 0.0, fAverageY = 0.0;
+ size_t i = 0;
+ for( i = 0; i < nMax; ++i )
+ {
+ fAverageX += log( aValues.first[i] );
+ fAverageY += aValues.second[i];
+ }
+
+ const double fN = static_cast< double >( nMax );
+ fAverageX /= fN;
+ fAverageY /= fN;
+
+ double fQx = 0.0, fQy = 0.0, fQxy = 0.0;
+ for( i = 0; i < nMax; ++i )
+ {
+ double fDeltaX = log( aValues.first[i] ) - fAverageX;
+ double fDeltaY = aValues.second[i] - fAverageY;
+
+ fQx += fDeltaX * fDeltaX;
+ fQy += fDeltaY * fDeltaY;
+ fQxy += fDeltaX * fDeltaY;
+ }
+
+ m_fSlope = fQxy / fQx;
+ m_fIntercept = fAverageY - m_fSlope * fAverageX;
+ m_fCorrelationCoeffitient = fQxy / sqrt( fQx * fQy );
+}
+
+double SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValue( double x )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if( ! ( ::rtl::math::isNan( m_fSlope ) ||
+ ::rtl::math::isNan( m_fIntercept )))
+ {
+ fResult = m_fSlope * log( x ) + m_fIntercept;
+ }
+
+ return fResult;
+}
+
+uno::Sequence< geometry::RealPoint2D > SAL_CALL LogarithmicRegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const uno::Reference< chart2::XScaling >& xScalingX,
+ const uno::Reference< chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( bMaySkipPointsInCalculation &&
+ isLogarithmicScaling( xScalingX ) &&
+ isLinearScaling( xScalingY ))
+ {
+ // optimize result
+ uno::Sequence< geometry::RealPoint2D > aResult( 2 );
+ aResult[0].X = min;
+ aResult[0].Y = this->getCurveValue( min );
+ aResult[1].X = max;
+ aResult[1].Y = this->getCurveValue( max );
+
+ return aResult;
+ }
+ return RegressionCurveCalculator::getCurveValues( min, max, nPointCount, xScalingX, xScalingY, bMaySkipPointsInCalculation );
+}
+
+OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
+ const uno::Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const
+{
+ OUStringBuffer aBuf( C2U( "f(x) = " ));
+
+ bool bHaveSlope = false;
+
+ if( m_fSlope != 0.0 )
+ {
+ if( ::rtl::math::approxEqual( fabs( m_fSlope ), 1.0 ))
+ {
+ if( m_fSlope < 0 )
+ aBuf.append( UC_MINUS_SIGN );
+ }
+ else
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope ));
+ aBuf.append( UC_SPACE );
+ }
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ln(x)" ));
+ bHaveSlope = true;
+ }
+
+ if( bHaveSlope )
+ {
+ if( m_fIntercept < 0.0 )
+ {
+ aBuf.append( UC_SPACE );
+ aBuf.append( UC_MINUS_SIGN );
+ aBuf.append( UC_SPACE );
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, fabs( m_fIntercept )));
+ }
+ else if( m_fIntercept > 0.0 )
+ {
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " + " ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+ }
+ else
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+
+ return aBuf.makeStringAndClear();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..8277a5830b0a
--- /dev/null
+++ b/chart2/source/tools/MeanValueRegressionCurveCalculator.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "MeanValueRegressionCurveCalculator.hxx"
+#include "macros.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+MeanValueRegressionCurveCalculator::MeanValueRegressionCurveCalculator() :
+ m_fMeanValue( 0.0 )
+{
+ ::rtl::math::setNan( & m_fMeanValue );
+}
+
+MeanValueRegressionCurveCalculator::~MeanValueRegressionCurveCalculator()
+{}
+
+// ____ XRegressionCurveCalculator ____
+void SAL_CALL MeanValueRegressionCurveCalculator::recalculateRegression(
+ const uno::Sequence< double >& /*aXValues*/,
+ const uno::Sequence< double >& aYValues )
+ throw (uno::RuntimeException)
+{
+ const sal_Int32 nDataLength = aYValues.getLength();
+ sal_Int32 nMax = nDataLength;
+ double fSumY = 0.0;
+ const double * pY = aYValues.getConstArray();
+
+ for( sal_Int32 i = 0; i < nDataLength; ++i )
+ {
+ if( ::rtl::math::isNan( pY[i] ) ||
+ ::rtl::math::isInf( pY[i] ))
+ --nMax;
+ else
+ fSumY += pY[i];
+ }
+
+ m_fCorrelationCoeffitient = 0.0;
+
+ if( nMax == 0 )
+ {
+ ::rtl::math::setNan( & m_fMeanValue );
+ }
+ else
+ {
+ m_fMeanValue = fSumY / static_cast< double >( nMax );
+
+ // correlation coefficient: standard deviation
+ if( nMax > 1 )
+ {
+ double fErrorSum = 0.0;
+ for( sal_Int32 i = 0; i < nDataLength; ++i )
+ {
+ if( !::rtl::math::isNan( pY[i] ) &&
+ !::rtl::math::isInf( pY[i] ))
+ {
+ double v = m_fMeanValue - pY[i];
+ fErrorSum += (v*v);
+ }
+ }
+ OSL_ASSERT( fErrorSum >= 0.0 );
+ m_fCorrelationCoeffitient = sqrt( fErrorSum / (nMax - 1 ));
+ }
+ }
+}
+
+double SAL_CALL MeanValueRegressionCurveCalculator::getCurveValue( double /*x*/ )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ return m_fMeanValue;
+}
+
+
+uno::Sequence< geometry::RealPoint2D > SAL_CALL MeanValueRegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const uno::Reference< chart2::XScaling >& xScalingX,
+ const uno::Reference< chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ 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;
+
+ return aResult;
+ }
+ return RegressionCurveCalculator::getCurveValues( min, max, nPointCount, xScalingX, xScalingY, bMaySkipPointsInCalculation );
+}
+
+OUString MeanValueRegressionCurveCalculator::ImplGetRepresentation(
+ const uno::Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const
+{
+ OUStringBuffer aBuf( C2U( "f(x) = " ));
+
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fMeanValue ));
+
+ return aBuf.makeStringAndClear();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx
new file mode 100644
index 000000000000..687bc203a84f
--- /dev/null
+++ b/chart2/source/tools/MediaDescriptorHelper.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "MediaDescriptorHelper.hxx"
+
+using namespace ::com::sun::star;
+
+namespace apphelper
+{
+
+
+const short FLAG_DEPRECATED =1;
+const short FLAG_MODEL =2;
+
+#define WRITE_PROPERTY( MediaName, nFlags ) \
+if(rProp.Name.equals(::rtl::OUString::createFromAscii(#MediaName))) \
+{ \
+ if( rProp.Value >>= MediaName ) \
+ ISSET_##MediaName = sal_True; \
+ if(nFlags & FLAG_DEPRECATED) \
+ { \
+ m_aDeprecatedProperties[nDeprecatedCount]=rProp;\
+ nDeprecatedCount++; \
+ } \
+ else \
+ { \
+ m_aRegularProperties[nRegularCount]=rProp; \
+ nRegularCount++; \
+ if( nFlags & FLAG_MODEL) \
+ { \
+ m_aModelProperties[nModelCount]=rProp; \
+ nModelCount++; \
+ } \
+ } \
+}
+
+MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
+ beans::PropertyValue > & rMediaDescriptor )
+{
+ impl_init();
+
+ m_aRegularProperties.realloc(0);
+ m_aRegularProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nRegularCount = 0;
+
+ m_aDeprecatedProperties.realloc(0);
+ m_aDeprecatedProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nDeprecatedCount = 0;
+
+ m_aAdditionalProperties.realloc(0);
+ m_aAdditionalProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nAdditionalCount = 0;
+
+ m_aModelProperties.realloc(0);
+ m_aModelProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nModelCount = 0;
+
+
+ //read given rMediaDescriptor and store in internal structures:
+ for( sal_Int32 i= rMediaDescriptor.getLength();i--;)
+ {
+ const beans::PropertyValue& rProp = rMediaDescriptor[i];
+ WRITE_PROPERTY( AsTemplate, FLAG_MODEL )
+ else WRITE_PROPERTY( Author, FLAG_MODEL )
+ else WRITE_PROPERTY( CharacterSet, FLAG_MODEL )
+ else WRITE_PROPERTY( Comment, FLAG_MODEL )
+ else WRITE_PROPERTY( ComponentData, FLAG_MODEL )
+ else WRITE_PROPERTY( FileName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( FilterData, FLAG_MODEL )
+ else WRITE_PROPERTY( FilterName, FLAG_MODEL )
+ else WRITE_PROPERTY( FilterFlags, FLAG_DEPRECATED)
+ else WRITE_PROPERTY( FilterOptions, FLAG_MODEL )
+ else WRITE_PROPERTY( FrameName, FLAG_MODEL )
+ else WRITE_PROPERTY( Hidden, FLAG_MODEL )
+ else WRITE_PROPERTY( HierarchicalDocumentName, FLAG_MODEL )
+ else WRITE_PROPERTY( OutputStream, 0 )
+ else WRITE_PROPERTY( InputStream, 0 )
+ else WRITE_PROPERTY( InteractionHandler, 0 )
+ else WRITE_PROPERTY( JumpMark, 0 )
+ else WRITE_PROPERTY( MediaType, FLAG_MODEL )
+ else WRITE_PROPERTY( OpenFlags, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( OpenNewView, 0 )
+ else WRITE_PROPERTY( Overwrite, FLAG_MODEL )
+ else WRITE_PROPERTY( Password, FLAG_MODEL )
+ else WRITE_PROPERTY( PosSize, 0 )
+ else WRITE_PROPERTY( PostData, 0 )
+ else WRITE_PROPERTY( PostString, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( Preview, FLAG_MODEL )
+ else WRITE_PROPERTY( ReadOnly, 0 )
+ else WRITE_PROPERTY( Referer, FLAG_MODEL )
+ else WRITE_PROPERTY( SetEmbedded, 0 )
+ else WRITE_PROPERTY( Silent, 0 )
+ else WRITE_PROPERTY( StatusIndicator, 0 )
+ else WRITE_PROPERTY( Storage, FLAG_MODEL )
+ else WRITE_PROPERTY( Stream, FLAG_MODEL )
+ else WRITE_PROPERTY( TemplateName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( TemplateRegionName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( Unpacked, FLAG_MODEL )
+ else WRITE_PROPERTY( URL, FLAG_MODEL )
+ else WRITE_PROPERTY( Version, FLAG_MODEL )
+ else WRITE_PROPERTY( ViewData, FLAG_MODEL )
+ else WRITE_PROPERTY( ViewId, FLAG_MODEL )
+ else WRITE_PROPERTY( WinExtent, FLAG_DEPRECATED )
+ else
+ {
+ m_aAdditionalProperties[nAdditionalCount]=rProp;
+ nAdditionalCount++;
+ }
+ }
+
+ m_aRegularProperties.realloc(nRegularCount);
+ m_aDeprecatedProperties.realloc(nDeprecatedCount);
+ m_aAdditionalProperties.realloc(nAdditionalCount);
+ m_aModelProperties.realloc(nModelCount);
+}
+
+void MediaDescriptorHelper::impl_init()
+{
+ AsTemplate = sal_False;
+ ISSET_AsTemplate = sal_False;
+
+ ISSET_Author = sal_False;
+ ISSET_CharacterSet = sal_False;
+ ISSET_Comment = sal_False;
+
+// ::com::sun::star::uno::Any ComponentData;
+ ISSET_ComponentData = sal_False;
+ ISSET_FileName = sal_False;
+
+// ::com::sun::star::uno::Any FilterData;
+ ISSET_FilterData = sal_False;
+ ISSET_FilterName = sal_False;
+ ISSET_FilterFlags = sal_False;
+ ISSET_FilterOptions = sal_False;
+ ISSET_FrameName = sal_False;
+
+ Hidden = sal_False;
+ ISSET_Hidden = sal_False;
+ ISSET_HierarchicalDocumentName = sal_False;
+ ISSET_OutputStream = sal_False;
+ ISSET_InputStream = sal_False;
+ ISSET_InteractionHandler = sal_False;
+ ISSET_JumpMark = sal_False;
+ ISSET_MediaType = sal_False;
+ ISSET_OpenFlags = sal_False;
+ OpenNewView = sal_False;
+ ISSET_OpenNewView = sal_False;
+ Overwrite = sal_False;
+ ISSET_Overwrite = sal_False;
+ ISSET_Password = sal_False;
+
+// ::com::sun::star::awt::Rectangle PosSize;
+ ISSET_PosSize = sal_False;
+
+// ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
+ ISSET_PostData = sal_False;
+ ISSET_PostString = sal_False;
+ Preview = sal_False;
+ ISSET_Preview = sal_False;
+ ReadOnly = sal_False;
+ ISSET_ReadOnly = sal_False;
+ ISSET_Referer = sal_False;
+ ISSET_StatusIndicator = sal_False;
+ Silent = sal_False;
+ ISSET_Silent = sal_False;
+ ISSET_TemplateName = sal_False;
+ ISSET_TemplateRegionName = sal_False;
+ Unpacked = sal_False;
+ ISSET_Unpacked = sal_False;
+ ISSET_URL = sal_False;
+ Version = 0;
+ ISSET_Version = sal_False;
+
+// ::com::sun::star::uno::Any ViewData;
+ ISSET_ViewData = sal_False;
+ ViewId = 0;
+ ISSET_ViewId = sal_False;
+
+ ISSET_WinExtent = sal_False;
+
+ ISSET_Storage = sal_False;
+ ISSET_Stream = sal_False;
+}
+
+MediaDescriptorHelper::~MediaDescriptorHelper()
+{
+
+}
+
+ uno::Sequence< beans::PropertyValue > MediaDescriptorHelper
+::getReducedForModel()
+{
+ return m_aModelProperties;
+}
+}
diff --git a/chart2/source/tools/ModifyListenerCallBack.cxx b/chart2/source/tools/ModifyListenerCallBack.cxx
new file mode 100644
index 000000000000..ae13b65c39c2
--- /dev/null
+++ b/chart2/source/tools/ModifyListenerCallBack.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ModifyListenerCallBack.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/compbase1.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace chart {
+
+typedef ::cppu::WeakComponentImplHelper1<
+ ::com::sun::star::util::XModifyListener >
+ ModifyListenerCallBack_Base;
+
+class ModifyListenerCallBack_impl
+ : public ::chart::MutexContainer
+ , public ModifyListenerCallBack_Base
+{
+public:
+ explicit ModifyListenerCallBack_impl( const Link& rCallBack );
+ virtual ~ModifyListenerCallBack_impl();
+
+ void startListening( const Reference< util::XModifyBroadcaster >& xBroadcaster );
+ void stopListening();
+
+ //XModifyListener
+ virtual void SAL_CALL modified( const lang::EventObject& aEvent ) throw (uno::RuntimeException);
+
+ //XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException);
+
+ using ::cppu::WeakComponentImplHelperBase::disposing;
+
+private:
+ Link m_aLink;//will be callef on modify
+ Reference< util::XModifyBroadcaster > m_xBroadcaster;//broadcaster to listen at
+};
+
+
+ModifyListenerCallBack_impl::ModifyListenerCallBack_impl( const Link& rCallBack )
+ : ModifyListenerCallBack_Base( m_aMutex )
+ , m_aLink( rCallBack )
+ , m_xBroadcaster(0)
+{
+}
+
+ModifyListenerCallBack_impl::~ModifyListenerCallBack_impl()
+{
+}
+
+//XModifyListener
+void SAL_CALL ModifyListenerCallBack_impl::modified( const lang::EventObject& /*aEvent*/ ) throw (uno::RuntimeException)
+{
+ m_aLink.Call(0);
+}
+
+//XEventListener
+void SAL_CALL ModifyListenerCallBack_impl::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
+{
+ 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& 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
+
diff --git a/chart2/source/tools/ModifyListenerHelper.cxx b/chart2/source/tools/ModifyListenerHelper.cxx
new file mode 100644
index 000000000000..7ac5a2786cef
--- /dev/null
+++ b/chart2/source/tools/ModifyListenerHelper.cxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ModifyListenerHelper.hxx"
+#include "WeakListenerAdapter.hxx"
+#include "macros.hxx"
+
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/frame/XModel.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+void lcl_fireModifyEvent(
+ ::cppu::OBroadcastHelper & rBroadcastHelper,
+ const Reference< uno::XWeak > & xEventSource,
+ const lang::EventObject * pEvent )
+{
+ ::cppu::OInterfaceContainerHelper * pCntHlp = rBroadcastHelper.getContainer(
+ ::getCppuType( reinterpret_cast< Reference< util::XModifyListener > * >(0)));
+ if( pCntHlp )
+ {
+ 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 : public ::std::unary_function<
+ ::std::pair<
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener >,
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > >,
+ bool >
+{
+ lcl_weakReferenceToSame( const Reference< util::XModifyListener > & xModListener ) :
+ m_xHardRef( xModListener )
+ {}
+
+ bool operator() ( const argument_type & 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
+{
+namespace ModifyListenerHelper
+{
+
+uno::Reference< util::XModifyListener > createModifyEventForwarder()
+{
+ return new ModifyEventForwarder();
+}
+
+ModifyEventForwarder::ModifyEventForwarder() :
+ ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >( m_aMutex ),
+ m_aModifyListeners( m_aMutex )
+{
+}
+
+void ModifyEventForwarder::FireEvent( const lang::EventObject & rEvent )
+{
+ lcl_fireModifyEvent( m_aModifyListeners, Reference< uno::XWeak >(), & rEvent );
+}
+
+void ModifyEventForwarder::AddListener( const Reference< util::XModifyListener >& aListener )
+{
+ 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.push_back( tListenerMap::value_type( xWeakRef, xListenerToAdd ));
+ }
+
+ m_aModifyListeners.addListener( ::getCppuType( &xListenerToAdd ), xListenerToAdd );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+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( ::getCppuType( &aListener ), xListenerToRemove );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ModifyEventForwarder::DisposeAndClear( const Reference< uno::XWeak > & xSource )
+{
+ ::cppu::OInterfaceContainerHelper * pCntHlp = m_aModifyListeners.getContainer(
+ ::getCppuType( reinterpret_cast< Reference< util::XModifyListener > * >(0)));
+ if( pCntHlp )
+ pCntHlp->disposeAndClear( lang::EventObject( xSource ) );
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL ModifyEventForwarder::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ AddListener( aListener );
+}
+
+void SAL_CALL ModifyEventForwarder::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ RemoveListener( aListener );
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ModifyEventForwarder::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ FireEvent( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL ModifyEventForwarder::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ WeakComponentImplHelperBase ____
+void SAL_CALL ModifyEventForwarder::disposing()
+{
+ // dispose was called at this
+ DisposeAndClear( this );
+}
+
+} // namespace ModifyListenerHelper
+} // namespace chart
diff --git a/chart2/source/tools/MutexContainer.cxx b/chart2/source/tools/MutexContainer.cxx
new file mode 100644
index 000000000000..4fbb14674cdb
--- /dev/null
+++ b/chart2/source/tools/MutexContainer.cxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "MutexContainer.hxx"
+
+namespace chart
+{
+
+MutexContainer::~MutexContainer()
+{}
+
+::osl::Mutex & MutexContainer::GetMutex() const
+{
+ return m_aMutex;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx
new file mode 100644
index 000000000000..05169c4608f9
--- /dev/null
+++ b/chart2/source/tools/NameContainer.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "NameContainer.hxx"
+
+/*
+//SvXMLUnitConverter
+#include <xmloff/xmluconv.hxx>
+*/
+#include <com/sun/star/uno/Any.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+uno::Reference< container::XNameContainer > createNameContainer(
+ const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName )
+{
+ return new NameContainer( rType, rServicename, rImplementationName );
+}
+
+NameContainer::NameContainer( const ::com::sun::star::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName )
+ : m_aType( rType )
+ , m_aServicename( rServicename )
+ , m_aImplementationName( rImplementationName )
+ , m_aMap()
+{
+}
+
+NameContainer::NameContainer(
+ const NameContainer & rOther )
+ : impl::NameContainer_Base()
+ , m_aType( rOther.m_aType )
+ , m_aServicename( rOther.m_aServicename )
+ , m_aImplementationName( rOther.m_aImplementationName )
+ , m_aMap( rOther.m_aMap )
+{
+}
+
+NameContainer::~NameContainer()
+{
+}
+
+//XServiceInfo
+OUString SAL_CALL NameContainer::getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ return m_aImplementationName;
+}
+
+sal_Bool SAL_CALL NameContainer::supportsService( const OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString* pArray = aSNL.getArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL NameContainer::getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = m_aServicename;
+ return aSNS;
+}
+
+//-----------------------------------------------------------------
+//-----------------------------------------------------------------
+//-----------------------------------------------------------------
+
+// XNameContainer
+void SAL_CALL NameContainer::insertByName( const OUString& rName, const Any& rElement )
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( m_aMap.find( rName ) != m_aMap.end() )
+ throw container::ElementExistException();
+ m_aMap.insert( tContentMap::value_type( rName, rElement ));
+}
+
+
+
+void SAL_CALL NameContainer::removeByName( const OUString& Name )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ tContentMap::iterator aIt( m_aMap.find( Name ));
+ if( aIt == m_aMap.end())
+ throw container::NoSuchElementException();
+ m_aMap.erase( aIt );
+}
+
+// XNameReplace
+void SAL_CALL NameContainer::replaceByName( const OUString& rName, const Any& rElement )
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ tContentMap::iterator aIt( m_aMap.find( rName ));
+ if( aIt == m_aMap.end() )
+ throw container::NoSuchElementException();
+ aIt->second = rElement;
+}
+
+// XNameAccess
+Any SAL_CALL NameContainer::getByName( const OUString& rName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ tContentMap::iterator aIter( m_aMap.find( rName ) );
+ if( aIter == m_aMap.end() )
+ throw container::NoSuchElementException();
+ return aIter->second;
+}
+
+Sequence< OUString > SAL_CALL NameContainer::getElementNames()
+ throw( uno::RuntimeException )
+{
+ sal_Int32 nCount = m_aMap.size();
+ Sequence< OUString > aSeq(nCount);
+ sal_Int32 nN = 0;
+ for( tContentMap::iterator aIter = m_aMap.begin(); aIter != m_aMap.end(), nN < nCount; aIter++, nN++ )
+ aSeq[nN]=aIter->first;
+ return aSeq;
+}
+
+sal_Bool SAL_CALL NameContainer::hasByName( const OUString& rName )
+ throw( uno::RuntimeException )
+{
+ return ( m_aMap.find( rName ) != m_aMap.end() );
+}
+
+// XElementAccess
+sal_Bool SAL_CALL NameContainer::hasElements()
+ throw( uno::RuntimeException )
+{
+ return ! m_aMap.empty();
+}
+
+uno::Type SAL_CALL NameContainer::getElementType()
+ throw( uno::RuntimeException )
+{
+ return m_aType;
+}
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL NameContainer::createClone()
+ throw ( uno::RuntimeException )
+{
+ return uno::Reference< util::XCloneable >( new NameContainer( *this ));
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/NamedFillProperties.cxx b/chart2/source/tools/NamedFillProperties.cxx
new file mode 100644
index 000000000000..f904c34c1df1
--- /dev/null
+++ b/chart2/source/tools/NamedFillProperties.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "NamedFillProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/chart2/FillBitmap.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+void NamedFillProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ const uno::Type tCppuTypeString = ::getCppuType( reinterpret_cast< const OUString * >(0));
+
+ // Fill Properties
+ // ---------------
+
+ //optional property:
+ rOutProperties.push_back(
+ Property( C2U( "FillTransparenceGradient" ),
+ PROP_FILL_TRANSPARENCE_GRADIENT,
+ ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //optional property:
+ rOutProperties.push_back(
+ Property( C2U( "FillGradient" ),
+ PROP_FILL_GRADIENT,
+ ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //optional property:
+ rOutProperties.push_back(
+ Property( C2U( "FillHatch" ),
+ PROP_FILL_HATCH,
+ ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //optional property:
+ rOutProperties.push_back(
+ Property( C2U( "FillBitmapURL" ),
+ PROP_FILL_BITMAP,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void NamedFillProperties::AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+}
+
+// static
+OUString NamedFillProperties::GetPropertyNameForHandle( sal_Int32 nHandle )
+{
+ //will return e.g. "FillGradientName" for PROP_FILL_GRADIENT_NAME
+ switch( nHandle )
+ {
+ case PROP_FILL_GRADIENT_NAME:
+ return C2U( "FillGradientName" );
+ case PROP_FILL_HATCH_NAME:
+ return C2U( "FillHatchName" );
+ case PROP_FILL_BITMAP_NAME:
+ return C2U( "FillBitmapName" );
+ case PROP_FILL_TRANSPARENCY_GRADIENT_NAME:
+ return C2U( "FillTransparenceGradientName" );
+ }
+ return OUString();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/NamedLineProperties.cxx b/chart2/source/tools/NamedLineProperties.cxx
new file mode 100644
index 000000000000..02680abf690e
--- /dev/null
+++ b/chart2/source/tools/NamedLineProperties.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "NamedLineProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+// @deprecated !!
+void NamedLineProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ const uno::Type tCppuTypeString = ::getCppuType( reinterpret_cast< const OUString * >(0));
+
+ // Line Properties
+ // ---------------
+ rOutProperties.push_back(
+ Property( C2U( "LineDash" ),
+ PROP_LINE_DASH,
+ ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ if( bIncludeLineEnds )
+ {
+ rOutProperties.push_back(
+ Property( C2U( "LineStartName" ),
+ PROP_LINE_START_NAME,
+ tCppuTypeString,
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LineEndName" ),
+ PROP_LINE_END_NAME,
+ tCppuTypeString,
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ }
+}
+
+void NamedLineProperties::AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap,
+ bool bIncludeLineEnds /* = false */ )
+{
+}
+
+// static
+OUString NamedLineProperties::GetPropertyNameForHandle( sal_Int32 nHandle )
+{
+ //will return e.g. "LineDashName" for PROP_LINE_DASH_NAME
+ switch( nHandle )
+ {
+ case PROP_LINE_DASH_NAME:
+ return C2U( "LineDashName" );
+ case PROP_LINE_START_NAME:
+ case PROP_LINE_END_NAME:
+ break;
+ }
+ return OUString();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/NamedProperties.cxx b/chart2/source/tools/NamedProperties.cxx
new file mode 100644
index 000000000000..4fcb536b3279
--- /dev/null
+++ b/chart2/source/tools/NamedProperties.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "NamedProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+void NamedProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ NamedFillProperties::AddPropertiesToVector( rOutProperties );
+ NamedLineProperties::AddPropertiesToVector( rOutProperties );
+}
+
+// static
+OUString NamedProperties::GetPropertyNameForHandle( sal_Int32 nHandle )
+{
+ OUString aName = NamedFillProperties::GetPropertyNameForHandle( nHandle );
+ if( !aName.getLength() )
+ aName = NamedLineProperties::GetPropertyNameForHandle( nHandle );
+ return aName;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx
new file mode 100644
index 000000000000..a1caac803dd7
--- /dev/null
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -0,0 +1,530 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "OPropertySet.hxx"
+#include "ImplOPropertySet.hxx"
+#include "ContainerHelper.hxx"
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::style::XStyleSupplier;
+// using ::com::sun::star::beans::XFastPropertyState;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// needed for MS compiler
+using ::cppu::OBroadcastHelper;
+using ::cppu::OPropertySetHelper;
+using ::cppu::OWeakObject;
+
+namespace property
+{
+
+OPropertySet::OPropertySet( ::osl::Mutex & par_rMutex ) :
+ OBroadcastHelper( par_rMutex ),
+ // 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 ),
+ // the following causes a warning; there seems to be no way to avoid it
+ OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
+ m_rMutex( par_rMutex ),
+ m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false)
+{
+ // /--
+ MutexGuard aGuard( m_rMutex );
+ if( rOther.m_pImplProperties.get())
+ m_pImplProperties.reset( new impl::ImplOPropertySet( * rOther.m_pImplProperties.get()));
+ // \--
+}
+
+void OPropertySet::SetNewValuesExplicitlyEvenIfTheyEqualDefault()
+{
+ m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault = true;
+}
+
+OPropertySet::~OPropertySet()
+{}
+
+void OPropertySet::disposePropertySet()
+{
+ m_pImplProperties.reset( 0 );
+}
+
+Any SAL_CALL OPropertySet::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ aType,
+// static_cast< uno::XInterface * >(
+// static_cast< uno::XWeak * >( this )),
+// static_cast< uno::XWeak * >( this ),
+// static_cast< lang::XServiceInfo * >( this ),
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< beans::XPropertySet * >( this ),
+ static_cast< beans::XMultiPropertySet * >( this ),
+ static_cast< beans::XFastPropertySet * >( this ),
+ static_cast< beans::XPropertyState * >( this ),
+ static_cast< beans::XMultiPropertyStates * >( this ),
+ static_cast< XStyleSupplier * >( this ) );
+// static_cast< XFastPropertyState * >( this ) );
+}
+
+// void SAL_CALL OPropertySet::acquire() throw ()
+// {
+// OWeakObject::acquire();
+// }
+
+// void SAL_CALL OPropertySet::release() throw ()
+// {
+// OWeakObject::release();
+// }
+
+
+// ____ XServiceInfo ____
+// OUString SAL_CALL
+// OPropertySet::getImplementationName()
+// throw (uno::RuntimeException)
+// {
+// return OUString( RTL_CONSTASCII_USTRINGPARAM( "property::OPropertySet" ));
+// }
+
+// sal_Bool SAL_CALL
+// OPropertySet::supportsService( const OUString& ServiceName )
+// throw (uno::RuntimeException)
+// {
+// return ( 0 == ServiceName.reverseCompareToAsciiL(
+// RTL_CONSTASCII_STRINGPARAM( "com.sun.star.beans.PropertySet" )));
+// }
+
+// Sequence< OUString > SAL_CALL
+// OPropertySet::getSupportedServiceNames()
+// throw (uno::RuntimeException)
+// {
+// Sequence< OUString > aServiceNames( 1 );
+// aServiceNames[ 0 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertySet" ));
+// return aServiceNames;
+// }
+
+#define LCL_PROP_CPPUTYPE(t) (::getCppuType( reinterpret_cast< const Reference<t> *>(0)))
+
+// // ____ XTypeProvider ____
+Sequence< uno::Type > SAL_CALL
+ OPropertySet::getTypes()
+ throw (uno::RuntimeException)
+{
+ static Sequence< uno::Type > aTypeList;
+
+ // /--
+ MutexGuard aGuard( m_rMutex );
+
+ if( aTypeList.getLength() == 0 )
+ {
+ ::std::vector< uno::Type > aTypes;
+
+// aTypes.push_back( LCL_PROP_CPPUTYPE( uno::XWeak ));
+// aTypes.push_back( LCL_PROP_CPPUTYPE( lang::XServiceInfo ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( lang::XTypeProvider ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XMultiPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XFastPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XPropertyState ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XMultiPropertyStates ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( XStyleSupplier ));
+// aTypes.push_back( LCL_PROP_CPPUTYPE( XFastPropertyState ));
+
+ aTypeList = ::chart::ContainerHelper::ContainerToSequence( aTypes );
+ }
+
+ return aTypeList;
+ // \--
+}
+
+Sequence< sal_Int8 > SAL_CALL
+ OPropertySet::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+
+// ____ XPropertyState ____
+beans::PropertyState SAL_CALL
+ OPropertySet::getPropertyState( const OUString& PropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ return m_pImplProperties->GetPropertyStateByHandle(
+ rPH.getHandleByName( PropertyName ));
+}
+
+Sequence< beans::PropertyState > SAL_CALL
+ OPropertySet::getPropertyStates( const Sequence< OUString >& aPropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ sal_Int32 * pHandles = new sal_Int32[ aPropertyName.getLength() ];
+ rPH.fillHandles( pHandles, aPropertyName );
+
+ ::std::vector< sal_Int32 > aHandles( pHandles, pHandles + aPropertyName.getLength());
+ delete[] pHandles;
+
+ return m_pImplProperties->GetPropertyStatesByHandle( aHandles );
+}
+
+void SAL_CALL
+ OPropertySet::setPropertyToDefault( const OUString& PropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ m_pImplProperties->SetPropertyToDefault( rPH.getHandleByName( PropertyName ));
+ firePropertyChangeEvent();
+}
+
+Any SAL_CALL
+ OPropertySet::getPropertyDefault( const OUString& aPropertyName )
+ throw (beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ return GetDefaultValue( rPH.getHandleByName( aPropertyName ) );
+}
+
+
+// ____ XMultiPropertyStates ____
+
+// Note: getPropertyStates() is already implemented in XPropertyState with the
+// same signature
+
+void SAL_CALL
+ OPropertySet::setAllPropertiesToDefault()
+ throw (uno::RuntimeException)
+{
+ m_pImplProperties->SetAllPropertiesToDefault();
+ firePropertyChangeEvent();
+}
+
+void SAL_CALL
+ OPropertySet::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ sal_Int32 * pHandles = new sal_Int32[ aPropertyNames.getLength() ];
+ rPH.fillHandles( pHandles, aPropertyNames );
+
+ ::std::vector< sal_Int32 > aHandles( pHandles, pHandles + aPropertyNames.getLength());
+ delete[] pHandles;
+
+ m_pImplProperties->SetPropertiesToDefault( aHandles );
+}
+
+Sequence< Any > SAL_CALL
+ OPropertySet::getPropertyDefaults( const Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ::cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+ const sal_Int32 nElements = aPropertyNames.getLength();
+
+ Sequence< Any > aResult( nElements );
+ Any * pResultArray = aResult.getArray();
+ sal_Int32 nI = 0;
+
+ for( ; nI < nElements; ++nI )
+ {
+ pResultArray[ nI ] = GetDefaultValue(
+ rPH.getHandleByName( aPropertyNames[ nI ] ));
+ }
+
+ return aResult;
+}
+
+sal_Bool SAL_CALL OPropertySet::convertFastPropertyValue
+ ( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+ throw (lang::IllegalArgumentException)
+{
+ getFastPropertyValue( rOldValue, nHandle );
+ //accept longs also for short values
+ {
+ sal_Int16 nValue;
+ if( (rOldValue>>=nValue) && !(rValue>>=nValue) )
+ {
+ sal_Int32 n32Value = 0;
+ if( rValue>>=n32Value )
+ {
+ rConvertedValue = uno::makeAny( static_cast<sal_Int16>(n32Value) );
+ return sal_True;
+ }
+
+ sal_Int64 n64Value = 0;
+ if( rValue>>=n64Value )
+ {
+ rConvertedValue = uno::makeAny( static_cast<sal_Int16>(n64Value) );
+ return sal_True;
+ }
+ }
+ }
+ rConvertedValue = rValue;
+ if( !m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault && rOldValue == rConvertedValue )
+ return sal_False;//no change necessary
+ return sal_True;
+}
+
+void SAL_CALL OPropertySet::setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const Any& rValue )
+ throw (uno::Exception)
+{
+#if OSL_DEBUG_LEVEL > 0
+ if( rValue.hasValue())
+ {
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+ OUString aName;
+ rPH.fillPropertyMembersByHandle( &aName, 0, nHandle );
+ OSL_ENSURE( rValue.isExtractableTo( rPH.getPropertyByName( aName ).Type ),
+ "Property type is wrong" );
+ }
+#endif
+
+ Any aDefault;
+ try
+ {
+ aDefault = GetDefaultValue( nHandle );
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ 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 );
+ else
+ m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
+}
+
+void SAL_CALL OPropertySet::getFastPropertyValue
+ ( Any& rValue,
+ sal_Int32 nHandle ) const
+{
+ if( ! m_pImplProperties->GetPropertyValueByHandle( rValue, nHandle ))
+ {
+// OSL_TRACE( "OPropertySet: asking style for property" );
+ // property was not set -> try style
+ uno::Reference< beans::XFastPropertySet > xStylePropSet( m_pImplProperties->GetStyle(), uno::UNO_QUERY );
+ if( xStylePropSet.is() )
+ {
+#ifdef DBG_UTIL
+ {
+ // check if the handle of the style points to the same property
+ // name as the handle in this property set
+ uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY );
+ if( xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo(),
+ uno::UNO_QUERY );
+ if( xInfo.is() )
+ {
+ // for some reason the virtual method getInfoHelper() is
+ // not const
+ ::cppu::IPropertyArrayHelper & rPH =
+ const_cast< OPropertySet * >( this )->getInfoHelper();
+
+ // find the Property with Handle nHandle in Style
+ Sequence< beans::Property > aProps( xInfo->getProperties() );
+ sal_Int32 nI = aProps.getLength() - 1;
+ while( ( nI >= 0 ) && nHandle != aProps[ nI ].Handle )
+ --nI;
+
+ if( nI >= 0 ) // => nHandle == aProps[nI].Handle
+ {
+ // check whether the handle in this property set is
+ // the same as the one in the style
+ beans::Property aProp( rPH.getPropertyByName( aProps[ nI ].Name ) );
+ OSL_ENSURE( nHandle == aProp.Handle,
+ "HandleCheck: Handles for same property differ!" );
+
+ if( nHandle == aProp.Handle )
+ {
+ OSL_ENSURE( aProp.Type == aProps[nI].Type,
+ "HandleCheck: Types differ!" );
+ OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes,
+ "HandleCheck: Attributes differ!" );
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "HandleCheck: Handle not found in Style" );
+ }
+ }
+ else
+ OSL_ENSURE( false, "HandleCheck: Invalid XPropertySetInfo returned" );
+ }
+ else
+ OSL_ENSURE( false, "HandleCheck: XPropertySet not supported" );
+ }
+#endif
+ rValue = xStylePropSet->getFastPropertyValue( nHandle );
+ }
+ else
+ {
+// OSL_TRACE( "OPropertySet: no style => getting default for property" );
+ // there is no style (or the style does not support XFastPropertySet)
+ // => take the default value
+ try
+ {
+ rValue = GetDefaultValue( nHandle );
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ rValue.clear();
+ }
+ }
+ }
+}
+
+void OPropertySet::firePropertyChangeEvent()
+{
+ // nothing in base class
+}
+
+// ____ XStyleSupplier ____
+Reference< style::XStyle > SAL_CALL OPropertySet::getStyle()
+ throw (uno::RuntimeException)
+{
+ return m_pImplProperties->GetStyle();
+}
+
+void SAL_CALL OPropertySet::setStyle( const Reference< style::XStyle >& xStyle )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( ! m_pImplProperties->SetStyle( xStyle ))
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Empty Style" )),
+ static_cast< beans::XPropertySet * >( this ),
+ 0 );
+}
+
+// ____ XFastPropertyState ____
+// beans::PropertyState OPropertySet::SAL_CALL getFastPropertyState( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// return m_pImplProperties->GetPropertyStateByHandle( nHandle );
+// }
+
+// uno::Sequence< beans::PropertyState > OPropertySet::SAL_CALL getFastPropertyStates(
+// const uno::Sequence< sal_Int32 >& aHandles )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// ::std::vector< sal_Int32 > aHandleVec(
+// aHandles.getConstArray(),
+// aHandles.getConstArray() + aHandles.getLength() );
+
+// return m_pImplProperties->GetPropertyStatesByHandle( aHandleVec );
+// }
+
+// void OPropertySet::SAL_CALL setFastPropertyToDefault( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// m_pImplProperties->SetPropertyToDefault( nHandle );
+// }
+
+// uno::Any OPropertySet::SAL_CALL getFastPropertyDefault( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// lang::WrappedTargetException,
+// uno::RuntimeException)
+// {
+// return GetDefaultValue( nHandle );
+// }
+
+// ____ XMultiPropertySet ____
+void SAL_CALL OPropertySet::setPropertyValues(
+ const Sequence< OUString >& PropertyNames, const Sequence< Any >& Values )
+ throw(beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ::cppu::OPropertySetHelper::setPropertyValues( PropertyNames, Values );
+
+ firePropertyChangeEvent();
+}
+
+// ____ XFastPropertySet ____
+void SAL_CALL OPropertySet::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
+ throw(beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::cppu::OPropertySetHelper::setFastPropertyValue( nHandle, rValue );
+
+ firePropertyChangeEvent();
+}
+
+
+} // namespace property
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
new file mode 100644
index 000000000000..0599f9317aed
--- /dev/null
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -0,0 +1,1491 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "AxisHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "DiagramHelper.hxx"
+#include "AxisIndexDefines.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>
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+#include <comphelper/InlineContainer.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+
+static OUString m_aMultiClick( C2U("MultiClick") );
+static OUString m_aDragMethodEquals( C2U("DragMethod=") );
+static OUString m_aDragParameterEquals( C2U("DragParameter=") );
+static OUString m_aProtocol( C2U("CID/") );
+static OUString m_aEmptyString;
+static OUString m_aPieSegmentDragMethodServiceName( C2U("PieSegmentDraging") );
+
+namespace
+{
+
+OUString lcl_createClassificationStringForType( ObjectType eObjectType
+ , const OUString& rDragMethodServiceName
+ , const OUString& rDragParameterString
+ )
+{
+ OUStringBuffer aRet;
+ switch( eObjectType )
+ {
+ //these object types are all selected only after their parents was selected before
+ case OBJECTTYPE_LEGEND_ENTRY: //parent is intended to be OBJECTTYPE_LEGEND
+ case OBJECTTYPE_DATA_POINT: //parent is intended to be OBJECTTYPE_DATA_SERIES
+ case OBJECTTYPE_DATA_LABEL: //parent is intended to be OBJECTTYPE_DATA_LABELS
+ case OBJECTTYPE_DATA_ERRORS_X: //parent is intended to be OBJECTTYPE_DATA_ERRORS
+ case OBJECTTYPE_DATA_ERRORS_Y: //parent is intended to be OBJECTTYPE_DATA_ERRORS
+ case OBJECTTYPE_DATA_ERRORS_Z: //parent is intended to be OBJECTTYPE_DATA_ERRORS
+ aRet=m_aMultiClick;
+ default:
+ ;//empty string
+ }
+ if( rDragMethodServiceName.getLength() )
+ {
+ if( aRet.getLength() )
+ aRet.appendAscii(":");
+ aRet.append( m_aDragMethodEquals );
+ aRet.append( rDragMethodServiceName );
+
+ if( rDragParameterString.getLength() )
+ {
+ if( aRet.getLength() )
+ aRet.appendAscii(":");
+ aRet.append( m_aDragParameterEquals );
+ aRet.append( rDragParameterString );
+ }
+ }
+ return aRet.makeStringAndClear();
+}
+
+typedef ::comphelper::MakeMap< TitleHelper::eTitleType, OUString > tTitleMap;
+const tTitleMap& lcl_getTitleMap()
+{
+ //maps the title type to the ParentParticle for that title
+ static tTitleMap m_aTitleMap = tTitleMap
+ ( TitleHelper::MAIN_TITLE, C2U("") )
+ ( TitleHelper::SUB_TITLE, C2U("D=0") )
+ ( TitleHelper::X_AXIS_TITLE, C2U("D=0:CS=0:Axis=0,0") )
+ ( TitleHelper::Y_AXIS_TITLE, C2U("D=0:CS=0:Axis=1,0") )
+ ( TitleHelper::Z_AXIS_TITLE, C2U("D=0:CS=0:Axis=2,0") )
+ ( TitleHelper::SECONDARY_X_AXIS_TITLE, C2U("D=0:CS=0:Axis=0,1") )
+ ( TitleHelper::SECONDARY_Y_AXIS_TITLE, C2U("D=0:CS=0:Axis=1,1") )
+ ;
+ return m_aTitleMap;
+}
+
+OUString lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType )
+{
+ OUString aRet;
+
+ const tTitleMap& rMap = lcl_getTitleMap();
+ tTitleMap::const_iterator aIt( rMap.find( aTitleType ) );
+ if( aIt != rMap.end())
+ aRet = (*aIt).second;
+
+ return aRet;
+}
+
+Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel >& xChartModel )
+{
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ if(!xDiagram.is())
+ return 0;
+
+ //iterate through all coordinate systems
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( !xCooSysContainer.is())
+ return 0;
+
+ uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+ {
+ //iterate through all chart types in the current coordinate system
+ Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY );
+ if( !xChartTypeContainer.is() )
+ continue;
+
+ uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+ for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+ {
+ Reference< XChartType > xChartType( aChartTypeList[nT] );
+ if(!xChartType.is())
+ continue;
+ OUString aChartType = xChartType->getChartType();
+ if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ return xChartType;
+ }
+ }
+ return 0;
+}
+
+OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& 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();
+}
+
+sal_Int32 lcl_StringToIndex( const OUString& rIndexString )
+{
+ sal_Int32 nRet = -1;
+ if( rIndexString.getLength() )
+ {
+ nRet = rIndexString.toInt32();
+ if( nRet < -1 )
+ nRet = -1;
+ }
+ return nRet;
+}
+
+void lcl_parseCooSysIndices( sal_Int32& rnDiagram, sal_Int32& rnCooSys, const OUString& rString )
+{
+ rnDiagram = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("D=") ) );
+ rnCooSys = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("CS=") ) );
+}
+
+void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, const OUString& rString )
+{
+ OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, C2U(":Axis=") );
+ sal_Int32 nCharacterIndex=0;
+ rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
+ rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
+}
+
+void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString )
+{
+ rnSubGridIndex = -1;
+ rnSubGridIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U(":SubGrid=") ) );
+}
+
+void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesIndex, sal_Int32& rnPointIndex, const OUString& rString )
+{
+ rnChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("CT=") ) );
+ rnSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("Series=") ) );
+ rnPointIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("Point=") ) );
+}
+
+void lcl_getDiagramAndCooSys( const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel
+ , Reference< XDiagram >& xDiagram
+ , Reference< XCoordinateSystem >& 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
+ 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];
+ }
+ }
+}
+
+} //anonymous namespace
+
+ObjectIdentifier::ObjectIdentifier()
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( 0 )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const OUString& rObjectCID )
+ :m_aObjectCID( rObjectCID )
+ ,m_xAdditionalShape( 0 )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape )
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( rxShape )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const Any& rAny )
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( 0 )
+{
+ const uno::Type& rType = rAny.getValueType();
+ if ( rType == ::getCppuType( static_cast< const OUString* >( 0 ) ) )
+ {
+ rAny >>= m_aObjectCID;
+ }
+ else if ( rType == ::getCppuType( static_cast< const Reference< drawing::XShape >* >( 0 ) ) )
+ {
+ rAny >>= m_xAdditionalShape;
+ }
+}
+
+ObjectIdentifier::~ObjectIdentifier()
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const ObjectIdentifier& rOID )
+ :m_aObjectCID( rOID.m_aObjectCID )
+ ,m_xAdditionalShape( rOID.m_xAdditionalShape )
+{
+
+}
+
+ObjectIdentifier& ObjectIdentifier::operator=( const ObjectIdentifier& rOID )
+{
+ m_aObjectCID = rOID.m_aObjectCID;
+ m_xAdditionalShape = rOID.m_xAdditionalShape;
+ return *this;
+}
+
+bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const
+{
+ if ( areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) &&
+ ( m_xAdditionalShape == rOID.m_xAdditionalShape ) )
+ {
+ return true;
+ }
+ return false;
+}
+
+bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const
+{
+ return !operator==( rOID );
+}
+
+bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
+{
+ bool bReturn = false;
+ if ( m_aObjectCID.getLength() && rOID.m_aObjectCID.getLength() )
+ {
+ bReturn = ( m_aObjectCID.compareTo( rOID.m_aObjectCID ) < 0 );
+ }
+ else if ( m_aObjectCID.getLength() )
+ {
+ bReturn = true;
+ }
+ else if ( rOID.m_aObjectCID.getLength() )
+ {
+ bReturn = false;
+ }
+ else if ( m_xAdditionalShape.is() && rOID.m_xAdditionalShape.is() )
+ {
+ bReturn = ( m_xAdditionalShape < rOID.m_xAdditionalShape );
+ }
+ return bReturn;
+}
+
+//static
+OUString ObjectIdentifier::createClassifiedIdentifierForObject(
+ const Reference< uno::XInterface >& xObject
+ , const Reference< frame::XModel >& 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() )
+ {
+ 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;
+
+ }
+
+ //axis
+ Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
+ if( xAxis.is() )
+ {
+ Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) ) );
+ rtl::OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, xChartModel ) );
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ rtl::OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
+ return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
+ }
+
+ //legend
+ Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
+ if( xLegend.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, xChartModel ) );
+ }
+
+ //diagram
+ Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
+ if( xDiagram.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, xChartModel ) );
+ }
+
+ //todo
+ //XDataSeries
+ //CooSys
+ //charttype
+ //datapoint?
+ //Gridproperties
+ }
+ catch( uno::Exception& ex)
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( eObjectType != OBJECTTYPE_UNKNOWN )
+ {
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ else
+ {
+ DBG_ASSERT(false,"give object could not be identifed in createClassifiedIdentifierForObject");
+ }
+
+ return aRet;
+}
+
+//static
+OUString ObjectIdentifier::createClassifiedIdentifierForParticle(
+ const OUString& rParticle )
+{
+ return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() );
+}
+
+//static
+OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
+ const OUString& rParentParticle
+ , const OUString& rChildParticle
+ , const OUString& rDragMethodServiceName
+ , const OUString& 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()>m_aProtocol.getLength())
+ aRet.appendAscii("/");
+
+ if(rParentParticle.getLength())
+ {
+ aRet.append(rParentParticle);
+ if( rChildParticle.getLength() )
+ aRet.appendAscii(":");
+ }
+ aRet.append(rChildParticle);
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createParticleForDiagram(
+ const Reference< XDiagram >& /*xDiagram*/
+ , const Reference< frame::XModel >& /*xChartModel*/ )
+{
+ static OUString aRet(C2U("D=0"));
+ //todo: if more than one diagram is implemeted, add the correct diagram index here
+ return aRet;
+}
+
+//static
+OUString ObjectIdentifier::createParticleForCoordinateSystem(
+ const Reference< XCoordinateSystem >& xCooSys
+ , const Reference< frame::XModel >& xChartModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ 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( xDiagram, xChartModel );
+ aRet.appendAscii(":CS=");
+ aRet.append( OUString::valueOf( nCooSysIndex ) );
+ break;
+ }
+ }
+ }
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createParticleForAxis(
+ sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex )
+{
+ OUStringBuffer aRet(C2U("Axis="));
+
+ aRet.append( OUString::valueOf( nDimensionIndex ) );
+ aRet.appendAscii(",");
+ aRet.append( OUString::valueOf( nAxisIndex ) );
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createParticleForGrid(
+ sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex )
+{
+ OUStringBuffer aRet(C2U("Axis="));
+ aRet.append( OUString::valueOf( nDimensionIndex ) );
+ aRet.appendAscii(",");
+ aRet.append( OUString::valueOf( nAxisIndex ) );
+ aRet.append( C2U(":Grid=0") );
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
+ const Reference< XAxis >& xAxis
+ , const Reference< frame::XModel >& xChartModel
+ , sal_Int32 nSubGridIndex )
+{
+ //-1: main grid, 0: first subgrid etc
+
+ rtl::OUString aAxisCID( createClassifiedIdentifierForObject( xAxis, xChartModel ) );
+ rtl::OUString aGridCID( addChildParticle( aAxisCID
+ , createChildParticleWithIndex( OBJECTTYPE_GRID, 0 ) ) );
+ if( nSubGridIndex >= 0 )
+ {
+ aGridCID = addChildParticle( aGridCID
+ , createChildParticleWithIndex( OBJECTTYPE_SUBGRID, 0 ) );
+ }
+ return aGridCID;
+}
+
+//static
+OUString ObjectIdentifier::createParticleForSeries(
+ sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
+ , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex )
+{
+ OUStringBuffer aRet;
+
+ aRet.appendAscii("D=");
+ aRet.append( OUString::valueOf( nDiagramIndex ) );
+ aRet.appendAscii(":CS=");
+ aRet.append( OUString::valueOf( nCooSysIndex ) );
+ aRet.appendAscii(":CT=");
+ aRet.append( OUString::valueOf( nChartTypeIndex ) );
+ aRet.appendAscii(":");
+ aRet.append(getStringForType( OBJECTTYPE_DATA_SERIES ));
+ aRet.appendAscii("=");
+ aRet.append( OUString::valueOf( nSeriesIndex ) );
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createParticleForLegend(
+ const Reference< XLegend >& /*xLegend*/
+ , const Reference< frame::XModel >& xChartModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ //todo: if more than one diagram is implemeted, find the correct diagram wich is owner of the given legend
+
+ aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel ) );
+ aRet.appendAscii(":");
+ aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
+ aRet.appendAscii("=");
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+OUString ObjectIdentifier::createClassifiedIdentifier(
+ enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
+ , const OUString& rParticleID )//e.g. SeriesID
+{
+ return createClassifiedIdentifierWithParent(
+ eObjectType, rParticleID, m_aEmptyString );
+}
+
+//static
+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
+ )
+ //, 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()>m_aProtocol.getLength())
+ aRet.appendAscii("/");
+ aRet.append(rParentPartical);
+ if(rParentPartical.getLength())
+ aRet.appendAscii(":");
+
+ aRet.append(getStringForType( eObjectType ));
+ aRet.appendAscii("=");
+ aRet.append(rParticleID);
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+const OUString& ObjectIdentifier::getPieSegmentDragMethodServiceName()
+{
+ return m_aPieSegmentDragMethodServiceName;
+}
+
+//static
+OUString ObjectIdentifier::createPieSegmentDragParameterString(
+ sal_Int32 nOffsetPercent
+ , const awt::Point& rMinimumPosition
+ , const awt::Point& rMaximumPosition )
+{
+ OUStringBuffer aRet( OUString::valueOf( nOffsetPercent ) );
+ aRet.append( sal_Unicode( ',' ));
+ aRet.append( OUString::valueOf( rMinimumPosition.X ) );
+ aRet.append( sal_Unicode( ',' ));
+ aRet.append( OUString::valueOf( rMinimumPosition.Y ) );
+ aRet.append( sal_Unicode( ',' ));
+ aRet.append( OUString::valueOf( rMaximumPosition.X ) );
+ aRet.append( sal_Unicode( ',' ));
+ aRet.append( OUString::valueOf( rMaximumPosition.Y ) );
+ return aRet.makeStringAndClear();
+}
+
+//static
+bool ObjectIdentifier::parsePieSegmentDragParameterString(
+ const OUString& rDragParameterString
+ , sal_Int32& rOffsetPercent
+ , awt::Point& rMinimumPosition
+ , awt::Point& rMaximumPosition )
+{
+ OUString aValue;
+ sal_Int32 nCharacterIndex = 0;
+
+ OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) );
+ rOffsetPercent = aValueString.toInt32();
+ if( nCharacterIndex < 0 )
+ return false;
+
+ aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
+ rMinimumPosition.X = aValueString.toInt32();
+ if( nCharacterIndex < 0 )
+ return false;
+
+ aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
+ rMinimumPosition.Y = aValueString.toInt32();
+ if( nCharacterIndex < 0 )
+ return false;
+
+ aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
+ rMaximumPosition.X = aValueString.toInt32();
+ if( nCharacterIndex < 0 )
+ return false;
+
+ aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
+ rMaximumPosition.Y = aValueString.toInt32();
+ if( nCharacterIndex < 0 )
+ return false;
+
+ return true;
+}
+
+//static
+OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID )
+{
+ OUString aRet;
+
+ sal_Int32 nIndexStart = rCID.indexOf( m_aDragMethodEquals );
+ if( nIndexStart != -1 )
+ {
+ nIndexStart = rCID.indexOf( '=', nIndexStart );
+ if( nIndexStart != -1 )
+ {
+ nIndexStart++;
+ sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
+ if( nNextSlash != -1 )
+ {
+ sal_Int32 nIndexEnd = nNextSlash;
+ sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
+ if( nNextColon < nNextSlash )
+ nIndexEnd = nNextColon;
+ aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
+ }
+ }
+ }
+ return aRet;
+}
+
+//static
+OUString ObjectIdentifier::getDragParameterString( const OUString& rCID )
+{
+ OUString aRet;
+
+ sal_Int32 nIndexStart = rCID.indexOf( m_aDragParameterEquals );
+ if( nIndexStart != -1 )
+ {
+ nIndexStart = rCID.indexOf( '=', nIndexStart );
+ if( nIndexStart != -1 )
+ {
+ nIndexStart++;
+ sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
+ if( nNextSlash != -1 )
+ {
+ sal_Int32 nIndexEnd = nNextSlash;
+ sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
+ if( nNextColon < nNextSlash )
+ nIndexEnd = nNextColon;
+ aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
+ }
+ }
+ }
+ return aRet;
+}
+
+//static
+bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
+{
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_TITLE:
+ case OBJECTTYPE_LEGEND:
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ //case OBJECTTYPE_DIAGRAM_WALL:
+ return true;
+ default:
+ OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) );
+ if( aDragMethodServiceName.getLength() )
+ return true;
+ return false;
+ }
+ return false;
+}
+
+bool ObjectIdentifier::isDragableObject()
+{
+ bool bReturn = false;
+ if ( isAutoGeneratedObject() )
+ {
+ bReturn = isDragableObject( m_aObjectCID );
+ }
+ else if ( isAdditionalShape() )
+ {
+ bReturn = true;
+ }
+ return bReturn;
+}
+
+//static
+bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier )
+{
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_DIAGRAM:
+ //case OBJECTTYPE_DIAGRAM_WALL:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+//static
+bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier )
+{
+ //the name of a shape is it's ClassifiedIdentifier
+
+ //a MultiClickObject is an object that is selectable by more than one click only ;
+ //before a MultiClickObject can be selected it is necessary that a named parent group object
+ //was selected before;
+
+ //!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
+ bool bRet = false;
+ bRet = rClassifiedIdentifier.match( m_aMultiClick, m_aProtocol.getLength() );
+ return bRet;
+}
+
+bool ObjectIdentifier::areSiblings( const OUString& rCID1, const OUString& 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
+ bRet=false;
+ else if( nLastSign2 == rCID2.indexOf( '=' ) )//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.getLength() )
+ {
+ OUString aParent2( ObjectIdentifier::getFullParentParticle( rCID2 ) );
+ bRet=aParent1.equals(aParent2);
+ }
+ //legend entries are special:
+ if(!bRet)
+ {
+ if( OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID1)
+ && OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID2) )
+ bRet = true;
+ }
+ }
+ return bRet;
+}
+
+bool ObjectIdentifier::areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 )
+{
+ if( rCID1.equals( 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 )
+ return false;
+
+ OUString aID1( ObjectIdentifier::getObjectID( rCID1 ) );
+ OUString aID2( ObjectIdentifier::getObjectID( rCID2 ) );
+ if( aID1.getLength() && aID1.equals( aID2 ) )
+ return true;
+ }
+ return false;
+}
+
+//static
+OUString ObjectIdentifier::getStringForType( ObjectType eObjectType )
+{
+ OUString aRet;
+ switch( eObjectType )
+ {
+ case OBJECTTYPE_PAGE:
+ aRet=C2U("Page");
+ break;
+ case OBJECTTYPE_TITLE:
+ aRet=C2U("Title");
+ break;
+ case OBJECTTYPE_LEGEND:
+ aRet=C2U("Legend");
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ aRet=C2U("LegendEntry");
+ break;
+ case OBJECTTYPE_DIAGRAM:
+ aRet=C2U("D");
+ break;
+ case OBJECTTYPE_DIAGRAM_WALL:
+ aRet=C2U("DiagramWall");
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ aRet=C2U("DiagramFloor");
+ break;
+ case OBJECTTYPE_AXIS:
+ aRet=C2U("Axis");
+ break;
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ aRet=C2U("AxisUnitLabel");
+ break;
+ case OBJECTTYPE_GRID:
+ aRet=C2U("Grid");
+ break;
+ case OBJECTTYPE_SUBGRID:
+ aRet=C2U("SubGrid");
+ break;
+ case OBJECTTYPE_DATA_SERIES:
+ aRet=C2U("Series");
+ break;
+ case OBJECTTYPE_DATA_POINT:
+ aRet=C2U("Point");
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ aRet=C2U("DataLabels");
+ break;
+ case OBJECTTYPE_DATA_LABEL:
+ aRet=C2U("DataLabel");
+ break;
+ case OBJECTTYPE_DATA_ERRORS:
+ aRet=C2U("Errors");
+ break;
+ case OBJECTTYPE_DATA_ERRORS_X:
+ aRet=C2U("ErrorsX");
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ aRet=C2U("ErrorsY");
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ aRet=C2U("ErrorsZ");
+ break;
+ case OBJECTTYPE_DATA_CURVE:
+ aRet=C2U("Curve");
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ aRet=C2U("Equation");
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ aRet=C2U("Average");
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ aRet=C2U("StockRange");
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ aRet=C2U("StockLoss");
+ break;
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ aRet=C2U("StockGain");
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ ;
+ }
+ return aRet;
+}
+
+//static
+ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
+{
+ ObjectType eRet;
+ sal_Int32 nLastSign = rCID.lastIndexOf( ':' );//last sign before the type string
+ if(nLastSign==-1)
+ nLastSign = rCID.lastIndexOf( '/' );
+ if(nLastSign==-1)
+ {
+ sal_Int32 nEndIndex = rCID.lastIndexOf( '=' );
+ if(nEndIndex==-1)
+ return OBJECTTYPE_UNKNOWN;
+ nLastSign = 0;
+ }
+ if( nLastSign>0 )
+ nLastSign++;
+
+ if( rCID.match(C2U("Page"),nLastSign) )
+ eRet = OBJECTTYPE_PAGE;
+ else if( rCID.match(C2U("Title"),nLastSign) )
+ eRet = OBJECTTYPE_TITLE;
+ else if( rCID.match(C2U("LegendEntry"),nLastSign) )
+ eRet = OBJECTTYPE_LEGEND_ENTRY;
+ else if( rCID.match(C2U("Legend"),nLastSign) )
+ eRet = OBJECTTYPE_LEGEND;
+ else if( rCID.match(C2U("DiagramWall"),nLastSign) )
+ eRet = OBJECTTYPE_DIAGRAM_WALL;
+ else if( rCID.match(C2U("DiagramFloor"),nLastSign) )
+ eRet = OBJECTTYPE_DIAGRAM_FLOOR;
+ else if( rCID.match(C2U("D="),nLastSign) )
+ eRet = OBJECTTYPE_DIAGRAM;
+ else if( rCID.match(C2U("AxisUnitLabel"),nLastSign) )
+ eRet = OBJECTTYPE_AXIS_UNITLABEL;
+ else if( rCID.match(C2U("Axis"),nLastSign) )
+ eRet = OBJECTTYPE_AXIS;
+ else if( rCID.match(C2U("Grid"),nLastSign) )
+ eRet = OBJECTTYPE_GRID;
+ else if( rCID.match(C2U("SubGrid"),nLastSign) )
+ eRet = OBJECTTYPE_SUBGRID;
+ else if( rCID.match(C2U("Series"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_SERIES;
+ else if( rCID.match(C2U("Point"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_POINT;
+ else if( rCID.match(C2U("DataLabels"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_LABELS;
+ else if( rCID.match(C2U("DataLabel"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_LABEL;
+ else if( rCID.match(C2U("ErrorsX"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_ERRORS_X;
+ else if( rCID.match(C2U("ErrorsY"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_ERRORS_Y;
+ else if( rCID.match(C2U("ErrorsZ"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_ERRORS_Z;
+ else if( rCID.match(C2U("Errors"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_ERRORS;
+ else if( rCID.match(C2U("Curve"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_CURVE;
+ else if( rCID.match(C2U("Equation"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_CURVE_EQUATION;
+ else if( rCID.match(C2U("Average"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_AVERAGE_LINE;
+ else if( rCID.match(C2U("StockRange"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_STOCK_RANGE;
+ else if( rCID.match(C2U("StockLoss"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_STOCK_LOSS;
+ else if( rCID.match(C2U("StockGain"),nLastSign) )
+ eRet = OBJECTTYPE_DATA_STOCK_GAIN;
+ else
+ eRet = OBJECTTYPE_UNKNOWN;
+
+ return eRet;
+}
+
+ObjectType ObjectIdentifier::getObjectType()
+{
+ ObjectType eObjectType( OBJECTTYPE_UNKNOWN );
+ if ( isAutoGeneratedObject() )
+ {
+ eObjectType = getObjectType( m_aObjectCID );
+ }
+ else if ( isAdditionalShape() )
+ {
+ eObjectType = OBJECTTYPE_SHAPE;
+ }
+ return eObjectType;
+}
+
+//static
+OUString ObjectIdentifier::createDataCurveCID(
+ const OUString& rSeriesParticle
+ , sal_Int32 nCurveIndex
+ , bool bAverageLine )
+{
+ OUString aParticleID( OUString::valueOf( nCurveIndex ) );
+ ObjectType eType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
+ return createClassifiedIdentifierWithParent( eType, aParticleID, rSeriesParticle );
+}
+
+//static
+OUString ObjectIdentifier::createDataCurveEquationCID(
+ const OUString& rSeriesParticle
+ , sal_Int32 nCurveIndex )
+{
+ OUString aParticleID( OUString::valueOf( nCurveIndex ) );
+ return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION, aParticleID, rSeriesParticle );
+}
+
+//static
+OUString ObjectIdentifier::addChildParticle( const rtl::OUString& rParticle, const rtl::OUString& rChildParticle )
+{
+ OUStringBuffer aRet(rParticle);
+
+ if( aRet.getLength() && rChildParticle.getLength() )
+ aRet.appendAscii(":");
+ if( rChildParticle.getLength() )
+ aRet.append(rChildParticle);
+
+ return aRet.makeStringAndClear();
+}
+
+//static
+rtl::OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex )
+{
+ OUStringBuffer aRet( getStringForType( eObjectType ) );
+ if( aRet.getLength() )
+ {
+ aRet.appendAscii("=");
+ aRet.append(OUString::valueOf(nIndex));
+ }
+ return aRet.makeStringAndClear();
+}
+
+//static
+sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const rtl::OUString& rParticleOrCID )
+{
+ sal_Int32 nRet = -1;
+
+ OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, C2U("=") );
+ sal_Int32 nCharacterIndex=0;
+ nRet = lcl_StringToIndex( aIndexString.getToken( 0, ',', nCharacterIndex ) );
+
+ return nRet;
+}
+
+//static
+OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
+ , const rtl::OUString& rSeriesParticle
+ , const rtl::OUString& rDragMethodServiceName
+ , const rtl::OUString& rDragParameterString )
+{
+ OUString aChildParticle( getStringForType( eSubObjectType ) );
+ aChildParticle+=(C2U("="));
+
+ return createClassifiedIdentifierForParticles(
+ rSeriesParticle, aChildParticle
+ , rDragMethodServiceName, rDragParameterString );
+}
+
+//static
+OUString ObjectIdentifier::createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex )
+{
+ OUString aRet(rPointCID_Stub);
+ return aRet+=OUString::valueOf( nIndex );
+}
+
+//static
+OUString ObjectIdentifier::getParticleID( const OUString& rCID )
+{
+ OUString aRet;
+ sal_Int32 nLast = rCID.lastIndexOf('=');
+ if(nLast>=0)
+ aRet = rCID.copy(++nLast);
+ return aRet;
+}
+
+//static
+OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID )
+{
+ OUString aRet;
+
+ sal_Int32 nStartPos = rCID.lastIndexOf('/');
+ if( nStartPos>=0 )
+ {
+ nStartPos++;
+ sal_Int32 nEndPos = rCID.lastIndexOf(':');
+ if( nEndPos>=0 && nStartPos < nEndPos )
+ {
+ aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
+ }
+ }
+
+ return aRet;
+}
+
+//static
+OUString ObjectIdentifier::getObjectID( const rtl::OUString& rCID )
+{
+ OUString aRet;
+
+ sal_Int32 nStartPos = rCID.lastIndexOf('/');
+ if( nStartPos>=0 )
+ {
+ nStartPos++;
+ sal_Int32 nEndPos = rCID.getLength();
+ aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
+ }
+
+ return aRet;
+}
+
+//static
+bool ObjectIdentifier::isCID( const OUString& rName )
+{
+ return rName.getLength() && rName.match( m_aProtocol );
+}
+
+Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
+ const OUString& rObjectCID,
+ const Reference< chart2::XChartDocument >& xChartDocument )
+{
+ return ObjectIdentifier::getObjectPropertySet(
+ rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY ));
+}
+
+//static
+Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
+ const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+{
+ //return the model object that is indicated by rObjectCID
+ if(!rObjectCID.getLength())
+ return NULL;
+ if(!xChartModel.is())
+ return NULL;
+
+ Reference< beans::XPropertySet > xObjectProperties = NULL;
+ try
+ {
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
+ OUString aParticleID = ObjectIdentifier::getParticleID( rObjectCID );
+
+ Reference< XDiagram > xDiagram;
+ Reference< XCoordinateSystem > 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() );
+ }
+ break;
+ case OBJECTTYPE_TITLE:
+ {
+ TitleHelper::eTitleType aTitleType = getTitleTypeForCID( rObjectCID );
+ Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
+ xObjectProperties.set( xTitle, uno::UNO_QUERY );
+ }
+ break;
+ case OBJECTTYPE_LEGEND:
+ {
+ if( xDiagram.is() )
+ xObjectProperties.set( xDiagram->getLegend(), uno::UNO_QUERY );
+ }
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ break;
+ case OBJECTTYPE_DIAGRAM:
+ {
+ xObjectProperties.set( xDiagram, uno::UNO_QUERY );
+ }
+ break;
+ case OBJECTTYPE_DIAGRAM_WALL:
+ {
+ if( xDiagram.is() )
+ xObjectProperties.set( xDiagram->getWall() );
+ }
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ {
+ if( xDiagram.is() )
+ xObjectProperties.set( xDiagram->getFloor() );
+ }
+ break;
+ case OBJECTTYPE_AXIS:
+ {
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
+
+ Reference< chart2::XAxis > xAxis(
+ AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
+ if( xAxis.is() )
+ xObjectProperties.set( xAxis, uno::UNO_QUERY );
+ }
+ break;
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ break;
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ {
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
+
+ sal_Int32 nSubGridIndex = -1;
+ lcl_parseGridIndices( nSubGridIndex, rObjectCID );
+
+ xObjectProperties.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, nAxisIndex, nSubGridIndex ) );
+ }
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_SERIES:
+ {
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel ) );
+ if( xSeries.is() )
+ xObjectProperties = Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY );
+
+ break;
+ }
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_POINT:
+ {
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel ) );
+ if(xSeries.is())
+ {
+ sal_Int32 nIndex = aParticleID.toInt32();
+ xObjectProperties = xSeries->getDataPointByIndex( nIndex );
+ }
+ break;
+ }
+ case OBJECTTYPE_DATA_ERRORS:
+ {
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel ) );
+ if(xSeries.is())
+ {
+ Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xErrorBarProp;
+ if( xSeriesProp.is() )
+ {
+ xSeriesProp->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProp;
+ xObjectProperties = Reference< beans::XPropertySet >( xErrorBarProp, uno::UNO_QUERY );
+ }
+ }
+ break;
+ }
+ case OBJECTTYPE_DATA_ERRORS_X:
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ break;
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ Reference< XRegressionCurveContainer > xRegressionContainer( ObjectIdentifier::getDataSeriesForCID(
+ rObjectCID, xChartModel ), uno::UNO_QUERY );
+ if(xRegressionContainer.is())
+ {
+ sal_Int32 nIndex = aParticleID.toInt32();
+ uno::Sequence< Reference< XRegressionCurve > > aCurveList =
+ xRegressionContainer->getRegressionCurves();
+ if( nIndex >= 0 && nIndex <aCurveList.getLength() )
+ {
+ if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ xObjectProperties.set( aCurveList[nIndex]->getEquationProperties());
+ else
+ xObjectProperties.set( aCurveList[nIndex], uno::UNO_QUERY );
+ }
+ }
+ break;
+ }
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ 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( C2U( "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( C2U( "WhiteDay" ) ) >>= xObjectProperties;
+ }
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ break;
+ }
+ }
+ catch( uno::Exception& ex)
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xObjectProperties;
+}
+
+//static
+Reference< XAxis > ObjectIdentifier::getAxisForCID(
+ const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+{
+ Reference< XDiagram > xDiagram;
+ Reference< XCoordinateSystem > xCooSys;
+ lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
+
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
+
+ return AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys );
+}
+
+//static
+Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
+ const OUString& rObjectCID
+ , const Reference< frame::XModel >& xChartModel )
+{
+ Reference< XDataSeries > xSeries(NULL);
+
+ Reference< XDiagram > xDiagram;
+ Reference< XCoordinateSystem > xCooSys;
+ lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
+
+ sal_Int32 nChartTypeIndex = -1;
+ sal_Int32 nSeriesIndex = -1;
+ sal_Int32 nPointIndex = -1;
+ lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rObjectCID );
+
+ Reference< XDataSeriesContainer > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ), uno::UNO_QUERY );
+ if( xDataSeriesContainer.is() )
+ {
+ uno::Sequence< uno::Reference< XDataSeries > > aDataSeriesSeq( xDataSeriesContainer->getDataSeries() );
+ if( nSeriesIndex >= 0 && nSeriesIndex < aDataSeriesSeq.getLength() )
+ xSeries.set( aDataSeriesSeq[nSeriesIndex] );
+ }
+
+ return xSeries;
+}
+
+//static
+Reference< XDiagram > ObjectIdentifier::getDiagramForCID(
+ const rtl::OUString& rObjectCID
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ Reference< XDiagram > xDiagram;
+
+ Reference< XCoordinateSystem > xCooSys;
+ lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
+
+ return xDiagram;
+}
+
+TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rCID )
+{
+ TitleHelper::eTitleType eRet( TitleHelper::MAIN_TITLE );
+
+ OUString aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
+ const tTitleMap& rMap = lcl_getTitleMap();
+ tTitleMap::const_iterator aIt( rMap.begin() );
+ for( ;aIt != rMap.end(); ++aIt )
+ {
+ if( aParentParticle.equals( (*aIt).second ) )
+ {
+ eRet = (*aIt).first;
+ break;
+ }
+ }
+
+ return eRet;
+}
+
+// static
+OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID )
+{
+ sal_Int32 nDiagramIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rCID );
+
+ sal_Int32 nChartTypeIndex = -1;
+ sal_Int32 nSeriesIndex = -1;
+ sal_Int32 nPointIndex = -1;
+ lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rCID );
+
+ return ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
+}
+
+//static
+OUString ObjectIdentifier::getMovedSeriesCID( const ::rtl::OUString& rObjectCID, sal_Bool bForward )
+{
+ sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CID/D=") ) );
+ sal_Int32 nCooSysIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CS=") ) );
+ sal_Int32 nChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CT=") ) );
+ sal_Int32 nSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("Series=") ) );
+
+ if( bForward )
+ nSeriesIndex--;
+ else
+ nSeriesIndex++;
+
+ OUString aRet = ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
+ return ObjectIdentifier::createClassifiedIdentifierForParticle( aRet );
+}
+
+bool ObjectIdentifier::isValid() const
+{
+ return ( isAutoGeneratedObject() || isAdditionalShape() );
+}
+
+bool ObjectIdentifier::isAutoGeneratedObject() const
+{
+ return ( m_aObjectCID.getLength() > 0 );
+}
+
+bool ObjectIdentifier::isAdditionalShape() const
+{
+ return m_xAdditionalShape.is();
+}
+
+OUString ObjectIdentifier::getObjectCID() const
+{
+ return m_aObjectCID;
+}
+
+Reference< drawing::XShape > ObjectIdentifier::getAdditionalShape() const
+{
+ return m_xAdditionalShape;
+}
+
+Any ObjectIdentifier::getAny() const
+{
+ Any aAny;
+ if ( isAutoGeneratedObject() )
+ {
+ aAny = uno::makeAny( getObjectCID() );
+ }
+ else if ( isAdditionalShape() )
+ {
+ aAny = uno::makeAny( getAdditionalShape() );
+ }
+ return aAny;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..b1d10424b9a1
--- /dev/null
+++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PotentialRegressionCurveCalculator.hxx"
+#include "macros.hxx"
+#include "RegressionCalculationHelper.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+namespace chart
+{
+
+PotentialRegressionCurveCalculator::PotentialRegressionCurveCalculator() :
+ m_fSlope( 0.0 ),
+ m_fIntercept( 0.0 )
+{
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+}
+
+PotentialRegressionCurveCalculator::~PotentialRegressionCurveCalculator()
+{}
+
+// ____ XRegressionCurveCalculator ____
+void SAL_CALL PotentialRegressionCurveCalculator::recalculateRegression(
+ const uno::Sequence< double >& aXValues,
+ const uno::Sequence< double >& aYValues )
+ throw (uno::RuntimeException)
+{
+ RegressionCalculationHelper::tDoubleVectorPair aValues(
+ RegressionCalculationHelper::cleanup(
+ aXValues, aYValues,
+ RegressionCalculationHelper::isValidAndBothPositive()));
+
+ const size_t nMax = aValues.first.size();
+ if( nMax == 0 )
+ {
+ ::rtl::math::setNan( & m_fSlope );
+ ::rtl::math::setNan( & m_fIntercept );
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+ return;
+ }
+
+ double fAverageX = 0.0, fAverageY = 0.0;
+ size_t i = 0;
+ for( i = 0; i < nMax; ++i )
+ {
+ fAverageX += log( aValues.first[i] );
+ fAverageY += log( aValues.second[i] );
+ }
+
+ const double fN = static_cast< double >( nMax );
+ fAverageX /= fN;
+ fAverageY /= fN;
+
+ double fQx = 0.0, fQy = 0.0, fQxy = 0.0;
+ for( i = 0; i < nMax; ++i )
+ {
+ double fDeltaX = log( aValues.first[i] ) - fAverageX;
+ double fDeltaY = log( aValues.second[i] ) - fAverageY;
+
+ fQx += fDeltaX * fDeltaX;
+ fQy += fDeltaY * fDeltaY;
+ fQxy += fDeltaX * fDeltaY;
+ }
+
+ m_fSlope = fQxy / fQx;
+ m_fIntercept = fAverageY - m_fSlope * fAverageX;
+ m_fCorrelationCoeffitient = fQxy / sqrt( fQx * fQy );
+
+ m_fIntercept = exp( m_fIntercept );
+}
+
+double SAL_CALL PotentialRegressionCurveCalculator::getCurveValue( double x )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+
+ if( ! ( ::rtl::math::isNan( m_fSlope ) ||
+ ::rtl::math::isNan( m_fIntercept )))
+ {
+ fResult = m_fIntercept * pow( x, m_fSlope );
+ }
+
+ return fResult;
+}
+
+uno::Sequence< geometry::RealPoint2D > SAL_CALL PotentialRegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const uno::Reference< chart2::XScaling >& xScalingX,
+ const uno::Reference< chart2::XScaling >& xScalingY,
+ ::sal_Bool bMaySkipPointsInCalculation )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( bMaySkipPointsInCalculation &&
+ isLogarithmicScaling( xScalingX ) &&
+ isLogarithmicScaling( xScalingY ))
+ {
+ // optimize result
+ uno::Sequence< geometry::RealPoint2D > aResult( 2 );
+ aResult[0].X = min;
+ aResult[0].Y = this->getCurveValue( min );
+ aResult[1].X = max;
+ aResult[1].Y = this->getCurveValue( max );
+
+ return aResult;
+ }
+ return RegressionCurveCalculator::getCurveValues( min, max, nPointCount, xScalingX, xScalingY, bMaySkipPointsInCalculation );
+}
+
+OUString PotentialRegressionCurveCalculator::ImplGetRepresentation(
+ const uno::Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey ) const
+{
+ OUStringBuffer aBuf( C2U( "f(x) = " ));
+
+ if( m_fIntercept == 0.0 )
+ {
+ aBuf.append( sal_Unicode( '0' ));
+ }
+ else if( m_fSlope == 0.0 )
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ }
+ else
+ {
+ if( ! rtl::math::approxEqual( m_fIntercept, 1.0 ) )
+ {
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fIntercept ));
+ aBuf.append( sal_Unicode( ' ' ));
+ }
+ if( m_fSlope != 0.0 )
+ {
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "x^" ));
+ aBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope ));
+ }
+ }
+
+ return aBuf.makeStringAndClear();
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/PropertyHelper.cxx b/chart2/source/tools/PropertyHelper.cxx
new file mode 100644
index 000000000000..dd0a1ad6cf2f
--- /dev/null
+++ b/chart2/source/tools/PropertyHelper.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PropertyHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace
+{
+struct lcl_EqualsElement : public ::std::unary_function< OUString, bool >
+{
+ explicit lcl_EqualsElement( const Any & rValue, const Reference< container::XNameAccess > & xAccess )
+ : m_aValue( rValue ), m_xAccess( xAccess )
+ {
+ OSL_ASSERT( m_xAccess.is());
+ }
+
+ bool operator() ( const OUString & rName )
+ {
+ try
+ {
+ return (m_xAccess->getByName( rName ) == m_aValue);
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return false;
+ }
+
+private:
+ Any m_aValue;
+ Reference< container::XNameAccess > m_xAccess;
+};
+
+struct lcl_StringMatches : public ::std::unary_function< OUString ,bool >
+{
+ lcl_StringMatches( const OUString & rCmpStr ) :
+ m_aCmpStr( rCmpStr )
+ {}
+
+ bool operator() ( const OUString & rStr )
+ {
+ return rStr.match( m_aCmpStr );
+ }
+
+private:
+ OUString m_aCmpStr;
+};
+
+struct lcl_OUStringRestToInt32 : public ::std::unary_function< OUString, sal_Int32 >
+{
+ lcl_OUStringRestToInt32( sal_Int32 nPrefixLength ) :
+ m_nPrefixLength( nPrefixLength )
+ {}
+ sal_Int32 operator() ( const OUString & rStr )
+ {
+ if( m_nPrefixLength > rStr.getLength() )
+ return 0;
+ return rStr.copy( m_nPrefixLength ).toInt32( 10 /* radix */ );
+ }
+private:
+ sal_Int32 m_nPrefixLength;
+};
+
+/** adds a fill gradient, fill hatch, fill bitmap, fill transparency gradient,
+ line dash or line marker to the corresponding name container with a unique
+ name.
+
+ @param rPrefix
+ The prefix used for automated name generation.
+
+ @param rPreferredName
+ If this string is not empty it is used as name if it is unique in the
+ table. Otherwise a new name is generated using pPrefix.
+
+ @return the new name under which the property was stored in the table
+*/
+OUString lcl_addNamedPropertyUniqueNameToTable(
+ const Any & rValue,
+ const Reference< container::XNameContainer > & xNameContainer,
+ const OUString & rPrefix,
+ const OUString & rPreferredName )
+{
+ if( ! xNameContainer.is() ||
+ ! rValue.hasValue() ||
+ ( rValue.getValueType() != xNameContainer->getElementType()))
+ return rPreferredName;
+
+ try
+ {
+ Reference< container::XNameAccess > xNameAccess( xNameContainer, uno::UNO_QUERY_THROW );
+ ::std::vector< OUString > aNames( ::chart::ContainerHelper::SequenceToVector( xNameAccess->getElementNames()));
+ ::std::vector< OUString >::const_iterator aIt(
+ ::std::find_if( aNames.begin(), aNames.end(), lcl_EqualsElement( rValue, xNameAccess )));
+
+ // element not found in container
+ if( aIt == aNames.end())
+ {
+ OUString aUniqueName;
+
+ // check if preferred name is already used
+ if( rPreferredName.getLength())
+ {
+ aIt = ::std::find( aNames.begin(), aNames.end(), rPreferredName );
+ if( aIt == aNames.end())
+ aUniqueName = rPreferredName;
+ }
+
+ if( ! aUniqueName.getLength())
+ {
+ // 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::valueOf( nIndex );
+ }
+
+ OSL_ASSERT( aUniqueName.getLength());
+ xNameContainer->insertByName( aUniqueName, rValue );
+ return aUniqueName;
+ }
+ else
+ // element found => return name
+ return *aIt;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return rPreferredName;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace PropertyHelper
+{
+
+OUString addLineDashUniqueNameToTable(
+ const Any & rValue,
+ const Reference< lang::XMultiServiceFactory > & xFact,
+ const OUString & rPreferredName )
+{
+ if( xFact.is())
+ {
+ Reference< container::XNameContainer > xNameCnt(
+ xFact->createInstance( C2U( "com.sun.star.drawing.DashTable" )),
+ uno::UNO_QUERY );
+ if( xNameCnt.is())
+ return lcl_addNamedPropertyUniqueNameToTable(
+ rValue, xNameCnt, C2U( "ChartDash " ), rPreferredName );
+ }
+ return OUString();
+}
+
+OUString addGradientUniqueNameToTable(
+ const Any & rValue,
+ const Reference< lang::XMultiServiceFactory > & xFact,
+ const OUString & rPreferredName )
+{
+ if( xFact.is())
+ {
+ Reference< container::XNameContainer > xNameCnt(
+ xFact->createInstance( C2U( "com.sun.star.drawing.GradientTable" )),
+ uno::UNO_QUERY );
+ if( xNameCnt.is())
+ return lcl_addNamedPropertyUniqueNameToTable(
+ rValue, xNameCnt, C2U( "ChartGradient " ), rPreferredName );
+ }
+ return OUString();
+}
+
+
+OUString addTransparencyGradientUniqueNameToTable(
+ const Any & rValue,
+ const Reference< lang::XMultiServiceFactory > & xFact,
+ const OUString & rPreferredName )
+{
+ if( xFact.is())
+ {
+ Reference< container::XNameContainer > xNameCnt(
+ xFact->createInstance( C2U( "com.sun.star.drawing.TransparencyGradientTable" )),
+ uno::UNO_QUERY );
+ if( xNameCnt.is())
+ return lcl_addNamedPropertyUniqueNameToTable(
+ rValue, xNameCnt, C2U( "ChartTransparencyGradient " ), rPreferredName );
+ }
+ return OUString();
+}
+
+OUString addHatchUniqueNameToTable(
+ const Any & rValue,
+ const Reference< lang::XMultiServiceFactory > & xFact,
+ const OUString & rPreferredName )
+{
+ if( xFact.is())
+ {
+ Reference< container::XNameContainer > xNameCnt(
+ xFact->createInstance( C2U( "com.sun.star.drawing.HatchTable" )),
+ uno::UNO_QUERY );
+ if( xNameCnt.is())
+ return lcl_addNamedPropertyUniqueNameToTable(
+ rValue, xNameCnt, C2U( "ChartHatch " ), rPreferredName );
+ }
+ return OUString();
+}
+
+OUString addBitmapUniqueNameToTable(
+ const Any & rValue,
+ const Reference< lang::XMultiServiceFactory > & xFact,
+ const OUString & rPreferredName )
+{
+ if( xFact.is())
+ {
+ Reference< container::XNameContainer > xNameCnt(
+ xFact->createInstance( C2U( "com.sun.star.drawing.BitmapTable" )),
+ uno::UNO_QUERY );
+ if( xNameCnt.is())
+ return lcl_addNamedPropertyUniqueNameToTable(
+ rValue, xNameCnt, C2U( "ChartBitmap " ), rPreferredName );
+ }
+ return OUString();
+}
+
+// ----------------------------------------
+
+void setPropertyValueAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const uno::Any & rAny )
+{
+ tPropertyValueMap::iterator aIt( rOutMap.find( key ));
+ if( aIt == rOutMap.end())
+ rOutMap.insert( tPropertyValueMap::value_type( key, rAny ));
+ else
+ (*aIt).second = rAny;
+}
+
+template<>
+ void setPropertyValue< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny )
+{
+ setPropertyValueAny( rOutMap, key, rAny );
+}
+
+void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const uno::Any & rAny )
+{
+ OSL_ENSURE( rOutMap.end() == rOutMap.find( key ), "Default already exists for property" );
+ setPropertyValue( rOutMap, key, rAny );
+}
+
+template<>
+ void setPropertyValueDefault< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny )
+{
+ setPropertyValueDefaultAny( rOutMap, key, rAny );
+}
+
+
+void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key )
+{
+ setPropertyValueDefault( rOutMap, key, uno::Any());
+}
+
+} // namespace PropertyHelper
+
+} // namespace chart
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
new file mode 100644
index 000000000000..1565344923b1
--- /dev/null
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RangeHighlighter.hxx"
+#include "WeakListenerAdapter.hxx"
+#include "ChartModelHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DataSeriesHelper.hxx"
+
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#define PREFERED_DEFAULT_COLOR 0x0000ff
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+
+void lcl_fillRanges(
+ Sequence< chart2::data::HighlightedRange > & rOutRanges,
+ Sequence< OUString > aRangeStrings,
+ sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR,
+ sal_Int32 nIndex = -1 )
+{
+ rOutRanges.realloc( aRangeStrings.getLength());
+ for( sal_Int32 i=0; i<aRangeStrings.getLength(); ++i )
+ {
+ rOutRanges[i].RangeRepresentation = aRangeStrings[i];
+ rOutRanges[i].PreferredColor = nPreferredColor;
+ rOutRanges[i].AllowMerginigWithOtherRanges = sal_False;
+ rOutRanges[i].Index = nIndex;
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+RangeHighlighter::RangeHighlighter(
+ const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
+ impl::RangeHighlighter_Base( m_aMutex ),
+ m_xSelectionSupplier( xSelectionSupplier ),
+ m_nAddedListenerCount( 0 ),
+ m_bIncludeHiddenCells(true)
+{
+}
+
+RangeHighlighter::~RangeHighlighter()
+{}
+
+// ____ XRangeHighlighter ____
+Sequence< chart2::data::HighlightedRange > SAL_CALL RangeHighlighter::getSelectedRanges()
+ throw (uno::RuntimeException)
+{
+ return m_aSelectedRanges;
+}
+
+void RangeHighlighter::determineRanges()
+{
+ m_aSelectedRanges.realloc( 0 );
+ if( m_xSelectionSupplier.is())
+ {
+ 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 );
+
+ uno::Any aSelection( m_xSelectionSupplier->getSelection());
+ const uno::Type& rType = aSelection.getValueType();
+
+ if ( rType == ::getCppuType( static_cast< const OUString* >( 0 ) ) )
+ {
+ // @todo??: maybe getSelection() should return a model object rather than a CID
+
+ OUString aCID;
+ aSelection >>= aCID;
+ if ( aCID.getLength() > 0 )
+ {
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
+ sal_Int32 nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aCID );
+ Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, xChartModel ) );
+ if( OBJECTTYPE_LEGEND_ENTRY == eObjectType )
+ {
+ OUString aParentParticel( ObjectIdentifier::getFullParentParticle( aCID ) );
+ ObjectType eParentObjectType = ObjectIdentifier::getObjectType( aParentParticel );
+ eObjectType = eParentObjectType;
+ if( OBJECTTYPE_DATA_POINT == eObjectType )
+ nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aParentParticel );
+ }
+
+ if( OBJECTTYPE_DATA_POINT == eObjectType || OBJECTTYPE_DATA_LABEL == eObjectType )
+ {
+ // Data Point
+ fillRangesForDataPoint( xDataSeries, nIndex );
+ return;
+ }
+ else if( OBJECTTYPE_DATA_ERRORS == eObjectType )
+ {
+ // select error bar ranges, or data series, if the style is
+ // not set to FROM_DATA
+ fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), xDataSeries );
+ return;
+ }
+ else if( xDataSeries.is() )
+ {
+ // Data Series
+ fillRangesForDataSeries( xDataSeries );
+ return;
+ }
+ else if( OBJECTTYPE_AXIS == eObjectType )
+ {
+ // Axis (Categories)
+ Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), uno::UNO_QUERY );
+ if( xAxis.is())
+ {
+ fillRangesForCategories( xAxis );
+ return;
+ }
+ }
+ else if( OBJECTTYPE_PAGE == eObjectType
+ || OBJECTTYPE_DIAGRAM == eObjectType
+ || OBJECTTYPE_DIAGRAM_WALL == eObjectType
+ || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType
+ )
+ {
+ // Diagram
+ Reference< chart2::XDiagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, xChartModel ) );
+ if( xDia.is())
+ {
+ fillRangesForDiagram( xDia );
+ return;
+ }
+ }
+ }
+ }
+ else if ( rType == ::getCppuType( static_cast< const Reference< drawing::XShape >* >( 0 ) ) )
+ {
+ // #i12587# support for shapes in chart
+ Reference< drawing::XShape > xShape;
+ aSelection >>= xShape;
+ if ( xShape.is() )
+ {
+ return;
+ }
+ }
+ else
+ {
+ //if nothing is selected select all ranges
+ Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY_THROW );
+ fillRangesForDiagram( xChartDoc->getFirstDiagram() );
+ return;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void RangeHighlighter::fillRangesForDiagram( const Reference< chart2::XDiagram > & xDiagram )
+{
+ Sequence< OUString > aSelectedRanges( DataSourceHelper::getUsedDataRanges( xDiagram ));
+ m_aSelectedRanges.realloc( aSelectedRanges.getLength());
+ // @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 = PREFERED_DEFAULT_COLOR;
+ m_aSelectedRanges[i].AllowMerginigWithOtherRanges = sal_True;
+ }
+}
+
+void RangeHighlighter::fillRangesForDataSeries( const uno::Reference< chart2::XDataSeries > & xSeries )
+{
+ sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
+ if( xSource.is())
+ lcl_fillRanges( m_aSelectedRanges,
+ ::chart::DataSourceHelper::getRangesFromDataSource( xSource ),
+ nPreferredColor );
+}
+
+void RangeHighlighter::fillRangesForErrorBars(
+ const uno::Reference< beans::XPropertySet > & xErrorBar,
+ const uno::Reference< chart2::XDataSeries > & xSeries )
+{
+ // only show error bar ranges, if the style is set to FROM_DATA
+ bool bUsesRangesAsErrorBars = false;
+ try
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ bUsesRangesAsErrorBars =
+ ( xErrorBar.is() &&
+ (xErrorBar->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle) &&
+ nStyle == ::com::sun::star::chart::ErrorBarStyle::FROM_DATA );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( bUsesRangesAsErrorBars )
+ {
+ sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
+ Reference< chart2::data::XDataSource > xSource( xErrorBar, uno::UNO_QUERY );
+ if( xSource.is())
+ lcl_fillRanges( m_aSelectedRanges,
+ ::chart::DataSourceHelper::getRangesFromDataSource( xSource ),
+ nPreferredColor );
+ }
+ else
+ {
+ fillRangesForDataSeries( xSeries );
+ }
+}
+
+void RangeHighlighter::fillRangesForCategories( const Reference< chart2::XAxis > & xAxis )
+{
+ if( ! xAxis.is())
+ return;
+ chart2::ScaleData aData( xAxis->getScaleData());
+ lcl_fillRanges( m_aSelectedRanges,
+ DataSourceHelper::getRangesFromLabeledDataSequence( aData.Categories ));
+}
+
+void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface > & xDataSeries, sal_Int32 nIndex )
+{
+ sal_Int32 nPreferredColor = PREFERED_DEFAULT_COLOR;
+ if( xDataSeries.is())
+ {
+ Reference< chart2::data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY );
+ if( xSource.is() )
+ {
+ ::std::vector< chart2::data::HighlightedRange > aHilightedRanges;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences());
+ for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i )
+ {
+ Reference< chart2::data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel());
+ Reference< chart2::data::XDataSequence > xValues( aLSeqSeq[i]->getValues());
+
+ if( xLabel.is())
+ aHilightedRanges.push_back(
+ chart2::data::HighlightedRange(
+ xLabel->getSourceRangeRepresentation(),
+ -1,
+ nPreferredColor,
+ sal_False ));
+
+ sal_Int32 nUnhiddenIndex = DataSeriesHelper::translateIndexFromHiddenToFullSequence( nIndex, xValues, !m_bIncludeHiddenCells );
+ if( xValues.is())
+ aHilightedRanges.push_back(
+ chart2::data::HighlightedRange(
+ xValues->getSourceRangeRepresentation(),
+ nUnhiddenIndex,
+ nPreferredColor,
+ sal_False ));
+ }
+ m_aSelectedRanges = ContainerHelper::ContainerToSequence( aHilightedRanges );
+ }
+ }
+}
+
+void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ if(!xListener.is())
+ return;
+
+ if( m_nAddedListenerCount == 0 )
+ startListening();
+ rBHelper.addListener( ::getCppuType( & xListener ), xListener);
+ ++m_nAddedListenerCount;
+
+ //bring the new listener up to the current state
+ lang::EventObject aEvent( static_cast< lang::XComponent* >( this ) );
+ xListener->selectionChanged( aEvent );
+}
+
+void SAL_CALL RangeHighlighter::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ rBHelper.removeListener( ::getCppuType( & xListener ), xListener );
+ --m_nAddedListenerCount;
+ if( m_nAddedListenerCount == 0 )
+ stopListening();
+}
+
+// ____ XSelectionChangeListener ____
+void SAL_CALL RangeHighlighter::selectionChanged( const lang::EventObject& /*aEvent*/ )
+ throw (uno::RuntimeException)
+{
+ determineRanges();
+
+ // determine ranges of selected view objects
+ // if changed, fire an event
+ fireSelectionEvent();
+}
+
+void RangeHighlighter::fireSelectionEvent()
+{
+ ::cppu::OInterfaceContainerHelper* pIC = rBHelper.getContainer(
+ ::getCppuType((const uno::Reference< view::XSelectionChangeListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+}
+
+void SAL_CALL RangeHighlighter::disposing( const lang::EventObject& Source )
+ throw (uno::RuntimeException)
+{
+ if( Source.Source == m_xSelectionSupplier )
+ {
+ m_xSelectionSupplier.clear();
+ m_aSelectedRanges.realloc( 0 );
+ fireSelectionEvent();
+ }
+}
+
+void RangeHighlighter::startListening()
+{
+ if( m_xSelectionSupplier.is())
+ {
+ if( ! m_xListener.is())
+ {
+ m_xListener.set( new WeakSelectionChangeListenerAdapter( this ));
+ determineRanges();
+ }
+ m_xSelectionSupplier->addSelectionChangeListener( m_xListener );
+ }
+}
+
+void RangeHighlighter::stopListening()
+{
+ if( m_xSelectionSupplier.is() && m_xListener.is())
+ {
+ m_xSelectionSupplier->removeSelectionChangeListener( m_xListener );
+ m_xListener.clear();
+ }
+}
+
+
+// ____ WeakComponentImplHelperBase ____
+// is called when dispose() is called at this component
+void SAL_CALL RangeHighlighter::disposing()
+{
+ // @todo: remove listener. Currently the controller shows an assertion
+ // because it is already disposed
+// stopListening();
+ m_xListener.clear();
+ m_xSelectionSupplier.clear();
+ m_nAddedListenerCount = 0;
+ m_aSelectedRanges.realloc( 0 );
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx
new file mode 100644
index 000000000000..5a37f4980323
--- /dev/null
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -0,0 +1,378 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ReferenceSizeProvider.hxx"
+#include "RelativeSizeHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "DataSeriesHelper.hxx"
+
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+// ================================================================================
+
+namespace chart
+{
+
+ReferenceSizeProvider::ReferenceSizeProvider(
+ awt::Size aPageSize,
+ const Reference< XChartDocument > & xChartDoc ) :
+ m_aPageSize( aPageSize ),
+ m_xChartDoc( xChartDoc ),
+ m_bUseAutoScale( getAutoResizeState( xChartDoc ) == AUTO_RESIZE_YES )
+{}
+
+awt::Size ReferenceSizeProvider::getPageSize() const
+{
+ return m_aPageSize;
+}
+
+bool ReferenceSizeProvider::useAutoScale() const
+{
+ return m_bUseAutoScale;
+}
+
+void ReferenceSizeProvider::impl_setValuesAtTitled(
+ const Reference< XTitled > & xTitled )
+{
+ if( xTitled.is())
+ {
+ Reference< XTitle > xTitle( xTitled->getTitleObject());
+ if( xTitle.is())
+ setValuesAtTitle( xTitle );
+ }
+}
+
+void ReferenceSizeProvider::setValuesAtTitle(
+ const Reference< XTitle > & xTitle )
+{
+ try
+ {
+ Reference< beans::XPropertySet > xTitleProp( xTitle, uno::UNO_QUERY_THROW );
+ awt::Size aOldRefSize;
+ bool bHasOldRefSize(
+ xTitleProp->getPropertyValue( C2U("ReferencePageSize")) >>= aOldRefSize );
+
+ // set from auto-resize on to off -> adapt font sizes at XFormattedStrings
+ if( bHasOldRefSize && ! useAutoScale())
+ {
+ uno::Sequence< uno::Reference< XFormattedString > > aStrSeq(
+ xTitle->getText());
+ for( sal_Int32 i=0; i<aStrSeq.getLength(); ++i )
+ {
+ RelativeSizeHelper::adaptFontSizes(
+ Reference< beans::XPropertySet >( aStrSeq[i], uno::UNO_QUERY ),
+ aOldRefSize, getPageSize());
+ }
+ }
+
+ setValuesAtPropertySet( xTitleProp, /* bAdaptFontSizes = */ false );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ReferenceSizeProvider::setValuesAtAllDataSeries()
+{
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDoc ));
+
+ // DataSeries/Points
+ ::std::vector< Reference< XDataSeries > > aSeries(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< XDataSeries > >::const_iterator aIt( aSeries.begin());
+ aIt != aSeries.end(); ++aIt )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( *aIt, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ {
+ // data points
+ Sequence< sal_Int32 > aPointIndexes;
+ try
+ {
+ if( xSeriesProp->getPropertyValue( C2U("AttributedDataPoints")) >>= aPointIndexes )
+ {
+ for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i )
+ setValuesAtPropertySet(
+ (*aIt)->getDataPointByIndex( aPointIndexes[i] ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ //it is important to correct the datapoint properties first as they do reference the series properties
+ setValuesAtPropertySet( xSeriesProp );
+ }
+ }
+}
+
+void ReferenceSizeProvider::setValuesAtPropertySet(
+ const Reference< beans::XPropertySet > & xProp,
+ bool bAdaptFontSizes /* = true */ )
+{
+ if( ! xProp.is())
+ return;
+
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize"));
+
+ try
+ {
+ awt::Size aRefSize( getPageSize() );
+ awt::Size aOldRefSize;
+ bool bHasOldRefSize( xProp->getPropertyValue( aRefSizeName ) >>= aOldRefSize );
+
+ if( useAutoScale())
+ {
+ if( ! bHasOldRefSize )
+ xProp->setPropertyValue( aRefSizeName, uno::makeAny( aRefSize ));
+ }
+ else
+ {
+ if( bHasOldRefSize )
+ {
+ xProp->setPropertyValue( aRefSizeName, uno::Any());
+
+ // adapt font sizes
+ if( bAdaptFontSizes )
+ RelativeSizeHelper::adaptFontSizes( xProp, aOldRefSize, aRefSize );
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ReferenceSizeProvider::getAutoResizeFromPropSet(
+ const Reference< beans::XPropertySet > & xProp,
+ ReferenceSizeProvider::AutoResizeState & rInOutState )
+{
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize"));
+ AutoResizeState eSingleState = AUTO_RESIZE_UNKNOWN;
+
+ if( xProp.is())
+ {
+ try
+ {
+ if( xProp->getPropertyValue( aRefSizeName ).hasValue())
+ eSingleState = AUTO_RESIZE_YES;
+ else
+ eSingleState = AUTO_RESIZE_NO;
+ }
+ catch( uno::Exception )
+ {
+ // unknown property -> state stays unknown
+ }
+ }
+
+ // curent state unknown => nothing changes. Otherwise if current state
+ // differs from state so far, we have an ambiguity
+ if( rInOutState == AUTO_RESIZE_UNKNOWN )
+ {
+ rInOutState = eSingleState;
+ }
+ else if( eSingleState != AUTO_RESIZE_UNKNOWN &&
+ eSingleState != rInOutState )
+ {
+ rInOutState = AUTO_RESIZE_AMBIGUOUS;
+ }
+}
+
+void ReferenceSizeProvider::impl_getAutoResizeFromTitled(
+ const Reference< XTitled > & xTitled,
+ ReferenceSizeProvider::AutoResizeState & rInOutState )
+{
+ if( xTitled.is())
+ {
+ Reference< beans::XPropertySet > xProp( xTitled->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is())
+ getAutoResizeFromPropSet( xProp, rInOutState );
+ }
+}
+
+/** Retrieves the state auto-resize from all objects that support this
+ feature. If all objects return the same state, AUTO_RESIZE_YES or
+ AUTO_RESIZE_NO is returned.
+
+ If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
+ returned. If there are multiple objects, some with state YES and some
+ with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
+*/
+ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState(
+ const Reference< XChartDocument > & xChartDoc )
+{
+ AutoResizeState eResult = AUTO_RESIZE_UNKNOWN;
+
+ // Main Title
+ Reference< XTitled > xDocTitled( xChartDoc, uno::UNO_QUERY );
+ if( xDocTitled.is())
+ impl_getAutoResizeFromTitled( xDocTitled, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+
+ // diagram is needed by the rest of the objects
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ), uno::UNO_QUERY );
+ if( ! xDiagram.is())
+ return eResult;
+
+ // Sub Title
+ Reference< XTitled > xDiaTitled( xDiagram, uno::UNO_QUERY );
+ if( xDiaTitled.is())
+ impl_getAutoResizeFromTitled( xDiaTitled, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+
+ // Legend
+ Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ getAutoResizeFromPropSet( xLegendProp, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+
+ // Axes (incl. Axis Titles)
+ Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ {
+ Reference< beans::XPropertySet > xProp( aAxes[i], uno::UNO_QUERY );
+ if( xProp.is())
+ getAutoResizeFromPropSet( xProp, eResult );
+ Reference< XTitled > xTitled( aAxes[i], uno::UNO_QUERY );
+ if( xTitled.is())
+ {
+ impl_getAutoResizeFromTitled( xTitled, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+ }
+ }
+
+ // DataSeries/Points
+ ::std::vector< Reference< XDataSeries > > aSeries(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< XDataSeries > >::const_iterator aIt( aSeries.begin());
+ aIt != aSeries.end(); ++aIt )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( *aIt, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ {
+ getAutoResizeFromPropSet( xSeriesProp, eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+
+ // data points
+ Sequence< sal_Int32 > aPointIndexes;
+ try
+ {
+ if( xSeriesProp->getPropertyValue( C2U("AttributedDataPoints")) >>= aPointIndexes )
+ {
+ for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i )
+ {
+ getAutoResizeFromPropSet(
+ (*aIt)->getDataPointByIndex( aPointIndexes[i] ), eResult );
+ if( eResult == AUTO_RESIZE_AMBIGUOUS )
+ return eResult;
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ return eResult;
+}
+
+void ReferenceSizeProvider::toggleAutoResizeState()
+{
+ setAutoResizeState( m_bUseAutoScale ? AUTO_RESIZE_NO : AUTO_RESIZE_YES );
+}
+
+
+/** sets the auto-resize at all objects that support this feature for text.
+ eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
+*/
+void ReferenceSizeProvider::setAutoResizeState( ReferenceSizeProvider::AutoResizeState eNewState )
+{
+ m_bUseAutoScale = (eNewState == AUTO_RESIZE_YES);
+
+ // Main Title
+ impl_setValuesAtTitled( Reference< XTitled >( m_xChartDoc, uno::UNO_QUERY ));
+
+ // diagram is needed by the rest of the objects
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartDoc ), uno::UNO_QUERY );
+ if( ! xDiagram.is())
+ return;
+
+ // Sub Title
+ impl_setValuesAtTitled( Reference< XTitled >( xDiagram, uno::UNO_QUERY ));
+
+ // Legend
+ Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ setValuesAtPropertySet( xLegendProp );
+
+ // Axes (incl. Axis Titles)
+ Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ {
+ Reference< beans::XPropertySet > xProp( aAxes[i], uno::UNO_QUERY );
+ if( xProp.is())
+ setValuesAtPropertySet( xProp );
+ impl_setValuesAtTitled( Reference< XTitled >( aAxes[i], uno::UNO_QUERY ));
+ }
+
+ // DataSeries/Points
+ setValuesAtAllDataSeries();
+
+ // recalculate new state (in case it stays unknown or is ambiguous
+ m_bUseAutoScale = (getAutoResizeState( m_xChartDoc ) == AUTO_RESIZE_YES);
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/RegressionCalculationHelper.hxx b/chart2/source/tools/RegressionCalculationHelper.hxx
new file mode 100644
index 000000000000..df407482b34d
--- /dev/null
+++ b/chart2/source/tools/RegressionCalculationHelper.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REGRESSIONCALCULATIONHELPER_HXX
+#define CHART2_REGRESSIONCALCULATIONHELPER_HXX
+
+#include <rtl/math.hxx>
+
+#include <utility>
+#include <functional>
+#include <vector>
+#include <rtl/math.hxx>
+
+#define NUMBER_TO_STR(number) (::rtl::OStringToOUString(::rtl::math::doubleToString( \
+ number, rtl_math_StringFormat_G, 4, '.', true ),RTL_TEXTENCODING_ASCII_US ))
+
+#define UC_SPACE (sal_Unicode(' '))
+#define UC_MINUS_SIGN (sal_Unicode('-'))
+// #define UC_MINUS_SIGN (sal_Unicode(0x2212))
+
+namespace chart
+{
+namespace RegressionCalculationHelper
+{
+
+typedef ::std::pair< ::std::vector< double >, ::std::vector< double > > tDoubleVectorPair;
+
+/** takes the given x- and y-values and copyies them into the resulting pair,
+ which contains x-values in the first element and the y-values in the second
+ one. All tuples for which aPred is false are not copied.
+
+ <p>The functors below provide a set of useful predicates that can be
+ used to pass as parameter aPred.</p>
+ */
+template< class Pred >
+tDoubleVectorPair
+ cleanup( const ::com::sun::star::uno::Sequence< double > & rXValues,
+ const ::com::sun::star::uno::Sequence< double > & rYValues,
+ Pred aPred )
+{
+ tDoubleVectorPair aResult;
+ sal_Int32 nSize = ::std::min( rXValues.getLength(), rYValues.getLength());
+ for( sal_Int32 i=0; i<nSize; ++i )
+ {
+ if( aPred( rXValues[i], rYValues[i] ))
+ {
+ aResult.first.push_back( rXValues[i] );
+ aResult.second.push_back( rYValues[i] );
+ }
+ }
+
+ return aResult;
+}
+
+
+class isValid : public ::std::binary_function< double, double, bool >
+{
+public:
+ inline bool operator()( double x, double y )
+ { return ! ( ::rtl::math::isNan( x ) ||
+ ::rtl::math::isNan( y ) ||
+ ::rtl::math::isInf( x ) ||
+ ::rtl::math::isInf( y ) );
+ }
+};
+
+class isValidAndXPositive : public ::std::binary_function< double, double, bool >
+{
+public:
+ inline bool operator()( double x, double y )
+ { return ! ( ::rtl::math::isNan( x ) ||
+ ::rtl::math::isNan( y ) ||
+ ::rtl::math::isInf( x ) ||
+ ::rtl::math::isInf( y ) ||
+ x <= 0.0 );
+ }
+};
+
+class isValidAndYPositive : public ::std::binary_function< double, double, bool >
+{
+public:
+ inline bool operator()( double x, double y )
+ { return ! ( ::rtl::math::isNan( x ) ||
+ ::rtl::math::isNan( y ) ||
+ ::rtl::math::isInf( x ) ||
+ ::rtl::math::isInf( y ) ||
+ y <= 0.0 );
+ }
+};
+
+class isValidAndBothPositive : public ::std::binary_function< double, double, bool >
+{
+public:
+ inline bool operator()( double x, double y )
+ { return ! ( ::rtl::math::isNan( x ) ||
+ ::rtl::math::isNan( y ) ||
+ ::rtl::math::isInf( x ) ||
+ ::rtl::math::isInf( y ) ||
+ x <= 0.0 ||
+ y <= 0.0 );
+ }
+};
+
+} // namespace RegressionCalculationHelper
+} // namespace chart
+
+// CHART2_REGRESSIONCALCULATIONHELPER_HXX
+#endif
diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx
new file mode 100644
index 000000000000..68e041e668ca
--- /dev/null
+++ b/chart2/source/tools/RegressionCurveCalculator.cxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RegressionCurveCalculator.hxx"
+#include "RegressionCalculationHelper.hxx"
+#include "servicenames_coosystems.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <rtl/math.hxx>
+
+#include <com/sun/star/lang/XServiceName.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+RegressionCurveCalculator::RegressionCurveCalculator() :
+ m_fCorrelationCoeffitient( 0.0 )
+{
+ ::rtl::math::setNan( & m_fCorrelationCoeffitient );
+}
+
+RegressionCurveCalculator::~RegressionCurveCalculator()
+{}
+
+// static
+bool RegressionCurveCalculator::isLinearScaling(
+ const Reference< chart2::XScaling > & xScaling )
+{
+ // no scaling means linear
+ if( !xScaling.is())
+ return true;
+ static OUString aLinScalingServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LinearScaling" ));
+ uno::Reference< lang::XServiceName > xServiceName( xScaling, uno::UNO_QUERY );
+ return (xServiceName.is() && xServiceName->getServiceName().equals( aLinScalingServiceName ));
+}
+
+// static
+bool RegressionCurveCalculator::isLogarithmicScaling(
+ const Reference< chart2::XScaling > & xScaling )
+{
+ static OUString aLogScalingServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LogarithmicScaling" ));
+ uno::Reference< lang::XServiceName > xServiceName( xScaling, uno::UNO_QUERY );
+ return (xServiceName.is() && xServiceName->getServiceName().equals( aLogScalingServiceName ));
+}
+
+
+OUString RegressionCurveCalculator::getFormattedString(
+ const Reference< util::XNumberFormatter >& xNumFormatter,
+ ::sal_Int32 nNumberFormatKey,
+ double fNumber ) const
+{
+ OUString aResult;
+
+ if( xNumFormatter.is())
+ aResult = xNumFormatter->convertNumberToString( nNumberFormatKey, fNumber );
+ else
+ aResult = NUMBER_TO_STR( fNumber );
+
+ return aResult;
+}
+
+Sequence< geometry::RealPoint2D > SAL_CALL RegressionCurveCalculator::getCurveValues(
+ double min, double max, ::sal_Int32 nPointCount,
+ const Reference< chart2::XScaling >& xScalingX,
+ const Reference< chart2::XScaling >& /* xScalingY */,
+ ::sal_Bool /* bMaySkipPointsInCalculation */ )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( nPointCount < 2 )
+ throw lang::IllegalArgumentException();
+
+ // determine if scaling and inverse scaling for x-values work
+ bool bDoXScaling( xScalingX.is());
+ uno::Reference< chart2::XScaling > xInverseScaling;
+ if( bDoXScaling )
+ xInverseScaling.set( xScalingX->getInverseScaling());
+ bDoXScaling = bDoXScaling && xInverseScaling.is();
+
+ Sequence< geometry::RealPoint2D > aResult( nPointCount );
+
+ double fMin( min );
+ double fFact = (max - min) / double(nPointCount-1);
+ if( bDoXScaling )
+ {
+ fMin = xScalingX->doScaling( min );
+ fFact = (xScalingX->doScaling( max ) - fMin) / double(nPointCount-1);
+ }
+
+ for(sal_Int32 nP=0; nP<nPointCount; nP++)
+ {
+ double x = fMin + nP * fFact;
+ if( bDoXScaling )
+ x = xInverseScaling->doScaling( x );
+ aResult[nP].X = x;
+ aResult[nP].Y = this->getCurveValue( x );
+ }
+
+ return aResult;
+}
+
+double SAL_CALL RegressionCurveCalculator::getCorrelationCoefficient()
+ throw (uno::RuntimeException)
+{
+ return m_fCorrelationCoeffitient;
+}
+
+OUString SAL_CALL RegressionCurveCalculator::getRepresentation()
+ throw (uno::RuntimeException)
+{
+ return ImplGetRepresentation( Reference< util::XNumberFormatter >(), 0 );
+}
+
+OUString SAL_CALL RegressionCurveCalculator::getFormattedRepresentation(
+ const Reference< util::XNumberFormatsSupplier > & xNumFmtSupplier,
+ ::sal_Int32 nNumberFormatKey )
+ throw (uno::RuntimeException)
+{
+ // create and prepare a number formatter
+ if( !xNumFmtSupplier.is())
+ return getRepresentation();
+ Reference< util::XNumberFormatter > xNumFormatter;
+ Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ if( xFact.is())
+ xNumFormatter.set( xFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter"))), uno::UNO_QUERY );
+ if( !xNumFormatter.is())
+ return getRepresentation();
+ xNumFormatter->attachNumberFormatsSupplier( xNumFmtSupplier );
+
+ return ImplGetRepresentation( xNumFormatter, nNumberFormatKey );
+}
+
+
+} // namespace chart
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
new file mode 100644
index 000000000000..b553dbc2d217
--- /dev/null
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "MeanValueRegressionCurveCalculator.hxx"
+#include "LinearRegressionCurveCalculator.hxx"
+#include "LogarithmicRegressionCurveCalculator.hxx"
+#include "ExponentialRegressionCurveCalculator.hxx"
+#include "PotentialRegressionCurveCalculator.hxx"
+#include "CommonConverters.hxx"
+#include "RegressionCurveModel.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+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::XComponentContext;
+using ::com::sun::star::lang::XServiceName;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Exception;
+using ::rtl::OUString;
+
+namespace
+{
+OUString lcl_getServiceNameForType( ::chart::RegressionCurveHelper::tRegressionType eType )
+{
+ OUString aServiceName;
+ switch( eType )
+ {
+ case ::chart::RegressionCurveHelper::REGRESSION_TYPE_LINEAR:
+ aServiceName = C2U( "com.sun.star.chart2.LinearRegressionCurve" );
+ break;
+ case ::chart::RegressionCurveHelper::REGRESSION_TYPE_LOG:
+ aServiceName = C2U( "com.sun.star.chart2.LogarithmicRegressionCurve" );
+ break;
+ case ::chart::RegressionCurveHelper::REGRESSION_TYPE_EXP:
+ aServiceName = C2U( "com.sun.star.chart2.ExponentialRegressionCurve" );
+ break;
+ case ::chart::RegressionCurveHelper::REGRESSION_TYPE_POWER:
+ aServiceName = C2U( "com.sun.star.chart2.PotentialRegressionCurve" );
+ break;
+ default:
+ OSL_ENSURE(false,"unknown regression curve type - use linear instead");
+ aServiceName = C2U( "com.sun.star.chart2.LinearRegressionCurve" );
+ break;
+ }
+ return aServiceName;
+}
+} // anonymous namespace
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+// static
+Reference< XRegressionCurve > RegressionCurveHelper::createMeanValueLine(
+ const Reference< XComponentContext > & xContext )
+{
+ return Reference< XRegressionCurve >(
+ new MeanValueRegressionCurve( xContext ));
+}
+
+// static
+Reference< XRegressionCurve > RegressionCurveHelper::createRegressionCurveByServiceName(
+ const Reference< XComponentContext > & xContext,
+ ::rtl::OUString aServiceName )
+{
+ Reference< XRegressionCurve > xResult;
+
+ // todo: use factory methods with service name
+ if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.LinearRegressionCurve" )))
+ {
+ xResult.set(
+ new LinearRegressionCurve( xContext ));
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.LogarithmicRegressionCurve" )))
+ {
+ xResult.set(
+ new LogarithmicRegressionCurve( xContext ));
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.ExponentialRegressionCurve" )))
+ {
+ xResult.set(
+ new ExponentialRegressionCurve( xContext ));
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.PotentialRegressionCurve" )))
+ {
+ xResult.set(
+ new PotentialRegressionCurve( xContext ));
+ }
+
+ return xResult;
+}
+
+// ------------------------------------------------------------
+
+// static
+Reference< XRegressionCurveCalculator > RegressionCurveHelper::createRegressionCurveCalculatorByServiceName(
+ ::rtl::OUString aServiceName )
+{
+ Reference< XRegressionCurveCalculator > xResult;
+
+ // todo: use factory methods with service name
+ if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.MeanValueRegressionCurve" )))
+ {
+ xResult.set( new MeanValueRegressionCurveCalculator());
+ }
+ if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.LinearRegressionCurve" )))
+ {
+ xResult.set( new LinearRegressionCurveCalculator());
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.LogarithmicRegressionCurve" )))
+ {
+ xResult.set( new LogarithmicRegressionCurveCalculator());
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.ExponentialRegressionCurve" )))
+ {
+ xResult.set( new ExponentialRegressionCurveCalculator());
+ }
+ else if( aServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.chart2.PotentialRegressionCurve" )))
+ {
+ xResult.set( new PotentialRegressionCurveCalculator());
+ }
+
+ return xResult;
+}
+
+// static
+void RegressionCurveHelper::initializeCurveCalculator(
+ const Reference< XRegressionCurveCalculator > & xOutCurveCalculator,
+ const Reference< data::XDataSource > & xSource,
+ bool bUseXValuesIfAvailable /* = true */ )
+{
+ if( ! (xOutCurveCalculator.is() &&
+ xSource.is() ))
+ return;
+
+ Sequence< double > aXValues, aYValues;
+ bool bXValuesFound = false, bYValuesFound = false;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aDataSeqs( xSource->getDataSequences());
+ sal_Int32 i = 0;
+ for( i=0;
+ ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.getLength();
+ ++i )
+ {
+ try
+ {
+ Reference< data::XDataSequence > xSeq( aDataSeqs[i]->getValues());
+ Reference< XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
+ ::rtl::OUString aRole;
+ if( xProp->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Role" ))) >>= aRole )
+ {
+ if( bUseXValuesIfAvailable &&
+ ! bXValuesFound &&
+ aRole.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "values-x" )))
+ {
+ aXValues = DataSequenceToDoubleSequence( xSeq );
+ bXValuesFound = true;
+ }
+ else if( ! bYValuesFound &&
+ aRole.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "values-y" )))
+ {
+ aYValues = DataSequenceToDoubleSequence( xSeq );
+ bYValuesFound = true;
+ }
+ }
+ }
+ catch( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if( ! bXValuesFound &&
+ bYValuesFound )
+ {
+ // 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;
+ bXValuesFound = true;
+ }
+
+ if( bXValuesFound && bYValuesFound &&
+ aXValues.getLength() > 0 &&
+ aYValues.getLength() > 0 )
+ xOutCurveCalculator->recalculateRegression( aXValues, aYValues );
+}
+
+// static
+void RegressionCurveHelper::initializeCurveCalculator(
+ const Reference< XRegressionCurveCalculator > & xOutCurveCalculator,
+ const Reference< XDataSeries > & xSeries,
+ const Reference< frame::XModel > & xModel )
+{
+ sal_Int32 nAxisType = ChartTypeHelper::getAxisType(
+ ChartModelHelper::getChartTypeOfSeries( xModel, xSeries ), 0 ); // x-axis
+
+ initializeCurveCalculator( xOutCurveCalculator,
+ uno::Reference< data::XDataSource >( xSeries, uno::UNO_QUERY ),
+ (nAxisType == AxisType::REALNUMBER) );
+}
+
+// ----------------------------------------
+
+// static
+bool RegressionCurveHelper::hasMeanValueLine(
+ const uno::Reference< XRegressionCurveContainer > & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return false;
+
+ try
+ {
+ uno::Sequence< uno::Reference< XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( isMeanValueLine( aCurves[i] ))
+ return true;
+ }
+ }
+ catch( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return false;
+}
+
+// static
+bool RegressionCurveHelper::isMeanValueLine(
+ const uno::Reference< chart2::XRegressionCurve > & xRegCurve )
+{
+ uno::Reference< XServiceName > xServName( xRegCurve, uno::UNO_QUERY );
+ if( xServName.is() &&
+ xServName->getServiceName().equals(
+ C2U( "com.sun.star.chart2.MeanValueRegressionCurve" )))
+ return true;
+ return false;
+}
+
+// static
+uno::Reference< chart2::XRegressionCurve >
+ RegressionCurveHelper::getMeanValueLine(
+ const uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt )
+{
+ if( xRegCnt.is())
+ {
+ try
+ {
+ uno::Sequence< uno::Reference< XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( isMeanValueLine( aCurves[i] ))
+ return aCurves[i];
+ }
+ }
+ catch( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return uno::Reference< chart2::XRegressionCurve >();
+}
+
+// static
+void RegressionCurveHelper::addMeanValueLine(
+ uno::Reference< XRegressionCurveContainer > & xRegCnt,
+ const uno::Reference< XComponentContext > & xContext,
+ const uno::Reference< XPropertySet > & xSeriesProp )
+{
+ if( !xRegCnt.is() ||
+ ::chart::RegressionCurveHelper::hasMeanValueLine( xRegCnt ) )
+ return;
+
+ // todo: use a valid context
+ uno::Reference< XRegressionCurve > xCurve( createMeanValueLine( xContext ));
+ xRegCnt->addRegressionCurve( xCurve );
+
+ if( xSeriesProp.is())
+ {
+ uno::Reference< XPropertySet > xProp( xCurve, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( C2U( "LineColor" ),
+ xSeriesProp->getPropertyValue( C2U( "Color" )));
+ }
+ }
+}
+
+// static
+void RegressionCurveHelper::removeMeanValueLine(
+ Reference< XRegressionCurveContainer > & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return;
+
+ try
+ {
+ Sequence< Reference< XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( isMeanValueLine( aCurves[i] ))
+ {
+ xRegCnt->removeRegressionCurve( aCurves[i] );
+ // 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( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void RegressionCurveHelper::addRegressionCurve(
+ tRegressionType eType,
+ uno::Reference< XRegressionCurveContainer > & xRegCnt,
+ const uno::Reference< XComponentContext > & /* xContext */,
+ const uno::Reference< beans::XPropertySet >& xPropertySource,
+ const uno::Reference< beans::XPropertySet >& xEquationProperties )
+{
+ if( !xRegCnt.is() )
+ return;
+
+ if( eType == REGRESSION_TYPE_NONE )
+ {
+ OSL_ENSURE(false,"don't create a regression curve of type none");
+ return;
+ }
+
+ uno::Reference< chart2::XRegressionCurve > xCurve;
+ ::rtl::OUString aServiceName( lcl_getServiceNameForType( eType ));
+
+ if( aServiceName.getLength())
+ {
+ // todo: use a valid context
+ xCurve.set( createRegressionCurveByServiceName(
+ uno::Reference< uno::XComponentContext >(), aServiceName ));
+
+ if( xEquationProperties.is())
+ xCurve->setEquationProperties( xEquationProperties );
+
+ uno::Reference< beans::XPropertySet > xProp( xCurve, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ if( xPropertySource.is())
+ comphelper::copyProperties( xPropertySource, xProp );
+ else
+ {
+ uno::Reference< XPropertySet > xSeriesProp( xRegCnt, uno::UNO_QUERY );
+ if( xSeriesProp.is())
+ {
+ xProp->setPropertyValue( C2U( "LineColor" ),
+ xSeriesProp->getPropertyValue( C2U( "Color" )));
+ }
+// xProp->setPropertyValue( C2U( "LineWidth" ), uno::makeAny( sal_Int32( 100 )));
+ }
+ }
+ }
+ xRegCnt->addRegressionCurve( 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 > & xRegCnt )
+{
+ bool bRemovedSomething = false;
+ if( xRegCnt.is())
+ {
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ ::std::vector< uno::Reference< chart2::XRegressionCurve > > aCurvesToDelete;
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( ! isMeanValueLine( aCurves[i] ))
+ {
+ aCurvesToDelete.push_back( aCurves[ i ] );
+ }
+ }
+
+ for( ::std::vector< uno::Reference< chart2::XRegressionCurve > >::const_iterator aIt = aCurvesToDelete.begin();
+ aIt != aCurvesToDelete.end(); ++aIt )
+ {
+ xRegCnt->removeRegressionCurve( *aIt );
+ bRemovedSomething = true;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return bRemovedSomething;
+}
+
+void RegressionCurveHelper::removeEquations(
+ uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt )
+{
+ if( xRegCnt.is())
+ {
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( !isMeanValueLine( aCurves[i] ) )
+ {
+ uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] );
+ if( xRegCurve.is() )
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ;
+ if( xEqProp.is())
+ {
+ xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false ));
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+// static
+void RegressionCurveHelper::replaceOrAddCurveAndReduceToOne(
+ tRegressionType eType,
+ uno::Reference< XRegressionCurveContainer > & xRegCnt,
+ const uno::Reference< XComponentContext > & xContext )
+{
+ uno::Reference< chart2::XRegressionCurve > xRegressionCurve( getFirstCurveNotMeanValueLine( xRegCnt ));
+ if( ! xRegressionCurve.is())
+ RegressionCurveHelper::addRegressionCurve( eType, xRegCnt, xContext );
+ else
+ {
+ OUString aServiceName( lcl_getServiceNameForType( eType ));
+ if( aServiceName.getLength())
+ {
+ RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
+ RegressionCurveHelper::addRegressionCurve(
+ eType, xRegCnt, xContext,
+ Reference< beans::XPropertySet >( xRegressionCurve, uno::UNO_QUERY ),
+ xRegressionCurve->getEquationProperties());
+ }
+ }
+}
+
+// static
+uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveNotMeanValueLine(
+ const Reference< XRegressionCurveContainer > & xRegCnt )
+{
+ if( !xRegCnt.is())
+ return NULL;
+
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ ::std::vector< uno::Reference< chart2::XRegressionCurve > > aCurvesToDelete;
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( ! isMeanValueLine( aCurves[i] ))
+ {
+ return aCurves[ i ];
+ }
+ }
+ }
+ catch( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return NULL;
+}
+
+// static
+RegressionCurveHelper::tRegressionType RegressionCurveHelper::getRegressionType(
+ const Reference< XRegressionCurve > & xCurve )
+{
+ tRegressionType eResult = REGRESSION_TYPE_UNKNOWN;
+
+ try
+ {
+ Reference< lang::XServiceName > xServName( xCurve, uno::UNO_QUERY );
+ if( xServName.is())
+ {
+ ::rtl::OUString aServiceName( xServName->getServiceName() );
+
+ if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.LinearRegressionCurve" )))
+ {
+ eResult = REGRESSION_TYPE_LINEAR;
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.LogarithmicRegressionCurve" )))
+ {
+ eResult = REGRESSION_TYPE_LOG;
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ExponentialRegressionCurve" )))
+ {
+ eResult = REGRESSION_TYPE_EXP;
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.PotentialRegressionCurve" )))
+ {
+ eResult = REGRESSION_TYPE_POWER;
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.MeanValueRegressionCurve" )))
+ {
+ eResult = REGRESSION_TYPE_MEAN_VALUE;
+ }
+ }
+ }
+ catch( Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return eResult;
+}
+
+// static
+RegressionCurveHelper::tRegressionType RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine(
+ const Reference< XRegressionCurveContainer > & xRegCnt )
+{
+ tRegressionType eResult = REGRESSION_TYPE_NONE;
+
+ if( xRegCnt.is())
+ {
+ Sequence< Reference< XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ tRegressionType eType = getRegressionType( aCurves[i] );
+ if( eType != REGRESSION_TYPE_MEAN_VALUE &&
+ eType != REGRESSION_TYPE_UNKNOWN )
+ {
+ eResult = eType;
+ break;
+ }
+ }
+ }
+
+ return eResult;
+}
+
+OUString RegressionCurveHelper::getUINameForRegressionCurve( const Reference< XRegressionCurve >& xRegressionCurve )
+{
+ OUString aResult;
+ Reference< lang::XServiceName > xServiceName( xRegressionCurve, uno::UNO_QUERY );
+ if( ! xServiceName.is())
+ return aResult;
+
+ OUString aServiceName( xServiceName->getServiceName());
+ if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.MeanValueRegressionCurve" )))
+ {
+ OSL_ENSURE( false, "Meanvalue lines in legend not supported" );
+ aResult = OUString();
+ // aResult = ::chart::SchResId::getResString( STR_OBJECT_AVERAGE_LINE );
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.LinearRegressionCurve" )))
+ {
+ aResult = ::chart::SchResId::getResString( STR_REGRESSION_LINEAR );
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.LogarithmicRegressionCurve" )))
+ {
+ aResult = ::chart::SchResId::getResString( STR_REGRESSION_LOG );
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ExponentialRegressionCurve" )))
+ {
+ aResult = ::chart::SchResId::getResString( STR_REGRESSION_EXP );
+ }
+ else if( aServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.PotentialRegressionCurve" )))
+ {
+ aResult = ::chart::SchResId::getResString( STR_REGRESSION_POWER );
+ }
+
+ return aResult;
+}
+
+// static
+::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( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeries.begin());
+ aIt != aSeries.end(); ++aIt )
+ {
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( *aIt, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
+ xCurveCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( ! isMeanValueLine( aCurves[i] ))
+ aResult.push_back( aCurves[i] );
+ }
+ }
+ }
+
+ return aResult;
+}
+
+// static
+void RegressionCurveHelper::resetEquationPosition(
+ const Reference< chart2::XRegressionCurve > & xCurve )
+{
+ if( xCurve.is())
+ {
+ try
+ {
+ const OUString aPosPropertyName( RTL_CONSTASCII_USTRINGPARAM( "RelativePosition" ));
+ Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties()); // since m233: , uno::UNO_SET_THROW );
+ if( xEqProp->getPropertyValue( aPosPropertyName ).hasValue())
+ xEqProp->setPropertyValue( aPosPropertyName, uno::Any());
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+sal_Int32 RegressionCurveHelper::getRegressionCurveIndex(
+ const Reference< chart2::XRegressionCurveContainer > & xContainer,
+ const Reference< chart2::XRegressionCurve > & xCurve )
+{
+ if( xContainer.is())
+ {
+ uno::Sequence< uno::Reference< XRegressionCurve > > aCurves(
+ xContainer->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( xCurve == aCurves[i] )
+ return i;
+ }
+ }
+ return -1;
+}
+
+bool RegressionCurveHelper::hasEquation( const Reference< chart2::XRegressionCurve > & xCurve )
+{
+ bool bHasEquation = false;
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEquationProp( xCurve->getEquationProperties());
+ if( xEquationProp.is())
+ {
+ bool bShowEquation = false;
+ bool bShowCoefficient = false;
+ xEquationProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEquation;
+ xEquationProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoefficient;
+ bHasEquation = bShowEquation || bShowCoefficient;
+ }
+ }
+ return bHasEquation;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx
new file mode 100644
index 000000000000..cf5be998308e
--- /dev/null
+++ b/chart2/source/tools/RegressionCurveModel.cxx
@@ -0,0 +1,441 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "RegressionCurveModel.hxx"
+#include "macros.hxx"
+#include "LineProperties.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "RegressionCalculationHelper.hxx"
+#include "RegressionEquation.hxx"
+#include "ContainerHelper.hxx"
+#include "CloneHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+namespace
+{
+static const OUString lcl_aImplementationName_MeanValue(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.MeanValueRegressionCurve" ));
+static const OUString lcl_aImplementationName_Linear(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.LinearRegressionCurve" ));
+static const OUString lcl_aImplementationName_Logarithmic(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.LogarithmicRegressionCurve" ));
+static const OUString lcl_aImplementationName_Exponential(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ExponentialRegressionCurve" ));
+static const OUString lcl_aImplementationName_Potential(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PotentialRegressionCurve" ));
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionCurve" ));
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+RegressionCurveModel::RegressionCurveModel(
+ uno::Reference< uno::XComponentContext > const & xContext,
+ tCurveType eCurveType ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xContext( xContext ),
+ m_eRegressionCurveType( eCurveType ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
+ m_xEquationProperties( new RegressionEquation( xContext ))
+{
+ // set 0 line width (default) hard, so that it is always written to XML,
+ // because the old implementation uses different defaults
+ setFastPropertyValue_NoBroadcast(
+ LineProperties::PROP_LINE_WIDTH, uno::makeAny( sal_Int32( 0 )));
+ ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
+}
+
+RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther ) :
+ MutexContainer(),
+ impl::RegressionCurveModel_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xContext( rOther.m_xContext ),
+ m_eRegressionCurveType( rOther.m_eRegressionCurveType ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ m_xEquationProperties.set( CloneHelper::CreateRefClone< uno::Reference< beans::XPropertySet > >()( rOther.m_xEquationProperties ));
+ ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
+}
+
+RegressionCurveModel::~RegressionCurveModel()
+{}
+
+// ____ XRegressionCurve ____
+uno::Reference< chart2::XRegressionCurveCalculator > SAL_CALL
+ RegressionCurveModel::getCalculator()
+ throw (uno::RuntimeException)
+{
+ return RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( getServiceName());
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL RegressionCurveModel::getEquationProperties()
+ throw (uno::RuntimeException)
+{
+ return m_xEquationProperties;
+}
+
+void SAL_CALL RegressionCurveModel::setEquationProperties( const uno::Reference< beans::XPropertySet >& xEquationProperties )
+ throw (uno::RuntimeException)
+{
+ if( xEquationProperties.is())
+ {
+ if( m_xEquationProperties.is())
+ ModifyListenerHelper::removeListener( m_xEquationProperties, m_xModifyEventForwarder );
+
+ m_xEquationProperties.set( xEquationProperties );
+ ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
+ fireModifyEvent();
+ }
+}
+
+// ____ XServiceName ____
+::rtl::OUString SAL_CALL RegressionCurveModel::getServiceName()
+ throw (uno::RuntimeException)
+{
+ switch( m_eRegressionCurveType )
+ {
+ case CURVE_TYPE_MEAN_VALUE:
+ return C2U( "com.sun.star.chart2.MeanValueRegressionCurve" );
+ case CURVE_TYPE_LINEAR:
+ return C2U( "com.sun.star.chart2.LinearRegressionCurve" );
+ case CURVE_TYPE_LOGARITHM:
+ return C2U( "com.sun.star.chart2.LogarithmicRegressionCurve" );
+ case CURVE_TYPE_EXPONENTIAL:
+ return C2U( "com.sun.star.chart2.ExponentialRegressionCurve" );
+ case CURVE_TYPE_POWER:
+ return C2U( "com.sun.star.chart2.PotentialRegressionCurve" );
+ }
+
+ return ::rtl::OUString();
+}
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL RegressionCurveModel::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL RegressionCurveModel::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL RegressionCurveModel::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL RegressionCurveModel::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void RegressionCurveModel::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void RegressionCurveModel::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// ================================================================================
+
+// ____ OPropertySet ____
+uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ RegressionCurveModel::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+// ================================================================================
+
+// needed by MSC compiler
+using impl::RegressionCurveModel_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( RegressionCurveModel, RegressionCurveModel_Base, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( RegressionCurveModel, RegressionCurveModel_Base, OPropertySet )
+
+
+
+// implementations
+
+// --------------------------------------------------------------------------------
+
+MeanValueRegressionCurve::MeanValueRegressionCurve(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_MEAN_VALUE )
+{}
+MeanValueRegressionCurve::MeanValueRegressionCurve(
+ const MeanValueRegressionCurve & rOther ) :
+ RegressionCurveModel( rOther )
+{}
+MeanValueRegressionCurve::~MeanValueRegressionCurve()
+{}
+uno::Sequence< ::rtl::OUString > MeanValueRegressionCurve::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.MeanValueRegressionCurve" );
+ return aServices;
+}
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( MeanValueRegressionCurve, lcl_aImplementationName_MeanValue );
+
+uno::Reference< util::XCloneable > SAL_CALL MeanValueRegressionCurve::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new MeanValueRegressionCurve( *this ));
+}
+
+// --------------------------------------------------------------------------------
+
+LinearRegressionCurve::LinearRegressionCurve(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_LINEAR )
+{}
+LinearRegressionCurve::LinearRegressionCurve(
+ const LinearRegressionCurve & rOther ) :
+ RegressionCurveModel( rOther )
+{}
+LinearRegressionCurve::~LinearRegressionCurve()
+{}
+uno::Sequence< ::rtl::OUString > LinearRegressionCurve::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.LinearRegressionCurve" );
+ return aServices;
+}
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LinearRegressionCurve, lcl_aImplementationName_Linear );
+
+uno::Reference< util::XCloneable > SAL_CALL LinearRegressionCurve::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new LinearRegressionCurve( *this ));
+}
+
+// --------------------------------------------------------------------------------
+
+LogarithmicRegressionCurve::LogarithmicRegressionCurve(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_LOGARITHM )
+{}
+LogarithmicRegressionCurve::LogarithmicRegressionCurve(
+ const LogarithmicRegressionCurve & rOther ) :
+ RegressionCurveModel( rOther )
+{}
+LogarithmicRegressionCurve::~LogarithmicRegressionCurve()
+{}
+uno::Sequence< ::rtl::OUString > LogarithmicRegressionCurve::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.LogarithmicRegressionCurve" );
+ return aServices;
+}
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LogarithmicRegressionCurve, lcl_aImplementationName_Logarithmic );
+
+uno::Reference< util::XCloneable > SAL_CALL LogarithmicRegressionCurve::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new LogarithmicRegressionCurve( *this ));
+}
+
+// --------------------------------------------------------------------------------
+
+ExponentialRegressionCurve::ExponentialRegressionCurve(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_EXPONENTIAL )
+{}
+ExponentialRegressionCurve::ExponentialRegressionCurve(
+ const ExponentialRegressionCurve & rOther ) :
+ RegressionCurveModel( rOther )
+{}
+ExponentialRegressionCurve::~ExponentialRegressionCurve()
+{}
+uno::Sequence< ::rtl::OUString > ExponentialRegressionCurve::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ExponentialRegressionCurve" );
+ return aServices;
+}
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ExponentialRegressionCurve, lcl_aImplementationName_Exponential );
+
+uno::Reference< util::XCloneable > SAL_CALL ExponentialRegressionCurve::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new ExponentialRegressionCurve( *this ));
+}
+
+// --------------------------------------------------------------------------------
+
+PotentialRegressionCurve::PotentialRegressionCurve(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_POWER )
+{}
+PotentialRegressionCurve::PotentialRegressionCurve(
+ const PotentialRegressionCurve & rOther ) :
+ RegressionCurveModel( rOther )
+{}
+PotentialRegressionCurve::~PotentialRegressionCurve()
+{}
+uno::Sequence< ::rtl::OUString > PotentialRegressionCurve::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.PotentialRegressionCurve" );
+ return aServices;
+}
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PotentialRegressionCurve, lcl_aImplementationName_Potential );
+
+uno::Reference< util::XCloneable > SAL_CALL PotentialRegressionCurve::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new PotentialRegressionCurve( *this ));
+}
+
+
+} // namespace chart
diff --git a/chart2/source/tools/RegressionCurveModel.hxx b/chart2/source/tools/RegressionCurveModel.hxx
new file mode 100644
index 000000000000..82098a76e45a
--- /dev/null
+++ b/chart2/source/tools/RegressionCurveModel.hxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REGRESSIONCURVEMODEL_HXX
+#define CHART2_REGRESSIONCURVEMODEL_HXX
+
+#include "MutexContainer.hxx"
+#include "OPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+
+#include <cppuhelper/implbase6.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <com/sun/star/chart2/XRegressionCurve.hpp>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper6<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::chart2::XRegressionCurve,
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener >
+ RegressionCurveModel_Base;
+}
+
+class RegressionCurveModel :
+ public MutexContainer,
+ public impl::RegressionCurveModel_Base,
+ public ::property::OPropertySet
+{
+public:
+ enum tCurveType
+ {
+ CURVE_TYPE_MEAN_VALUE,
+ CURVE_TYPE_LINEAR,
+ CURVE_TYPE_LOGARITHM,
+ CURVE_TYPE_EXPONENTIAL,
+ CURVE_TYPE_POWER
+ };
+
+ RegressionCurveModel( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ tCurveType eCurveType );
+ RegressionCurveModel( const RegressionCurveModel & rOther );
+ virtual ~RegressionCurveModel();
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ // ____ OPropertySet ____
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XRegressionCurve ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveCalculator > SAL_CALL getCalculator()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getEquationProperties()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEquationProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xEquationProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ // not implemented here
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ using ::cppu::OPropertySetHelper::disposing;
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ const tCurveType m_eRegressionCurveType;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xEquationProperties;
+};
+
+// implementations for factory instantiation
+
+class MeanValueRegressionCurve : public RegressionCurveModel
+{
+public:
+ explicit MeanValueRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit MeanValueRegressionCurve(
+ const MeanValueRegressionCurve & rOther );
+ virtual ~MeanValueRegressionCurve();
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( MeanValueRegressionCurve )
+};
+
+class LinearRegressionCurve : public RegressionCurveModel
+{
+public:
+ explicit LinearRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit LinearRegressionCurve(
+ const LinearRegressionCurve & rOther );
+ virtual ~LinearRegressionCurve();
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LinearRegressionCurve )
+};
+
+class LogarithmicRegressionCurve : public RegressionCurveModel
+{
+public:
+ explicit LogarithmicRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit LogarithmicRegressionCurve(
+ const LogarithmicRegressionCurve & rOther );
+ virtual ~LogarithmicRegressionCurve();
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicRegressionCurve )
+};
+
+class ExponentialRegressionCurve : public RegressionCurveModel
+{
+public:
+ explicit ExponentialRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit ExponentialRegressionCurve(
+ const ExponentialRegressionCurve & rOther );
+ virtual ~ExponentialRegressionCurve();
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( ExponentialRegressionCurve )
+};
+
+class PotentialRegressionCurve : public RegressionCurveModel
+{
+public:
+ explicit PotentialRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ explicit PotentialRegressionCurve(
+ const PotentialRegressionCurve & rOther );
+ virtual ~PotentialRegressionCurve();
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( PotentialRegressionCurve )
+};
+
+} // namespace chart
+
+// CHART2_REGRESSIONCURVEMODEL_HXX
+#endif
diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx
new file mode 100644
index 000000000000..ea16e5b7702a
--- /dev/null
+++ b/chart2/source/tools/RegressionEquation.cxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RegressionEquation.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+
+// ____________________________________________________________
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aImplementationName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.RegressionEquation" ));
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionEquation" ));
+
+enum
+{
+ PROP_EQUATION_SHOW,
+ PROP_EQUATION_SHOW_CORRELATION_COEFF,
+// PROP_EQUATION_SEPARATOR,
+ PROP_EQUATION_REF_PAGE_SIZE,
+ PROP_EQUATION_REL_POS,
+ PROP_EQUATION_NUMBER_FORMAT
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ShowEquation" ),
+ PROP_EQUATION_SHOW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ShowCorrelationCoefficient" ),
+ PROP_EQUATION_SHOW_CORRELATION_COEFF,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+// rOutProperties.push_back(
+// Property( C2U( "Separator" ),
+// PROP_EQUATION_SEPARATOR,
+// ::getCppuType( reinterpret_cast< ::rtl::OUString * >(0)),
+// beans::PropertyAttribute::BOUND
+// | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReferencePageSize" ),
+ PROP_EQUATION_REF_PAGE_SIZE,
+ ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "RelativePosition" ),
+ PROP_EQUATION_REL_POS,
+ ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_EQUATION_NUMBER_FORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false );
+// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SEPARATOR, ::rtl::OUString( sal_Unicode( '\n' )));
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::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 );
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+// ____________________________________________________________
+
+namespace chart
+{
+
+RegressionEquation::RegressionEquation( const Reference< uno::XComponentContext > & xContext ) :
+ ::property::OPropertySet( m_aMutex ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder()),
+ m_xContext( xContext )
+{}
+
+RegressionEquation::RegressionEquation( const RegressionEquation & rOther ) :
+ MutexContainer(),
+ impl::RegressionEquation_Base(),
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+{}
+
+RegressionEquation::~RegressionEquation()
+{}
+
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL RegressionEquation::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new RegressionEquation( *this ));
+}
+
+// ____ OPropertySet ____
+uno::Any RegressionEquation::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+ CharacterProperties::AddDefaultsToMap( aStaticDefaults );
+
+ // overrides a line property
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL RegressionEquation::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL
+ RegressionEquation::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ lcl_getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+
+// ____ XModifyBroadcaster ____
+void SAL_CALL RegressionEquation::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL RegressionEquation::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL RegressionEquation::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL RegressionEquation::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void RegressionEquation::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void RegressionEquation::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+// --------------------------------------------------------------------------------
+
+// ____ XTitle ____
+uno::Sequence< uno::Reference< chart2::XFormattedString > > SAL_CALL RegressionEquation::getText()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return m_aStrings;
+ // \--
+}
+
+void SAL_CALL RegressionEquation::setText( const uno::Sequence< uno::Reference< chart2::XFormattedString > >& Strings )
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ ModifyListenerHelper::removeListenerFromAllElements(
+ ContainerHelper::SequenceToVector( m_aStrings ), m_xModifyEventForwarder );
+ m_aStrings = Strings;
+ ModifyListenerHelper::addListenerToAllElements(
+ ContainerHelper::SequenceToVector( m_aStrings ), m_xModifyEventForwarder );
+ fireModifyEvent();
+ // \--
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > RegressionEquation::getSupportedServiceNames_Static()
+{
+ const sal_Int32 nNumServices( 5 );
+ sal_Int32 nI = 0;
+ uno::Sequence< ::rtl::OUString > aServices( nNumServices );
+ aServices[ nI++ ] = lcl_aServiceName;
+ aServices[ nI++ ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ nI++ ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ nI++ ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ nI++ ] = C2U( "com.sun.star.style.CharacterProperties" );
+ OSL_ASSERT( nNumServices == nI );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( RegressionEquation, lcl_aImplementationName );
+
+using impl::RegressionEquation_Base;
+
+IMPLEMENT_FORWARD_XINTERFACE2( RegressionEquation, RegressionEquation_Base, ::property::OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/tools/RegressionEquation.hxx b/chart2/source/tools/RegressionEquation.hxx
new file mode 100644
index 000000000000..35dbd828370d
--- /dev/null
+++ b/chart2/source/tools/RegressionEquation.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_REGRESSIONEQUATION_HXX
+#define CHART2_REGRESSIONEQUATION_HXX
+
+#include <com/sun/star/uno/XComponentContext.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 "ServiceMacros.hxx"
+#include "ModifyListenerHelper.hxx"
+
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::WeakImplHelper4<
+ ::com::sun::star::util::XCloneable,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::chart2::XTitle >
+ RegressionEquation_Base;
+}
+
+class RegressionEquation :
+ public MutexContainer,
+ public impl::RegressionEquation_Base,
+ public ::property::OPropertySet
+{
+public:
+ explicit RegressionEquation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~RegressionEquation();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( RegressionEquation )
+
+protected:
+ explicit RegressionEquation( const RegressionEquation & rOther );
+
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ // ____ XPropertySet ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyBroadcaster ____
+ virtual void SAL_CALL addModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XModifyListener ____
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener (base of XModifyListener) ____
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTitle ____
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > > SAL_CALL getText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setText( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > >& Strings )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ using ::cppu::OPropertySetHelper::disposing;
+
+ // ____ OPropertySet ____
+ virtual void firePropertyChangeEvent();
+
+ void fireModifyEvent();
+
+private:
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XFormattedString > > m_aStrings;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+};
+
+} // namespace chart
+
+// CHART2_REGRESSIONEQUATION_HXX
+#endif
diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx
new file mode 100644
index 000000000000..4d566b1f7f48
--- /dev/null
+++ b/chart2/source/tools/RelativePositionHelper.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RelativePositionHelper.hxx"
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+
+// static
+chart2::RelativePosition RelativePositionHelper::getReanchoredPosition(
+ const chart2::RelativePosition & rPosition,
+ const chart2::RelativeSize & rObjectSize,
+ drawing::Alignment aNewAnchor )
+{
+ chart2::RelativePosition aResult( rPosition );
+ if( rPosition.Anchor != aNewAnchor )
+ {
+ sal_Int32 nShiftHalfWidths = 0;
+ sal_Int32 nShiftHalfHeights = 0;
+
+ // normalize to top-left
+ switch( rPosition.Anchor )
+ {
+ case drawing::Alignment_TOP_LEFT:
+ break;
+ case drawing::Alignment_LEFT:
+ nShiftHalfHeights -= 1;
+ break;
+ case drawing::Alignment_BOTTOM_LEFT:
+ nShiftHalfHeights -= 2;
+ break;
+ case drawing::Alignment_TOP:
+ nShiftHalfWidths -= 1;
+ break;
+ case drawing::Alignment_CENTER:
+ nShiftHalfWidths -= 1;
+ nShiftHalfHeights -= 1;
+ break;
+ case drawing::Alignment_BOTTOM:
+ nShiftHalfWidths -= 1;
+ nShiftHalfHeights -= 2;
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ nShiftHalfWidths -= 2;
+ break;
+ case drawing::Alignment_RIGHT:
+ nShiftHalfWidths -= 2;
+ nShiftHalfHeights -= 1;
+ break;
+ case drawing::Alignment_BOTTOM_RIGHT:
+ nShiftHalfWidths -= 2;
+ nShiftHalfHeights -= 2;
+ break;
+ case drawing::Alignment_MAKE_FIXED_SIZE:
+ break;
+ }
+
+ // transform
+ switch( aNewAnchor )
+ {
+ case drawing::Alignment_TOP_LEFT:
+ break;
+ case drawing::Alignment_LEFT:
+ nShiftHalfHeights += 1;
+ break;
+ case drawing::Alignment_BOTTOM_LEFT:
+ nShiftHalfHeights += 2;
+ break;
+ case drawing::Alignment_TOP:
+ nShiftHalfWidths += 1;
+ break;
+ case drawing::Alignment_CENTER:
+ nShiftHalfWidths += 1;
+ nShiftHalfHeights += 1;
+ break;
+ case drawing::Alignment_BOTTOM:
+ nShiftHalfWidths += 1;
+ nShiftHalfHeights += 2;
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ nShiftHalfWidths += 2;
+ break;
+ case drawing::Alignment_RIGHT:
+ nShiftHalfWidths += 2;
+ nShiftHalfHeights += 1;
+ break;
+ case drawing::Alignment_BOTTOM_RIGHT:
+ nShiftHalfWidths += 2;
+ nShiftHalfHeights += 2;
+ break;
+ case drawing::Alignment_MAKE_FIXED_SIZE:
+ break;
+ }
+
+ if( nShiftHalfWidths != 0 )
+ aResult.Primary += (rObjectSize.Primary / 2.0) * nShiftHalfWidths;
+ if( nShiftHalfHeights != 0 )
+ aResult.Secondary += (rObjectSize.Secondary / 2.0) * nShiftHalfHeights;
+ }
+
+ return aResult;
+}
+
+
+// static
+awt::Point RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ awt::Point aPoint
+ , awt::Size aObjectSize
+ , drawing::Alignment aAnchor )
+{
+ awt::Point aResult( aPoint );
+
+ double fXDelta = 0.0;
+ double fYDelta = 0.0;
+
+ // adapt x-value
+ switch( aAnchor )
+ {
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_BOTTOM:
+ fXDelta -= static_cast< double >( aObjectSize.Width ) / 2.0;
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ case drawing::Alignment_RIGHT:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ fXDelta -= aObjectSize.Width;
+ break;
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_BOTTOM_LEFT:
+ default:
+ // nothing to do
+ break;
+ }
+
+ // adapt y-value
+ switch( aAnchor )
+ {
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_RIGHT:
+ fYDelta -= static_cast< double >( aObjectSize.Height ) / 2.0;
+ break;
+ case drawing::Alignment_BOTTOM_LEFT:
+ case drawing::Alignment_BOTTOM:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ fYDelta -= aObjectSize.Height;
+ break;
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_TOP_RIGHT:
+ default:
+ // nothing to do
+ break;
+ }
+
+ aResult.X += static_cast< sal_Int32 >( ::rtl::math::round( fXDelta ));
+ aResult.Y += static_cast< sal_Int32 >( ::rtl::math::round( fYDelta ));
+
+ return aResult;
+}
+
+// static
+awt::Point RelativePositionHelper::getCenterOfAnchoredObject(
+ awt::Point aPoint
+ , awt::Size aUnrotatedObjectSize
+ , drawing::Alignment aAnchor
+ , double fAnglePi )
+{
+ awt::Point aResult( aPoint );
+
+ double fXDelta = 0.0;
+ double fYDelta = 0.0;
+
+ // adapt x-value
+ switch( aAnchor )
+ {
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_BOTTOM:
+ // nothing to do
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ case drawing::Alignment_RIGHT:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ fXDelta -= aUnrotatedObjectSize.Width/2;
+ break;
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_BOTTOM_LEFT:
+ default:
+ fXDelta += aUnrotatedObjectSize.Width/2;
+ break;
+ }
+
+ // adapt y-value
+ switch( aAnchor )
+ {
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_RIGHT:
+ // nothing to do
+ break;
+ case drawing::Alignment_BOTTOM_LEFT:
+ case drawing::Alignment_BOTTOM:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ fYDelta -= aUnrotatedObjectSize.Height/2;
+ break;
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_TOP_RIGHT:
+ fYDelta += aUnrotatedObjectSize.Height/2;
+ default:
+ // nothing to do
+ break;
+ }
+
+ //take rotation into account:
+ aResult.X += static_cast< sal_Int32 >(
+ ::rtl::math::round( fXDelta * rtl::math::cos( fAnglePi ) + fYDelta * rtl::math::sin( fAnglePi ) ) );
+ aResult.Y += static_cast< sal_Int32 >(
+ ::rtl::math::round( - fXDelta * rtl::math::sin( fAnglePi ) + fYDelta * rtl::math::cos( fAnglePi ) ) );
+
+ return aResult;
+}
+
+bool RelativePositionHelper::centerGrow(
+ chart2::RelativePosition & rInOutPosition,
+ chart2::RelativeSize & rInOutSize,
+ double fAmountX, double fAmountY,
+ bool bCheck /* = true */ )
+{
+ chart2::RelativePosition aPos( rInOutPosition );
+ chart2::RelativeSize aSize( rInOutSize );
+ const double fPosCheckThreshold = 0.02;
+ const double fSizeCheckThreshold = 0.1;
+
+ // grow/shrink, back to relaative
+ aSize.Primary += fAmountX;
+ aSize.Secondary += fAmountY;
+
+ double fShiftAmountX = fAmountX / 2.0;
+ double fShiftAmountY = fAmountY / 2.0;
+
+ // shift X
+ switch( rInOutPosition.Anchor )
+ {
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_BOTTOM_LEFT:
+ aPos.Primary -= fShiftAmountX;
+ break;
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_BOTTOM:
+ // nothing
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ case drawing::Alignment_RIGHT:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ aPos.Primary += fShiftAmountX;
+ break;
+ case drawing::Alignment_MAKE_FIXED_SIZE:
+ break;
+ }
+
+ // shift Y
+ switch( rInOutPosition.Anchor )
+ {
+ case drawing::Alignment_TOP:
+ case drawing::Alignment_TOP_LEFT:
+ case drawing::Alignment_TOP_RIGHT:
+ aPos.Secondary -= fShiftAmountY;
+ break;
+ case drawing::Alignment_CENTER:
+ case drawing::Alignment_LEFT:
+ case drawing::Alignment_RIGHT:
+ // nothing
+ break;
+ case drawing::Alignment_BOTTOM:
+ case drawing::Alignment_BOTTOM_LEFT:
+ case drawing::Alignment_BOTTOM_RIGHT:
+ aPos.Secondary += fShiftAmountY;
+ break;
+ case drawing::Alignment_MAKE_FIXED_SIZE:
+ break;
+ }
+
+ // anchor must not be changed
+ OSL_ASSERT( rInOutPosition.Anchor == aPos.Anchor );
+
+ if( rInOutPosition.Primary == aPos.Primary &&
+ rInOutPosition.Secondary == aPos.Secondary &&
+ rInOutSize.Primary == aSize.Primary &&
+ rInOutSize.Secondary == aSize.Secondary )
+ return false;
+
+ // check
+ if( bCheck )
+ {
+ // Note: this somewhat complicated check allows the output being
+ // out-of-bounds if the input was also out-of-bounds, and the change is
+ // for "advantage". E.g., you have a chart that laps out on the left
+ // side. If you shrink it, this should be possible, also if it still
+ // laps out on the left side afterwards. But you shouldn't be able to
+ // grow it then.
+
+ chart2::RelativePosition aUpperLeft(
+ RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_TOP_LEFT ));
+ chart2::RelativePosition aLowerRight(
+ RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_BOTTOM_RIGHT ));
+
+ // Do not grow, if this leads to corners being off-screen
+ if( fAmountX > 0.0 &&
+ ( (aUpperLeft.Primary < fPosCheckThreshold) ||
+ (aLowerRight.Primary > (1.0 - fPosCheckThreshold)) ))
+ return false;
+ if( fAmountY > 0.0 &&
+ ( (aUpperLeft.Secondary < fPosCheckThreshold) ||
+ (aLowerRight.Secondary > (1.0 - fPosCheckThreshold)) ))
+ return false;
+
+ // Do not shrink, if this leads to a size too small
+ if( fAmountX < 0.0 &&
+ ( aSize.Primary < fSizeCheckThreshold ))
+ return false;
+ if( fAmountY < 0.0 &&
+ ( aSize.Secondary < fSizeCheckThreshold ))
+ return false;
+ }
+
+ rInOutPosition = aPos;
+ rInOutSize = aSize;
+ return true;
+}
+
+bool RelativePositionHelper::moveObject(
+ chart2::RelativePosition & rInOutPosition,
+ const chart2::RelativeSize & rObjectSize,
+ double fAmountX, double fAmountY,
+ bool bCheck /* = true */ )
+{
+ chart2::RelativePosition aPos( rInOutPosition );
+ aPos.Primary += fAmountX;
+ aPos.Secondary += fAmountY;
+ const double fPosCheckThreshold = 0.02;
+
+ if( bCheck )
+ {
+ chart2::RelativePosition aUpperLeft(
+ RelativePositionHelper::getReanchoredPosition( aPos, rObjectSize, drawing::Alignment_TOP_LEFT ));
+ chart2::RelativePosition aLowerRight( aUpperLeft );
+ aLowerRight.Primary += rObjectSize.Primary;
+ aLowerRight.Secondary += rObjectSize.Secondary;
+
+ const double fFarEdgeThreshold = 1.0 - fPosCheckThreshold;
+ if( ( fAmountX > 0.0 && (aLowerRight.Primary > fFarEdgeThreshold)) ||
+ ( fAmountX < 0.0 && (aUpperLeft.Primary < fPosCheckThreshold)) ||
+ ( fAmountY > 0.0 && (aLowerRight.Secondary > fFarEdgeThreshold)) ||
+ ( fAmountY < 0.0 && (aUpperLeft.Secondary < fPosCheckThreshold)) )
+ return false;
+ }
+
+ rInOutPosition = aPos;
+ return true;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/RelativeSizeHelper.cxx b/chart2/source/tools/RelativeSizeHelper.cxx
new file mode 100644
index 000000000000..d3da090ca397
--- /dev/null
+++ b/chart2/source/tools/RelativeSizeHelper.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "RelativeSizeHelper.hxx"
+#include "macros.hxx"
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::std;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Exception;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+// static
+double RelativeSizeHelper::calculate(
+ double fValue,
+ const Size & rOldReferenceSize,
+ const Size & rNewReferenceSize )
+{
+ if( rOldReferenceSize.Width <= 0 ||
+ rOldReferenceSize.Height <= 0 )
+ return fValue;
+
+ return min(
+ static_cast< double >( rNewReferenceSize.Width ) / static_cast< double >( rOldReferenceSize.Width ),
+ static_cast< double >( rNewReferenceSize.Height ) / static_cast< double >( rOldReferenceSize.Height ))
+ * fValue;
+}
+
+// static
+void RelativeSizeHelper::adaptFontSizes(
+ const Reference< XPropertySet > & xTargetProperties,
+ const Size & rOldReferenceSize,
+ const Size & rNewReferenceSize )
+{
+ if( ! xTargetProperties.is())
+ return;
+
+ float fFontHeight = 0;
+
+ vector< OUString > aProperties;
+ aProperties.push_back( OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" )));
+ aProperties.push_back( OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeightAsian" )));
+ aProperties.push_back( OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeightComplex" )));
+
+ for( vector< OUString >::const_iterator aIt = aProperties.begin();
+ aIt != aProperties.end(); ++aIt )
+ {
+ try
+ {
+ if( xTargetProperties->getPropertyValue( *aIt ) >>= fFontHeight )
+ {
+ xTargetProperties->setPropertyValue(
+ *aIt,
+ makeAny( static_cast< float >(
+ calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
+ }
+ }
+ catch( const Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/ResId.cxx b/chart2/source/tools/ResId.cxx
new file mode 100644
index 000000000000..0d6e35974aaa
--- /dev/null
+++ b/chart2/source/tools/ResId.cxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ResId.hxx"
+#include "RessourceManager.hxx"
+#include <tools/string.hxx>
+
+namespace chart
+{
+
+SchResId::SchResId( sal_Int16 nId )
+ : ResId( nId, RessourceManager::getRessourceManager() )
+{}
+
+::rtl::OUString SchResId::getResString( sal_Int16 nId )
+{
+ return ::rtl::OUString( String( SchResId( nId )));
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/RessourceManager.cxx b/chart2/source/tools/RessourceManager.cxx
new file mode 100644
index 000000000000..a2d43b309019
--- /dev/null
+++ b/chart2/source/tools/RessourceManager.cxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "RessourceManager.hxx"
+
+#include <tools/resmgr.hxx>
+
+namespace chart
+{
+
+ResMgr * RessourceManager::m_pRessourceManager = 0;
+
+ResMgr & RessourceManager::getRessourceManager()
+{
+ // not threadsafe
+ if( ! m_pRessourceManager )
+ m_pRessourceManager = CREATEVERSIONRESMGR( chartcontroller );
+ OSL_ASSERT( m_pRessourceManager );
+ return *m_pRessourceManager;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/Scaling.cxx b/chart2/source/tools/Scaling.cxx
new file mode 100644
index 000000000000..e106f1dcc5e2
--- /dev/null
+++ b/chart2/source/tools/Scaling.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Scaling.hxx"
+#include <rtl/math.hxx>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName_Logarithmic(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LogarithmicScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Exponential(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ExponentialScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Linear(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LinearScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Power(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PowerScaling" ));
+
+static const ::rtl::OUString lcl_aImplementationName_Logarithmic(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.LogarithmicScaling" ));
+static const ::rtl::OUString lcl_aImplementationName_Exponential(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ExponentialScaling" ));
+static const ::rtl::OUString lcl_aImplementationName_Linear(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.LinearScaling" ));
+static const ::rtl::OUString lcl_aImplementationName_Power(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PowerScaling" ));
+}
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LogarithmicScaling::LogarithmicScaling( const uno::Reference< uno::XComponentContext > & xContext ) :
+ m_fBase( 10.0 ),
+ m_fLogOfBase( log( 10.0 ) ),
+ m_xContext( xContext )
+{
+}
+
+LogarithmicScaling::LogarithmicScaling( double fBase ) :
+ m_fBase( fBase ),
+ m_fLogOfBase( log( fBase ) )
+{
+}
+
+LogarithmicScaling::~LogarithmicScaling()
+{
+}
+
+ double SAL_CALL
+LogarithmicScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult;
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ fResult = log( value ) / m_fLogOfBase;
+ return fResult;
+}
+
+ uno::Reference< XScaling > SAL_CALL
+LogarithmicScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new ExponentialScaling( m_fBase );
+}
+
+ ::rtl::OUString SAL_CALL
+LogarithmicScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Logarithmic;
+}
+
+uno::Sequence< ::rtl::OUString > LogarithmicScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_Logarithmic, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LogarithmicScaling, lcl_aServiceName_Logarithmic )
+
+// ----------------------------------------
+
+ExponentialScaling::ExponentialScaling( const uno::Reference< uno::XComponentContext > & xContext ) :
+ m_fBase( 10.0 ),
+ m_xContext( xContext )
+{
+}
+
+ExponentialScaling::ExponentialScaling( double fBase ) :
+ m_fBase( fBase )
+{
+}
+
+ExponentialScaling::~ExponentialScaling()
+{
+}
+
+ double SAL_CALL
+ExponentialScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult;
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ fResult = pow( m_fBase, value );
+ return fResult;
+}
+
+ uno::Reference< XScaling > SAL_CALL
+ExponentialScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new LogarithmicScaling( m_fBase );
+}
+
+ ::rtl::OUString SAL_CALL
+ExponentialScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Exponential;
+}
+
+uno::Sequence< ::rtl::OUString > ExponentialScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_Exponential, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ExponentialScaling, lcl_aServiceName_Exponential )
+
+// ----------------------------------------
+
+LinearScaling::LinearScaling( const uno::Reference< uno::XComponentContext > & xContext ) :
+ m_fSlope( 1.0 ),
+ m_fOffset( 0.0 ),
+ m_xContext( xContext )
+{}
+
+LinearScaling::LinearScaling( double fSlope, double fOffset ) :
+ m_fSlope( fSlope ),
+ m_fOffset( fOffset )
+{}
+
+LinearScaling::~LinearScaling()
+{}
+
+double SAL_CALL LinearScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult;
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ fResult = m_fOffset + m_fSlope * value;
+ return fResult;
+}
+
+uno::Reference< XScaling > SAL_CALL
+ LinearScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ // ToDo: ApproxEqual ?
+ if( m_fSlope == 0 )
+ throw uno::RuntimeException();
+
+ return new LinearScaling( 1.0 / m_fSlope, m_fOffset / m_fSlope );
+}
+
+ ::rtl::OUString SAL_CALL
+LinearScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Linear;
+}
+
+uno::Sequence< ::rtl::OUString > LinearScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_Linear, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LinearScaling, lcl_aServiceName_Linear )
+
+// ----------------------------------------
+
+PowerScaling::PowerScaling( const uno::Reference< uno::XComponentContext > & xContext ) :
+ m_fExponent( 10.0 ),
+ m_xContext( xContext )
+{}
+
+PowerScaling::PowerScaling( double fExponent ) :
+ m_fExponent( fExponent )
+{}
+
+PowerScaling::~PowerScaling()
+{}
+
+double SAL_CALL PowerScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult;
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ fResult = pow( value, m_fExponent );
+ return fResult;
+}
+
+uno::Reference< XScaling > SAL_CALL
+ PowerScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ // ToDo: ApproxEqual ?
+ if( m_fExponent == 0 )
+ throw uno::RuntimeException();
+
+ return new PowerScaling( 1.0 / m_fExponent );
+}
+
+ ::rtl::OUString SAL_CALL
+PowerScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Power;
+}
+
+uno::Sequence< ::rtl::OUString > PowerScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_Power, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( PowerScaling, lcl_aServiceName_Power )
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/SceneProperties.cxx b/chart2/source/tools/SceneProperties.cxx
new file mode 100644
index 000000000000..21a95d99be7d
--- /dev/null
+++ b/chart2/source/tools/SceneProperties.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "SceneProperties.hxx"
+#include "macros.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+
+// for F_PI
+#include <tools/solar.h>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+namespace chart
+{
+
+void SceneProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ // transformation matrix
+ rOutProperties.push_back(
+ Property( C2U( "D3DTransformMatrix" ),
+ PROP_SCENE_TRANSF_MATRIX,
+ ::getCppuType( reinterpret_cast< const drawing::HomogenMatrix * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // distance: deprecated ( this is not used by the chart view; it's only here for compatibility with old chart )
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneDistance" ),
+ PROP_SCENE_DISTANCE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // focalLength: deprecated ( this is not used by the chart view; it's only here for compatibility with old chart )
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneFocalLength" ),
+ PROP_SCENE_FOCAL_LENGTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // shadowSlant
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneShadowSlant" ),
+ PROP_SCENE_SHADOW_SLANT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // shadeMode
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneShadeMode" ),
+ PROP_SCENE_SHADE_MODE,
+ ::getCppuType( reinterpret_cast< const drawing::ShadeMode * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // ambientColor
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneAmbientColor" ),
+ PROP_SCENE_AMBIENT_COLOR,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // lightingMode
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneTwoSidedLighting" ),
+ PROP_SCENE_TWO_SIDED_LIGHTING,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // camera geometry
+ rOutProperties.push_back(
+ Property( C2U( "D3DCameraGeometry" ),
+ PROP_SCENE_CAMERA_GEOMETRY,
+ ::getCppuType( reinterpret_cast< const drawing::CameraGeometry * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // perspective
+ rOutProperties.push_back(
+ Property( C2U( "D3DScenePerspective" ),
+ PROP_SCENE_PERSPECTIVE,
+ ::getCppuType( reinterpret_cast< const drawing::ProjectionMode * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ // Light Sources
+ // -------------
+ // light source 1
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor1" ),
+ PROP_SCENE_LIGHT_COLOR_1,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection1" ),
+ PROP_SCENE_LIGHT_DIRECTION_1,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn1" ),
+ PROP_SCENE_LIGHT_ON_1,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 2
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor2" ),
+ PROP_SCENE_LIGHT_COLOR_2,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection2" ),
+ PROP_SCENE_LIGHT_DIRECTION_2,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn2" ),
+ PROP_SCENE_LIGHT_ON_2,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 3
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor3" ),
+ PROP_SCENE_LIGHT_COLOR_3,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection3" ),
+ PROP_SCENE_LIGHT_DIRECTION_3,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn3" ),
+ PROP_SCENE_LIGHT_ON_3,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 4
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor4" ),
+ PROP_SCENE_LIGHT_COLOR_4,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection4" ),
+ PROP_SCENE_LIGHT_DIRECTION_4,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn4" ),
+ PROP_SCENE_LIGHT_ON_4,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 5
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor5" ),
+ PROP_SCENE_LIGHT_COLOR_5,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection5" ),
+ PROP_SCENE_LIGHT_DIRECTION_5,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn5" ),
+ PROP_SCENE_LIGHT_ON_5,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 6
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor6" ),
+ PROP_SCENE_LIGHT_COLOR_6,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection6" ),
+ PROP_SCENE_LIGHT_DIRECTION_6,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn6" ),
+ PROP_SCENE_LIGHT_ON_6,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 7
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor7" ),
+ PROP_SCENE_LIGHT_COLOR_7,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection7" ),
+ PROP_SCENE_LIGHT_DIRECTION_7,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn7" ),
+ PROP_SCENE_LIGHT_ON_7,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ // light source 8
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightColor8" ),
+ PROP_SCENE_LIGHT_COLOR_8,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightDirection8" ),
+ PROP_SCENE_LIGHT_DIRECTION_8,
+ ::getCppuType( reinterpret_cast< const drawing::Direction3D * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "D3DSceneLightOn8" ),
+ PROP_SCENE_LIGHT_ON_8,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void SceneProperties::AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+ // Identity Matrix
+ drawing::HomogenMatrix aMtx;
+ aMtx.Line1.Column1 = aMtx.Line2.Column2 =
+ aMtx.Line3.Column3 = aMtx.Line4.Column4 = 1.0;
+ aMtx.Line1.Column2 = aMtx.Line1.Column3 = aMtx.Line1.Column4 =
+ aMtx.Line2.Column1 = aMtx.Line2.Column3 = aMtx.Line2.Column4 =
+ aMtx.Line3.Column1 = aMtx.Line3.Column2 = aMtx.Line3.Column4 =
+ 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 );
+
+// PROP_SCENE_SHADOW_SLANT;
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_SHADE_MODE, drawing::ShadeMode_SMOOTH );
+
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >(
+ rOutMap, PROP_SCENE_AMBIENT_COLOR, ChartTypeHelper::getDefaultAmbientLightColor(ThreeDLookScheme_Simple,0));
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_TWO_SIDED_LIGHTING, true );
+
+ drawing::Position3D vrp( 0.0, 0.0, 1.0 );
+ drawing::Direction3D vpn( 0.0, 0.0, 1.0 );
+ drawing::Direction3D vup( 0.0, 1.0, 0.0 );
+ drawing::CameraGeometry aDefaultCameraGeometry( vrp, vpn, vup );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_CAMERA_GEOMETRY, aDefaultCameraGeometry );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_PERSPECTIVE, drawing::ProjectionMode_PERSPECTIVE );
+
+ // Light Sources
+ // -------------
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_1, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_2, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_3, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_4, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_5, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_6, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_7, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_ON_8, false );
+
+ uno::Any aDefaultLightDirection( uno::makeAny( drawing::Direction3D( 0.0, 0.0, 1.0 ) ) );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_1, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_2, ChartTypeHelper::getDefaultSimpleLightDirection(0));
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_3, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_4, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_5, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_6, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_7, aDefaultLightDirection );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_DIRECTION_8, aDefaultLightDirection );
+
+ uno::Any aDefaultLightColor;
+ aDefaultLightColor <<= ChartTypeHelper::getDefaultDirectLightColor(ThreeDLookScheme_Simple,0);
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_1, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_2, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_3, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_4, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_5, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_6, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_7, aDefaultLightColor );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCENE_LIGHT_COLOR_8, aDefaultLightColor );
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
new file mode 100644
index 000000000000..721451c276da
--- /dev/null
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -0,0 +1,403 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "StatisticsHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ErrorBar.hxx"
+#include "macros.hxx"
+
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::com::sun::star;
+
+namespace
+{
+
+double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidCount,
+ bool bUnbiasedEstimator )
+{
+ const sal_Int32 nCount = rData.getLength();
+ rOutValidCount = nCount;
+
+ double fSum = 0.0;
+ double fQuadSum = 0.0;
+
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ const double fData = rData[i];
+ if( ::rtl::math::isNan( fData ))
+ --rOutValidCount;
+ else
+ {
+ fSum += fData;
+ fQuadSum += fData * fData;
+ }
+ }
+
+ double fResult;
+ if( rOutValidCount == 0 )
+ ::rtl::math::setNan( & fResult );
+ else
+ {
+ const double fN = static_cast< double >( rOutValidCount );
+ if( bUnbiasedEstimator )
+ fResult = (fQuadSum - fSum*fSum/fN) / (fN - 1);
+ else
+ fResult = (fQuadSum - fSum*fSum/fN) / fN;
+ }
+
+ return fResult;
+}
+
+Reference< chart2::data::XLabeledDataSequence > lcl_getErrorBarLabeledSequence(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ bool bPositiveValue, bool bYError,
+ OUString & rOutRoleNameUsed )
+{
+ OUStringBuffer aRole( C2U("error-bars-"));
+ if( bYError )
+ aRole.append( sal_Unicode( 'y' ));
+ else
+ aRole.append( sal_Unicode( 'x' ));
+
+ OUString aPlainRole = aRole.makeStringAndClear();
+ aRole.append( aPlainRole );
+ aRole.append( sal_Unicode( '-' ));
+
+ if( bPositiveValue )
+ aRole = aRole.appendAscii( "positive" );
+ else
+ aRole = aRole.appendAscii( "negative" );
+
+ OUString aLongRole = aRole.makeStringAndClear();
+ 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 ));
+ if( xLSeq.is())
+ rOutRoleNameUsed = aPlainRole;
+ else
+ rOutRoleNameUsed = aLongRole;
+ }
+
+ return xLSeq;
+}
+
+void lcl_setRole(
+ const Reference< chart2::data::XDataSequence > & xNewSequence,
+ const OUString & rRole )
+{
+ Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
+ if( xSeqProp.is())
+ xSeqProp->setPropertyValue( C2U("Role"), uno::makeAny( rRole ));
+}
+
+void lcl_addSequenceToDataSource(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ const Reference< chart2::data::XDataSequence > & xNewSequence,
+ const OUString & rRole )
+{
+ Reference< chart2::data::XDataSink > xSink( xDataSource, uno::UNO_QUERY );
+ Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ if( ! ( xFact.is() && xSink.is() ))
+ return;
+
+ Reference< chart2::data::XLabeledDataSequence > xLSeq(
+ xFact->createInstance( C2U("com.sun.star.chart2.data.LabeledDataSequence")), uno::UNO_QUERY );
+ if( xLSeq.is())
+ {
+ lcl_setRole( xNewSequence, rRole );
+ xLSeq->setValues( xNewSequence );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
+ xDataSource->getDataSequences());
+ aSequences.realloc( aSequences.getLength() + 1 );
+ aSequences[ aSequences.getLength() - 1 ] = xLSeq;
+ xSink->setData( aSequences );
+ }
+}
+
+void lcl_setXMLRangePropertyAtDataSequence(
+ const Reference< chart2::data::XDataSequence > & xDataSequence,
+ const OUString & rXMLRange )
+{
+ try
+ {
+ const OUString aXMLRangePropName( C2U( "CachedXMLRange" ));
+ Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
+ if( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ))
+ xProp->setPropertyValue( aXMLRangePropName, uno::makeAny( rXMLRange ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+// static
+double StatisticsHelper::getVariance(
+ const Sequence< double > & rData,
+ bool bUnbiasedEstimator /* = false */ )
+{
+ sal_Int32 nValCount;
+ return lcl_getVariance( rData, nValCount, bUnbiasedEstimator );
+}
+
+// static
+double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData )
+{
+ double fResult = getVariance( rData );
+ if( ! ::rtl::math::isNan( fResult ))
+ fResult = sqrt( fResult );
+
+ return fResult;
+}
+
+// static
+double StatisticsHelper::getStandardError( const Sequence< double > & rData )
+{
+ sal_Int32 nValCount;
+ double fVar = lcl_getVariance( rData, nValCount, false );
+ double fResult;
+
+ if( nValCount == 0 ||
+ ::rtl::math::isNan( fVar ))
+ {
+ ::rtl::math::setNan( & fResult );
+ }
+ else
+ {
+ // standard-deviation / sqrt(n)
+ fResult = sqrt( fVar ) / sqrt( double(nValCount) );
+ }
+
+ return fResult;
+}
+
+// static
+Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ bool bPositiveValue,
+ bool bYError /* = true */ )
+{
+ Reference< chart2::data::XLabeledDataSequence > xResult;
+ if( !xDataSource.is())
+ return xResult;
+
+ OUString aRole;
+ Reference< chart2::data::XLabeledDataSequence > xLSeq(
+ lcl_getErrorBarLabeledSequence( xDataSource, bPositiveValue, bYError, aRole ));
+ if( xLSeq.is())
+ xResult.set( xLSeq );
+
+ return xResult;
+}
+
+// static
+Reference< chart2::data::XDataSequence > StatisticsHelper::getErrorDataSequenceFromDataSource(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ bool bPositiveValue,
+ bool bYError /* = true */ )
+{
+ Reference< chart2::data::XLabeledDataSequence > xLSeq(
+ StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
+ xDataSource, bPositiveValue,
+ bYError ));
+ if( !xLSeq.is())
+ return Reference< chart2::data::XDataSequence >();
+
+ return xLSeq->getValues();
+}
+
+// static
+double StatisticsHelper::getErrorFromDataSource(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ sal_Int32 nIndex,
+ bool bPositiveValue,
+ bool bYError /* = true */ )
+{
+ double fResult = 0.0;
+ ::rtl::math::setNan( & fResult );
+
+ Reference< chart2::data::XDataSequence > xValues(
+ StatisticsHelper::getErrorDataSequenceFromDataSource( xDataSource, bPositiveValue, bYError ));
+
+ Reference< chart2::data::XNumericalDataSequence > xNumValues( xValues, uno::UNO_QUERY );
+ if( xNumValues.is())
+ {
+ Sequence< double > aData( xNumValues->getNumericalData());
+ if( nIndex < aData.getLength())
+ fResult = aData[nIndex];
+ }
+ else if( xValues.is())
+ {
+ Sequence< uno::Any > aData( xValues->getData());
+ if( nIndex < aData.getLength())
+ aData[nIndex] >>= fResult;
+ }
+
+ return fResult;
+}
+
+// static
+void StatisticsHelper::setErrorDataSequence(
+ const Reference< chart2::data::XDataSource > & xDataSource,
+ const Reference< chart2::data::XDataProvider > & xDataProvider,
+ const OUString & rNewRange,
+ bool bPositiveValue,
+ bool bYError /* = true */,
+ OUString * pXMLRange /* = 0 */ )
+{
+ Reference< chart2::data::XDataSink > xDataSink( xDataSource, uno::UNO_QUERY );
+ if( ! ( xDataSink.is() && xDataProvider.is()))
+ return;
+
+ OUString aRole;
+ Reference< chart2::data::XLabeledDataSequence > xLSeq(
+ lcl_getErrorBarLabeledSequence( xDataSource, bPositiveValue, bYError, aRole ));
+ Reference< chart2::data::XDataSequence > xNewSequence(
+ xDataProvider->createDataSequenceByRangeRepresentation( rNewRange ));
+ if( xNewSequence.is())
+ {
+ if( pXMLRange )
+ lcl_setXMLRangePropertyAtDataSequence( xNewSequence, *pXMLRange );
+ if( xLSeq.is())
+ {
+ lcl_setRole( xNewSequence, aRole );
+ xLSeq->setValues( xNewSequence );
+ }
+ else
+ lcl_addSequenceToDataSource( xDataSource, xNewSequence, aRole );
+ }
+}
+
+// static
+Reference< beans::XPropertySet > StatisticsHelper::addErrorBars(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ const Reference< uno::XComponentContext > & xContext,
+ sal_Int32 nStyle,
+ bool bYError /* = true */ )
+{
+ Reference< beans::XPropertySet > xErrorBar;
+ Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
+ if( !xSeriesProp.is())
+ return xErrorBar;
+
+ const OUString aPropName( bYError ? C2U("ErrorBarY") : C2U("ErrorBarX"));
+ if( !( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar ) ||
+ !xErrorBar.is())
+ {
+ xErrorBar.set( createErrorBar( xContext ));
+ }
+
+ OSL_ASSERT( xErrorBar.is());
+ if( xErrorBar.is())
+ {
+ xErrorBar->setPropertyValue( C2U("ErrorBarStyle"), uno::makeAny( nStyle ));
+ }
+
+ xSeriesProp->setPropertyValue( aPropName, uno::makeAny( xErrorBar ));
+
+ return xErrorBar;
+}
+
+// static
+Reference< beans::XPropertySet > StatisticsHelper::getErrorBars(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ bool bYError /* = true */ )
+{
+ Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xErrorBar;
+ const OUString aPropName( bYError ? C2U("ErrorBarY") : C2U("ErrorBarX"));
+
+ if ( xSeriesProp.is())
+ xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar;
+
+ return xErrorBar;
+}
+
+// static
+bool StatisticsHelper::hasErrorBars(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ bool bYError /* = true */ )
+{
+ Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+
+ return ( xErrorBar.is() &&
+ ( xErrorBar->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) &&
+ nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE );
+}
+
+// static
+void StatisticsHelper::removeErrorBars(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ bool bYError /* = true */ )
+{
+ Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
+ if ( xErrorBar.is())
+ xErrorBar->setPropertyValue( C2U("ErrorBarStyle"), uno::makeAny(
+ ::com::sun::star::chart::ErrorBarStyle::NONE ));
+}
+
+// static
+bool StatisticsHelper::usesErrorBarRanges(
+ const Reference< chart2::XDataSeries > & xDataSeries,
+ bool bYError /* = true */ )
+{
+ Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, bYError ));
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+
+ return ( xErrorBar.is() &&
+ ( xErrorBar->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) &&
+ nStyle == ::com::sun::star::chart::ErrorBarStyle::FROM_DATA );
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
new file mode 100644
index 000000000000..44ed73eade43
--- /dev/null
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -0,0 +1,1527 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ThreeDHelper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "BaseGFXHelper.hxx"
+#include "DataSeriesHelper.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 <tools/debug.hxx>
+
+//.............................................................................
+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 ::rtl::OUString;
+using ::rtl::math::cos;
+using ::rtl::math::sin;
+using ::rtl::math::tan;
+
+#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
+
+namespace
+{
+
+bool lcl_isRightAngledAxesSetAndSupported( const Reference< beans::XPropertySet >& xSceneProperties )
+{
+ sal_Bool bRightAngledAxes = sal_False;
+ if( xSceneProperties.is() )
+ {
+ xSceneProperties->getPropertyValue( C2U("RightAngledAxes")) >>= bRightAngledAxes;
+ if(bRightAngledAxes)
+ {
+ uno::Reference< chart2::XDiagram > xDiagram( xSceneProperties, uno::UNO_QUERY );
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void lcl_RotateLightSource( const Reference< beans::XPropertySet >& xSceneProperties
+ , const OUString& rLightSourceDirection
+ , const OUString& rLightSourceOn
+ , const ::basegfx::B3DHomMatrix& rRotationMatrix )
+{
+ if( xSceneProperties.is() )
+ {
+ sal_Bool bLightOn = sal_False;
+ if( xSceneProperties->getPropertyValue( rLightSourceOn ) >>= bLightOn )
+ {
+ if( bLightOn )
+ {
+ drawing::Direction3D aLight;
+ if( xSceneProperties->getPropertyValue( rLightSourceDirection ) >>= aLight )
+ {
+ ::basegfx::B3DVector aLightVector( BaseGFXHelper::Direction3DToB3DVector( aLight ) );
+ aLightVector = rRotationMatrix*aLightVector;
+
+ xSceneProperties->setPropertyValue( rLightSourceDirection
+ , uno::makeAny( 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, C2U("D3DSceneLightDirection1"), C2U("D3DSceneLightOn1"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection2"), C2U("D3DSceneLightOn2"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection3"), C2U("D3DSceneLightOn3"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection4"), C2U("D3DSceneLightOn4"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection5"), C2U("D3DSceneLightOn5"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection6"), C2U("D3DSceneLightOn6"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection7"), C2U("D3DSceneLightOn7"), aLightRottion );
+ lcl_RotateLightSource( xSceneProperties, C2U("D3DSceneLightDirection8"), C2U("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;
+
+ sal_Bool bIsOn = sal_False;
+ xDiagramProps->getPropertyValue( C2U( 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( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ) ) >>= nColor;
+ if( nColor != ::chart::ChartTypeHelper::getDefaultDirectLightColor( !bRealistic, xChartType ) )
+ return false;
+
+ sal_Int32 nAmbientColor = 0;
+ xDiagramProps->getPropertyValue( C2U( UNO_NAME_3D_SCENE_AMBIENTCOLOR ) ) >>= nAmbientColor;
+ if( nAmbientColor != ::chart::ChartTypeHelper::getDefaultAmbientLightColor( !bRealistic, xChartType ) )
+ return false;
+
+ drawing::Direction3D aDirection(0,0,0);
+ xDiagramProps->getPropertyValue( C2U( 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
+ {
+ sal_Bool bRightAngledAxes = sal_False;
+ xDiagramProps->getPropertyValue( C2U("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( C2U( UNO_NAME_3D_SCENE_LIGHTON_2 ), uno::makeAny( sal_True ) );
+
+ uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY );
+ uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ uno::Any aADirection( uno::makeAny( rScheme == ThreeDLookScheme_Simple
+ ? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType)
+ : ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) ) );
+
+ xDiagramProps->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 ), aADirection );
+ //rotate light direction when right angled axes are off but supported
+ {
+ sal_Bool bRightAngledAxes = sal_False;
+ xDiagramProps->getPropertyValue( C2U("RightAngledAxes")) >>= bRightAngledAxes;
+ if(!bRightAngledAxes)
+ {
+ if( ChartTypeHelper::isSupportingRightAngledAxes( xChartType ) )
+ {
+ ::basegfx::B3DHomMatrix aRotation( lcl_getCompleteRotationMatrix( xDiagramProps ) );
+ BaseGFXHelper::ReduceToRotationMatrix( aRotation );
+ lcl_RotateLightSource( xDiagramProps, C2U("D3DSceneLightDirection2"), C2U("D3DSceneLightOn2"), aRotation );
+ }
+ }
+ }
+
+ sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
+ xDiagramProps->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ), uno::makeAny( nColor ) );
+
+ sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
+ xDiagramProps->setPropertyValue( C2U( UNO_NAME_3D_SCENE_AMBIENTCOLOR ), uno::makeAny( 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 )
+{
+ // ViewReferencePoint (Point on the View plane)
+ drawing::Position3D vrp(17634.6218373783, 10271.4823817647, 24594.8639082739);
+ // ViewPlaneNormal (Normal to the View Plane)
+ drawing::Direction3D vpn(0.416199821709347, 0.173649045905254, 0.892537795986984);
+ // ViewUpVector (determines the v-axis direction on the view plane as
+ // projection of VUP parallel to VPN onto th view pane)
+ drawing::Direction3D vup(-0.0733876362771618, 0.984807599917971, -0.157379306090273);
+
+ if( bPie )
+ {
+ vrp = drawing::Position3D( 0.0, 0.0, 87591.2408759124 );//--> 5 percent perspecitve
+ vpn = drawing::Direction3D( 0.0, 0.0, 1.0 );
+ vup = drawing::Direction3D( 0.0, 1.0, 0.0 );
+ }
+
+ return drawing::CameraGeometry( vrp, vpn, vup );
+}
+
+namespace
+{
+::basegfx::B3DHomMatrix lcl_getCameraMatrix( const uno::Reference< beans::XPropertySet >& xSceneProperties )
+{
+ drawing::HomogenMatrix aCameraMatrix;
+
+ drawing::CameraGeometry aCG( ThreeDHelper::getDefaultCameraGeometry() );
+ if( xSceneProperties.is() )
+ xSceneProperties->getPropertyValue( C2U( "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_shiftAngleToIntervalMinus180To180( sal_Int32& rnAngleDegree )
+{
+ //valid range: ]-180,180]
+ while( rnAngleDegree<=-180 )
+ rnAngleDegree+=360;
+ while( rnAngleDegree>180 )
+ rnAngleDegree-=360;
+}
+
+void lcl_shiftAngleToIntervalZeroTo360( sal_Int32& rnAngleDegree )
+{
+ //valid range: [0,360[
+ while( rnAngleDegree<0 )
+ rnAngleDegree+=360;
+ while( rnAngleDegree>=360 )
+ rnAngleDegree-=360;
+}
+
+void lcl_ensureIntervalMinus1To1( double& rSinOrCos )
+{
+ if (rSinOrCos < -1.0)
+ rSinOrCos = -1.0;
+ else if (rSinOrCos > 1.0)
+ rSinOrCos = 1.0;
+}
+
+bool lcl_isSinZero( double fAngleRad )
+{
+ return ::basegfx::fTools::equalZero( sin(fAngleRad), 0.0000001 );
+}
+bool lcl_isCosZero( double fAngleRad )
+{
+ return ::basegfx::fTools::equalZero( cos(fAngleRad), 0.0000001 );
+}
+
+}
+
+void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
+ sal_Int32 nElevationDeg, sal_Int32 nRotationDeg,
+ double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad)
+{
+ // for a description of the algorithm see issue 72994
+ //http://www.openoffice.org/issues/show_bug.cgi?id=72994
+ //http://www.openoffice.org/nonav/issues/showattachment.cgi/50608/DescriptionCorrected.odt
+
+ lcl_shiftAngleToIntervalZeroTo360( nElevationDeg );
+ lcl_shiftAngleToIntervalZeroTo360( nRotationDeg );
+
+ double& x = rfXAngleRad;
+ double& y = rfYAngleRad;
+ double& z = rfZAngleRad;
+
+ double E = F_PI*nElevationDeg/180; //elevation in Rad
+ double R = F_PI*nRotationDeg/180; //rotation in Rad
+
+ if( (nRotationDeg == 0 || nRotationDeg == 180 )
+ && ( nElevationDeg == 90 || nElevationDeg == 270 ) )
+ {
+ //sR==0 && cE==0
+ z = 0.0;
+ //element 23
+ double f23 = cos(R)*sin(E);
+ if(f23>0)
+ x = F_PI/2;
+ else
+ x = -F_PI/2;
+ y = R;
+ }
+ else if( ( nRotationDeg == 90 || nRotationDeg == 270 )
+ && ( nElevationDeg == 90 || nElevationDeg == 270 ) )
+ {
+ //cR==0 && cE==0
+ z = F_PI/2;
+ if( sin(R)>0 )
+ x = F_PI/2.0;
+ else
+ x = -F_PI/2.0;
+
+ if( (sin(R)*sin(E))>0 )
+ y = 0.0;
+ else
+ y = F_PI;
+ }
+ else if( (nRotationDeg == 0 || nRotationDeg == 180 )
+ && ( nElevationDeg == 0 || nElevationDeg == 180 ) )
+ {
+ //sR==0 && sE==0
+ z = 0.0;
+ y = R;
+ x = E;
+ }
+ else if( ( nRotationDeg == 90 || nRotationDeg == 270 )
+ && ( nElevationDeg == 0 || nElevationDeg == 180 ) )
+ {
+ //cR==0 && sE==0
+ z = 0.0;
+
+ if( (sin(R)/cos(E))>0 )
+ y = F_PI/2;
+ else
+ y = -F_PI/2;
+
+ if( (cos(E))>0 )
+ x = 0;
+ else
+ x = F_PI;
+ }
+ else if ( nElevationDeg == 0 || nElevationDeg == 180 )
+ {
+ //sR!=0 cR!=0 sE==0
+ z = 0.0;
+ x = E;
+ y = R;
+ //use element 13 for sign
+ if((cos(x)*sin(y)*sin(R))<0.0)
+ y *= -1.0;
+ }
+ 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 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_PI/2;
+ else
+ x = -F_PI/2;
+ //use element 21 for y
+ if( (sin(R)*sin(E)*sin(z))>0.0)
+ y = 0.0;
+ else
+ y = F_PI;
+ }
+ else if ( nRotationDeg == 0 || nRotationDeg == 180 )
+ {
+ //sE!=0 cE!=0 sR==0
+ z = 0.0;
+ x = E;
+ y = R;
+ double f23 = cos(R)*sin(E);
+ if( (f23 * sin(x)) < 0.0 )
+ x *= -1.0; //todo ??
+ }
+ else if (nRotationDeg == 90 || nRotationDeg == 270)
+ {
+ //sE!=0 cE!=0 cR==0
+ //z = +- F_PI/2;
+ //x = +- F_PI/2;
+ z = F_PI/2;
+ x = F_PI/2;
+ double sR = sin(R);
+ if( sR<0.0 )
+ x *= -1.0; //different signs for x and z
+
+ //use element 21:
+ double cy = sR*sin(E)/sin(z);
+ lcl_ensureIntervalMinus1To1(cy);
+ y = acos(cy);
+
+ //use element 22 for sign:
+ if( (sin(x)*sin(y)*sin(z)*cos(E))<0.0)
+ y *= -1.0;
+ }
+ else
+ {
+ z = atan(tan(R) * sin(E));
+ if(cos(z)==0.0)
+ {
+ DBG_ERROR("calculation error in ThreeDHelper::convertElevationRotationDegToXYZAngleRad");
+ return;
+ }
+ double cy = cos(R)/cos(z);
+ lcl_ensureIntervalMinus1To1(cy);
+ y = acos(cy);
+
+ //element 12 in 23
+ double fDenominator = cos(z)*(1.0-pow(sin(y),2));
+ if(fDenominator==0.0)
+ {
+ DBG_ERROR("calculation error in ThreeDHelper::convertElevationRotationDegToXYZAngleRad");
+ return;
+ }
+ double sx = cos(R)*sin(E)/fDenominator;
+ lcl_ensureIntervalMinus1To1(sx);
+ x = asin( sx );
+
+ //use element 13 for sign:
+ double f13a = cos(x)*cos(z)*sin(y);
+ double f13b = sin(R)-sx*sin(z);
+ if( (f13b*f13a)<0.0 )
+ {
+ //change x or y
+ //use element 22 for further investigations:
+ //try
+ y *= -1;
+ double f22a = cos(x)*cos(z);
+ double f22b = cos(E)-(sx*sin(y)*sin(z));
+ if( (f22a*f22b)<0.0 )
+ {
+ y *= -1;
+ x=(F_PI-x);
+ }
+ }
+ else
+ {
+ //change nothing or both
+ //use element 22 for further investigations:
+ double f22a = cos(x)*cos(z);
+ double f22b = cos(E)-(sx*sin(y)*sin(z));
+ if( (f22a*f22b)<0.0 )
+ {
+ y *= -1;
+ x=(F_PI-x);
+ }
+ }
+ }
+}
+
+void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
+ sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg,
+ double fXRad, double fYRad, double fZRad)
+{
+ // for a description of the algorithm see issue 72994
+ //http://www.openoffice.org/issues/show_bug.cgi?id=72994
+ //http://www.openoffice.org/nonav/issues/showattachment.cgi/50608/DescriptionCorrected.odt
+
+ double R = 0.0; //Rotation in Rad
+ double E = 0.0; //Elevation in Rad
+
+ double& x = fXRad;
+ double& y = fYRad;
+ double& z = fZRad;
+
+ double f11 = cos(y)*cos(z);
+
+ if( lcl_isSinZero(y) )
+ {
+ //siny == 0
+
+ if( lcl_isCosZero(x) )
+ {
+ //siny == 0 && cosx == 0
+
+ if( lcl_isSinZero(z) )
+ {
+ //siny == 0 && cosx == 0 && sinz == 0
+ //example: x=+-90 y=0oder180 z=0(oder180)
+
+ //element 13+11
+ if( f11 > 0 )
+ R = 0.0;
+ else
+ R = F_PI;
+
+ //element 23
+ double f23 = cos(z)*sin(x) / cos(R);
+ if( f23 > 0 )
+ E = F_PI/2.0;
+ else
+ E = -F_PI/2.0;
+ }
+ else if( lcl_isCosZero(z) )
+ {
+ //siny == 0 && cosx == 0 && cosz == 0
+ //example: x=+-90 y=0oder180 z=+-90
+
+ double f13 = sin(x)*sin(z);
+ //element 13+11
+ if( f13 > 0 )
+ R = F_PI/2.0;
+ else
+ R = -F_PI/2.0;
+
+ //element 21
+ double f21 = cos(y)*sin(z) / sin(R);
+ if( f21 > 0 )
+ E = F_PI/2.0;
+ else
+ E = -F_PI/2.0;
+ }
+ else
+ {
+ //siny == 0 && cosx == 0 && cosz != 0 && sinz != 0
+ //element 11 && 13
+ double f13 = sin(x)*sin(z);
+ R = atan( f13/f11 );
+
+ if(f11<0)
+ R+=F_PI;
+
+ //element 23
+ double f23 = cos(z)*sin(x);
+ if( f23/cos(R) > 0 )
+ E = F_PI/2.0;
+ else
+ E = -F_PI/2.0;
+ }
+ }
+ else if( lcl_isSinZero(x) )
+ {
+ //sinY==0 sinX==0
+ //element 13+11
+ if( f11 > 0 )
+ R = 0.0;
+ else
+ R = F_PI;
+
+ double f22 = cos(x)*cos(z);
+ if( f22 > 0 )
+ E = 0.0;
+ else
+ E = F_PI;
+ }
+ else if( lcl_isSinZero(z) )
+ {
+ //sinY==0 sinZ==0 sinx!=0 cosx!=0
+ //element 13+11
+ if( f11 > 0 )
+ R = 0.0;
+ else
+ R = F_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;
+ }
+ else if( lcl_isCosZero(z) )
+ {
+ //sinY == 0 && cosZ == 0 && cosx != 0 && sinx != 0
+ double f13 = sin(x)*sin(z);
+ //element 13+11
+ if( f13 > 0 )
+ R = F_PI/2.0;
+ else
+ R = -F_PI/2.0;
+
+ //element 21+22
+ double f21 = cos(y)*sin(z);
+ if( f21/sin(R) > 0 )
+ E = F_PI/2.0;
+ else
+ E = -F_PI/2.0;
+ }
+ else
+ {
+ //sinY == 0 && all other !=0
+ double f13 = sin(x)*sin(z);
+ R = atan( f13/f11 );
+ if( (f11*cos(R))<0.0 )
+ R+=F_PI;
+
+ double f22 = cos(x)*cos(z);
+ if( !lcl_isCosZero(R) )
+ E = atan( cos(z)*sin(x) /( f22*cos(R) ) );
+ else
+ E = atan( cos(y)*sin(z) /( f22*sin(R) ) );
+ if( (f22*cos(E))<0 )
+ E+=F_PI;
+ }
+ }
+ else if( lcl_isCosZero(y) )
+ {
+ //cosY==0
+
+ double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y);
+ if( f13 >= 0 )
+ R = F_PI/2.0;
+ else
+ R = -F_PI/2.0;
+
+ double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z);
+ if( f22 >= 0 )
+ E = 0.0;
+ else
+ E = F_PI;
+ }
+ else if( lcl_isSinZero(x) )
+ {
+ //cosY!=0 sinY!=0 sinX=0
+ if( lcl_isSinZero(z) )
+ {
+ //cosY!=0 sinY!=0 sinX=0 sinZ=0
+ double f13 = cos(x)*cos(z)*sin(y);
+ R = atan( f13/f11 );
+ //R = asin(f13);
+ if( f11<0 )
+ R+=F_PI;
+
+ double f22 = cos(x)*cos(z);
+ if( f22>0 )
+ E = 0.0;
+ else
+ E = F_PI;
+ }
+ else if( lcl_isCosZero(z) )
+ {
+ //cosY!=0 sinY!=0 sinX=0 cosZ=0
+ R = x;
+ E = y;//or -y
+ //use 23 for 'signs'
+ double f23 = -1.0*cos(x)*sin(y)*sin(z);
+ if( (f23*cos(R)*sin(E))<0.0 )
+ {
+ //change R or E
+ E = -y;
+ }
+ }
+ else
+ {
+ //cosY!=0 sinY!=0 sinX=0 sinZ!=0 cosZ!=0
+ double f13 = cos(x)*cos(z)*sin(y);
+ R = atan( f13/f11 );
+
+ if( f11<0 )
+ R+=F_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;
+ }
+ }
+ else if( lcl_isCosZero(x) )
+ {
+ //cosY!=0 sinY!=0 cosX=0
+
+ if( lcl_isSinZero(z) )
+ {
+ //cosY!=0 sinY!=0 cosX=0 sinZ=0
+ R=0;//13 -> R=0 or F_PI
+ if( f11<0.0 )
+ R=F_PI;
+ E=F_PI/2;//22 -> E=+-F_PI/2
+ //use element 11 and 23 for sign
+ double f23 = cos(z)*sin(x);
+ if( (f11*f23*sin(E))<0.0 )
+ E=-F_PI/2.0;
+ }
+ 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_PI/2.0;
+ else
+ R=-F_PI/2.0;
+ //element 22:
+ E=acos( sin(x)*sin(y)*sin(z));
+ //use element 21 for sign:
+ if( (cos(y)*sin(z)*sin(R)*sin(E))<0.0 )
+ E*=-1.0;
+ }
+ else
+ {
+ //cosY!=0 sinY!=0 cosX=0 sinZ!=0 cosZ!=0
+ //element 13/11
+ R = atan( sin(x)*sin(z)/(cos(y)*cos(z)) );
+ //use 13 for 'sign'
+ if( (sin(x)*sin(z))<0.0 )
+ R += F_PI;
+ //element 22
+ E = acos(sin(x)*sin(y)*sin(z) );
+ //use 21 for sign
+ if( (cos(y)*sin(z)*sin(R)*sin(E))<0.0 )
+ E*=-1.0;
+ }
+ }
+ else if( lcl_isSinZero(z) )
+ {
+ //cosY!=0 sinY!=0 sinX!=0 cosX!=0 sinZ=0
+ //element 11
+ R=y;
+ //use elenment 13 for sign
+ if( (cos(x)*cos(z)*sin(y)*sin(R))<0.0 )
+ R*=-1.0;
+ //element 22
+ E = acos( cos(x)*cos(z) );
+ //use element 23 for sign
+ if( (cos(z)*sin(x)*cos(R)*sin(E))<0.0 )
+ E*=-1.0;
+ }
+ else if( lcl_isCosZero(z) )
+ {
+ //cosY!=0 sinY!=0 sinX!=0 cosX!=0 cosZ=0
+ //element 21/23
+ 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;
+ //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;
+ }
+ else
+ {
+ //cosY!=0 sinY!=0 sinX!=0 cosX!=0 sinZ!=0 cosZ!=0
+ //13/11:
+ double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y);
+ R = atan( f13/ f11 );
+ if(f11<0.0)
+ R+=F_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;
+ }
+
+ rnElevationDeg = ::basegfx::fround( BaseGFXHelper::Rad2Deg( E ) );
+ rnRotationDeg = ::basegfx::fround( BaseGFXHelper::Rad2Deg( R ) );
+}
+
+double ThreeDHelper::getValueClippedToRange( double fAngle, const double& fPositivLimit )
+{
+ if( fAngle<-1*fPositivLimit )
+ fAngle=-1*fPositivLimit;
+ else if( fAngle>fPositivLimit )
+ fAngle=fPositivLimit;
+ return fAngle;
+}
+
+double ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()
+{
+ return 90.0;
+}
+
+double ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()
+{
+ return 45.0;
+}
+
+void ThreeDHelper::adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad )
+{
+ rfXAngleRad = ThreeDHelper::getValueClippedToRange(rfXAngleRad, BaseGFXHelper::Deg2Rad(ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()) );
+ rfYAngleRad = ThreeDHelper::getValueClippedToRange(rfYAngleRad, BaseGFXHelper::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( C2U("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_PI/2) || rfZAngleRad>(F_PI/2))
+ {
+ 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, sal_Bool bRightAngledAxes, bool bRotateLights )
+{
+ try
+ {
+ if( xSceneProperties.is() )
+ {
+ sal_Bool bOldRightAngledAxes = sal_False;
+ xSceneProperties->getPropertyValue( C2U("RightAngledAxes")) >>= bOldRightAngledAxes;
+ if( bOldRightAngledAxes!=bRightAngledAxes)
+ {
+ xSceneProperties->setPropertyValue( C2U("RightAngledAxes"), uno::makeAny( bRightAngledAxes ));
+ if( bRotateLights )
+ {
+ 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 & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+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 adaption 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(
+ C2U("D3DTransformMatrix"), uno::makeAny( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
+
+ //rotate lights if RightAngledAxes are not set or not supported
+ sal_Bool bRightAngledAxes = sal_False;
+ xSceneProperties->getPropertyValue( C2U("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 & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+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
+ {
+ fXAngle = BaseGFXHelper::Rad2Deg( fXAngle );
+ fYAngle = BaseGFXHelper::Rad2Deg( fYAngle );
+ fZAngle = BaseGFXHelper::Rad2Deg( fZAngle );
+
+ rnHorizontalAngleDegree = ::basegfx::fround(fXAngle);
+ rnVerticalAngleDegree = ::basegfx::fround(-1.0*fYAngle);
+ //nZRotation = ::basegfx::fround(-1.0*fZAngle);
+ }
+
+ lcl_shiftAngleToIntervalMinus180To180( rnHorizontalAngleDegree );
+ lcl_shiftAngleToIntervalMinus180To180( 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 = BaseGFXHelper::Deg2Rad( nHorizontalAngleDegree );
+ double fYAngle = BaseGFXHelper::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 )
+{
+ rfMinimumDistance = 3.0/4.0*FIXED_SIZE_FOR_3D_CHART_VOLUME;//empiric value
+ rfMaximumDistance = 20.0*FIXED_SIZE_FOR_3D_CHART_VOLUME;//empiric value
+}
+
+void ThreeDHelper::ensureCameraDistanceRange( double& rfCameraDistance )
+{
+ double fMin, fMax;
+ getCameraDistanceRange( fMin, fMax );
+ if( rfCameraDistance < fMin )
+ rfCameraDistance = fMin;
+ if( rfCameraDistance > fMax )
+ 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( C2U( "D3DCameraGeometry" ) ) >>= aCG;
+ ::basegfx::B3DVector aVRP( BaseGFXHelper::Position3DToB3DVector( aCG.vrp ) );
+ fCameraDistance = aVRP.getLength();
+
+ ensureCameraDistanceRange( fCameraDistance );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ 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( C2U( "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( C2U("D3DCameraGeometry"), uno::makeAny( aCG ));
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//static
+double ThreeDHelper::CameraDistanceToPerspective( double fCameraDistance )
+{
+ double fRet = fCameraDistance;
+ double fMin, fMax;
+ ThreeDHelper::getCameraDistanceRange( fMin, fMax );
+ //fMax <-> 0; fMin <->100
+ //a/x + b = y
+ double a = 100.0*fMax*fMin/(fMax-fMin);
+ double b = -a/fMax;
+
+ fRet = a/fCameraDistance + b;
+
+ return fRet;
+}
+
+//static
+double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective )
+{
+ double fRet = fPerspective;
+ double fMin, fMax;
+ ThreeDHelper::getCameraDistanceRange( fMin, fMax );
+ //fMax <-> 0; fMin <->100
+ //a/x + b = y
+ double a = 100.0*fMax*fMin/(fMax-fMin);
+ double b = -a/fMax;
+
+ fRet = a/(fPerspective - b);
+
+ return fRet;
+}
+
+//static
+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( C2U( "D3DSceneShadeMode" ) )>>= aShadeMode;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ 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( C2U( "D3DSceneShadeMode" ) )>>=aOldShadeMode) &&
+ aOldShadeMode == aShadeMode ))
+ {
+ xProp->setPropertyValue( C2U( "D3DSceneShadeMode" ), uno::makeAny( aShadeMode ));
+ }
+ }
+
+ lcl_setLightsForScheme( xProp, aScheme );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+}
+
+//static
+void ThreeDHelper::set3DSettingsToDefault( const uno::Reference< beans::XPropertySet >& xSceneProperties )
+{
+ Reference< beans::XPropertyState > xState( xSceneProperties, uno::UNO_QUERY );
+ if(xState.is())
+ {
+ xState->setPropertyToDefault( C2U("D3DSceneDistance"));
+ xState->setPropertyToDefault( C2U("D3DSceneFocalLength"));
+ }
+ ThreeDHelper::setDefaultRotation( xSceneProperties );
+ ThreeDHelper::setDefaultIllumination( xSceneProperties );
+}
+
+//static
+void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties, bool bPieOrDonut )
+{
+ if( !xSceneProperties.is() )
+ return;
+
+ drawing::CameraGeometry aCameraGeo( ThreeDHelper::getDefaultCameraGeometry( bPieOrDonut ) );
+ xSceneProperties->setPropertyValue( C2U("D3DCameraGeometry"), uno::makeAny( aCameraGeo ));
+
+ ::basegfx::B3DHomMatrix aSceneRotation;
+ if( bPieOrDonut )
+ aSceneRotation.rotate( -F_PI/3.0, 0, 0 );
+ xSceneProperties->setPropertyValue( C2U("D3DTransformMatrix"),
+ uno::makeAny( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation )));
+}
+
+//static
+void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties )
+{
+ bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( uno::Reference< XDiagram >(xSceneProperties, uno::UNO_QUERY) ) );
+ ThreeDHelper::setDefaultRotation( xSceneProperties, bPieOrDonut );
+}
+
+//static
+void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropertySet >& xSceneProperties )
+{
+ if( !xSceneProperties.is() )
+ return;
+
+ drawing::ShadeMode aShadeMode( drawing::ShadeMode_SMOOTH );
+ try
+ {
+ xSceneProperties->getPropertyValue( C2U( "D3DSceneShadeMode" ) )>>= aShadeMode;
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_1 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_3 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_4 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_5 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_6 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_7 ), uno::makeAny( sal_False ) );
+ xSceneProperties->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_8 ), uno::makeAny( sal_False ) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ ThreeDLookScheme aScheme = (drawing::ShadeMode_FLAT==aShadeMode) ? ThreeDLookScheme_Simple : ThreeDLookScheme_Realistic;
+ lcl_setLightsForScheme( xSceneProperties, aScheme );
+}
+
+//static
+void ThreeDHelper::getRoundedEdgesAndObjectLines(
+ const uno::Reference< XDiagram > & xDiagram
+ , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines )
+{
+ rnRoundedEdges = -1;
+ rnObjectLines = -1;
+ try
+ {
+ bool bDifferentRoundedEdges = false;
+ bool bDifferentObjectLines = false;
+
+ drawing::LineStyle aLineStyle( drawing::LineStyle_SOLID );
+
+ ::std::vector< uno::Reference< XDataSeries > > aSeriesList(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ sal_Int32 nSeriesCount = static_cast<sal_Int32>( aSeriesList.size() );
+
+ rtl::OUString aPercentDiagonalPropertyName( C2U( "PercentDiagonal" ) );
+ rtl::OUString aBorderStylePropertyName( C2U( "BorderStyle" ) );
+
+ for( sal_Int32 nS = 0; nS < nSeriesCount; ++nS )
+ {
+ uno::Reference< XDataSeries > xSeries( aSeriesList[nS] );
+ uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ if(!nS)
+ {
+ rnRoundedEdges = 0;
+ try
+ {
+ sal_Int16 nPercentDiagonal = 0;
+
+ xProp->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
+ rnRoundedEdges = static_cast< sal_Int32 >( nPercentDiagonal );
+
+ if( DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
+ , aPercentDiagonalPropertyName, uno::makeAny(nPercentDiagonal) ) )
+ bDifferentRoundedEdges = true;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ bDifferentRoundedEdges = true;
+ }
+ try
+ {
+ xProp->getPropertyValue( aBorderStylePropertyName ) >>= aLineStyle;
+
+ if( DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
+ , aBorderStylePropertyName, uno::makeAny(aLineStyle) ) )
+ bDifferentObjectLines = true;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ bDifferentObjectLines = true;
+ }
+ }
+ else
+ {
+ if( !bDifferentRoundedEdges )
+ {
+ sal_Int16 nPercentDiagonal = 0;
+ xProp->getPropertyValue( aPercentDiagonalPropertyName ) >>= nPercentDiagonal;
+ sal_Int32 nCurrentRoundedEdges = static_cast< sal_Int32 >( nPercentDiagonal );
+ if(nCurrentRoundedEdges!=rnRoundedEdges
+ || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
+ , aPercentDiagonalPropertyName, uno::makeAny( static_cast< sal_Int16 >(rnRoundedEdges) ) ) )
+ {
+ bDifferentRoundedEdges = true;
+ nCurrentRoundedEdges = -1;
+ }
+ }
+
+ if( !bDifferentObjectLines )
+ {
+ drawing::LineStyle aCurrentLineStyle;
+ xProp->getPropertyValue( aBorderStylePropertyName ) >>= aCurrentLineStyle;
+ if(aCurrentLineStyle!=aLineStyle
+ || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries
+ , aBorderStylePropertyName, uno::makeAny(aLineStyle) ) )
+ bDifferentObjectLines = true;
+ }
+ }
+ if( bDifferentRoundedEdges && bDifferentObjectLines )
+ break;
+ }
+
+ //set rnObjectLines
+ rnObjectLines = 0;
+ if( bDifferentObjectLines )
+ rnObjectLines = -1;
+ else if( aLineStyle == drawing::LineStyle_SOLID )
+ rnObjectLines = 1;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+//static
+void ThreeDHelper::setRoundedEdgesAndObjectLines(
+ const uno::Reference< XDiagram > & xDiagram
+ , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines )
+{
+ if( (nRoundedEdges<0||nRoundedEdges>100) && nObjectLines!=0 && nObjectLines!=1 )
+ return;
+
+ drawing::LineStyle aLineStyle( drawing::LineStyle_NONE );
+ if(nObjectLines==1)
+ aLineStyle = drawing::LineStyle_SOLID;
+
+ uno::Any aALineStyle( uno::makeAny(aLineStyle));
+ uno::Any aARoundedEdges( uno::makeAny( 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 )
+ {
+ uno::Reference< XDataSeries > xSeries( aSeriesList[nS] );
+
+ if( nRoundedEdges>=0 && nRoundedEdges<=100 )
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "PercentDiagonal" ), aARoundedEdges );
+
+ if( nObjectLines==0 || nObjectLines==1 )
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), aALineStyle );
+ }
+}
+
+//static
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const Reference< beans::XPropertySet >& xSceneProperties )
+{
+ 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 ) )
+ {
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
+ fZAngleRad=0.0;
+ }
+ if( sin(fYAngleRad)>0.0 )
+ eRet = CuboidPlanePosition_Right;
+ return eRet;
+}
+
+//static
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const Reference< beans::XPropertySet >& xSceneProperties )
+{
+ 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 ) )
+ {
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
+ fZAngleRad=0.0;
+ }
+ if( cos(fXAngleRad)*cos(fYAngleRad)<0.0 )
+ eRet = CuboidPlanePosition_Front;
+ return eRet;
+}
+
+//static
+CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const Reference< beans::XPropertySet >& xSceneProperties )
+{
+ 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 ) )
+ {
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad );
+ fZAngleRad=0.0;
+ }
+ if( sin(fXAngleRad)*cos(fYAngleRad)<0.0 )
+ eRet = CuboidPlanePosition_Top;
+ return eRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
new file mode 100644
index 000000000000..828a523245ff
--- /dev/null
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -0,0 +1,378 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <rtl/ustrbuf.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
+ TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< XDiagram >& xDiagram )
+{
+ uno::Reference< XTitled > xResult;
+
+ if( nTitleIndex == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION ||
+ nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
+ {
+ bool bDummy = false;
+ bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
+
+ if( nTitleIndex == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
+ nTitleIndex = bIsVertical ? TitleHelper::X_AXIS_TITLE : TitleHelper::Y_AXIS_TITLE;
+ else
+ nTitleIndex = bIsVertical ? TitleHelper::Y_AXIS_TITLE : TitleHelper::X_AXIS_TITLE;
+ }
+
+
+ switch( nTitleIndex )
+ {
+ case TitleHelper::SUB_TITLE:
+ if( xDiagram.is())
+ xResult.set( xDiagram, uno::UNO_QUERY );
+ break;
+ case TitleHelper::X_AXIS_TITLE:
+ if( xDiagram.is())
+ xResult.set( AxisHelper::getAxis( 0, true, xDiagram ), uno::UNO_QUERY );
+ break;
+ case TitleHelper::Y_AXIS_TITLE:
+ if( xDiagram.is())
+ xResult.set( AxisHelper::getAxis( 1, true, xDiagram ), uno::UNO_QUERY );
+ break;
+ case TitleHelper::Z_AXIS_TITLE:
+ if( xDiagram.is())
+ xResult.set( AxisHelper::getAxis( 2, true, xDiagram ), uno::UNO_QUERY );
+ break;
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ if( xDiagram.is())
+ xResult.set( AxisHelper::getAxis( 0, false, xDiagram ), uno::UNO_QUERY );
+ break;
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ if( xDiagram.is())
+ xResult.set( AxisHelper::getAxis( 1, false, xDiagram ), uno::UNO_QUERY );
+ break;
+
+ case TitleHelper::MAIN_TITLE:
+ default:
+ OSL_ENSURE( false, "Unsupported Title-Type requested" );
+ break;
+ }
+
+ return xResult;
+}
+
+uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< XTitled > xResult;
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ uno::Reference< XDiagram > xDiagram;
+ if( xChartDoc.is())
+ xDiagram.set( xChartDoc->getFirstDiagram());
+
+ switch( nTitleIndex )
+ {
+ case TitleHelper::MAIN_TITLE:
+ xResult.set( xModel, uno::UNO_QUERY );
+ break;
+ case TitleHelper::SUB_TITLE:
+ 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:
+ xResult.set( lcl_getTitleParentFromDiagram( nTitleIndex, xDiagram ));
+ break;
+ default:
+ OSL_ENSURE( false, "Unsupported Title-Type requested" );
+ break;
+ }
+
+ return xResult;
+}
+
+uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+ if( xTitled.is())
+ return xTitled->getTitleObject();
+ return NULL;
+}
+
+uno::Reference< XTitle > TitleHelper::createTitle(
+ TitleHelper::eTitleType eTitleType
+ , const rtl::OUString& rTitleText
+ , const uno::Reference< frame::XModel >& xModel
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , ReferenceSizeProvider * pRefSizeProvider )
+{
+ uno::Reference< XTitle > xTitle;
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) );
+
+ if( !xTitled.is() )
+ {
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
+ uno::Reference< chart2::XAxis > xAxis;
+ switch( eTitleType )
+ {
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ xAxis = AxisHelper::createAxis( 0, false, xDiagram, xContext );
+ break;
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ xAxis = AxisHelper::createAxis( 1, false, xDiagram, xContext );
+ break;
+ default:
+ break;
+ }
+ uno::Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ xProps->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ xTitled = lcl_getTitleParent( eTitleType, xModel );
+ }
+ }
+
+ if(xTitled.is())
+ {
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
+
+ xTitle.set( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.Title" ),
+ xContext ), uno::UNO_QUERY );
+
+ if(xTitle.is())
+ {
+ // 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;
+ }
+
+ // set/clear autoscale
+ if( pRefSizeProvider )
+ pRefSizeProvider->setValuesAtTitle( 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 )
+
+ {
+ try
+ {
+ bool bDummy = false;
+ bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
+
+ Reference< beans::XPropertySet > xTitleProps( xTitle, uno::UNO_QUERY );
+ if( xTitleProps.is() )
+ {
+ double fNewAngleDegree = 90.0;
+ 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( C2U( "TextRotation" ), uno::makeAny( fNewAngleDegree ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ return xTitle;
+
+}
+
+rtl::OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle )
+{
+ rtl::OUString aRet;
+ if(!xTitle.is())
+ return aRet;
+ uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText();
+ for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ )
+ aRet += aStringList[nN]->getString();
+ return aRet;
+}
+
+void TitleHelper::setCompleteString( const rtl::OUString& rNewText
+ , const uno::Reference< XTitle >& xTitle
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , float * pDefaultCharHeight /* = 0 */ )
+{
+ //the format of the first old text portion will be maintained if there is any
+ if(!xTitle.is())
+ return;
+
+ rtl::OUString aNewText = rNewText;
+
+ bool bStacked = false;
+ uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY );
+ if( xTitleProperties.is() )
+ xTitleProperties->getPropertyValue( C2U( "StackCharacters" ) ) >>= bStacked;
+
+ if( bStacked )
+ {
+ //#i99841# remove linebreaks that were added for vertical stacking
+ rtl::OUStringBuffer aUnstackedStr;
+ rtl::OUStringBuffer aSource(rNewText);
+
+ bool bBreakIgnored = false;
+ sal_Int32 nLen = rNewText.getLength();
+ for( sal_Int32 nPos = 0; nPos < nLen; ++nPos )
+ {
+ sal_Unicode aChar = aSource.charAt( nPos );
+ if( aChar != '\n' )
+ {
+ aUnstackedStr.append( aChar );
+ bBreakIgnored = false;
+ }
+ else if( aChar == '\n' && bBreakIgnored )
+ aUnstackedStr.append( aChar );
+ else
+ bBreakIgnored = true;
+ }
+ aNewText = aUnstackedStr.makeStringAndClear();
+ }
+
+ uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1);
+
+ uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText();
+ if( aOldStringList.getLength() )
+ {
+ aNewStringList[0].set( aOldStringList[0] );
+ aNewStringList[0]->setString( aNewText );
+ }
+ else
+ {
+ uno::Reference< uno::XInterface > xI(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.FormattedString" ), xContext ) );
+ uno::Reference< XFormattedString > xFormattedString( xI, uno::UNO_QUERY );
+
+ if(xFormattedString.is())
+ {
+ xFormattedString->setString( aNewText );
+ aNewStringList[0].set( xFormattedString );
+ if( pDefaultCharHeight != 0 )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProp( xFormattedString, uno::UNO_QUERY_THROW );
+
+ uno::Any aFontSize( uno::makeAny( *pDefaultCharHeight ));
+ xProp->setPropertyValue( C2U("CharHeight"), aFontSize );
+ xProp->setPropertyValue( C2U("CharHeightAsian"), aFontSize );
+ xProp->setPropertyValue( C2U("CharHeightComplex"), aFontSize );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ xTitle->setText( aNewStringList );
+}
+
+void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel )
+{
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+ if( xTitled.is())
+ {
+ xTitled->setTitleObject(NULL);
+ }
+}
+
+bool TitleHelper::getTitleType( eTitleType& rType
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel )
+{
+ if( !xTitle.is() || !xModel.is() )
+ return false;
+
+ Reference< chart2::XTitle > xCurrentTitle;
+ for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ )
+ {
+ xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel );
+ if( xCurrentTitle == xTitle )
+ {
+ rType = static_cast<eTitleType>(nTitleType);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/tools/TrueGuard.cxx b/chart2/source/tools/TrueGuard.cxx
new file mode 100644
index 000000000000..6992552367ed
--- /dev/null
+++ b/chart2/source/tools/TrueGuard.cxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "TrueGuard.hxx"
+
+namespace chart
+{
+
+TrueGuard::TrueGuard( bool& rbTrueDuringGuardedTime )
+ : m_rbTrueDuringGuardedTime( rbTrueDuringGuardedTime )
+{
+ m_rbTrueDuringGuardedTime = true;
+}
+
+TrueGuard::~TrueGuard()
+{
+ m_rbTrueDuringGuardedTime = false;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx
new file mode 100644
index 000000000000..52cc6b9c03b6
--- /dev/null
+++ b/chart2/source/tools/UncachedDataSequence.cxx
@@ -0,0 +1,379 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UncachedDataSequence.hxx"
+#include "macros.hxx"
+#include "PropertyHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ModifyListenerHelper.hxx"
+
+#include <algorithm>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// necessary for MS compiler
+using ::comphelper::OPropertyContainer;
+using ::chart::impl::UncachedDataSequence_Base;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.UncachedDataSequence" ));
+
+enum
+{
+// PROP_SOURCE_IDENTIFIER,
+ PROP_NUMBERFORMAT_KEY,
+ PROP_PROPOSED_ROLE,
+ PROP_XML_RANGE
+};
+} // anonymous namespace
+
+
+// ____________________
+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())
+{
+ registerProperties();
+}
+
+UncachedDataSequence::UncachedDataSequence(
+ const Reference< chart2::XInternalDataProvider > & xIntDataProv,
+ const OUString & rRangeRepresentation,
+ const OUString & rRole )
+ : OPropertyContainer( GetBroadcastHelper()),
+ UncachedDataSequence_Base( GetMutex()),
+ m_nNumberFormatKey(0),
+ m_xDataProvider( xIntDataProv ),
+ m_aSourceRepresentation( rRangeRepresentation ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ registerProperties();
+ setFastPropertyValue_NoBroadcast( PROP_PROPOSED_ROLE, uno::makeAny( rRole ));
+}
+
+UncachedDataSequence::UncachedDataSequence( const UncachedDataSequence & rSource )
+ : ::comphelper::OMutexAndBroadcastHelper(),
+ OPropertyContainer( GetBroadcastHelper()),
+ ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >(),
+ UncachedDataSequence_Base( GetMutex()),
+ m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
+ m_sRole( rSource.m_sRole ),
+ m_xDataProvider( rSource.m_xDataProvider ),
+ m_aSourceRepresentation( rSource.m_aSourceRepresentation ),
+ m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
+{
+ registerProperties();
+}
+
+UncachedDataSequence::~UncachedDataSequence()
+{}
+
+void UncachedDataSequence::registerProperties()
+{
+ registerProperty( C2U( "NumberFormatKey" ),
+ PROP_NUMBERFORMAT_KEY,
+ 0, // PropertyAttributes
+ & m_nNumberFormatKey,
+ ::getCppuType( & m_nNumberFormatKey ) );
+
+ registerProperty( C2U( "Role" ),
+ PROP_PROPOSED_ROLE,
+ 0, // PropertyAttributes
+ & m_sRole,
+ ::getCppuType( & m_sRole ) );
+
+ registerProperty( C2U( "CachedXMLRange" ),
+ PROP_XML_RANGE,
+ 0, // PropertyAttributes
+ & m_aXMLRange,
+ ::getCppuType( & m_aXMLRange ) );
+}
+
+// ================================================================================
+
+Sequence< OUString > UncachedDataSequence::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.data.DataSequence" );
+ aServices[ 2 ] = C2U( "com.sun.star.chart2.data.NumericalDataSequence" );
+ aServices[ 3 ] = C2U( "com.sun.star.chart2.data.TextualDataSequence" );
+ return aServices;
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2( UncachedDataSequence, UncachedDataSequence_Base, OPropertyContainer )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UncachedDataSequence, UncachedDataSequence_Base, OPropertyContainer )
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL UncachedDataSequence::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ return Reference< beans::XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) );
+}
+
+// ____ ::comphelper::OPropertySetHelper ____
+// __________________________________________
+::cppu::IPropertyArrayHelper& UncachedDataSequence::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+// ____ ::comphelper::OPropertyArrayHelper ____
+// ____________________________________________
+::cppu::IPropertyArrayHelper* UncachedDataSequence::createArrayHelper() const
+{
+ Sequence< beans::Property > aProps;
+ // describes all properties which have been registered in the ctor
+ describeProperties( aProps );
+
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( UncachedDataSequence, lcl_aServiceName )
+
+// ================================================================================
+
+// ________ XNumericalDataSequence ________
+Sequence< double > SAL_CALL UncachedDataSequence::getNumericalData()
+ throw (uno::RuntimeException)
+{
+ Sequence< double > aResult;
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ if( m_xDataProvider.is())
+ {
+ Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
+ aResult.realloc( aValues.getLength());
+ ::std::transform( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(),
+ aResult.getArray(), CommonFunctors::AnyToDouble());
+ }
+ return aResult;
+ // \--
+}
+
+// ________ XTextualDataSequence ________
+Sequence< OUString > SAL_CALL UncachedDataSequence::getTextualData()
+ throw (uno::RuntimeException)
+{
+ Sequence< OUString > aResult;
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ if( m_xDataProvider.is())
+ {
+ Sequence< uno::Any > aValues( m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation ));
+ aResult.realloc( aValues.getLength());
+ ::std::transform( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(),
+ aResult.getArray(), CommonFunctors::AnyToString());
+ }
+ return aResult;
+ // \--
+}
+
+// ________ XDataSequence ________
+Sequence< Any > SAL_CALL UncachedDataSequence::getData()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ if( m_xDataProvider.is())
+ return m_xDataProvider->getDataByRangeRepresentation( m_aSourceRepresentation );
+ return Sequence< Any >();
+ // \--
+}
+
+OUString SAL_CALL UncachedDataSequence::getSourceRangeRepresentation()
+ throw (uno::RuntimeException)
+{
+ return getName();
+}
+
+
+Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data::LabelOrigin )
+ throw (uno::RuntimeException)
+{
+ // auto-generated label is an empty string
+ static const Sequence< OUString > aOneEmptyString( 1 );
+ return aOneEmptyString;
+}
+
+::sal_Int32 SAL_CALL UncachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ return m_nNumberFormatKey;
+}
+
+// ____ XIndexReplace ____
+void SAL_CALL UncachedDataSequence::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+ throw (lang::IllegalArgumentException,
+ lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ Sequence< Any > aData( getData());
+ if( Index < aData.getLength() &&
+ m_xDataProvider.is() )
+ {
+ aData[Index] = Element;
+ m_xDataProvider->setDataByRangeRepresentation( m_aSourceRepresentation, aData );
+ fireModifyEvent();
+ }
+}
+
+// ____ XIndexAccess (base of XIndexReplace) ____
+::sal_Int32 SAL_CALL UncachedDataSequence::getCount()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Implement!" );
+ return 0;
+}
+
+uno::Any SAL_CALL UncachedDataSequence::getByIndex( ::sal_Int32 )
+ throw (lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Implement!" );
+ return uno::Any();
+}
+
+// ____ XElementAccess (base of XIndexAccess) ____
+uno::Type SAL_CALL UncachedDataSequence::getElementType()
+ throw (uno::RuntimeException)
+{
+ return ::getCppuType( reinterpret_cast< uno::Any * >(0));
+}
+
+::sal_Bool SAL_CALL UncachedDataSequence::hasElements()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataProvider.is())
+ return sal_False;
+ return m_xDataProvider->hasDataByRangeRepresentation( m_aSourceRepresentation );
+}
+
+// ____ XNamed ____
+::rtl::OUString SAL_CALL UncachedDataSequence::getName()
+ throw (uno::RuntimeException)
+{
+ return m_aSourceRepresentation;
+}
+
+void SAL_CALL UncachedDataSequence::setName( const OUString& aName )
+ throw (uno::RuntimeException)
+{
+ m_aSourceRepresentation = aName;
+ fireModifyEvent();
+}
+
+
+
+Reference< util::XCloneable > SAL_CALL UncachedDataSequence::createClone()
+ throw (uno::RuntimeException)
+{
+ UncachedDataSequence * pNewSeq = new UncachedDataSequence( *this );
+ return Reference< util::XCloneable >( pNewSeq );
+}
+
+
+// ____ XModifiable ____
+::sal_Bool SAL_CALL UncachedDataSequence::isModified()
+ throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL UncachedDataSequence::setModified( ::sal_Bool bModified )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ if( bModified )
+ fireModifyEvent();
+}
+
+// ____ XModifyBroadcaster (base of XModifiable) ____
+void SAL_CALL UncachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL UncachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void UncachedDataSequence::fireModifyEvent()
+{
+ // @todo: currently never called, as data changes are not yet reported by
+ // the data provider
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/UserDefinedProperties.cxx b/chart2/source/tools/UserDefinedProperties.cxx
new file mode 100644
index 000000000000..707c48c1a6cc
--- /dev/null
+++ b/chart2/source/tools/UserDefinedProperties.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "UserDefinedProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::beans::Property;
+
+namespace chart
+{
+
+void UserDefinedProperties::AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ChartUserDefinedAttributes" ),
+ PROP_XML_USERDEF_CHART,
+ ::getCppuType( reinterpret_cast< const uno::Reference< container::XNameContainer > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "TextUserDefinedAttributes" ),
+ PROP_XML_USERDEF_TEXT,
+ ::getCppuType( reinterpret_cast< const uno::Reference< container::XNameContainer > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "ParaUserDefinedAttributes" ),
+ PROP_XML_USERDEF_PARA,
+ ::getCppuType( reinterpret_cast< const uno::Reference< container::XNameContainer > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ // UserDefinedAttributeSupplier
+ // ----------------------------
+ rOutProperties.push_back(
+ Property( C2U( "UserDefinedAttributes" ),
+ PROP_XML_USERDEF,
+ ::getCppuType( reinterpret_cast< const uno::Reference< container::XNameContainer > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/WeakListenerAdapter.cxx b/chart2/source/tools/WeakListenerAdapter.cxx
new file mode 100644
index 000000000000..bbb54e20bdce
--- /dev/null
+++ b/chart2/source/tools/WeakListenerAdapter.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WeakListenerAdapter.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+WeakModifyListenerAdapter::WeakModifyListenerAdapter(
+ const uno::WeakReference< util::XModifyListener > & xListener ) :
+ WeakListenerAdapter< ::com::sun::star::util::XModifyListener >( xListener )
+{}
+
+WeakModifyListenerAdapter::~WeakModifyListenerAdapter()
+{}
+
+void SAL_CALL WeakModifyListenerAdapter::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ Reference< util::XModifyListener > xModListener( getListener() );
+ if( xModListener.is())
+ xModListener->modified( aEvent );
+}
+
+// --------------------------------------------------------------------------------
+
+WeakSelectionChangeListenerAdapter::WeakSelectionChangeListenerAdapter(
+ const Reference< view::XSelectionChangeListener > & xListener ) :
+ WeakListenerAdapter< ::com::sun::star::view::XSelectionChangeListener >( xListener )
+{}
+
+WeakSelectionChangeListenerAdapter::~WeakSelectionChangeListenerAdapter()
+{}
+
+void SAL_CALL WeakSelectionChangeListenerAdapter::selectionChanged( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ Reference< view::XSelectionChangeListener > xSelChgListener( getListener() );
+ if( xSelChgListener.is())
+ xSelChgListener->selectionChanged( aEvent );
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/WrappedDefaultProperty.cxx b/chart2/source/tools/WrappedDefaultProperty.cxx
new file mode 100644
index 000000000000..03178d204ef7
--- /dev/null
+++ b/chart2/source/tools/WrappedDefaultProperty.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedDefaultProperty.hxx"
+#include "macros.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+WrappedDefaultProperty::WrappedDefaultProperty(
+ const OUString& rOuterName, const OUString& rInnerName,
+ const uno::Any& rNewOuterDefault ) :
+ WrappedProperty( rOuterName, rInnerName ),
+ m_aOuterDefaultValue( rNewOuterDefault )
+{}
+
+WrappedDefaultProperty::~WrappedDefaultProperty()
+{}
+
+void WrappedDefaultProperty::setPropertyToDefault(
+ const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xInnerPropSet( xInnerPropertyState, uno::UNO_QUERY );
+ if( xInnerPropSet.is())
+ this->setPropertyValue( m_aOuterDefaultValue, xInnerPropSet );
+}
+
+uno::Any WrappedDefaultProperty::getPropertyDefault(
+ const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ return m_aOuterDefaultValue;
+}
+
+beans::PropertyState WrappedDefaultProperty::getPropertyState(
+ const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ beans::PropertyState aState = beans::PropertyState_DIRECT_VALUE;
+ try
+ {
+ Reference< beans::XPropertySet > xInnerProp( xInnerPropertyState, uno::UNO_QUERY_THROW );
+ uno::Any aValue = this->getPropertyValue( xInnerProp );
+ if( m_aOuterDefaultValue == this->convertInnerToOuterValue( aValue ))
+ aState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aState;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/WrappedDirectStateProperty.cxx b/chart2/source/tools/WrappedDirectStateProperty.cxx
new file mode 100644
index 000000000000..601b6e199d59
--- /dev/null
+++ b/chart2/source/tools/WrappedDirectStateProperty.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedDirectStateProperty.hxx"
+#include "macros.hxx"
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+WrappedDirectStateProperty::WrappedDirectStateProperty(
+ const OUString& rOuterName, const OUString& rInnerName ) :
+ WrappedProperty( rOuterName, rInnerName )
+{}
+
+WrappedDirectStateProperty::~WrappedDirectStateProperty()
+{}
+
+beans::PropertyState WrappedDirectStateProperty::getPropertyState(
+ const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ return beans::PropertyState_DIRECT_VALUE;
+}
+
+} // namespace chart
diff --git a/chart2/source/tools/WrappedIgnoreProperty.cxx b/chart2/source/tools/WrappedIgnoreProperty.cxx
new file mode 100644
index 000000000000..aaa6c545a799
--- /dev/null
+++ b/chart2/source/tools/WrappedIgnoreProperty.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedIgnoreProperty.hxx"
+#include "macros.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+
+WrappedIgnoreProperty::WrappedIgnoreProperty( const OUString& rOuterName, const Any& rDefaultValue )
+ : WrappedProperty( rOuterName, OUString() )
+ , m_aDefaultValue( rDefaultValue )
+ , m_aCurrentValue( rDefaultValue )
+{
+}
+WrappedIgnoreProperty::~WrappedIgnoreProperty()
+{
+}
+
+void WrappedIgnoreProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ m_aCurrentValue = rOuterValue;
+}
+
+Any WrappedIgnoreProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return m_aCurrentValue;
+}
+
+void WrappedIgnoreProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ m_aCurrentValue = m_aDefaultValue;
+}
+
+Any WrappedIgnoreProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return m_aDefaultValue;
+}
+
+beans::PropertyState WrappedIgnoreProperty::getPropertyState( const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ return ( m_aCurrentValue == m_aDefaultValue
+ ? beans::PropertyState_DEFAULT_VALUE
+ : beans::PropertyState_DIRECT_VALUE );
+}
+
+//static
+void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedProperty* >& rList )
+{
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "LineDash" ), uno::makeAny( drawing::LineDash() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineDashName" ), uno::makeAny( rtl::OUString() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineColor" ), uno::makeAny( sal_Int32(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineTransparence" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineWidth" ), uno::makeAny( sal_Int32(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) );
+}
+
+//static
+void WrappedIgnoreProperties::addIgnoreFillProperties( std::vector< WrappedProperty* >& rList )
+{
+ addIgnoreFillProperties_without_BitmapProperties( rList );
+ addIgnoreFillProperties_only_BitmapProperties( rList );
+}
+
+//static
+void WrappedIgnoreProperties::addIgnoreFillProperties_without_BitmapProperties( ::std::vector< WrappedProperty* >& rList )
+{
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_SOLID ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillColor" ), uno::makeAny( sal_Int32(-1) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparence" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparenceGradientName" ), uno::makeAny( ::rtl::OUString() ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillTransparenceGradient" ), uno::makeAny( awt::Gradient() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillGradientName" ), uno::makeAny( ::rtl::OUString() ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillGradient" ), uno::makeAny( awt::Gradient() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillHatchName" ), uno::makeAny( ::rtl::OUString() ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillHatch" ), uno::makeAny( drawing::Hatch() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBackground" ), uno::makeAny( sal_Bool(sal_False) ) ) );
+}
+
+//static
+void WrappedIgnoreProperties::addIgnoreFillProperties_only_BitmapProperties( ::std::vector< WrappedProperty* >& rList )
+{
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapName" ), uno::makeAny( ::rtl::OUString() ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmap" ), uno::makeAny( uno::Reference< awt::XBitmap > (0) ) ) );
+// rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapURL" ), uno::makeAny( ::rtl::OUString() ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapOffsetX" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapOffsetY" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapPositionOffsetX" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapPositionOffsetY" ), uno::makeAny( sal_Int16(0) ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapRectanglePoint" ), uno::makeAny( drawing::RectanglePoint_LEFT_TOP ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapLogicalSize" ), uno::makeAny( sal_Bool(sal_False) ) ) );//todo correct default?
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapSizeX" ), uno::makeAny( sal_Int32(10) ) ) );//todo which default?
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapSizeY" ), uno::makeAny( sal_Int32(10) ) ) );//todo which default?
+ rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapMode" ), uno::makeAny( drawing::BitmapMode_REPEAT ) ) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/WrappedProperty.cxx b/chart2/source/tools/WrappedProperty.cxx
new file mode 100644
index 000000000000..b41d8a331f11
--- /dev/null
+++ b/chart2/source/tools/WrappedProperty.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedProperty.hxx"
+#include "macros.hxx"
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+WrappedProperty::WrappedProperty( const OUString& rOuterName, const OUString& rInnerName)
+ : m_aOuterName( rOuterName )
+ , m_aInnerName( rInnerName )
+{
+}
+WrappedProperty::~WrappedProperty()
+{
+}
+
+const OUString& WrappedProperty::getOuterName() const
+{
+ return m_aOuterName;
+}
+
+//virtual
+::rtl::OUString WrappedProperty::getInnerName() const
+{
+ return m_aInnerName;
+}
+
+Any WrappedProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ return rInnerValue;
+}
+Any WrappedProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ return rOuterValue;
+}
+
+void WrappedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(xInnerPropertySet.is())
+ xInnerPropertySet->setPropertyValue( this->getInnerName(), this->convertOuterToInnerValue( rOuterValue ) );
+}
+
+Any WrappedProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertySet.is() )
+ {
+ aRet = xInnerPropertySet->getPropertyValue( this->getInnerName() );
+ aRet = this->convertInnerToOuterValue( aRet );
+ }
+ return aRet;
+}
+
+void WrappedProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( xInnerPropertyState.is() && this->getInnerName().getLength() )
+ xInnerPropertyState->setPropertyToDefault(this->getInnerName());
+ else
+ {
+ Reference< beans::XPropertySet > xInnerProp( xInnerPropertyState, uno::UNO_QUERY );
+ setPropertyValue( getPropertyDefault( xInnerPropertyState ), xInnerProp );
+ }
+}
+
+Any WrappedProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertyState.is() )
+ {
+ aRet = xInnerPropertyState->getPropertyDefault( this->getInnerName() );
+ aRet = this->convertInnerToOuterValue( aRet );
+ }
+ return aRet;
+}
+
+beans::PropertyState WrappedProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState = beans::PropertyState_DIRECT_VALUE;
+ rtl::OUString aInnerName( this->getInnerName() );
+ if( xInnerPropertyState.is() && aInnerName.getLength() )
+ aState = xInnerPropertyState->getPropertyState( aInnerName );
+ else
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xInnerProp( xInnerPropertyState, uno::UNO_QUERY );
+ uno::Any aValue = this->getPropertyValue( xInnerProp );
+ if( !aValue.hasValue() )
+ aState = beans::PropertyState_DEFAULT_VALUE;
+ else
+ {
+ uno::Any aDefault = this->getPropertyDefault( xInnerPropertyState );
+ if( aValue == aDefault )
+ aState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ return aState;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx
new file mode 100644
index 000000000000..843aeb261a5f
--- /dev/null
+++ b/chart2/source/tools/WrappedPropertySet.cxx
@@ -0,0 +1,495 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedPropertySet.hxx"
+#include "macros.hxx"
+
+// header for define DELETEZ
+#include <tools/solar.h>
+
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+WrappedPropertySet::WrappedPropertySet()
+ : MutexContainer()
+ , m_xInfo(0)
+ , m_pPropertyArrayHelper(0)
+ , m_pWrappedPropertyMap(0)
+{
+}
+WrappedPropertySet::~WrappedPropertySet()
+{
+ clearWrappedPropertySet();
+}
+
+Reference< beans::XPropertyState > WrappedPropertySet::getInnerPropertyState()
+{
+ return Reference< beans::XPropertyState >( getInnerPropertySet(), uno::UNO_QUERY );
+}
+
+void WrappedPropertySet::clearWrappedPropertySet()
+{
+ // /--
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ //delete all wrapped properties
+ if(m_pWrappedPropertyMap)
+ {
+ for( tWrappedPropertyMap::iterator aIt = m_pWrappedPropertyMap->begin()
+ ; aIt!= m_pWrappedPropertyMap->end(); aIt++ )
+ {
+ const WrappedProperty* pWrappedProperty = (*aIt).second;
+ DELETEZ(pWrappedProperty);
+ }
+ }
+
+ DELETEZ(m_pPropertyArrayHelper);
+ DELETEZ(m_pWrappedPropertyMap);
+
+ m_xInfo = NULL;
+ // \--
+}
+
+//XPropertySet
+Reference< beans::XPropertySetInfo > SAL_CALL WrappedPropertySet::getPropertySetInfo( )
+ throw (uno::RuntimeException)
+{
+ if( !m_xInfo.is() )
+ {
+ // /--
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if( !m_xInfo.is() )
+ {
+ m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+ }
+ // \--
+ }
+ return m_xInfo;
+}
+
+void SAL_CALL WrappedPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ try
+ {
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( pWrappedProperty )
+ pWrappedProperty->setPropertyValue( rValue, xInnerPropertySet );
+ else if( xInnerPropertySet.is() )
+ xInnerPropertySet->setPropertyValue( rPropertyName, rValue );
+ else
+ {
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ERROR("found no inner property set to map to");
+#endif
+ }
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ throw ex;
+ }
+ catch( beans::PropertyVetoException& ex )
+ {
+ throw ex;
+ }
+ catch( lang::IllegalArgumentException& ex )
+ {
+ throw ex;
+ }
+ catch( lang::WrappedTargetException& ex )
+ {
+ throw ex;
+ }
+ catch( uno::RuntimeException& ex )
+ {
+ throw ex;
+ }
+ catch( uno::Exception& ex )
+ {
+ OSL_ENSURE(false,"invalid exception caught in WrappedPropertySet::setPropertyValue");
+ lang::WrappedTargetException aWrappedException;
+ aWrappedException.TargetException = uno::makeAny( ex );
+ throw aWrappedException;
+ }
+}
+Any SAL_CALL WrappedPropertySet::getPropertyValue( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ try
+ {
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyValue( xInnerPropertySet );
+ else if( xInnerPropertySet.is() )
+ aRet = xInnerPropertySet->getPropertyValue( rPropertyName );
+ else
+ {
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ERROR("found no inner property set to map to");
+#endif
+ }
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ throw ex;
+ }
+ catch( lang::WrappedTargetException& ex )
+ {
+ throw ex;
+ }
+ catch( uno::RuntimeException& ex )
+ {
+ throw ex;
+ }
+ catch( uno::Exception& ex )
+ {
+ OSL_ENSURE(false,"invalid exception caught in WrappedPropertySet::setPropertyValue");
+ lang::WrappedTargetException aWrappedException;
+ aWrappedException.TargetException = uno::makeAny( ex );
+ throw aWrappedException;
+ }
+
+ return aRet;
+}
+
+void SAL_CALL WrappedPropertySet::addPropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ xInnerPropertySet->addPropertyChangeListener( pWrappedProperty->getInnerName(), xListener );
+ else
+ xInnerPropertySet->addPropertyChangeListener( rPropertyName, xListener );
+ }
+// m_aBoundListenerContainer.addInterface( (sal_Int32)nHandle, xListener );
+}
+void SAL_CALL WrappedPropertySet::removePropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& aListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ xInnerPropertySet->removePropertyChangeListener( pWrappedProperty->getInnerName(), aListener );
+ else
+ xInnerPropertySet->removePropertyChangeListener( rPropertyName, aListener );
+ }
+}
+void SAL_CALL WrappedPropertySet::addVetoableChangeListener( const OUString& rPropertyName, const Reference< beans::XVetoableChangeListener >& aListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ xInnerPropertySet->addVetoableChangeListener( pWrappedProperty->getInnerName(), aListener );
+ else
+ xInnerPropertySet->addVetoableChangeListener( rPropertyName, aListener );
+ }
+}
+void SAL_CALL WrappedPropertySet::removeVetoableChangeListener( const OUString& rPropertyName, const Reference< beans::XVetoableChangeListener >& aListener )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xInnerPropertySet( this->getInnerPropertySet() );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ xInnerPropertySet->removeVetoableChangeListener( pWrappedProperty->getInnerName(), aListener );
+ else
+ xInnerPropertySet->removeVetoableChangeListener( rPropertyName, aListener );
+ }
+}
+
+//XMultiPropertySet
+void SAL_CALL WrappedPropertySet::setPropertyValues( const Sequence< OUString >& rNameSeq, const Sequence< Any >& rValueSeq )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bUnknownProperty = false;
+ sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<nMinCount; nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ try
+ {
+ this->setPropertyValue( aPropertyName, rValueSeq[nN] );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bUnknownProperty = true;
+ }
+ }
+ //todo: store unknown properties elsewhere
+// if( bUnknownProperty )
+// throw beans::UnknownPropertyException();
+}
+Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyValues( const Sequence< OUString >& rNameSeq )
+ throw (uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ try
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyValue( aPropertyName );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ catch( lang::WrappedTargetException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL WrappedPropertySet::addPropertiesChangeListener( const Sequence< OUString >& /* rNameSeq */, const Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented yet");
+ //todo
+}
+void SAL_CALL WrappedPropertySet::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented yet");
+ //todo
+}
+void SAL_CALL WrappedPropertySet::firePropertiesChangeEvent( const Sequence< OUString >& /* rNameSeq */, const Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented yet");
+ //todo
+}
+
+//XPropertyState
+beans::PropertyState SAL_CALL WrappedPropertySet::getPropertyState( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
+
+ Reference< beans::XPropertyState > xInnerPropertyState( this->getInnerPropertyState() );
+ if( xInnerPropertyState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aState = pWrappedProperty->getPropertyState( xInnerPropertyState );
+ else
+ aState = xInnerPropertyState->getPropertyState( rPropertyName );
+ }
+ return aState;
+}
+
+const WrappedProperty* WrappedPropertySet::getWrappedProperty( const ::rtl::OUString& rOuterName )
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rOuterName );
+ return getWrappedProperty( nHandle );
+}
+
+const WrappedProperty* WrappedPropertySet::getWrappedProperty( sal_Int32 nHandle )
+{
+ tWrappedPropertyMap::const_iterator aFound( getWrappedPropertyMap().find( nHandle ) );
+ if( aFound != getWrappedPropertyMap().end() )
+ return (*aFound).second;
+ return 0;
+}
+
+Sequence< beans::PropertyState > SAL_CALL WrappedPropertySet::getPropertyStates( const Sequence< OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Sequence< beans::PropertyState > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyState( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+void SAL_CALL WrappedPropertySet::setPropertyToDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Reference< beans::XPropertyState > xInnerPropertyState( this->getInnerPropertyState() );
+ if( xInnerPropertyState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ pWrappedProperty->setPropertyToDefault( xInnerPropertyState );
+ else
+ xInnerPropertyState->setPropertyToDefault( rPropertyName );
+ }
+}
+Any SAL_CALL WrappedPropertySet::getPropertyDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ Reference< beans::XPropertyState > xInnerPropertyState( this->getInnerPropertyState() );
+ if( xInnerPropertyState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyDefault(xInnerPropertyState);
+ else
+ aRet = xInnerPropertyState->getPropertyDefault( rPropertyName );
+ }
+ return aRet;
+}
+
+//XMultiPropertyStates
+void SAL_CALL WrappedPropertySet::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ const Sequence< beans::Property >& rPropSeq = getPropertySequence();
+ for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+void SAL_CALL WrappedPropertySet::setPropertiesToDefault( const Sequence< OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence< OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+::cppu::IPropertyArrayHelper& WrappedPropertySet::getInfoHelper()
+{
+ if(!m_pPropertyArrayHelper)
+ {
+ // /--
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if(!m_pPropertyArrayHelper)
+ {
+ sal_Bool bSorted = sal_True;
+ m_pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( getPropertySequence(), bSorted );
+ }
+ // \--
+ }
+ return *m_pPropertyArrayHelper;
+}
+
+//-----------------------------------------------------------------------------
+
+tWrappedPropertyMap& WrappedPropertySet::getWrappedPropertyMap()
+{
+ if(!m_pWrappedPropertyMap)
+ {
+ // /--
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if(!m_pWrappedPropertyMap)
+ {
+ std::vector< WrappedProperty* > aPropList( createWrappedProperties() );
+ m_pWrappedPropertyMap = new tWrappedPropertyMap();
+
+ for( std::vector< WrappedProperty* >::const_iterator aIt = aPropList.begin(); aIt!=aPropList.end(); ++aIt )
+ {
+ WrappedProperty* pProperty = *aIt;
+ if(pProperty)
+ {
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( pProperty->getOuterName() );
+
+ if( nHandle == -1 )
+ {
+ OSL_ENSURE( false, "missing property in property list" );
+ delete pProperty;//we are owner or the created WrappedProperties
+ }
+ else if( m_pWrappedPropertyMap->find( nHandle ) != m_pWrappedPropertyMap->end() )
+ {
+ //duplicate Wrapped property
+ OSL_ENSURE( false, "duplicate Wrapped property" );
+ delete pProperty;//we are owner or the created WrappedProperties
+ }
+ else
+ (*m_pWrappedPropertyMap)[ nHandle ] = pProperty;
+ }
+ }
+ }
+ // \--
+ }
+ return *m_pWrappedPropertyMap;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/XMLRangeHelper.cxx b/chart2/source/tools/XMLRangeHelper.cxx
new file mode 100644
index 000000000000..c5d345db0124
--- /dev/null
+++ b/chart2/source/tools/XMLRangeHelper.cxx
@@ -0,0 +1,418 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "XMLRangeHelper.hxx"
+#include <unotools/charclass.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <algorithm>
+#include <functional>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ================================================================================
+
+namespace
+{
+/** unary function that escapes backslashes and single quotes in a sal_Unicode
+ array (which you can get from an OUString with getStr()) and puts the result
+ into the OUStringBuffer given in the CTOR
+ */
+class lcl_Escape : public ::std::unary_function< sal_Unicode, void >
+{
+public:
+ lcl_Escape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {}
+ void operator() ( sal_Unicode aChar )
+ {
+ static const sal_Unicode m_aQuote( '\'' );
+ static const sal_Unicode m_aBackslash( '\\' );
+
+ if( aChar == m_aQuote ||
+ aChar == m_aBackslash )
+ m_aResultBuffer.append( m_aBackslash );
+ m_aResultBuffer.append( aChar );
+ }
+
+private:
+ ::rtl::OUStringBuffer & m_aResultBuffer;
+};
+
+// ----------------------------------------
+
+/** unary function that removes backslash escapes in a sal_Unicode array (which
+ you can get from an OUString with getStr()) and puts the result into the
+ OUStringBuffer given in the CTOR
+ */
+class lcl_UnEscape : public ::std::unary_function< sal_Unicode, void >
+{
+public:
+ lcl_UnEscape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {}
+ void operator() ( sal_Unicode aChar )
+ {
+ static const sal_Unicode m_aBackslash( '\\' );
+
+ if( aChar != m_aBackslash )
+ m_aResultBuffer.append( aChar );
+ }
+
+private:
+ ::rtl::OUStringBuffer & m_aResultBuffer;
+};
+
+// ----------------------------------------
+
+OUStringBuffer lcl_getXMLStringForCell( const ::chart::XMLRangeHelper::Cell & rCell )
+{
+ ::rtl::OUStringBuffer aBuffer;
+ if( rCell.empty())
+ return aBuffer;
+
+ sal_Int32 nCol = rCell.nColumn;
+ aBuffer.append( (sal_Unicode)'.' );
+ if( ! rCell.bRelativeColumn )
+ aBuffer.append( (sal_Unicode)'$' );
+
+ // get A, B, C, ..., AA, AB, ... representation of column number
+ if( nCol < 26 )
+ aBuffer.append( (sal_Unicode)('A' + nCol) );
+ else if( nCol < 702 )
+ {
+ aBuffer.append( (sal_Unicode)('A' + nCol / 26 - 1 ));
+ aBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+ else // works for nCol <= 18,278
+ {
+ aBuffer.append( (sal_Unicode)('A' + nCol / 702 - 1 ));
+ aBuffer.append( (sal_Unicode)('A' + (nCol % 702) / 26 ));
+ aBuffer.append( (sal_Unicode)('A' + nCol % 26) );
+ }
+
+ // write row number as number
+ if( ! rCell.bRelativeRow )
+ aBuffer.append( (sal_Unicode)'$' );
+ aBuffer.append( rCell.nRow + (sal_Int32)1 );
+
+ return aBuffer;
+}
+
+void lcl_getSingleCellAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ ::chart::XMLRangeHelper::Cell & rOutCell )
+{
+ // expect "\$?[a-zA-Z]+\$?[1-9][0-9]*"
+ static const sal_Unicode aDollar( '$' );
+ static const sal_Unicode aLetterA( 'A' );
+
+ ::rtl::OUString aCellStr = rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 ).toAsciiUpperCase();
+ const sal_Unicode* pStrArray = aCellStr.getStr();
+ sal_Int32 nLength = aCellStr.getLength();
+ sal_Int32 i = nLength - 1, nColumn = 0;
+
+ // parse number for row
+ while( CharClass::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
+ i--;
+ rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1;
+ // a dollar in XML means absolute (whereas in UI it means relative)
+ if( pStrArray[ i ] == aDollar )
+ {
+ i--;
+ rOutCell.bRelativeRow = false;
+ }
+ else
+ rOutCell.bRelativeRow = true;
+
+ // parse rest for column
+ sal_Int32 nPower = 1;
+ while( CharClass::isAsciiAlpha( pStrArray[ i ] ))
+ {
+ nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower;
+ i--;
+ nPower *= 26;
+ }
+ rOutCell.nColumn = nColumn - 1;
+
+ rOutCell.bRelativeColumn = true;
+ if( i >= 0 &&
+ pStrArray[ i ] == aDollar )
+ rOutCell.bRelativeColumn = false;
+ rOutCell.bIsEmpty = false;
+}
+
+bool lcl_getCellAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ ::chart::XMLRangeHelper::Cell & rOutCell,
+ ::rtl::OUString& rOutTableName )
+{
+ static const sal_Unicode aDot( '.' );
+ static const sal_Unicode aQuote( '\'' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nNextDelimiterPos = nStartPos;
+
+ sal_Int32 nDelimiterPos = nStartPos;
+ bool bInQuotation = false;
+ // parse table name
+ while( nDelimiterPos < nEndPos &&
+ ( bInQuotation || rXMLString[ nDelimiterPos ] != aDot ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nDelimiterPos ] == aBackslash )
+ ++nDelimiterPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nDelimiterPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nDelimiterPos;
+ }
+
+ if( nDelimiterPos == -1 )
+ return false;
+
+ if( nDelimiterPos > nStartPos && nDelimiterPos < nEndPos )
+ {
+ // there is a table name before the address
+
+ ::rtl::OUStringBuffer aTableNameBuffer;
+ const sal_Unicode * pTableName = rXMLString.getStr();
+
+ // remove escapes from table name
+ ::std::for_each( pTableName + nStartPos,
+ pTableName + nDelimiterPos,
+ lcl_UnEscape( aTableNameBuffer ));
+
+ // unquote quoted table name
+ const sal_Unicode * pBuf = aTableNameBuffer.getStr();
+ if( pBuf[ 0 ] == aQuote &&
+ pBuf[ aTableNameBuffer.getLength() - 1 ] == aQuote )
+ {
+ ::rtl::OUString aName = aTableNameBuffer.makeStringAndClear();
+ rOutTableName = aName.copy( 1, aName.getLength() - 2 );
+ }
+ else
+ rOutTableName = aTableNameBuffer.makeStringAndClear();
+ }
+ else
+ nDelimiterPos = nStartPos;
+
+ for( sal_Int32 i = 0;
+ nNextDelimiterPos < nEndPos;
+ nDelimiterPos = nNextDelimiterPos, i++ )
+ {
+ nNextDelimiterPos = rXMLString.indexOf( aDot, nDelimiterPos + 1 );
+ if( nNextDelimiterPos == -1 ||
+ nNextDelimiterPos > nEndPos )
+ nNextDelimiterPos = nEndPos + 1;
+
+ if( i==0 )
+ // only take first cell
+ lcl_getSingleCellAddressFromXMLString(
+ rXMLString, nDelimiterPos + 1, nNextDelimiterPos - 1, rOutCell );
+ }
+
+ return true;
+}
+
+bool lcl_getCellRangeAddressFromXMLString(
+ const ::rtl::OUString& rXMLString,
+ sal_Int32 nStartPos, sal_Int32 nEndPos,
+ ::chart::XMLRangeHelper::CellRange & rOutRange )
+{
+ bool bResult = true;
+ static const sal_Unicode aColon( ':' );
+ static const sal_Unicode aQuote( '\'' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nDelimiterPos = nStartPos;
+ bool bInQuotation = false;
+ // parse table name
+ while( nDelimiterPos < nEndPos &&
+ ( bInQuotation || rXMLString[ nDelimiterPos ] != aColon ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nDelimiterPos ] == aBackslash )
+ ++nDelimiterPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nDelimiterPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nDelimiterPos;
+ }
+
+ if( nDelimiterPos == nEndPos )
+ {
+ // only one cell
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nStartPos, nEndPos,
+ rOutRange.aUpperLeft,
+ rOutRange.aTableName );
+ if( !rOutRange.aTableName.getLength() )
+ bResult = false;
+ }
+ else
+ {
+ // range (separated by a colon)
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nStartPos, nDelimiterPos - 1,
+ rOutRange.aUpperLeft,
+ rOutRange.aTableName );
+ if( !rOutRange.aTableName.getLength() )
+ bResult = false;
+
+ ::rtl::OUString sTableSecondName;
+ if( bResult )
+ {
+ bResult = lcl_getCellAddressFromXMLString( rXMLString, nDelimiterPos + 1, nEndPos,
+ rOutRange.aLowerRight,
+ sTableSecondName );
+ }
+ if( bResult &&
+ sTableSecondName.getLength() &&
+ ! sTableSecondName.equals( rOutRange.aTableName ))
+ bResult = false;
+ }
+
+ return bResult;
+}
+
+} // anonymous namespace
+
+// ================================================================================
+
+namespace chart
+{
+namespace XMLRangeHelper
+{
+
+CellRange getCellRangeFromXMLString( const OUString & rXMLString )
+{
+ static const sal_Unicode aSpace( ' ' );
+ static const sal_Unicode aQuote( '\'' );
+// static const sal_Unicode aDoubleQuote( '\"' );
+ static const sal_Unicode aDollar( '$' );
+ static const sal_Unicode aBackslash( '\\' );
+
+ sal_Int32 nStartPos = 0;
+ sal_Int32 nEndPos = nStartPos;
+ const sal_Int32 nLength = rXMLString.getLength();
+
+ // reset
+ CellRange aResult;
+
+ // iterate over different ranges
+ for( sal_Int32 i = 0;
+ nEndPos < nLength;
+ nStartPos = ++nEndPos, i++ )
+ {
+ // find start point of next range
+
+ // ignore leading '$'
+ if( rXMLString[ nEndPos ] == aDollar)
+ nEndPos++;
+
+ bool bInQuotation = false;
+ // parse range
+ while( nEndPos < nLength &&
+ ( bInQuotation || rXMLString[ nEndPos ] != aSpace ))
+ {
+ // skip escaped characters (with backslash)
+ if( rXMLString[ nEndPos ] == aBackslash )
+ ++nEndPos;
+ // toggle quotation mode when finding single quotes
+ else if( rXMLString[ nEndPos ] == aQuote )
+ bInQuotation = ! bInQuotation;
+
+ ++nEndPos;
+ }
+
+ if( ! lcl_getCellRangeAddressFromXMLString(
+ rXMLString,
+ nStartPos, nEndPos - 1,
+ aResult ))
+ {
+ // if an error occured, bail out
+ return CellRange();
+ }
+ }
+
+ return aResult;
+}
+
+OUString getXMLStringFromCellRange( const CellRange & rRange )
+{
+ static const sal_Unicode aSpace( ' ' );
+ static const sal_Unicode aQuote( '\'' );
+
+ ::rtl::OUStringBuffer aBuffer;
+
+ if( (rRange.aTableName).getLength())
+ {
+ bool bNeedsEscaping = ( rRange.aTableName.indexOf( aQuote ) > -1 );
+ bool bNeedsQuoting = bNeedsEscaping || ( rRange.aTableName.indexOf( aSpace ) > -1 );
+
+ // quote table name if it contains spaces or quotes
+ if( bNeedsQuoting )
+ {
+ // leading quote
+ aBuffer.append( aQuote );
+
+ // escape existing quotes
+ if( bNeedsEscaping )
+ {
+ const sal_Unicode * pTableNameBeg = rRange.aTableName.getStr();
+
+ // append the quoted string at the buffer
+ ::std::for_each( pTableNameBeg,
+ pTableNameBeg + rRange.aTableName.getLength(),
+ lcl_Escape( aBuffer ) );
+ }
+ else
+ aBuffer.append( rRange.aTableName );
+
+ // final quote
+ aBuffer.append( aQuote );
+ }
+ else
+ aBuffer.append( rRange.aTableName );
+ }
+ aBuffer.append( lcl_getXMLStringForCell( rRange.aUpperLeft ));
+
+ if( ! rRange.aLowerRight.empty())
+ {
+ // we have a range (not a single cell)
+ aBuffer.append( sal_Unicode( ':' ));
+ aBuffer.append( lcl_getXMLStringForCell( rRange.aLowerRight ));
+ }
+
+ return aBuffer.makeStringAndClear();
+}
+
+} // namespace XMLRangeHelper
+} // namespace chart
diff --git a/chart2/source/tools/_serviceregistration_tools.cxx b/chart2/source/tools/_serviceregistration_tools.cxx
new file mode 100644
index 000000000000..3b1271921ede
--- /dev/null
+++ b/chart2/source/tools/_serviceregistration_tools.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <cppuhelper/implementationentry.hxx>
+#include "LabeledDataSequence.hxx"
+#include "CachedDataSequence.hxx"
+#include "DataSource.hxx"
+#include "ConfigColorScheme.hxx"
+#include "Scaling.hxx"
+#include "ErrorBar.hxx"
+#include "RegressionCurveModel.hxx"
+#include "RegressionEquation.hxx"
+#include "InternalDataProvider.hxx"
+#include "charttoolsdllapi.hxx"
+
+static struct ::cppu::ImplementationEntry g_entries_chart2_tools[] =
+{
+ {
+ ::chart::LabeledDataSequence::create
+ , ::chart::LabeledDataSequence::getImplementationName_Static
+ , ::chart::LabeledDataSequence::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::CachedDataSequence::create
+ , ::chart::CachedDataSequence::getImplementationName_Static
+ , ::chart::CachedDataSequence::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::DataSource::create
+ , ::chart::DataSource::getImplementationName_Static
+ , ::chart::DataSource::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ConfigColorScheme::create
+ , ::chart::ConfigColorScheme::getImplementationName_Static
+ , ::chart::ConfigColorScheme::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+
+ ,{
+ ::chart::LogarithmicScaling::create
+ , ::chart::LogarithmicScaling::getImplementationName_Static
+ , ::chart::LogarithmicScaling::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ExponentialScaling::create
+ , ::chart::ExponentialScaling::getImplementationName_Static
+ , ::chart::ExponentialScaling::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::LinearScaling::create
+ , ::chart::LinearScaling::getImplementationName_Static
+ , ::chart::LinearScaling::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PowerScaling::create
+ , ::chart::PowerScaling::getImplementationName_Static
+ , ::chart::PowerScaling::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ErrorBar::create
+ , ::chart::ErrorBar::getImplementationName_Static
+ , ::chart::ErrorBar::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::MeanValueRegressionCurve::create
+ , ::chart::MeanValueRegressionCurve::getImplementationName_Static
+ , ::chart::MeanValueRegressionCurve::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::LinearRegressionCurve::create
+ , ::chart::LinearRegressionCurve::getImplementationName_Static
+ , ::chart::LinearRegressionCurve::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::LogarithmicRegressionCurve::create
+ , ::chart::LogarithmicRegressionCurve::getImplementationName_Static
+ , ::chart::LogarithmicRegressionCurve::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::ExponentialRegressionCurve::create
+ , ::chart::ExponentialRegressionCurve::getImplementationName_Static
+ , ::chart::ExponentialRegressionCurve::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::PotentialRegressionCurve::create
+ , ::chart::PotentialRegressionCurve::getImplementationName_Static
+ , ::chart::PotentialRegressionCurve::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::RegressionEquation::create
+ , ::chart::RegressionEquation::getImplementationName_Static
+ , ::chart::RegressionEquation::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
+ ::chart::InternalDataProvider::create
+ , ::chart::InternalDataProvider::getImplementationName_Static
+ , ::chart::InternalDataProvider::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+OOO_DLLPUBLIC_CHARTTOOLS void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+OOO_DLLPUBLIC_CHARTTOOLS void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey , g_entries_chart2_tools );
+}
+}
+//=========================================================================
diff --git a/chart2/source/tools/charttools.component b/chart2/source/tools/charttools.component
new file mode 100644
index 000000000000..7ca499a7ba80
--- /dev/null
+++ b/chart2/source/tools/charttools.component
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.chart2.ExponentialScaling">
+ <service name="com.sun.star.chart2.ExponentialScaling"/>
+ </implementation>
+ <implementation name="com.sun.star.chart2.LinearScaling">
+ <service name="com.sun.star.chart2.LinearScaling"/>
+ </implementation>
+ <implementation name="com.sun.star.chart2.LogarithmicScaling">
+ <service name="com.sun.star.chart2.LogarithmicScaling"/>
+ </implementation>
+ <implementation name="com.sun.star.chart2.PowerScaling">
+ <service name="com.sun.star.chart2.PowerScaling"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.CachedDataSequence">
+ <service name="com.sun.star.chart2.data.DataSequence"/>
+ <service name="com.sun.star.chart2.data.NumericalDataSequence"/>
+ <service name="com.sun.star.chart2.data.TextualDataSequence"/>
+ <service name="com.sun.star.comp.chart.CachedDataSequence"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.DataSource">
+ <service name="com.sun.star.chart2.data.DataSource"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart.InternalDataProvider">
+ <service name="com.sun.star.chart2.data.DataProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ConfigDefaultColorScheme">
+ <service name="com.sun.star.chart2.ColorScheme"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ErrorBar">
+ <service name="com.sun.star.chart2.ErrorBar"/>
+ <service name="com.sun.star.comp.chart2.ErrorBar"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.ExponentialRegressionCurve">
+ <service name="com.sun.star.chart2.ExponentialRegressionCurve"/>
+ <service name="com.sun.star.chart2.RegressionCurve"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.LabeledDataSequence">
+ <service name="com.sun.star.chart2.data.LabeledDataSequence"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.LinearRegressionCurve">
+ <service name="com.sun.star.chart2.LinearRegressionCurve"/>
+ <service name="com.sun.star.chart2.RegressionCurve"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.LogarithmicRegressionCurve">
+ <service name="com.sun.star.chart2.LogarithmicRegressionCurve"/>
+ <service name="com.sun.star.chart2.RegressionCurve"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.MeanValueRegressionCurve">
+ <service name="com.sun.star.chart2.MeanValueRegressionCurve"/>
+ <service name="com.sun.star.chart2.RegressionCurve"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.PotentialRegressionCurve">
+ <service name="com.sun.star.chart2.PotentialRegressionCurve"/>
+ <service name="com.sun.star.chart2.RegressionCurve"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.chart2.RegressionEquation">
+ <service name="com.sun.star.beans.PropertySet"/>
+ <service name="com.sun.star.chart2.RegressionEquation"/>
+ <service name="com.sun.star.drawing.FillProperties"/>
+ <service name="com.sun.star.drawing.LineProperties"/>
+ <service name="com.sun.star.style.CharacterProperties"/>
+ </implementation>
+</component>
diff --git a/chart2/source/tools/exports.flt b/chart2/source/tools/exports.flt
new file mode 100644
index 000000000000..376659ce91b7
--- /dev/null
+++ b/chart2/source/tools/exports.flt
@@ -0,0 +1,3 @@
+_real@
+_TI1
+_TI2
diff --git a/chart2/source/tools/makefile.mk b/chart2/source/tools/makefile.mk
new file mode 100644
index 000000000000..fd92b894bfab
--- /dev/null
+++ b/chart2/source/tools/makefile.mk
@@ -0,0 +1,197 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..
+PRJNAME= chart2
+TARGET= charttools
+
+PRJINC= $(PRJ)$/source
+
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+CDEFS += -DOOO_DLLIMPLEMENTATION_CHARTTOOLS
+
+# --- export library -------------------------------------------------
+
+#You can use several library macros of this form to build libraries that
+#do not consist of all object files in a directory or to merge different libraries.
+#LIB1TARGET= $(SLB)$/_$(TARGET).lib
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/ErrorBar.obj \
+ $(SLO)$/TrueGuard.obj \
+ $(SLO)$/LifeTime.obj \
+ $(SLO)$/MediaDescriptorHelper.obj \
+ $(SLO)$/ConfigColorScheme.obj \
+ $(SLO)$/ColorPerPointHelper.obj \
+ $(SLO)$/ObjectIdentifier.obj \
+ $(SLO)$/CachedDataSequence.obj \
+ $(SLO)$/CommonConverters.obj \
+ $(SLO)$/DataSeriesHelper.obj \
+ $(SLO)$/DataSource.obj \
+ $(SLO)$/DataSourceHelper.obj \
+ $(SLO)$/DiagramHelper.obj \
+ $(SLO)$/ExponentialRegressionCurveCalculator.obj \
+ $(SLO)$/ImplOPropertySet.obj \
+ $(SLO)$/InternalData.obj \
+ $(SLO)$/InternalDataProvider.obj \
+ $(SLO)$/LabeledDataSequence.obj \
+ $(SLO)$/LinearRegressionCurveCalculator.obj \
+ $(SLO)$/LogarithmicRegressionCurveCalculator.obj \
+ $(SLO)$/MeanValueRegressionCurveCalculator.obj \
+ $(SLO)$/OPropertySet.obj \
+ $(SLO)$/WrappedPropertySet.obj \
+ $(SLO)$/WrappedProperty.obj \
+ $(SLO)$/WrappedIgnoreProperty.obj \
+ $(SLO)$/WrappedDefaultProperty.obj \
+ $(SLO)$/WrappedDirectStateProperty.obj \
+ $(SLO)$/PotentialRegressionCurveCalculator.obj \
+ $(SLO)$/RegressionCurveHelper.obj \
+ $(SLO)$/RegressionCurveModel.obj \
+ $(SLO)$/RelativeSizeHelper.obj \
+ $(SLO)$/RelativePositionHelper.obj \
+ $(SLO)$/Scaling.obj \
+ $(SLO)$/SceneProperties.obj \
+ $(SLO)$/ThreeDHelper.obj \
+ $(SLO)$/StatisticsHelper.obj \
+ $(SLO)$/ChartModelHelper.obj \
+ $(SLO)$/ChartViewHelper.obj \
+ $(SLO)$/ChartTypeHelper.obj \
+ $(SLO)$/AxisHelper.obj \
+ $(SLO)$/MutexContainer.obj \
+ $(SLO)$/PropertyHelper.obj \
+ $(SLO)$/FormattedStringHelper.obj \
+ $(SLO)$/TitleHelper.obj \
+ $(SLO)$/LegendHelper.obj \
+ $(SLO)$/CharacterProperties.obj \
+ $(SLO)$/LineProperties.obj \
+ $(SLO)$/FillProperties.obj \
+ $(SLO)$/UserDefinedProperties.obj \
+ $(SLO)$/NameContainer.obj \
+ $(SLO)$/ChartDebugTrace.obj \
+ $(SLO)$/_serviceregistration_tools.obj \
+ $(SLO)$/UncachedDataSequence.obj \
+ $(SLO)$/XMLRangeHelper.obj \
+ $(SLO)$/ModifyListenerHelper.obj \
+ $(SLO)$/ModifyListenerCallBack.obj \
+ $(SLO)$/BaseGFXHelper.obj \
+ $(SLO)$/ControllerLockGuard.obj \
+ $(SLO)$/WeakListenerAdapter.obj \
+ $(SLO)$/ResId.obj \
+ $(SLO)$/RessourceManager.obj \
+ $(SLO)$/RangeHighlighter.obj \
+ $(SLO)$/ReferenceSizeProvider.obj \
+ $(SLO)$/ExplicitCategoriesProvider.obj \
+ $(SLO)$/RegressionCurveCalculator.obj \
+ $(SLO)$/RegressionEquation.obj
+
+DISABLED_SLOFILES= \
+ $(SLO)$/NamedFillProperties.obj \
+ $(SLO)$/NamedLineProperties.obj \
+ $(SLO)$/NamedProperties.obj
+
+#--------
+
+#Indicates the filename of the shared library.
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+
+#indicates dependencies:
+SHL1DEPN=
+#Specifies an import library to create. For Win32 only.
+SHL1IMPLIB= i$(TARGET)
+
+#Specifies libraries from the same module to put into the shared library.
+#was created above
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+
+#Links import libraries.
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(SVLLIB) \
+ $(VCLLIB) \
+ $(I18NISOLANGLIB) \
+ $(BASEGFXLIB) \
+ $(UNOTOOLSLIB)
+
+# $(SVLIB) \
+# $(SVTOOLLIB) \
+# $(SVXLIB) \
+# $(TKLIB) \
+# $(SFXLIB)
+
+#--------exports
+
+#specifies the exported symbols for Windows only:
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+#Specifies the library name to parse for symbols. For Win32 only.
+DEFLIB1NAME= $(TARGET)
+
+#A file of symbols to export.
+#DEF1EXPORTFILE= $(PRJ)$/source$/inc$/exports.dxp
+
+#--------definition file
+
+#name of the definition file:
+DEF1NAME= $(SHL1TARGET)
+
+# indicates definition file dependencies
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+
+#A comment on the definition file.
+DEF1DES= Chart Tools
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk \
+ exports.flt
+ $(TYPE) exports.flt > $@
+
+
+ALLTAR : $(MISC)/charttools.component
+
+$(MISC)/charttools.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ charttools.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt charttools.component
diff --git a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
new file mode 100644
index 000000000000..88f99b493144
--- /dev/null
+++ b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "MinimumAndMaximumSupplier.hxx"
+#include <rtl/math.hxx>
+#include <com/sun/star/awt/Size.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+MergedMinimumAndMaximumSupplier::MergedMinimumAndMaximumSupplier()
+{
+}
+
+MergedMinimumAndMaximumSupplier::~MergedMinimumAndMaximumSupplier()
+{
+}
+
+void MergedMinimumAndMaximumSupplier::addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
+{
+ m_aMinimumAndMaximumSupplierList.insert( pMinimumAndMaximumSupplier );
+}
+
+bool MergedMinimumAndMaximumSupplier::hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
+{
+ return m_aMinimumAndMaximumSupplierList.count( pMinimumAndMaximumSupplier ) != 0;
+}
+
+double MergedMinimumAndMaximumSupplier::getMinimumX()
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, false);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMinimumX();
+ if(fLocalExtremum<fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+double MergedMinimumAndMaximumSupplier::getMaximumX()
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, true);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMaximumX();
+ if(fLocalExtremum>fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+double MergedMinimumAndMaximumSupplier::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, false);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMinimumYInRange( fMinimumX, fMaximumX, nAxisIndex );
+ if(fLocalExtremum<fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+double MergedMinimumAndMaximumSupplier::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, true);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMaximumYInRange( fMinimumX, fMaximumX, nAxisIndex );
+ if(fLocalExtremum>fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+double MergedMinimumAndMaximumSupplier::getMinimumZ()
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, false);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMinimumZ();
+ if(fLocalExtremum<fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+double MergedMinimumAndMaximumSupplier::getMaximumZ()
+{
+ double fGlobalExtremum;
+ ::rtl::math::setInf(&fGlobalExtremum, true);
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ double fLocalExtremum = (*aIt)->getMaximumZ();
+ if(fLocalExtremum>fGlobalExtremum)
+ fGlobalExtremum=fLocalExtremum;
+ }
+ if(::rtl::math::isInf(fGlobalExtremum))
+ ::rtl::math::setNan(&fGlobalExtremum);
+ return fGlobalExtremum;
+}
+
+bool MergedMinimumAndMaximumSupplier::isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex )
+{
+ // only return true, if *all* suppliers want to scale to the main tick marks
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( !(*aIt)->isExpandBorderToIncrementRhythm( nDimensionIndex ) )
+ return false;
+ return true;
+}
+
+bool MergedMinimumAndMaximumSupplier::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
+{
+ // only return true, if *all* suppliers want to expand the range
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( !(*aIt)->isExpandIfValuesCloseToBorder( nDimensionIndex ) )
+ return false;
+ return true;
+}
+
+bool MergedMinimumAndMaximumSupplier::isExpandWideValuesToZero( sal_Int32 nDimensionIndex )
+{
+ // already return true, if at least one supplier wants to expand the range
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( (*aIt)->isExpandWideValuesToZero( nDimensionIndex ) )
+ return true;
+ return false;
+}
+
+bool MergedMinimumAndMaximumSupplier::isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex )
+{
+ // already return true, if at least one supplier wants to expand the range
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( (*aIt)->isExpandNarrowValuesTowardZero( nDimensionIndex ) )
+ return true;
+ return false;
+}
+
+bool MergedMinimumAndMaximumSupplier::isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex )
+{
+ // should not be called
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ if( (*aIt)->isSeperateStackingForDifferentSigns( nDimensionIndex ) )
+ return true;
+ return false;
+}
+
+void MergedMinimumAndMaximumSupplier::clearMinimumAndMaximumSupplierList()
+{
+ m_aMinimumAndMaximumSupplierList.clear();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
new file mode 100644
index 000000000000..890bf87df96e
--- /dev/null
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -0,0 +1,760 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ScaleAutomatism.hxx"
+#include "macros.hxx"
+#include "TickmarkHelper.hxx"
+#include "AxisHelper.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+const sal_Int32 MAXIMUM_MANUAL_INCREMENT_COUNT = 500;
+const sal_Int32 MAXIMUM_AUTO_INCREMENT_COUNT = 10;
+const sal_Int32 MAXIMUM_SUB_INCREMENT_COUNT = 100;
+
+namespace
+{
+
+void lcl_ensureMaximumSubIncrementCount( sal_Int32& rnSubIntervalCount )
+{
+ if( rnSubIntervalCount > MAXIMUM_SUB_INCREMENT_COUNT )
+ rnSubIntervalCount = MAXIMUM_SUB_INCREMENT_COUNT;
+}
+
+}//end anonymous namespace
+
+ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale )
+ : m_aSourceScale( rSourceScale )
+ , m_fValueMinimum( 0.0 )
+ , m_fValueMaximum( 0.0 )
+ , m_nMaximumAutoMainIncrementCount( MAXIMUM_AUTO_INCREMENT_COUNT )
+ , m_bExpandBorderToIncrementRhythm( false )
+ , m_bExpandIfValuesCloseToBorder( false )
+ , m_bExpandWideValuesToZero( false )
+ , m_bExpandNarrowValuesTowardZero( false )
+{
+ ::rtl::math::setNan( &m_fValueMinimum );
+ ::rtl::math::setNan( &m_fValueMaximum );
+
+ double fExplicitOrigin = 0.0;
+ if( m_aSourceScale.Origin >>= fExplicitOrigin )
+ expandValueRange( fExplicitOrigin, fExplicitOrigin);
+}
+ScaleAutomatism::~ScaleAutomatism()
+{
+}
+
+void ScaleAutomatism::expandValueRange( double fMinimum, double fMaximum )
+{
+ if( (fMinimum < m_fValueMinimum) || ::rtl::math::isNan( m_fValueMinimum ) )
+ m_fValueMinimum = fMinimum;
+ if( (fMaximum > m_fValueMaximum) || ::rtl::math::isNan( m_fValueMaximum ) )
+ m_fValueMaximum = fMaximum;
+}
+
+void ScaleAutomatism::setAutoScalingOptions(
+ bool bExpandBorderToIncrementRhythm,
+ bool bExpandIfValuesCloseToBorder,
+ bool bExpandWideValuesToZero,
+ bool bExpandNarrowValuesTowardZero )
+{
+ // if called multiple times, enable an option, if it is set in at least one call
+ m_bExpandBorderToIncrementRhythm |= bExpandBorderToIncrementRhythm;
+ m_bExpandIfValuesCloseToBorder |= bExpandIfValuesCloseToBorder;
+ m_bExpandWideValuesToZero |= bExpandWideValuesToZero;
+ m_bExpandNarrowValuesTowardZero |= bExpandNarrowValuesTowardZero;
+
+ if( m_aSourceScale.AxisType==AxisType::PERCENT )
+ m_bExpandIfValuesCloseToBorder = false;
+}
+
+void ScaleAutomatism::setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMainIncrementCount )
+{
+ if( nMaximumAutoMainIncrementCount < 2 )
+ m_nMaximumAutoMainIncrementCount = 2; //#i82006
+ else if( nMaximumAutoMainIncrementCount > MAXIMUM_AUTO_INCREMENT_COUNT )
+ m_nMaximumAutoMainIncrementCount = MAXIMUM_AUTO_INCREMENT_COUNT;
+ else
+ m_nMaximumAutoMainIncrementCount = nMaximumAutoMainIncrementCount;
+}
+
+void ScaleAutomatism::calculateExplicitScaleAndIncrement(
+ ExplicitScaleData& rExplicitScale, ExplicitIncrementData& rExplicitIncrement ) const
+{
+ // fill explicit scale
+ rExplicitScale.Orientation = m_aSourceScale.Orientation;
+ rExplicitScale.Scaling = m_aSourceScale.Scaling;
+ rExplicitScale.Breaks = m_aSourceScale.Breaks;
+ rExplicitScale.AxisType = m_aSourceScale.AxisType;
+
+ bool bAutoMinimum = !(m_aSourceScale.Minimum >>= rExplicitScale.Minimum);
+ bool bAutoMaximum = !(m_aSourceScale.Maximum >>= rExplicitScale.Maximum);
+ bool bAutoOrigin = !(m_aSourceScale.Origin >>= rExplicitScale.Origin);
+
+ // automatic scale minimum
+ if( bAutoMinimum )
+ {
+ if( m_aSourceScale.AxisType==AxisType::PERCENT )
+ rExplicitScale.Minimum = 0.0;
+ else if( ::rtl::math::isNan( m_fValueMinimum ) )
+ rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
+ else
+ rExplicitScale.Minimum = m_fValueMinimum;
+ }
+
+ // automatic scale maximum
+ if( bAutoMaximum )
+ {
+ if( m_aSourceScale.AxisType==AxisType::PERCENT )
+ rExplicitScale.Maximum = 1.0;
+ else if( ::rtl::math::isNan( m_fValueMaximum ) )
+ rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
+ else
+ rExplicitScale.Maximum = m_fValueMaximum;
+ }
+
+ //---------------------------------------------------------------
+ //fill explicit increment
+
+ rExplicitIncrement.ShiftedPosition = (m_aSourceScale.AxisType==AxisType::SERIES) ? true : false;
+ bool bIsLogarithm = false;
+
+ //minimum and maximum of the ExplicitScaleData may be changed if allowed
+ if( m_aSourceScale.AxisType==AxisType::CATEGORY || m_aSourceScale.AxisType==AxisType::SERIES )
+ {
+ calculateExplicitIncrementAndScaleForCategory( rExplicitScale, rExplicitIncrement, bAutoMinimum, bAutoMaximum );
+ }
+ else
+ {
+ bIsLogarithm = AxisHelper::isLogarithmic( rExplicitScale.Scaling );
+ if( bIsLogarithm )
+ calculateExplicitIncrementAndScaleForLogarithmic( rExplicitScale, rExplicitIncrement, bAutoMinimum, bAutoMaximum );
+ else
+ calculateExplicitIncrementAndScaleForLinear( rExplicitScale, rExplicitIncrement, bAutoMinimum, bAutoMaximum );
+ }
+
+ // automatic origin
+ if( bAutoOrigin )
+ {
+ // #i71415# automatic origin for logarithmic axis
+ double fDefaulOrigin = bIsLogarithm ? 1.0 : 0.0;
+
+ if( fDefaulOrigin < rExplicitScale.Minimum )
+ fDefaulOrigin = rExplicitScale.Minimum;
+ else if( fDefaulOrigin > rExplicitScale.Maximum )
+ fDefaulOrigin = rExplicitScale.Maximum;
+
+ rExplicitScale.Origin = fDefaulOrigin;
+ }
+}
+
+ScaleData ScaleAutomatism::getScale() const
+{
+ return m_aSourceScale;
+}
+
+// private --------------------------------------------------------------------
+
+void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const
+{
+ // no scaling for categories
+ rExplicitScale.Scaling.clear();
+
+ // ensure that at least one category is visible
+ if( rExplicitScale.Maximum <= rExplicitScale.Minimum )
+ rExplicitScale.Maximum = rExplicitScale.Minimum + 1.0;
+
+ // default increment settings
+ rExplicitIncrement.PostEquidistant = sal_True; // does not matter anyhow
+ rExplicitIncrement.Distance = 1.0; // category axis always have a main increment of 1
+ rExplicitIncrement.BaseValue = 0.0; // category axis always have a base of 0
+
+ // automatic minimum and maximum
+ if( bAutoMinimum && m_bExpandBorderToIncrementRhythm )
+ rExplicitScale.Minimum = TickmarkHelper::getMinimumAtIncrement( rExplicitScale.Minimum, rExplicitIncrement );
+ if( bAutoMaximum && m_bExpandBorderToIncrementRhythm )
+ rExplicitScale.Maximum = TickmarkHelper::getMaximumAtIncrement( rExplicitScale.Maximum, rExplicitIncrement );
+
+ //prevent performace killover
+ double fDistanceCount = ::rtl::math::approxFloor( (rExplicitScale.Maximum-rExplicitScale.Minimum) / rExplicitIncrement.Distance );
+ if( static_cast< sal_Int32 >( fDistanceCount ) > MAXIMUM_MANUAL_INCREMENT_COUNT )
+ {
+ double fMinimumFloor = ::rtl::math::approxFloor( rExplicitScale.Minimum );
+ double fMaximumCeil = ::rtl::math::approxCeil( rExplicitScale.Maximum );
+ rExplicitIncrement.Distance = ::rtl::math::approxCeil( (fMaximumCeil - fMinimumFloor) / MAXIMUM_MANUAL_INCREMENT_COUNT );
+ }
+
+ //---------------------------------------------------------------
+ //fill explicit sub increment
+ sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
+ rExplicitIncrement.SubIncrements.realloc(nSubCount);
+ for( sal_Int32 nN=0; nN<nSubCount; nN++ )
+ {
+ const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
+ ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
+
+ if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ {
+ //scaling dependent
+ //@todo autocalculate IntervalCount dependent on MainIncrement and scaling
+ rExplicitSubIncrement.IntervalCount = 2;
+ }
+ lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ {
+ //scaling dependent
+ rExplicitSubIncrement.PostEquidistant = sal_False;
+ }
+ }
+}
+
+//@todo these method should become part of the scaling interface and implementation somehow
+//@todo problem with outparamters at api
+void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const
+{
+ // *** STEP 1: initialize the range data ***
+
+ const double fInputMinimum = rExplicitScale.Minimum;
+ const double fInputMaximum = rExplicitScale.Maximum;
+
+ double fSourceMinimum = rExplicitScale.Minimum;
+ double fSourceMaximum = rExplicitScale.Maximum;
+
+ // set automatic PostEquidistant to true (maybe scaling dependent?)
+ // Note: scaling with PostEquidistant==false is untested and needs review
+ if( !(m_aSourceScale.IncrementData.PostEquidistant >>= rExplicitIncrement.PostEquidistant) )
+ rExplicitIncrement.PostEquidistant = sal_True;
+
+ /* All following scaling code will operate on the logarithms of the source
+ values. In the last step, the original values will be restored. */
+ uno::Reference< XScaling > xScaling = rExplicitScale.Scaling;
+ if( !xScaling.is() )
+ xScaling.set( AxisHelper::createLogarithmicScaling() );
+ uno::Reference< XScaling > xInverseScaling = xScaling->getInverseScaling();
+
+ fSourceMinimum = xScaling->doScaling( fSourceMinimum );
+ if( !::rtl::math::isFinite( fSourceMinimum ) )
+ fSourceMinimum = 0.0;
+ else if( ::rtl::math::approxEqual( fSourceMinimum, ::rtl::math::approxFloor( fSourceMinimum ) ) )
+ fSourceMinimum = ::rtl::math::approxFloor( fSourceMinimum );
+
+ fSourceMaximum = xScaling->doScaling( fSourceMaximum );
+ if( !::rtl::math::isFinite( fSourceMaximum ) )
+ fSourceMaximum = 0.0;
+ else if( ::rtl::math::approxEqual( fSourceMaximum, ::rtl::math::approxFloor( fSourceMaximum ) ) )
+ fSourceMaximum = ::rtl::math::approxFloor( fSourceMaximum );
+
+ /* If range is invalid (minimum greater than maximum), change one of the
+ variable limits to validate the range. In this step, a zero-sized range
+ is still allowed. */
+ if( fSourceMinimum > fSourceMaximum )
+ {
+ // force changing the maximum, if both limits are fixed
+ if( bAutoMaximum || !bAutoMinimum )
+ fSourceMaximum = fSourceMinimum;
+ else
+ fSourceMinimum = fSourceMaximum;
+ }
+
+ /* If maximum is less than 0 (and therefore minimum too), minimum and
+ maximum will be negated and swapped to make the following algorithms
+ easier. Example: Both ranges [2,5] and [-5,-2] will be processed as
+ [2,5], and the latter will be swapped back later. The range [0,0] is
+ explicitly excluded from swapping (this would result in [-1,0] instead
+ of the expected [0,1]). */
+ bool bSwapAndNegateRange = (fSourceMinimum < 0.0) && (fSourceMaximum <= 0.0);
+ if( bSwapAndNegateRange )
+ {
+ double fTempValue = fSourceMinimum;
+ fSourceMinimum = -fSourceMaximum;
+ fSourceMaximum = -fTempValue;
+ ::std::swap( bAutoMinimum, bAutoMaximum );
+ }
+
+ // *** STEP 2: find temporary (unrounded) axis minimum and maximum ***
+
+ double fTempMinimum = fSourceMinimum;
+ double fTempMaximum = fSourceMaximum;
+
+ /* If minimum is variable and greater than 0 (and therefore maximum too),
+ means all original values are greater than 1 (or all values are less
+ than 1, and the range has been swapped above), then: */
+ if( bAutoMinimum && (fTempMinimum > 0.0) )
+ {
+ /* If minimum is less than 5 (i.e. original source values less than
+ B^5, B being the base of the scaling), or if minimum and maximum
+ are in different increment intervals (means, if minimum and maximum
+ are not both in the range [B^n,B^(n+1)] for a whole number n), set
+ minimum to 0, which results in B^0=1 on the axis. */
+ double fMinimumFloor = ::rtl::math::approxFloor( fTempMinimum );
+ double fMaximumFloor = ::rtl::math::approxFloor( fTempMaximum );
+ // handle the exact value B^(n+1) to be in the range [B^n,B^(n+1)]
+ if( ::rtl::math::approxEqual( fTempMaximum, fMaximumFloor ) )
+ fMaximumFloor -= 1.0;
+
+ if( (fMinimumFloor < 5.0) || (fMinimumFloor < fMaximumFloor) )
+ {
+ if( m_bExpandWideValuesToZero )
+ fTempMinimum = 0.0;
+ }
+ /* Else (minimum and maximum are in one increment interval), expand
+ minimum toward 0 to make the 'shorter' data points visible. */
+ else
+ {
+ if( m_bExpandNarrowValuesTowardZero )
+ fTempMinimum -= 1.0;
+ }
+ }
+
+ /* If range is still zero-sized (e.g. when minimum is fixed), set minimum
+ to 0, which makes the axis start/stop at the value 1. */
+ if( fTempMinimum == fTempMaximum )
+ {
+ if( bAutoMinimum && (fTempMaximum > 0.0) )
+ fTempMinimum = 0.0;
+ else
+ fTempMaximum += 1.0; // always add one interval, even if maximum is fixed
+ }
+
+ // *** STEP 3: calculate main interval size ***
+
+ // base value (anchor position of the intervals), already scaled
+ if( !(m_aSourceScale.IncrementData.BaseValue >>= rExplicitIncrement.BaseValue) )
+ {
+ //scaling dependent
+ //@maybe todo is this default also plotter dependent ??
+ if( !bAutoMinimum )
+ rExplicitIncrement.BaseValue = fTempMinimum;
+ else if( !bAutoMaximum )
+ rExplicitIncrement.BaseValue = fTempMaximum;
+ else
+ rExplicitIncrement.BaseValue = 0.0;
+ }
+
+ // calculate automatic interval
+ bool bAutoDistance = !(m_aSourceScale.IncrementData.Distance >>= rExplicitIncrement.Distance);
+ if( bAutoDistance )
+ rExplicitIncrement.Distance = 0.0;
+
+ /* Restrict number of allowed intervals with user-defined distance to
+ MAXIMUM_MANUAL_INCREMENT_COUNT. */
+ sal_Int32 nMaxMainIncrementCount = bAutoDistance ?
+ m_nMaximumAutoMainIncrementCount : MAXIMUM_MANUAL_INCREMENT_COUNT;
+
+ // repeat calculation until number of intervals are valid
+ bool bNeedIteration = true;
+ bool bHasCalculatedDistance = false;
+ while( bNeedIteration )
+ {
+ if( bAutoDistance )
+ {
+ // first iteration: calculate interval size from axis limits
+ if( !bHasCalculatedDistance )
+ {
+ double fMinimumFloor = ::rtl::math::approxFloor( fTempMinimum );
+ double fMaximumCeil = ::rtl::math::approxCeil( fTempMaximum );
+ rExplicitIncrement.Distance = ::rtl::math::approxCeil( (fMaximumCeil - fMinimumFloor) / nMaxMainIncrementCount );
+ }
+ else
+ {
+ // following iterations: increase distance
+ rExplicitIncrement.Distance += 1.0;
+ }
+
+ // for next iteration: distance calculated -> use else path to increase
+ bHasCalculatedDistance = true;
+ }
+
+ // *** STEP 4: additional space above or below the data points ***
+
+ double fAxisMinimum = fTempMinimum;
+ double fAxisMaximum = fTempMaximum;
+
+ // round to entire multiples of the distance and add additional space
+ if( bAutoMinimum && m_bExpandBorderToIncrementRhythm )
+ {
+ fAxisMinimum = TickmarkHelper::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
+
+ //ensure valid values after scaling #i100995#
+ if( !bAutoDistance )
+ {
+ double fCheck = xInverseScaling->doScaling( fAxisMinimum );
+ if( !::rtl::math::isFinite( fCheck ) || fCheck <= 0 )
+ {
+ bAutoDistance = true;
+ bHasCalculatedDistance = false;
+ continue;
+ }
+ }
+ }
+ if( bAutoMaximum && m_bExpandBorderToIncrementRhythm )
+ {
+ fAxisMaximum = TickmarkHelper::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
+
+ //ensure valid values after scaling #i100995#
+ if( !bAutoDistance )
+ {
+ double fCheck = xInverseScaling->doScaling( fAxisMaximum );
+ if( !::rtl::math::isFinite( fCheck ) || fCheck <= 0 )
+ {
+ bAutoDistance = true;
+ bHasCalculatedDistance = false;
+ continue;
+ }
+ }
+ }
+
+ // set the resulting limits (swap back to negative range if needed)
+ if( bSwapAndNegateRange )
+ {
+ rExplicitScale.Minimum = -fAxisMaximum;
+ rExplicitScale.Maximum = -fAxisMinimum;
+ }
+ else
+ {
+ rExplicitScale.Minimum = fAxisMinimum;
+ rExplicitScale.Maximum = fAxisMaximum;
+ }
+
+ /* If the number of intervals is too high (e.g. due to invalid fixed
+ distance or due to added space above or below data points),
+ calculate again with increased distance. */
+ double fDistanceCount = ::rtl::math::approxFloor( (fAxisMaximum - fAxisMinimum) / rExplicitIncrement.Distance );
+ bNeedIteration = static_cast< sal_Int32 >( fDistanceCount ) > nMaxMainIncrementCount;
+ // if manual distance is invalid, trigger automatic calculation
+ if( bNeedIteration )
+ bAutoDistance = true;
+
+ // convert limits back to logarithmic scale
+ rExplicitScale.Minimum = xInverseScaling->doScaling( rExplicitScale.Minimum );
+ rExplicitScale.Maximum = xInverseScaling->doScaling( rExplicitScale.Maximum );
+
+ //ensure valid values after scaling #i100995#
+ if( !::rtl::math::isFinite( rExplicitScale.Minimum ) || rExplicitScale.Minimum <= 0)
+ {
+ rExplicitScale.Minimum = fInputMinimum;
+ if( !::rtl::math::isFinite( rExplicitScale.Minimum ) || rExplicitScale.Minimum <= 0 )
+ rExplicitScale.Minimum = 1.0;
+ }
+ if( !::rtl::math::isFinite( rExplicitScale.Maximum) || rExplicitScale.Maximum <= 0 )
+ {
+ rExplicitScale.Maximum= fInputMaximum;
+ if( !::rtl::math::isFinite( rExplicitScale.Maximum) || rExplicitScale.Maximum <= 0 )
+ rExplicitScale.Maximum = 10.0;
+ }
+ if( rExplicitScale.Maximum < rExplicitScale.Minimum )
+ ::std::swap( rExplicitScale.Maximum, rExplicitScale.Minimum );
+ }
+
+ //---------------------------------------------------------------
+ //fill explicit sub increment
+ sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
+ rExplicitIncrement.SubIncrements.realloc(nSubCount);
+ for( sal_Int32 nN=0; nN<nSubCount; nN++ )
+ {
+ const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
+ ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
+
+ if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ {
+ //scaling dependent
+ //@todo autocalculate IntervalCount dependent on MainIncrement and scaling
+ rExplicitSubIncrement.IntervalCount = 9;
+ }
+ lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ {
+ //scaling dependent
+ rExplicitSubIncrement.PostEquidistant = sal_False;
+ }
+ }
+}
+
+void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const
+{
+ // *** STEP 1: initialize the range data ***
+
+ double fSourceMinimum = rExplicitScale.Minimum;
+ double fSourceMaximum = rExplicitScale.Maximum;
+
+ // set automatic PostEquidistant to true (maybe scaling dependent?)
+ if( !(m_aSourceScale.IncrementData.PostEquidistant >>= rExplicitIncrement.PostEquidistant) )
+ rExplicitIncrement.PostEquidistant = sal_True;
+
+ /* If range is invalid (minimum greater than maximum), change one of the
+ variable limits to validate the range. In this step, a zero-sized range
+ is still allowed. */
+ if( fSourceMinimum > fSourceMaximum )
+ {
+ // force changing the maximum, if both limits are fixed
+ if( bAutoMaximum || !bAutoMinimum )
+ fSourceMaximum = fSourceMinimum;
+ else
+ fSourceMinimum = fSourceMaximum;
+ }
+
+ /* If maximum is zero or negative (and therefore minimum too), minimum and
+ maximum will be negated and swapped to make the following algorithms
+ easier. Example: Both ranges [2,5] and [-5,-2] will be processed as
+ [2,5], and the latter will be swapped back later. The range [0,0] is
+ explicitly excluded from swapping (this would result in [-1,0] instead
+ of the expected [0,1]). */
+ bool bSwapAndNegateRange = (fSourceMinimum < 0.0) && (fSourceMaximum <= 0.0);
+ if( bSwapAndNegateRange )
+ {
+ double fTempValue = fSourceMinimum;
+ fSourceMinimum = -fSourceMaximum;
+ fSourceMaximum = -fTempValue;
+ ::std::swap( bAutoMinimum, bAutoMaximum );
+ }
+
+ // *** STEP 2: find temporary (unrounded) axis minimum and maximum ***
+
+ double fTempMinimum = fSourceMinimum;
+ double fTempMaximum = fSourceMaximum;
+
+ /* If minimum is variable and greater than 0 (and therefore maximum too),
+ means all values are positive (or all values are negative, and the
+ range has been swapped above), then: */
+ if( bAutoMinimum && (fTempMinimum > 0.0) )
+ {
+ /* If minimum equals maximum, or if minimum is less than 5/6 of
+ maximum, set minimum to 0. */
+ if( (fTempMinimum == fTempMaximum) || (fTempMinimum / fTempMaximum < 5.0 / 6.0) )
+ {
+ if( m_bExpandWideValuesToZero )
+ fTempMinimum = 0.0;
+ }
+ /* Else (minimum is greater than or equal to 5/6 of maximum), add half
+ of the visible range (expand minimum toward 0) to make the
+ 'shorter' data points visible. */
+ else
+ {
+ if( m_bExpandNarrowValuesTowardZero )
+ fTempMinimum -= (fTempMaximum - fTempMinimum) / 2.0;
+ }
+ }
+
+ /* If range is still zero-sized (e.g. when minimum is fixed), add some
+ space to a variable limit. */
+ if( fTempMinimum == fTempMaximum )
+ {
+ if( bAutoMaximum || !bAutoMinimum )
+ {
+ // change 0 to 1, otherwise double the value
+ if( fTempMaximum == 0.0 )
+ fTempMaximum = 1.0;
+ else
+ fTempMaximum *= 2.0;
+ }
+ else
+ {
+ // change 0 to -1, otherwise halve the value
+ if( fTempMinimum == 0.0 )
+ fTempMinimum = -1.0;
+ else
+ fTempMinimum /= 2.0;
+ }
+ }
+
+ // *** STEP 3: calculate main interval size ***
+
+ // base value (anchor position of the intervals)
+ if( !(m_aSourceScale.IncrementData.BaseValue >>= rExplicitIncrement.BaseValue) )
+ {
+ if( !bAutoMinimum )
+ rExplicitIncrement.BaseValue = fTempMinimum;
+ else if( !bAutoMaximum )
+ rExplicitIncrement.BaseValue = fTempMaximum;
+ else
+ rExplicitIncrement.BaseValue = 0.0;
+ }
+
+ // calculate automatic interval
+ bool bAutoDistance = !(m_aSourceScale.IncrementData.Distance >>= rExplicitIncrement.Distance);
+ /* Restrict number of allowed intervals with user-defined distance to
+ MAXIMUM_MANUAL_INCREMENT_COUNT. */
+ sal_Int32 nMaxMainIncrementCount = bAutoDistance ?
+ m_nMaximumAutoMainIncrementCount : MAXIMUM_MANUAL_INCREMENT_COUNT;
+
+ double fDistanceMagnitude = 0.0;
+ double fDistanceNormalized = 0.0;
+ bool bHasNormalizedDistance = false;
+
+ // repeat calculation until number of intervals are valid
+ bool bNeedIteration = true;
+ while( bNeedIteration )
+ {
+ if( bAutoDistance )
+ {
+ // first iteration: calculate interval size from axis limits
+ if( !bHasNormalizedDistance )
+ {
+ // raw size of an interval
+ double fDistance = (fTempMaximum - fTempMinimum) / nMaxMainIncrementCount;
+
+ // if distance of is less than 1e-307, do not do anything
+ if( fDistance <= 1.0e-307 )
+ {
+ fDistanceNormalized = 1.0;
+ fDistanceMagnitude = 1.0e-307;
+ }
+ else
+ {
+ // distance magnitude (a power of 10)
+ int nExponent = static_cast< int >( ::rtl::math::approxFloor( log10( fDistance ) ) );
+ fDistanceMagnitude = ::rtl::math::pow10Exp( 1.0, nExponent );
+
+ // stick normalized distance to a few predefined values
+ fDistanceNormalized = fDistance / fDistanceMagnitude;
+ if( fDistanceNormalized <= 1.0 )
+ fDistanceNormalized = 1.0;
+ else if( fDistanceNormalized <= 2.0 )
+ fDistanceNormalized = 2.0;
+ else if( fDistanceNormalized <= 5.0 )
+ fDistanceNormalized = 5.0;
+ else
+ {
+ fDistanceNormalized = 1.0;
+ fDistanceMagnitude *= 10;
+ }
+ }
+ // for next iteration: distance is normalized -> use else path to increase distance
+ bHasNormalizedDistance = true;
+ }
+ // following iterations: increase distance, use only allowed values
+ else
+ {
+ if( fDistanceNormalized == 1.0 )
+ fDistanceNormalized = 2.0;
+ else if( fDistanceNormalized == 2.0 )
+ fDistanceNormalized = 5.0;
+ else
+ {
+ fDistanceNormalized = 1.0;
+ fDistanceMagnitude *= 10;
+ }
+ }
+
+ // set the resulting distance
+ rExplicitIncrement.Distance = fDistanceNormalized * fDistanceMagnitude;
+ }
+
+ // *** STEP 4: additional space above or below the data points ***
+
+ double fAxisMinimum = fTempMinimum;
+ double fAxisMaximum = fTempMaximum;
+
+ // round to entire multiples of the distance and add additional space
+ if( bAutoMinimum )
+ {
+ // round to entire multiples of the distance, based on the base value
+ if( m_bExpandBorderToIncrementRhythm )
+ fAxisMinimum = TickmarkHelper::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
+ // additional space, if source minimum is to near at axis minimum
+ if( m_bExpandIfValuesCloseToBorder )
+ if( (fAxisMinimum != 0.0) && ((fAxisMaximum - fSourceMinimum) / (fAxisMaximum - fAxisMinimum) > 20.0 / 21.0) )
+ fAxisMinimum -= rExplicitIncrement.Distance;
+ }
+ if( bAutoMaximum )
+ {
+ // round to entire multiples of the distance, based on the base value
+ if( m_bExpandBorderToIncrementRhythm )
+ fAxisMaximum = TickmarkHelper::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
+ // additional space, if source maximum is to near at axis maximum
+ if( m_bExpandIfValuesCloseToBorder )
+ if( (fAxisMaximum != 0.0) && ((fSourceMaximum - fAxisMinimum) / (fAxisMaximum - fAxisMinimum) > 20.0 / 21.0) )
+ fAxisMaximum += rExplicitIncrement.Distance;
+ }
+
+ // set the resulting limits (swap back to negative range if needed)
+ if( bSwapAndNegateRange )
+ {
+ rExplicitScale.Minimum = -fAxisMaximum;
+ rExplicitScale.Maximum = -fAxisMinimum;
+ }
+ else
+ {
+ rExplicitScale.Minimum = fAxisMinimum;
+ rExplicitScale.Maximum = fAxisMaximum;
+ }
+
+ /* If the number of intervals is too high (e.g. due to invalid fixed
+ distance or due to added space above or below data points),
+ calculate again with increased distance. */
+ double fDistanceCount = ::rtl::math::approxFloor( (fAxisMaximum - fAxisMinimum) / rExplicitIncrement.Distance );
+ bNeedIteration = static_cast< sal_Int32 >( fDistanceCount ) > nMaxMainIncrementCount;
+ // if manual distance is invalid, trigger automatic calculation
+ if( bNeedIteration )
+ bAutoDistance = true;
+ }
+
+ //---------------------------------------------------------------
+ //fill explicit sub increment
+ sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
+ rExplicitIncrement.SubIncrements.realloc(nSubCount);
+ for( sal_Int32 nN=0; nN<nSubCount; nN++ )
+ {
+ const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
+ ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
+
+ if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ {
+ //scaling dependent
+ //@todo autocalculate IntervalCount dependent on MainIncrement and scaling
+ rExplicitSubIncrement.IntervalCount = 2;
+ }
+ lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ {
+ //scaling dependent
+ rExplicitSubIncrement.PostEquidistant = sal_False;
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/TickmarkHelper.cxx b/chart2/source/view/axes/TickmarkHelper.cxx
new file mode 100644
index 000000000000..9e2e2707c035
--- /dev/null
+++ b/chart2/source/view/axes/TickmarkHelper.cxx
@@ -0,0 +1,937 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "TickmarkHelper.hxx"
+#include "ViewDefines.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::rtl::math;
+using ::basegfx::B2DVector;
+
+TickInfo::TickInfo()
+: fScaledTickValue( 0.0 )
+, fUnscaledTickValue( 0.0 )
+, aTickScreenPosition(0.0,0.0)
+, bPaintIt( true )
+, xTextShape( NULL )
+, nFactorForLimitedTextWidth(1)
+{
+}
+
+void TickInfo::updateUnscaledValue( const uno::Reference< XScaling >& xInverseScaling )
+{
+ if( xInverseScaling.is() )
+ this->fUnscaledTickValue = xInverseScaling->doScaling( this->fScaledTickValue );
+ else
+ this->fUnscaledTickValue = this->fScaledTickValue;
+}
+
+sal_Int32 TickInfo::getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const
+{
+ //return the positive distance between the two first tickmarks in screen values
+
+ B2DVector aDistance = rOherTickInfo.aTickScreenPosition - aTickScreenPosition;
+ sal_Int32 nRet = static_cast<sal_Int32>(aDistance.getLength());
+ if(nRet<0)
+ nRet *= -1;
+ return nRet;
+}
+
+PureTickIter::PureTickIter( ::std::vector< TickInfo >& rTickInfoVector )
+ : m_rTickVector(rTickInfoVector)
+ , m_aTickIter(m_rTickVector.begin())
+{
+}
+PureTickIter::~PureTickIter()
+{
+}
+TickInfo* PureTickIter::firstInfo()
+{
+ m_aTickIter = m_rTickVector.begin();
+ if(m_aTickIter!=m_rTickVector.end())
+ return &*m_aTickIter;
+ return 0;
+}
+TickInfo* PureTickIter::nextInfo()
+{
+ m_aTickIter++;
+ if(m_aTickIter!=m_rTickVector.end())
+ return &*m_aTickIter;
+ return 0;
+}
+
+EquidistantTickIter::EquidistantTickIter( const uno::Sequence< uno::Sequence< double > >& rTicks
+ , const ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : m_pSimpleTicks(&rTicks)
+ , m_pInfoTicks(0)
+ , m_rIncrement(rIncrement)
+ , m_nMinDepth(0), m_nMaxDepth(0)
+ , m_nTickCount(0), m_pnPositions(NULL)
+ , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL)
+ , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
+{
+ initIter( nMinDepth, nMaxDepth );
+}
+
+EquidistantTickIter::EquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTicks
+ , const ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : m_pSimpleTicks(NULL)
+ , m_pInfoTicks(&rTicks)
+ , m_rIncrement(rIncrement)
+ , m_nMinDepth(0), m_nMaxDepth(0)
+ , m_nTickCount(0), m_pnPositions(NULL)
+ , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL)
+ , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
+{
+ initIter( nMinDepth, nMaxDepth );
+}
+
+void EquidistantTickIter::initIter( sal_Int32 /*nMinDepth*/, sal_Int32 nMaxDepth )
+{
+ m_nMaxDepth = nMaxDepth;
+ if(nMaxDepth<0 || m_nMaxDepth>getMaxDepth())
+ m_nMaxDepth=getMaxDepth();
+
+ sal_Int32 nDepth = 0;
+ for( nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ m_nTickCount += getTickCount(nDepth);
+
+ if(!m_nTickCount)
+ return;
+
+ m_pnPositions = new sal_Int32[m_nMaxDepth+1];
+
+ m_pnPreParentCount = new sal_Int32[m_nMaxDepth+1];
+ m_pbIntervalFinished = new bool[m_nMaxDepth+1];
+ m_pnPreParentCount[0] = 0;
+ m_pbIntervalFinished[0] = false;
+ double fParentValue = getTickValue(0,0);
+ for( nDepth = 1; nDepth<=m_nMaxDepth ;nDepth++ )
+ {
+ m_pbIntervalFinished[nDepth] = false;
+
+ sal_Int32 nPreParentCount = 0;
+ sal_Int32 nCount = getTickCount(nDepth);
+ for(sal_Int32 nN = 0; nN<nCount; nN++)
+ {
+ if(getTickValue(nDepth,nN) < fParentValue)
+ nPreParentCount++;
+ else
+ break;
+ }
+ m_pnPreParentCount[nDepth] = nPreParentCount;
+ if(nCount)
+ {
+ double fNextParentValue = getTickValue(nDepth,0);
+ if( fNextParentValue < fParentValue )
+ fParentValue = fNextParentValue;
+ }
+ }
+}
+
+EquidistantTickIter::~EquidistantTickIter()
+{
+ delete[] m_pnPositions;
+ delete[] m_pnPreParentCount;
+ delete[] m_pbIntervalFinished;
+}
+
+sal_Int32 EquidistantTickIter::getStartDepth() const
+{
+ //find the depth of the first visible tickmark:
+ //it is the depth of the smallest value
+ sal_Int32 nReturnDepth=0;
+ double fMinValue = DBL_MAX;
+ for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ {
+ sal_Int32 nCount = getTickCount(nDepth);
+ if( !nCount )
+ continue;
+ double fThisValue = getTickValue(nDepth,0);
+ if(fThisValue<fMinValue)
+ {
+ nReturnDepth = nDepth;
+ fMinValue = fThisValue;
+ }
+ }
+ return nReturnDepth;
+}
+
+double* EquidistantTickIter::firstValue()
+{
+ if( gotoFirst() )
+ {
+ m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]);
+ return &m_fCurrentValue;
+ }
+ return NULL;
+}
+
+TickInfo* EquidistantTickIter::firstInfo()
+{
+ if( m_pInfoTicks && gotoFirst() )
+ return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]];
+ return NULL;
+}
+
+sal_Int32 EquidistantTickIter::getIntervalCount( sal_Int32 nDepth )
+{
+ if(nDepth>m_rIncrement.SubIncrements.getLength() || nDepth<0)
+ return 0;
+
+ if(!nDepth)
+ return m_nTickCount;
+
+ return m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+}
+
+bool EquidistantTickIter::isAtLastPartTick()
+{
+ if(!m_nCurrentDepth)
+ return false;
+ sal_Int32 nIntervalCount = getIntervalCount( m_nCurrentDepth );
+ if(!nIntervalCount || nIntervalCount == 1)
+ return true;
+ if( m_pbIntervalFinished[m_nCurrentDepth] )
+ return false;
+ sal_Int32 nPos = m_pnPositions[m_nCurrentDepth]+1;
+ if(m_pnPreParentCount[m_nCurrentDepth])
+ nPos += nIntervalCount-1 - m_pnPreParentCount[m_nCurrentDepth];
+ bool bRet = nPos && nPos % (nIntervalCount-1) == 0;
+ if(!nPos && !m_pnPreParentCount[m_nCurrentDepth]
+ && m_pnPositions[m_nCurrentDepth-1]==-1 )
+ bRet = true;
+ return bRet;
+}
+
+bool EquidistantTickIter::gotoFirst()
+{
+ if( m_nMaxDepth<0 )
+ return false;
+ if( !m_nTickCount )
+ return false;
+
+ for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ m_pnPositions[nDepth] = -1;
+
+ m_nCurrentPos = 0;
+ m_nCurrentDepth = getStartDepth();
+ m_pnPositions[m_nCurrentDepth] = 0;
+ return true;
+}
+
+bool EquidistantTickIter::gotoNext()
+{
+ if( m_nCurrentPos < 0 )
+ return false;
+ m_nCurrentPos++;
+
+ if( m_nCurrentPos >= m_nTickCount )
+ return false;
+
+ if( m_nCurrentDepth==m_nMaxDepth && isAtLastPartTick() )
+ {
+ do
+ {
+ m_pbIntervalFinished[m_nCurrentDepth] = true;
+ m_nCurrentDepth--;
+ }
+ while( m_nCurrentDepth && isAtLastPartTick() );
+ }
+ else if( m_nCurrentDepth<m_nMaxDepth )
+ {
+ do
+ {
+ m_nCurrentDepth++;
+ }
+ while( m_nCurrentDepth<m_nMaxDepth );
+ }
+ m_pbIntervalFinished[m_nCurrentDepth] = false;
+ m_pnPositions[m_nCurrentDepth] = m_pnPositions[m_nCurrentDepth]+1;
+ return true;
+}
+
+bool EquidistantTickIter::gotoIndex( sal_Int32 nTickIndex )
+{
+ if( nTickIndex < 0 )
+ return false;
+ if( nTickIndex >= m_nTickCount )
+ return false;
+
+ if( nTickIndex < m_nCurrentPos )
+ if( !gotoFirst() )
+ return false;
+
+ while( nTickIndex > m_nCurrentPos )
+ if( !gotoNext() )
+ return false;
+
+ return true;
+}
+
+sal_Int32 EquidistantTickIter::getCurrentIndex() const
+{
+ return m_nCurrentPos;
+}
+sal_Int32 EquidistantTickIter::getMaxIndex() const
+{
+ return m_nTickCount-1;
+}
+
+double* EquidistantTickIter::nextValue()
+{
+ if( gotoNext() )
+ {
+ m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]);
+ return &m_fCurrentValue;
+ }
+ return NULL;
+}
+
+TickInfo* EquidistantTickIter::nextInfo()
+{
+ if( m_pInfoTicks && gotoNext() &&
+ static_cast< sal_Int32 >(
+ (*m_pInfoTicks)[m_nCurrentDepth].size()) > m_pnPositions[m_nCurrentDepth] )
+ {
+ return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]];
+ }
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+double TickmarkHelper::getMinimumAtIncrement( double fMin, const ExplicitIncrementData& rIncrement )
+{
+ //the returned value will be <= fMin and on a Major Tick given by rIncrement
+ if(rIncrement.Distance<=0.0)
+ return fMin;
+
+ double fRet = rIncrement.BaseValue +
+ floor( approxSub( fMin, rIncrement.BaseValue )
+ / rIncrement.Distance)
+ *rIncrement.Distance;
+
+ if( fRet > fMin )
+ {
+ if( !approxEqual(fRet, fMin) )
+ fRet -= rIncrement.Distance;
+ }
+ return fRet;
+}
+//static
+double TickmarkHelper::getMaximumAtIncrement( double fMax, const ExplicitIncrementData& rIncrement )
+{
+ //the returned value will be >= fMax and on a Major Tick given by rIncrement
+ if(rIncrement.Distance<=0.0)
+ return fMax;
+
+ double fRet = rIncrement.BaseValue +
+ floor( approxSub( fMax, rIncrement.BaseValue )
+ / rIncrement.Distance)
+ *rIncrement.Distance;
+
+ if( fRet < fMax )
+ {
+ if( !approxEqual(fRet, fMax) )
+ fRet += rIncrement.Distance;
+ }
+ return fRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+TickmarkHelper::TickmarkHelper(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
+ : m_rScale( rScale )
+ , m_rIncrement( rIncrement )
+ , m_xInverseScaling(NULL)
+ , m_pfCurrentValues(NULL)
+{
+ //@todo: make sure that the scale is valid for the scaling
+
+ m_pfCurrentValues = new double[getTickDepth()];
+
+ if( m_rScale.Scaling.is() )
+ {
+ m_xInverseScaling = m_rScale.Scaling->getInverseScaling();
+ DBG_ASSERT( m_xInverseScaling.is(), "each Scaling needs to return a inverse Scaling" );
+ }
+
+ double fMin = m_fScaledVisibleMin = m_rScale.Minimum;
+ if( m_xInverseScaling.is() )
+ {
+ m_fScaledVisibleMin = m_rScale.Scaling->doScaling(m_fScaledVisibleMin);
+ if(m_rIncrement.PostEquidistant )
+ fMin = m_fScaledVisibleMin;
+ }
+
+ double fMax = m_fScaledVisibleMax = m_rScale.Maximum;
+ if( m_xInverseScaling.is() )
+ {
+ m_fScaledVisibleMax = m_rScale.Scaling->doScaling(m_fScaledVisibleMax);
+ if(m_rIncrement.PostEquidistant )
+ fMax = m_fScaledVisibleMax;
+ }
+
+ //--
+ m_fOuterMajorTickBorderMin = TickmarkHelper::getMinimumAtIncrement( fMin, m_rIncrement );
+ m_fOuterMajorTickBorderMax = TickmarkHelper::getMaximumAtIncrement( fMax, m_rIncrement );
+ //--
+
+ m_fOuterMajorTickBorderMin_Scaled = m_fOuterMajorTickBorderMin;
+ m_fOuterMajorTickBorderMax_Scaled = m_fOuterMajorTickBorderMax;
+ if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() )
+ {
+ m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin);
+ m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax);
+
+ //check validity of new range: m_fOuterMajorTickBorderMin <-> m_fOuterMajorTickBorderMax
+ //it is assumed here, that the original range in the given Scale is valid
+ if( !rtl::math::isFinite(m_fOuterMajorTickBorderMin_Scaled) )
+ {
+ m_fOuterMajorTickBorderMin += m_rIncrement.Distance;
+ m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin);
+ }
+ if( !rtl::math::isFinite(m_fOuterMajorTickBorderMax_Scaled) )
+ {
+ m_fOuterMajorTickBorderMax -= m_rIncrement.Distance;
+ m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax);
+ }
+ }
+}
+
+TickmarkHelper* TickmarkHelper::createShiftedTickmarkHelper() const
+{
+ ExplicitIncrementData aShiftedIncrement( m_rIncrement );
+ aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0;
+ return new TickmarkHelper( m_rScale, aShiftedIncrement );
+}
+
+TickmarkHelper::~TickmarkHelper()
+{
+ delete[] m_pfCurrentValues;
+}
+
+sal_Int32 TickmarkHelper::getTickDepth() const
+{
+ return m_rIncrement.SubIncrements.getLength() + 1;
+}
+
+sal_Int32 TickmarkHelper::getMaxTickCount( sal_Int32 nDepth ) const
+{
+ //return the maximum amount of ticks
+ //possibly open intervals at the two ends of the region are handled as if they were completely visible
+ //(this is necessary for calculating the sub ticks at the borders correctly)
+
+ if( nDepth >= getTickDepth() )
+ return 0;
+ if( m_fOuterMajorTickBorderMax < m_fOuterMajorTickBorderMin )
+ return 0;
+ if( m_rIncrement.Distance<=0.0)
+ return 0;
+
+ double fSub;
+ if(m_rIncrement.PostEquidistant )
+ fSub = approxSub( m_fScaledVisibleMax, m_fScaledVisibleMin );
+ else
+ fSub = approxSub( m_rScale.Maximum, m_rScale.Minimum );
+
+ if (!isFinite(fSub))
+ return 0;
+
+ sal_Int32 nIntervalCount = static_cast<sal_Int32>( fSub / m_rIncrement.Distance );
+
+ nIntervalCount+=3;
+ for(sal_Int32 nN=0; nN<nDepth-1; nN++)
+ {
+ if( m_rIncrement.SubIncrements[nN].IntervalCount>1 )
+ nIntervalCount *= m_rIncrement.SubIncrements[nN].IntervalCount;
+ }
+
+ sal_Int32 nTickCount = nIntervalCount;
+ if(nDepth>0 && m_rIncrement.SubIncrements[nDepth-1].IntervalCount>1)
+ nTickCount = nIntervalCount * (m_rIncrement.SubIncrements[nDepth-1].IntervalCount-1);
+
+ return nTickCount;
+}
+
+double* TickmarkHelper::getMajorTick( sal_Int32 nTick ) const
+{
+ m_pfCurrentValues[0] = m_fOuterMajorTickBorderMin + nTick*m_rIncrement.Distance;
+
+ if(m_pfCurrentValues[0]>m_fOuterMajorTickBorderMax)
+ {
+ if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMax) )
+ return NULL;
+ }
+ if(m_pfCurrentValues[0]<m_fOuterMajorTickBorderMin)
+ {
+ if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMin) )
+ return NULL;
+ }
+
+ //return always the value after scaling
+ if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() )
+ m_pfCurrentValues[0] = m_rScale.Scaling->doScaling( m_pfCurrentValues[0] );
+
+ return &m_pfCurrentValues[0];
+}
+
+double* TickmarkHelper::getMinorTick( sal_Int32 nTick, sal_Int32 nDepth
+ , double fStartParentTick, double fNextParentTick ) const
+{
+ //check validity of arguments
+ {
+ //DBG_ASSERT( fStartParentTick < fNextParentTick, "fStartParentTick >= fNextParentTick");
+ if(fStartParentTick >= fNextParentTick)
+ return NULL;
+ if(nDepth>m_rIncrement.SubIncrements.getLength() || nDepth<=0)
+ return NULL;
+
+ //subticks are only calculated if they are laying between parent ticks:
+ if(nTick<=0)
+ return NULL;
+ if(nTick>=m_rIncrement.SubIncrements[nDepth-1].IntervalCount)
+ return NULL;
+ }
+
+ bool bPostEquidistant = m_rIncrement.SubIncrements[nDepth-1].PostEquidistant;
+
+ double fAdaptedStartParent = fStartParentTick;
+ double fAdaptedNextParent = fNextParentTick;
+
+ if( !bPostEquidistant && m_xInverseScaling.is() )
+ {
+ fAdaptedStartParent = m_xInverseScaling->doScaling(fStartParentTick);
+ fAdaptedNextParent = m_xInverseScaling->doScaling(fNextParentTick);
+ }
+
+ double fDistance = (fAdaptedNextParent - fAdaptedStartParent)/m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+
+ m_pfCurrentValues[nDepth] = fAdaptedStartParent + nTick*fDistance;
+
+ //return always the value after scaling
+ if(!bPostEquidistant && m_xInverseScaling.is() )
+ m_pfCurrentValues[nDepth] = m_rScale.Scaling->doScaling( m_pfCurrentValues[nDepth] );
+
+ if( !isWithinOuterBorder( m_pfCurrentValues[nDepth] ) )
+ return NULL;
+
+ return &m_pfCurrentValues[nDepth];
+}
+
+bool TickmarkHelper::isWithinOuterBorder( double fScaledValue ) const
+{
+ if(fScaledValue>m_fOuterMajorTickBorderMax_Scaled)
+ return false;
+ if(fScaledValue<m_fOuterMajorTickBorderMin_Scaled)
+ return false;
+
+ return true;
+}
+
+
+bool TickmarkHelper::isVisible( double fScaledValue ) const
+{
+ if(fScaledValue>m_fScaledVisibleMax)
+ {
+ if( !approxEqual(fScaledValue,m_fScaledVisibleMax) )
+ return false;
+ }
+ if(fScaledValue<m_fScaledVisibleMin)
+ {
+ if( !approxEqual(fScaledValue,m_fScaledVisibleMin) )
+ return false;
+ }
+ return true;
+}
+
+void TickmarkHelper::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ uno::Sequence< uno::Sequence< double > > aAllTicks;
+
+ //create point sequences for each tick depth
+ sal_Int32 nDepthCount = this->getTickDepth();
+ sal_Int32 nMaxMajorTickCount = this->getMaxTickCount( 0 );
+
+ aAllTicks.realloc(nDepthCount);
+ aAllTicks[0].realloc(nMaxMajorTickCount);
+
+ sal_Int32 nRealMajorTickCount = 0;
+ double* pValue = NULL;
+ for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ )
+ {
+ pValue = this->getMajorTick( nMajorTick );
+ if(!pValue)
+ continue;
+ aAllTicks[0][nRealMajorTickCount] = *pValue;
+ nRealMajorTickCount++;
+ }
+ if(!nRealMajorTickCount)
+ return;
+ aAllTicks[0].realloc(nRealMajorTickCount);
+
+ if(nDepthCount>0)
+ this->addSubTicks( 1, aAllTicks );
+
+ //so far we have added all ticks between the outer major tick marks
+ //this was necessary to create sub ticks correctly
+ //now we reduce all ticks to the visible ones that lie between the real borders
+ sal_Int32 nDepth = 0;
+ sal_Int32 nTick = 0;
+ for( nDepth = 0; nDepth < nDepthCount; nDepth++)
+ {
+ sal_Int32 nInvisibleAtLowerBorder = 0;
+ sal_Int32 nInvisibleAtUpperBorder = 0;
+ //we need only to check all ticks within the first major interval at each border
+ sal_Int32 nCheckCount = 1;
+ for(sal_Int32 nN=0; nN<nDepth; nN++)
+ {
+ if( m_rIncrement.SubIncrements[nN].IntervalCount>1 )
+ nCheckCount *= m_rIncrement.SubIncrements[nN].IntervalCount;
+ }
+ uno::Sequence< double >& rTicks = aAllTicks[nDepth];
+ sal_Int32 nCount = rTicks.getLength();
+ //check lower border
+ for( nTick=0; nTick<nCheckCount && nTick<nCount; nTick++)
+ {
+ if( !isVisible( rTicks[nTick] ) )
+ nInvisibleAtLowerBorder++;
+ }
+ //check upper border
+ for( nTick=nCount-1; nTick>nCount-1-nCheckCount && nTick>=0; nTick--)
+ {
+ if( !isVisible( rTicks[nTick] ) )
+ nInvisibleAtUpperBorder++;
+ }
+ //resize sequence
+ if( !nInvisibleAtLowerBorder && !nInvisibleAtUpperBorder)
+ continue;
+ if( !nInvisibleAtLowerBorder )
+ rTicks.realloc(nCount-nInvisibleAtUpperBorder);
+ else
+ {
+ sal_Int32 nNewCount = nCount-nInvisibleAtUpperBorder-nInvisibleAtLowerBorder;
+ if(nNewCount<0)
+ nNewCount=0;
+
+ uno::Sequence< double > aOldTicks(rTicks);
+ rTicks.realloc(nNewCount);
+ for(nTick = 0; nTick<nNewCount; nTick++)
+ rTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick];
+ }
+ }
+
+ //fill return value
+ rAllTickInfos.resize(aAllTicks.getLength());
+ for( nDepth=0 ;nDepth<aAllTicks.getLength(); nDepth++ )
+ {
+ sal_Int32 nCount = aAllTicks[nDepth].getLength();
+ rAllTickInfos[nDepth].resize( nCount );
+ for(sal_Int32 nN = 0; nN<nCount; nN++)
+ {
+ rAllTickInfos[nDepth][nN].fScaledTickValue = aAllTicks[nDepth][nN];
+ }
+ }
+}
+
+void TickmarkHelper::getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ std::auto_ptr< TickmarkHelper > apShiftedTickmarkHelper( createShiftedTickmarkHelper() );
+ apShiftedTickmarkHelper->getAllTicks( rAllTickInfos );
+}
+
+void TickmarkHelper::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::Sequence< double > >& rParentTicks ) const
+{
+ EquidistantTickIter aIter( rParentTicks, m_rIncrement, 0, nDepth-1 );
+ double* pfNextParentTick = aIter.firstValue();
+ if(!pfNextParentTick)
+ return;
+ double fLastParentTick = *pfNextParentTick;
+ pfNextParentTick = aIter.nextValue();
+ if(!pfNextParentTick)
+ return;
+
+ sal_Int32 nMaxSubTickCount = this->getMaxTickCount( nDepth );
+ if(!nMaxSubTickCount)
+ return;
+
+ uno::Sequence< double > aSubTicks(nMaxSubTickCount);
+ sal_Int32 nRealSubTickCount = 0;
+ sal_Int32 nIntervalCount = m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+
+ double* pValue = NULL;
+ for(; pfNextParentTick; fLastParentTick=*pfNextParentTick, pfNextParentTick = aIter.nextValue())
+ {
+ for( sal_Int32 nPartTick = 1; nPartTick<nIntervalCount; nPartTick++ )
+ {
+ pValue = this->getMinorTick( nPartTick, nDepth
+ , fLastParentTick, *pfNextParentTick );
+ if(!pValue)
+ continue;
+
+ aSubTicks[nRealSubTickCount] = *pValue;
+ nRealSubTickCount++;
+ }
+ }
+
+ aSubTicks.realloc(nRealSubTickCount);
+ rParentTicks[nDepth] = aSubTicks;
+ if(m_rIncrement.SubIncrements.getLength()>nDepth)
+ addSubTicks( nDepth+1, rParentTicks );
+}
+
+//-----------------------------------------------------------------------------
+// ___TickmarkHelper_2D___
+//-----------------------------------------------------------------------------
+TickmarkHelper_2D::TickmarkHelper_2D(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement
+ //, double fStrech_SceneToScreen, double fOffset_SceneToScreen )
+ , const B2DVector& rStartScreenPos, const B2DVector& rEndScreenPos
+ , const B2DVector& rAxisLineToLabelLineShift )
+ : TickmarkHelper( rScale, rIncrement )
+ , m_aAxisStartScreenPosition2D(rStartScreenPos)
+ , m_aAxisEndScreenPosition2D(rEndScreenPos)
+ , m_aAxisLineToLabelLineShift(rAxisLineToLabelLineShift)
+ , m_fStrech_LogicToScreen(1.0)
+ , m_fOffset_LogicToScreen(0.0)
+{
+ double fWidthY = m_fScaledVisibleMax - m_fScaledVisibleMin;
+ if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation )
+ {
+ m_fStrech_LogicToScreen = 1.0/fWidthY;
+ m_fOffset_LogicToScreen = -m_fScaledVisibleMin;
+ }
+ else
+ {
+ B2DVector aSwap(m_aAxisStartScreenPosition2D);
+ m_aAxisStartScreenPosition2D = m_aAxisEndScreenPosition2D;
+ m_aAxisEndScreenPosition2D = aSwap;
+
+ m_fStrech_LogicToScreen = -1.0/fWidthY;
+ m_fOffset_LogicToScreen = -m_fScaledVisibleMax;
+ }
+}
+
+TickmarkHelper* TickmarkHelper_2D::createShiftedTickmarkHelper() const
+{
+ ExplicitIncrementData aShiftedIncrement( m_rIncrement );
+ aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0;
+
+ ::basegfx::B2DVector aStart( m_aAxisStartScreenPosition2D );
+ ::basegfx::B2DVector aEnd( m_aAxisEndScreenPosition2D );
+ if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation )
+ std::swap( aStart, aEnd );
+
+ return new TickmarkHelper_2D( m_rScale, aShiftedIncrement, aStart, aEnd, m_aAxisLineToLabelLineShift );
+}
+
+TickmarkHelper_2D::~TickmarkHelper_2D()
+{
+}
+
+bool TickmarkHelper_2D::isHorizontalAxis() const
+{
+ return ( m_aAxisStartScreenPosition2D.getY() == m_aAxisEndScreenPosition2D.getY() );
+}
+bool TickmarkHelper_2D::isVerticalAxis() const
+{
+ return ( m_aAxisStartScreenPosition2D.getX() == m_aAxisEndScreenPosition2D.getX() );
+}
+
+//static
+sal_Int32 TickmarkHelper_2D::getTickScreenDistance( TickIter& rIter )
+{
+ //return the positive distance between the two first tickmarks in screen values
+ //if there are less than two tickmarks -1 is returned
+
+ const TickInfo* pFirstTickInfo = rIter.firstInfo();
+ const TickInfo* pSecondTickInfo = rIter.nextInfo();
+ if(!pSecondTickInfo || !pFirstTickInfo)
+ return -1;
+
+ return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo );
+}
+
+B2DVector TickmarkHelper_2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const
+{
+ B2DVector aRet(m_aAxisStartScreenPosition2D);
+ aRet += (m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D)
+ *((fScaledLogicTickValue+m_fOffset_LogicToScreen)*m_fStrech_LogicToScreen);
+ return aRet;
+}
+
+void TickmarkHelper_2D::addPointSequenceForTickLine( drawing::PointSequenceSequence& rPoints
+ , sal_Int32 nSequenceIndex
+ , double fScaledLogicTickValue, double fInnerDirectionSign
+ , const TickmarkProperties& rTickmarkProperties
+ , bool bPlaceAtLabels ) const
+{
+ if( fInnerDirectionSign==0.0 )
+ fInnerDirectionSign = 1.0;
+
+ B2DVector aTickScreenPosition = this->getTickScreenPosition2D(fScaledLogicTickValue);
+ if( bPlaceAtLabels )
+ aTickScreenPosition += m_aAxisLineToLabelLineShift;
+
+ B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D;
+ aMainDirection.normalize();
+ B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX());
+ aOrthoDirection *= fInnerDirectionSign;
+ aOrthoDirection.normalize();
+
+ 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());
+}
+
+B2DVector TickmarkHelper_2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties, bool bIncludeFarAwayDistanceIfSo, bool bIncludeSpaceBetweenTickAndText ) const
+{
+ bool bFarAwayLabels = false;
+ if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == rAxisProperties.m_eLabelPos
+ || ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == rAxisProperties.m_eLabelPos )
+ bFarAwayLabels = true;
+
+ double fInnerDirectionSign = rAxisProperties.m_fInnerDirectionSign;
+ if( fInnerDirectionSign==0.0 )
+ fInnerDirectionSign = 1.0;
+
+ B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D;
+ aMainDirection.normalize();
+ B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX());
+ aOrthoDirection *= fInnerDirectionSign;
+ aOrthoDirection.normalize();
+
+ B2DVector aStart(0,0), aEnd(0,0);
+ if( bFarAwayLabels )
+ {
+ TickmarkProperties aProps( AxisProperties::getBiggestTickmarkProperties() );
+ aStart = aOrthoDirection*aProps.RelativePos;
+ aEnd = aStart - aOrthoDirection*aProps.Length;
+ }
+ else
+ {
+ for( sal_Int32 nN=rAxisProperties.m_aTickmarkPropertiesList.size();nN--;)
+ {
+ const TickmarkProperties& rProps = rAxisProperties.m_aTickmarkPropertiesList[nN];
+ B2DVector aNewStart = aOrthoDirection*rProps.RelativePos;
+ B2DVector aNewEnd = aNewStart - aOrthoDirection*rProps.Length;
+ if(aNewStart.getLength()>aStart.getLength())
+ aStart=aNewStart;
+ if(aNewEnd.getLength()>aEnd.getLength())
+ aEnd=aNewEnd;
+ }
+ }
+
+ B2DVector aLabelDirection(aStart);
+ if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
+ aLabelDirection = aEnd;
+
+ B2DVector aOrthoLabelDirection(aOrthoDirection);
+ if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
+ aOrthoLabelDirection*=-1.0;
+ aOrthoLabelDirection.normalize();
+ if( bIncludeSpaceBetweenTickAndText )
+ aLabelDirection += aOrthoLabelDirection*AXIS2D_TICKLABELSPACING;
+ if( bFarAwayLabels && bIncludeFarAwayDistanceIfSo )
+ aLabelDirection += m_aAxisLineToLabelLineShift;
+ return aLabelDirection;
+}
+
+void TickmarkHelper_2D::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());
+}
+
+void TickmarkHelper_2D::updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ //get the transformed screen values for all tickmarks in rAllTickInfos
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAllTickInfos.end();
+ for( ; aDepthIter != aDepthEnd; aDepthIter++ )
+ {
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = (*aTickIter);
+ rTickInfo.aTickScreenPosition =
+ this->getTickScreenPosition2D( rTickInfo.fScaledTickValue );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+// ___TickmarkHelper_3D___
+//-----------------------------------------------------------------------------
+TickmarkHelper_3D::TickmarkHelper_3D(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
+ : TickmarkHelper( rScale, rIncrement )
+{
+}
+
+TickmarkHelper* TickmarkHelper_3D::createShiftedTickmarkHelper() const
+{
+ ExplicitIncrementData aShiftedIncrement( m_rIncrement );
+ aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0;
+ return new TickmarkHelper_3D( m_rScale, aShiftedIncrement );
+}
+
+TickmarkHelper_3D::~TickmarkHelper_3D()
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/TickmarkHelper.hxx b/chart2/source/view/axes/TickmarkHelper.hxx
new file mode 100644
index 000000000000..78fc2fe1c502
--- /dev/null
+++ b/chart2/source/view/axes/TickmarkHelper.hxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TICKMARKHELPER_HXX
+#define _CHART2_TICKMARKHELPER_HXX
+
+#include "TickmarkProperties.hxx"
+#include "VAxisProperties.hxx"
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <basegfx/vector/b2dvector.hxx>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using ::basegfx::B2DVector;
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct TickInfo
+{
+ double fScaledTickValue;
+ double fUnscaledTickValue;
+
+ ::basegfx::B2DVector aTickScreenPosition;
+ bool bPaintIt;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > xTextShape;
+
+ rtl::OUString aText;//used only for complex categories so far
+ sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
+
+//methods:
+ TickInfo();
+ void updateUnscaledValue( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling >& xInverseScaling );
+
+ sal_Int32 getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const;
+};
+class TickIter
+{
+public:
+ virtual ~TickIter(){};
+ virtual TickInfo* firstInfo()=0;
+ virtual TickInfo* nextInfo()=0;
+};
+
+class PureTickIter : public TickIter
+{
+public:
+ PureTickIter( ::std::vector< TickInfo >& rTickInfoVector );
+ virtual ~PureTickIter();
+ virtual TickInfo* firstInfo();
+ virtual TickInfo* nextInfo();
+
+private:
+ ::std::vector< TickInfo >& m_rTickVector;
+ ::std::vector< TickInfo >::iterator m_aTickIter;
+};
+
+class EquidistantTickIter : public TickIter
+{
+public:
+ EquidistantTickIter( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > >& rTicks
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
+ EquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
+ virtual ~EquidistantTickIter();
+
+ virtual double* firstValue();
+ virtual double* nextValue();
+
+ virtual TickInfo* firstInfo();
+ virtual TickInfo* nextInfo();
+
+ sal_Int32 getCurrentDepth() const { return m_nCurrentDepth; }
+
+protected:
+ bool gotoIndex( sal_Int32 nTickIndex );
+ sal_Int32 getCurrentIndex() const;
+ sal_Int32 getMaxIndex() const;
+
+private: //methods
+ sal_Int32 getIntervalCount( sal_Int32 nDepth );
+ bool isAtLastPartTick();
+
+ void initIter( sal_Int32 nMinDepth, sal_Int32 nMaxDepth );
+ sal_Int32 getStartDepth() const;
+
+ bool gotoFirst();
+ bool gotoNext();
+
+
+ double getTickValue(sal_Int32 nDepth, sal_Int32 nIndex) const
+ {
+ if(m_pSimpleTicks)
+ return (*m_pSimpleTicks)[nDepth][nIndex];
+ else
+ return (((*m_pInfoTicks)[nDepth])[nIndex]).fScaledTickValue;
+ }
+ sal_Int32 getTickCount( sal_Int32 nDepth ) const
+ {
+ if(m_pSimpleTicks)
+ return (*m_pSimpleTicks)[nDepth].getLength();
+ else
+ return (*m_pInfoTicks)[nDepth].size();
+ }
+ sal_Int32 getMaxDepth() const
+ {
+ if(m_pSimpleTicks)
+ return (*m_pSimpleTicks).getLength()-1;
+ else
+ return (*m_pInfoTicks).size()-1;
+ }
+
+private: //member
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > >* m_pSimpleTicks;
+ ::std::vector< ::std::vector< TickInfo > >* m_pInfoTicks;
+ const ::com::sun::star::chart2::ExplicitIncrementData& m_rIncrement;
+ //iteration from m_nMinDepth to m_nMaxDepth
+ sal_Int32 m_nMinDepth;
+ sal_Int32 m_nMaxDepth;
+ sal_Int32 m_nTickCount;
+ sal_Int32* m_pnPositions; //current positions in the different sequences
+ sal_Int32* m_pnPreParentCount; //the tickmarks do not start with a major tick always,
+ //the PreParentCount states for each depth how many subtickmarks are available in front of the first parent tickmark
+ bool* m_pbIntervalFinished;
+ sal_Int32 m_nCurrentDepth;
+ sal_Int32 m_nCurrentPos;
+ double m_fCurrentValue;
+};
+
+class TickmarkHelper
+{
+public:
+ TickmarkHelper(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
+ virtual ~TickmarkHelper();
+
+ virtual TickmarkHelper* createShiftedTickmarkHelper() const;
+
+ void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+ //
+ static double getMinimumAtIncrement( double fMin, const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
+ static double getMaximumAtIncrement( double fMax, const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
+
+protected: //methods
+ void addSubTicks( sal_Int32 nDepth,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > >& rParentTicks ) const;
+ double* getMajorTick( sal_Int32 nTick ) const;
+ double* getMinorTick( sal_Int32 nTick, sal_Int32 nDepth
+ , double fStartParentTick, double fNextParentTick ) const;
+ sal_Int32 getMaxTickCount( sal_Int32 nDepth = 0 ) const;
+ sal_Int32 getTickDepth() const;
+ bool isVisible( double fValue ) const;
+ bool isWithinOuterBorder( double fScaledValue ) const; //all within the outer major tick marks
+
+ virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& /*rAllTickInfos*/ ) const {}
+
+protected: //member
+ ::com::sun::star::chart2::ExplicitScaleData m_rScale;
+ ::com::sun::star::chart2::ExplicitIncrementData m_rIncrement;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
+ m_xInverseScaling;
+ double* m_pfCurrentValues;
+ //major-tick positions that may lay outside the visible range but complete partly visible intervals at the borders
+ double m_fOuterMajorTickBorderMin;
+ double m_fOuterMajorTickBorderMax;
+ double m_fOuterMajorTickBorderMin_Scaled;
+ double m_fOuterMajorTickBorderMax_Scaled;
+
+ //minimum and maximum of the visible range after scaling
+ double m_fScaledVisibleMin;
+ double m_fScaledVisibleMax;
+};
+
+class TickmarkHelper_2D : public TickmarkHelper
+{
+public:
+ TickmarkHelper_2D(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos
+ , const ::basegfx::B2DVector& rAxisLineToLabelLineShift );
+ //, double fStrech_SceneToScreen, double fOffset_SceneToScreen );
+ virtual ~TickmarkHelper_2D();
+
+ virtual TickmarkHelper* createShiftedTickmarkHelper() const;
+
+ static sal_Int32 getTickScreenDistance( TickIter& rIter );
+
+ void createPointSequenceForAxisMainLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints ) const;
+ void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , sal_Int32 nSequenceIndex
+ , double fScaledLogicTickValue, double fInnerDirectionSign
+ , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const;
+ ::basegfx::B2DVector getDistanceAxisTickToText( const AxisProperties& rAxisProperties
+ , bool bIncludeFarAwayDistanceIfSo = false
+ , bool bIncludeSpaceBetweenTickAndText = true ) const;
+
+ virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+ bool isHorizontalAxis() const;
+ bool isVerticalAxis() const;
+
+protected: //methods
+ ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const;
+
+private: //member
+ ::basegfx::B2DVector m_aAxisStartScreenPosition2D;
+ ::basegfx::B2DVector m_aAxisEndScreenPosition2D;
+
+ //labels might be posioned high or low on the border of the diagram far away from the axis
+ //add this vector to go from the axis line to the label line (border of the diagram)
+ ::basegfx::B2DVector m_aAxisLineToLabelLineShift;
+
+ double m_fStrech_LogicToScreen;
+ double m_fOffset_LogicToScreen;
+};
+
+class TickmarkHelper_3D : public TickmarkHelper
+{
+public:
+ TickmarkHelper_3D(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
+ virtual ~TickmarkHelper_3D();
+
+ virtual TickmarkHelper* createShiftedTickmarkHelper() const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/TickmarkProperties.hxx b/chart2/source/view/axes/TickmarkProperties.hxx
new file mode 100644
index 000000000000..09c0179d3698
--- /dev/null
+++ b/chart2/source/view/axes/TickmarkProperties.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_VTICKMARKPROPERTIES_HXX
+#define _CHART2_VTICKMARKPROPERTIES_HXX
+
+#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
+
+ VLineProperties aLineProperties;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx
new file mode 100644
index 000000000000..0159fb20cad6
--- /dev/null
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VAxisBase.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "TickmarkHelper.hxx"
+#include "macros.hxx"
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+VAxisBase::VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , const AxisProperties& rAxisProperties
+ , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+ : VAxisOrGridBase( nDimensionIndex, nDimensionCount )
+ , m_xNumberFormatsSupplier( xNumberFormatsSupplier )
+ , m_aAxisProperties( rAxisProperties )
+ , m_bUseTextLabels( false )
+ , m_bReCreateAllTickInfos( true )
+ , m_bRecordMaximumTextSize(false)
+ , m_nMaximumTextWidthSoFar(0)
+ , m_nMaximumTextHeightSoFar(0)
+{
+}
+
+VAxisBase::~VAxisBase()
+{
+}
+
+sal_Int32 VAxisBase::getDimensionCount()
+{
+ return m_nDimension;
+}
+
+void SAL_CALL VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels )
+{
+ m_aAxisLabelProperties.m_aFontReferenceSize = rFontReferenceSize;
+ m_aAxisLabelProperties.m_aMaximumSpaceForLabels = rMaximumSpaceForLabels;
+
+ if( !m_aAxisProperties.m_bDisplayLabels )
+ return;
+
+ if( AxisType::SERIES==m_aAxisProperties.m_nAxisType )
+ {
+ if( m_aAxisProperties.m_xAxisTextProvider.is() )
+ m_aTextLabels = m_aAxisProperties.m_xAxisTextProvider->getTextualData();
+
+ m_bUseTextLabels = true;
+ if( m_aTextLabels.getLength() == 1 )
+ {
+ //don't show a single series name
+ m_aAxisProperties.m_bDisplayLabels = false;
+ return;
+ }
+ }
+ else if( AxisType::CATEGORY==m_aAxisProperties.m_nAxisType )
+ {
+ if( m_aAxisProperties.m_pExplicitCategoriesProvider )
+ m_aTextLabels = m_aAxisProperties.m_pExplicitCategoriesProvider->getSimpleCategories();
+
+ m_bUseTextLabels = true;
+ }
+
+ m_aAxisLabelProperties.nNumberFormatKey = m_aAxisProperties.m_nNumberFormatKey;
+ m_aAxisLabelProperties.init(m_aAxisProperties.m_xAxisModel);
+ if( m_aAxisProperties.m_bComplexCategories && AxisType::CATEGORY == m_aAxisProperties.m_nAxisType )
+ m_aAxisLabelProperties.eStaggering = SIDE_BY_SIDE;
+}
+
+void VAxisBase::recordMaximumTextSize( const Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
+{
+ if( m_bRecordMaximumTextSize && xShape.is() )
+ {
+ awt::Size aSize( ShapeFactory::getSizeAfterRotation(
+ xShape, fRotationAngleDegree ) );
+
+ m_nMaximumTextWidthSoFar = std::max( m_nMaximumTextWidthSoFar, aSize.Width );
+ m_nMaximumTextHeightSoFar = std::max( m_nMaximumTextHeightSoFar, aSize.Height );
+ }
+}
+
+sal_Int32 VAxisBase::estimateMaximumAutoMainIncrementCount()
+{
+ return 10;
+}
+
+void VAxisBase::setExrtaLinePositionAtOtherAxis( const double& fCrossingAt )
+{
+ if( m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
+ delete m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
+ m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis = new double(fCrossingAt);
+}
+
+sal_Bool SAL_CALL VAxisBase::isAnythingToDraw()
+{
+ if( !m_aAxisProperties.m_xAxisModel.is() )
+ return false;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return false;
+
+ uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ if( xProps.is() )
+ {
+ sal_Bool bShow = sal_False;
+ xProps->getPropertyValue( C2U( "Show" ) ) >>= bShow;
+ if( !bShow )
+ return false;
+ }
+ return true;
+}
+
+void SAL_CALL VAxisBase::setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
+ throw (uno::RuntimeException)
+{
+ m_bReCreateAllTickInfos = true;
+ m_aScale = rScale;
+ m_aIncrement = rIncrement;
+}
+
+void VAxisBase::createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
+{
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ apTickmarkHelper->getAllTicks( rAllTickInfos );
+}
+
+bool VAxisBase::prepareShapeCreation()
+{
+ //returns true if all is ready for further shape creation and any shapes need to be created
+ if( !isAnythingToDraw() )
+ return false;
+
+ if( m_bReCreateAllTickInfos )
+ {
+ //-----------------------------------------
+ //create all scaled tickmark values
+ removeTextShapesFromTicks();
+
+ createAllTickInfos(m_aAllTickInfos);
+ m_bReCreateAllTickInfos = false;
+ }
+
+ if( m_xGroupShape_Shapes.is() )
+ return true;
+
+ //-----------------------------------------
+ //create named group shape
+ m_xGroupShape_Shapes = this->createGroupShape( m_xLogicTarget, m_nDimension==2 ? m_aCID : C2U(""));
+
+ if( m_aAxisProperties.m_bDisplayLabels )
+ m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget, m_aCID );
+
+ return true;
+}
+
+sal_Int32 VAxisBase::getIndexOfLongestLabel( const uno::Sequence< rtl::OUString >& rLabels )
+{
+ sal_Int32 nRet = 0;
+ sal_Int32 nLength = 0;
+ sal_Int32 nN = 0;
+ for( nN=0; nN<rLabels.getLength(); nN++ )
+ {
+ //todo: get real text width (without creating shape) instead of character count
+ if( rLabels[nN].getLength() > nLength )
+ {
+ nLength = rLabels[nN].getLength();
+ nRet = nN;
+ }
+ }
+ return nRet;
+}
+
+void VAxisBase::removeTextShapesFromTicks()
+{
+ if( m_xTextTarget.is() )
+ {
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = m_aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = m_aAllTickInfos.end();
+ for( ; aDepthIter != aDepthEnd; aDepthIter++ )
+ {
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = (*aTickIter);
+ if(rTickInfo.xTextShape.is())
+ {
+ m_xTextTarget->remove(rTickInfo.xTextShape);
+ rTickInfo.xTextShape = NULL;
+ }
+ }
+ }
+ }
+}
+
+void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter )
+{
+ Reference< XScaling > xInverseScaling( NULL );
+ if( m_aScale.Scaling.is() )
+ xInverseScaling = m_aScale.Scaling->getInverseScaling();
+
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo; pTickInfo = rIter.nextInfo() )
+ {
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx
new file mode 100644
index 000000000000..ba7e94b2070c
--- /dev/null
+++ b/chart2/source/view/axes/VAxisBase.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VAXISBASE_HXX
+#define _CHART2_VAXISBASE_HXX
+
+#include "VAxisOrGridBase.hxx"
+#include "VAxisProperties.hxx"
+#include "TickmarkHelper.hxx"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VAxisBase : public VAxisOrGridBase
+{
+public:
+ VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+ virtual ~VAxisBase();
+
+ sal_Int32 getDimensionCount();
+
+ virtual void SAL_CALL createMaximumLabels()=0;
+ virtual void SAL_CALL createLabels()=0;
+ virtual void SAL_CALL updatePositions()=0;
+
+ virtual sal_Bool SAL_CALL isAnythingToDraw();
+ virtual void SAL_CALL initAxisLabelProperties(
+ const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
+
+ virtual void SAL_CALL setExplicitScaleAndIncrement(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
+ virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
+
+ void setExrtaLinePositionAtOtherAxis( const double& fCrossingAt );
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+protected: //methods
+ sal_Int32 getIndexOfLongestLabel( const ::com::sun::star::uno::Sequence< rtl::OUString >& rLabels );
+ void removeTextShapesFromTicks();
+ void updateUnscaledValuesAtTicks( TickIter& rIter );
+
+ virtual bool prepareShapeCreation();
+ void recordMaximumTextSize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape
+ , double fRotationAngleDegree );
+
+protected: //member
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier;
+ AxisProperties m_aAxisProperties;
+ AxisLabelProperties m_aAxisLabelProperties;
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aTextLabels;
+ bool m_bUseTextLabels;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape_Shapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xTextTarget;
+
+ ::std::vector< ::std::vector< TickInfo > > m_aAllTickInfos;
+ bool m_bReCreateAllTickInfos;
+
+ bool m_bRecordMaximumTextSize;
+ sal_Int32 m_nMaximumTextWidthSoFar;
+ sal_Int32 m_nMaximumTextHeightSoFar;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VAxisOrGridBase.cxx b/chart2/source/view/axes/VAxisOrGridBase.cxx
new file mode 100644
index 000000000000..f2e2e90c1045
--- /dev/null
+++ b/chart2/source/view/axes/VAxisOrGridBase.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VAxisOrGridBase.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "TickmarkHelper.hxx"
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+VAxisOrGridBase::VAxisOrGridBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount )
+ : PlotterBase( nDimensionCount )
+ , m_nDimensionIndex( nDimensionIndex )
+ , m_eLeftWallPos(CuboidPlanePosition_Left)
+ , m_eBackWallPos(CuboidPlanePosition_Back)
+ , m_eBottomPos(CuboidPlanePosition_Bottom)
+{
+}
+
+VAxisOrGridBase::~VAxisOrGridBase()
+{
+}
+
+void SAL_CALL VAxisOrGridBase::setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
+ throw (uno::RuntimeException)
+{
+ m_aScale = rScale;
+ m_aIncrement = rIncrement;
+}
+
+void VAxisOrGridBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix )
+{
+ m_aMatrixScreenToScene = HomogenMatrixToB3DHomMatrix(rMatrix);
+ PlotterBase::setTransformationSceneToScreen( rMatrix);
+}
+
+void VAxisOrGridBase::set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos )
+{
+ m_eLeftWallPos = eLeftWallPos;
+ m_eBackWallPos = eBackWallPos;
+ m_eBottomPos = eBottomPos;
+}
+
+TickmarkHelper* VAxisOrGridBase::createTickmarkHelper()
+{
+ TickmarkHelper* pRet=NULL;
+ if( 2==m_nDimension )
+ {
+ pRet = new TickmarkHelper( m_aScale, m_aIncrement );
+ }
+ else
+ {
+ pRet = new TickmarkHelper_3D( m_aScale, m_aIncrement );
+ }
+ return pRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VAxisOrGridBase.hxx b/chart2/source/view/axes/VAxisOrGridBase.hxx
new file mode 100644
index 000000000000..35b32b2b1c03
--- /dev/null
+++ b/chart2/source/view/axes/VAxisOrGridBase.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VAXISORGRIDBASE_HXX
+#define _CHART2_VAXISORGRIDBASE_HXX
+
+#include "PlotterBase.hxx"
+#include "ThreeDHelper.hxx"
+
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ShapeFactory;
+class TickmarkHelper;
+
+class VAxisOrGridBase : public PlotterBase
+{
+public:
+ VAxisOrGridBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
+ virtual ~VAxisOrGridBase();
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
+ virtual void SAL_CALL setExplicitScaleAndIncrement(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ throw (::com::sun::star::uno::RuntimeException);
+ void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
+
+ virtual TickmarkHelper* createTickmarkHelper();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+protected: //member
+ ::com::sun::star::chart2::ExplicitScaleData m_aScale;
+ ::com::sun::star::chart2::ExplicitIncrementData m_aIncrement;
+ sal_Int32 m_nDimensionIndex;
+
+ ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
+
+ CuboidPlanePosition m_eLeftWallPos;
+ CuboidPlanePosition m_eBackWallPos;
+ CuboidPlanePosition m_eBottomPos;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
new file mode 100644
index 000000000000..1e3e62894741
--- /dev/null
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VAxisProperties.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "CommonConverters.hxx"
+#include "AxisHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+
+#include <tools/color.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+sal_Int32 lcl_calcTickLengthForDepth(sal_Int32 nDepth,sal_Int32 nTickmarkStyle)
+{
+ sal_Int32 nWidth = AXIS2D_TICKLENGTH; //@maybefuturetodo this length could be offered by the model
+ double fPercent = 1.0;
+ switch(nDepth)
+ {
+ case 0:
+ fPercent = 1.0;
+ break;
+ case 1:
+ fPercent = 0.75;//percentage like in the old chart
+ break;
+ case 2:
+ fPercent = 0.5;
+ break;
+ default:
+ fPercent = 0.3;
+ break;
+ }
+ if(nTickmarkStyle==3)//inner and outer tickmarks
+ fPercent*=2.0;
+ return static_cast<sal_Int32>(nWidth*fPercent);
+}
+
+double lcl_getTickOffset(sal_Int32 nLength,sal_Int32 nTickmarkStyle)
+{
+ double fPercent = 0.0; //0<=fPercent<=1
+ //0.0: completly inner
+ //1.0: completly outer
+ //0.5: half and half
+
+ /*
+ nTickmarkStyle:
+ 1: inner tickmarks
+ 2: outer tickmarks
+ 3: inner and outer tickmarks
+ */
+ switch(nTickmarkStyle)
+ {
+ case 1:
+ fPercent = 0.0;
+ break;
+ case 2:
+ fPercent = 1.0;
+ break;
+ default:
+ fPercent = 0.5;
+ break;
+ }
+ return fPercent*nLength;
+}
+
+VLineProperties AxisProperties::makeLinePropertiesForDepth( sal_Int32 /* nDepth */ ) const
+{
+ //@todo get this from somewhere; maybe for each subincrement
+ //so far the model does not offer different settings for each tick depth
+ return m_aLineProperties;
+}
+
+TickmarkProperties AxisProperties::makeTickmarkProperties(
+ sal_Int32 nDepth ) const
+{
+ /*
+ nTickmarkStyle:
+ 1: inner tickmarks
+ 2: outer tickmarks
+ 3: inner and outer tickmarks
+ */
+ sal_Int32 nTickmarkStyle = 1;
+ if(nDepth==0)
+ {
+ nTickmarkStyle = m_nMajorTickmarks;
+ if(!nTickmarkStyle)
+ {
+ //create major tickmarks as if they were minor tickmarks
+ nDepth = 1;
+ nTickmarkStyle = m_nMinorTickmarks;
+ }
+ }
+ else if( nDepth==1)
+ {
+ nTickmarkStyle = m_nMinorTickmarks;
+ }
+
+ if( m_fInnerDirectionSign == 0.0 )
+ {
+ if( nTickmarkStyle != 0 )
+ nTickmarkStyle = 3; //inner and outer tickmarks
+ }
+
+ TickmarkProperties aTickmarkProperties;
+ aTickmarkProperties.Length = lcl_calcTickLengthForDepth(nDepth,nTickmarkStyle);
+ aTickmarkProperties.RelativePos = static_cast<sal_Int32>(lcl_getTickOffset(aTickmarkProperties.Length,nTickmarkStyle));
+ aTickmarkProperties.aLineProperties = this->makeLinePropertiesForDepth( nDepth );
+ return aTickmarkProperties;
+}
+
+TickmarkProperties AxisProperties::makeTickmarkPropertiesForComplexCategories(
+ sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 /*nTextLevel*/ ) const
+{
+ sal_Int32 nTickmarkStyle = (m_fLabelDirectionSign==m_fInnerDirectionSign) ? 2/*outside*/ : 1/*inside*/;
+
+ TickmarkProperties aTickmarkProperties;
+ aTickmarkProperties.Length = nTickLength;// + nTextLevel*( lcl_calcTickLengthForDepth(0,nTickmarkStyle) );
+ aTickmarkProperties.RelativePos = static_cast<sal_Int32>(lcl_getTickOffset(aTickmarkProperties.Length+nTickStartDistanceToAxis,nTickmarkStyle));
+ aTickmarkProperties.aLineProperties = this->makeLinePropertiesForDepth( 0 );
+ return aTickmarkProperties;
+}
+
+//static
+TickmarkProperties AxisProperties::getBiggestTickmarkProperties()
+{
+ TickmarkProperties aTickmarkProperties;
+ sal_Int32 nDepth = 0;
+ sal_Int32 nTickmarkStyle = 3;//inner and outer tickmarks
+ aTickmarkProperties.Length = lcl_calcTickLengthForDepth( nDepth,nTickmarkStyle );
+ aTickmarkProperties.RelativePos = static_cast<sal_Int32>( lcl_getTickOffset( aTickmarkProperties.Length, nTickmarkStyle ) );
+ return aTickmarkProperties;
+}
+
+//--------------------------------------------------------------------------
+
+AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
+ , ExplicitCategoriesProvider* pExplicitCategoriesProvider )
+ : m_xAxisModel(xAxisModel)
+ , m_nDimensionIndex(0)
+ , m_bIsMainAxis(true)
+ , m_bSwapXAndY(false)
+ , m_eCrossoverType( ::com::sun::star::chart::ChartAxisPosition_ZERO )
+ , m_eLabelPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS )
+ , m_eTickmarkPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
+ , m_pfMainLinePositionAtOtherAxis(NULL)
+ , m_pfExrtaLinePositionAtOtherAxis(NULL)
+ , m_bCrossingAxisHasReverseDirection(false)
+ , m_bCrossingAxisIsCategoryAxes(false)
+ , m_bAxisBetweenCategories(false)
+ , m_fLabelDirectionSign(1.0)
+ , m_fInnerDirectionSign(1.0)
+ , m_aLabelAlignment(LABEL_ALIGN_RIGHT_TOP)
+ , m_bDisplayLabels( true )
+ , 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_xAxisTextProvider(0)
+{
+}
+
+AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
+ : m_xAxisModel( rAxisProperties.m_xAxisModel )
+ , m_nDimensionIndex( m_nDimensionIndex )
+ , m_bIsMainAxis( rAxisProperties.m_bIsMainAxis )
+ , m_bSwapXAndY( rAxisProperties.m_bSwapXAndY )
+ , m_eCrossoverType( rAxisProperties.m_eCrossoverType )
+ , m_eLabelPos( rAxisProperties.m_eLabelPos )
+ , m_eTickmarkPos( rAxisProperties.m_eTickmarkPos )
+ , m_pfMainLinePositionAtOtherAxis( NULL )
+ , m_pfExrtaLinePositionAtOtherAxis( NULL )
+ , m_bCrossingAxisHasReverseDirection( rAxisProperties.m_bCrossingAxisHasReverseDirection )
+ , m_bCrossingAxisIsCategoryAxes( rAxisProperties.m_bCrossingAxisIsCategoryAxes )
+ , m_bAxisBetweenCategories( rAxisProperties.m_bAxisBetweenCategories )
+ , m_fLabelDirectionSign( rAxisProperties.m_fLabelDirectionSign )
+ , m_fInnerDirectionSign( rAxisProperties.m_fInnerDirectionSign )
+ , m_aLabelAlignment( rAxisProperties.m_aLabelAlignment )
+ , m_bDisplayLabels( rAxisProperties.m_bDisplayLabels )
+ , m_nNumberFormatKey( rAxisProperties.m_nNumberFormatKey )
+ , m_nMajorTickmarks( rAxisProperties.m_nMajorTickmarks )
+ , m_nMinorTickmarks( rAxisProperties.m_nMinorTickmarks )
+ , m_aTickmarkPropertiesList( rAxisProperties.m_aTickmarkPropertiesList )
+ , m_aLineProperties( rAxisProperties.m_aLineProperties )
+ //for category axes
+ , m_nAxisType( rAxisProperties.m_nAxisType )
+ , m_bComplexCategories( rAxisProperties.m_bComplexCategories )
+ , m_pExplicitCategoriesProvider( rAxisProperties.m_pExplicitCategoriesProvider )
+ , m_xAxisTextProvider( rAxisProperties.m_xAxisTextProvider )
+{
+ if( rAxisProperties.m_pfMainLinePositionAtOtherAxis )
+ m_pfMainLinePositionAtOtherAxis = new double(*rAxisProperties.m_pfMainLinePositionAtOtherAxis);
+ if( rAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
+ m_pfExrtaLinePositionAtOtherAxis = new double (*rAxisProperties.m_pfExrtaLinePositionAtOtherAxis);
+}
+
+AxisProperties::~AxisProperties()
+{
+ delete m_pfMainLinePositionAtOtherAxis;
+ delete m_pfExrtaLinePositionAtOtherAxis;
+}
+
+LabelAlignment lcl_getLabelAlignmentForZAxis( const AxisProperties& rAxisProperties )
+{
+ LabelAlignment aRet( LABEL_ALIGN_RIGHT );
+ if( rAxisProperties.m_fLabelDirectionSign<0 )
+ aRet = LABEL_ALIGN_LEFT;
+ return aRet;
+}
+
+LabelAlignment lcl_getLabelAlignmentForYAxis( const AxisProperties& rAxisProperties )
+{
+ LabelAlignment aRet( LABEL_ALIGN_RIGHT );
+ if( rAxisProperties.m_fLabelDirectionSign<0 )
+ aRet = LABEL_ALIGN_LEFT;
+ return aRet;
+}
+
+LabelAlignment lcl_getLabelAlignmentForXAxis( const AxisProperties& rAxisProperties )
+{
+ LabelAlignment aRet( LABEL_ALIGN_BOTTOM );
+ if( rAxisProperties.m_fLabelDirectionSign<0 )
+ aRet = LABEL_ALIGN_TOP;
+ return aRet;
+}
+
+void AxisProperties::initAxisPositioning( const uno::Reference< beans::XPropertySet >& xAxisProp )
+{
+ if( !xAxisProp.is() )
+ return;
+ try
+ {
+ if( AxisHelper::isAxisPositioningEnabled() )
+ {
+ xAxisProp->getPropertyValue(C2U( "CrossoverPosition" )) >>= m_eCrossoverType;
+ if( ::com::sun::star::chart::ChartAxisPosition_VALUE == m_eCrossoverType )
+ {
+ double fValue = 0.0;
+ xAxisProp->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue;
+
+ if( m_bCrossingAxisIsCategoryAxes )
+ {
+ fValue = ::rtl::math::round(fValue);
+ if( m_bAxisBetweenCategories )
+ fValue-=0.5;
+ }
+ m_pfMainLinePositionAtOtherAxis = new double(fValue);
+ }
+ else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == m_eCrossoverType )
+ m_pfMainLinePositionAtOtherAxis = new double(0.0);
+
+ xAxisProp->getPropertyValue(C2U( "LabelPosition" )) >>= m_eLabelPos;
+ xAxisProp->getPropertyValue(C2U( "MarkPosition" )) >>= m_eTickmarkPos;
+ }
+ else
+ {
+ m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_START;
+ if( m_bIsMainAxis == m_bCrossingAxisHasReverseDirection )
+ m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_END;
+ m_eLabelPos = ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS;
+ m_eTickmarkPos = ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void AxisProperties::init( bool bCartesian )
+{
+ uno::Reference< beans::XPropertySet > xProp =
+ uno::Reference<beans::XPropertySet>::query( this->m_xAxisModel );
+ if( !xProp.is() )
+ return;
+
+ if( m_nDimensionIndex<2 )
+ initAxisPositioning( xProp );
+
+ if( bCartesian )
+ {
+ if( ::com::sun::star::chart::ChartAxisPosition_END == m_eCrossoverType )
+ m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
+ else
+ m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
+
+ if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS == m_eLabelPos )
+ m_fLabelDirectionSign = m_fInnerDirectionSign;
+ else if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE == m_eLabelPos )
+ m_fLabelDirectionSign = -m_fInnerDirectionSign;
+ else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_eLabelPos )
+ m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
+ else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_eLabelPos )
+ m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
+
+ if( m_nDimensionIndex==2 )
+ m_aLabelAlignment = lcl_getLabelAlignmentForZAxis(*this);
+ else
+ {
+ bool bIsYAxisPosition = (m_nDimensionIndex==1 && !m_bSwapXAndY)
+ || (m_nDimensionIndex==0 && m_bSwapXAndY);
+ if( bIsYAxisPosition )
+ {
+ m_fLabelDirectionSign*=-1;
+ m_fInnerDirectionSign*=-1;
+ }
+
+ if( bIsYAxisPosition )
+ m_aLabelAlignment = lcl_getLabelAlignmentForYAxis(*this);
+ else
+ m_aLabelAlignment = lcl_getLabelAlignmentForXAxis(*this);
+ }
+ }
+
+ try
+ {
+ //init LineProperties
+ m_aLineProperties.initFromPropertySet( xProp );
+
+ //init display labels
+ xProp->getPropertyValue( C2U( "DisplayLabels" ) ) >>= m_bDisplayLabels;
+
+ //init categories
+ ScaleData aScaleData = m_xAxisModel->getScaleData();
+ m_nAxisType = aScaleData.AxisType;
+
+ //init TickmarkProperties
+ xProp->getPropertyValue( C2U( "MajorTickmarks" ) ) >>= m_nMajorTickmarks;
+ xProp->getPropertyValue( C2U( "MinorTickmarks" ) ) >>= m_nMinorTickmarks;
+
+ sal_Int32 nMaxDepth = 0;
+ if(m_nMinorTickmarks!=0)
+ nMaxDepth=2;
+ else if(m_nMajorTickmarks!=0)
+ nMaxDepth=1;
+
+ this->m_aTickmarkPropertiesList.clear();
+ for( sal_Int32 nDepth=0; nDepth<nMaxDepth; nDepth++ )
+ {
+ TickmarkProperties aTickmarkProperties = this->makeTickmarkProperties( nDepth );
+ this->m_aTickmarkPropertiesList.push_back( aTickmarkProperties );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+AxisLabelProperties::AxisLabelProperties()
+ : m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() )
+ , m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height )
+ , nNumberFormatKey(0)
+ , eStaggering( SIDE_BY_SIDE )
+ , bLineBreakAllowed( false )
+ , bOverlapAllowed( false )
+ , bStackCharacters( false )
+ , fRotationAngleDegree( 0.0 )
+ , nRhythm( 1 )
+ , bRhythmIsFix(false)
+{
+ /*
+ aLocale.Language = C2U( "en" );
+ aLocale.Country = C2U( "US" );
+
+ //aLocale.Language = C2U( "ar" );
+ //aLocale.Country = C2U( "IR" );
+
+ //aLocale.Language = C2U( "ja" );
+ //aLocale.Country = C2U( "JP" );
+ */
+}
+
+void AxisLabelProperties::init( const uno::Reference< XAxis >& xAxisModel )
+{
+ uno::Reference< beans::XPropertySet > xProp =
+ uno::Reference<beans::XPropertySet>::query( xAxisModel );
+ if(xProp.is())
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U( "TextBreak" ) ) >>= this->bLineBreakAllowed;
+ xProp->getPropertyValue( C2U( "TextOverlap" ) ) >>= this->bOverlapAllowed;
+ xProp->getPropertyValue( C2U( "StackCharacters" ) ) >>= this->bStackCharacters;
+ xProp->getPropertyValue( C2U( "TextRotation" ) ) >>= this->fRotationAngleDegree;
+
+ ::com::sun::star::chart::ChartAxisArrangeOrderType eArrangeOrder;
+ xProp->getPropertyValue( C2U( "ArrangeOrder" ) ) >>= eArrangeOrder;
+ switch(eArrangeOrder)
+ {
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
+ this->eStaggering = SIDE_BY_SIDE;
+ break;
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
+ this->eStaggering = STAGGER_EVEN;
+ break;
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
+ this->eStaggering = STAGGER_ODD;
+ break;
+ default:
+ this->eStaggering = STAGGER_AUTO;
+ break;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+/*
+sal_Int16 getSwappedWritingMode( sal_Int16 nWritingMode )
+{
+ //LR_TB == LT
+ //RL_TB == RT (Arabic, Hebrew)
+ //TB_RL == TR (Japanese, Chinese, Korean)
+ // ?? TL (Mongolian) see also text::WritingMode2
+
+ switch(nWritingMode)
+ {
+ case text::WritingMode2::RL_TB:
+ return text::WritingMode2::TB_RL;
+ case text::WritingMode2::TB_RL:
+ return text::WritingMode2::RL_TB;
+ case text::WritingMode2::LR_TB:
+ return text::WritingMode2::TB_LR;
+ default:
+ return text::WritingMode2::LR_TB;
+ }
+}
+*/
+
+sal_Bool AxisLabelProperties::getIsStaggered() const
+{
+ if( STAGGER_ODD == eStaggering || STAGGER_EVEN == eStaggering )
+ return sal_True;
+ return sal_False;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx
new file mode 100644
index 000000000000..5b6bfe98f777
--- /dev/null
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VAXIS_PROPERTIES_HXX
+#define _CHART2_VAXIS_PROPERTIES_HXX
+
+#include "TickmarkProperties.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "LabelAlignment.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+//These properties describe how a couple of labels are arranged one to another.
+//The couple can contain all labels for all tickmark depth or just the labels for one single depth or
+//the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
+//... only allow side by side for different tick depth
+enum AxisLabelStaggering
+{
+ SIDE_BY_SIDE
+ , STAGGER_EVEN
+ , STAGGER_ODD
+ , STAGGER_AUTO
+};
+
+struct AxisLabelProperties
+{
+ AxisLabelProperties();
+
+ ::com::sun::star::awt::Size m_aFontReferenceSize;//reference size to calculate the font height
+ ::com::sun::star::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
+
+ sal_Int32 nNumberFormatKey;
+
+ AxisLabelStaggering eStaggering;
+
+ sal_Bool bLineBreakAllowed;
+ sal_Bool bOverlapAllowed;
+
+ sal_Bool bStackCharacters;
+ double fRotationAngleDegree;
+
+ sal_Int32 nRhythm; //show only each nth label with n==nRhythm
+ bool bRhythmIsFix; //states wether the given rhythm is fix or may be changed
+
+ //methods:
+ void init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxisModel );
+
+ sal_Bool getIsStaggered() const;
+};
+
+struct AxisProperties
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > m_xAxisModel;
+
+ sal_Int32 m_nDimensionIndex;
+ bool m_bIsMainAxis;//not secondary axis
+ bool m_bSwapXAndY;
+
+ ::com::sun::star::chart::ChartAxisPosition m_eCrossoverType;
+ ::com::sun::star::chart::ChartAxisLabelPosition m_eLabelPos;
+ ::com::sun::star::chart::ChartAxisMarkPosition m_eTickmarkPos;
+
+ double* m_pfMainLinePositionAtOtherAxis;
+ double* m_pfExrtaLinePositionAtOtherAxis;
+
+ bool m_bCrossingAxisHasReverseDirection;
+ bool m_bCrossingAxisIsCategoryAxes;
+ bool m_bAxisBetweenCategories;
+
+ //this direction is used to indicate in which direction the labels are to be drawn
+ double m_fLabelDirectionSign;
+ //this direction is used to indicate in which direction inner tickmarks are to be drawn
+ double m_fInnerDirectionSign;
+ LabelAlignment m_aLabelAlignment;
+ sal_Bool m_bDisplayLabels;
+
+ sal_Int32 m_nNumberFormatKey;
+
+ /*
+ 0: no tickmarks 1: inner tickmarks
+ 2: outer tickmarks 3: inner and outer tickmarks
+ */
+ sal_Int32 m_nMajorTickmarks;
+ sal_Int32 m_nMinorTickmarks;
+ ::std::vector<TickmarkProperties> m_aTickmarkPropertiesList;
+
+ VLineProperties m_aLineProperties;
+
+ //for category axes ->
+ sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType
+ bool m_bComplexCategories;
+ ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;/*no ownership here*/
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XTextualDataSequence >
+ m_xAxisTextProvider; //for categries or series names
+ //<- category axes
+
+ //methods:
+
+ AxisProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxisModel
+ , ExplicitCategoriesProvider* pExplicitCategoriesProvider );
+ AxisProperties( const AxisProperties& rAxisProperties );
+ virtual ~AxisProperties();
+ virtual void init(bool bCartesian=false);//init from model data (m_xAxisModel)
+
+ void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp );
+
+ static TickmarkProperties getBiggestTickmarkProperties();
+ TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 nTextLevel ) const;
+
+private:
+ AxisProperties();
+
+protected:
+ virtual TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const;
+ VLineProperties makeLinePropertiesForDepth( sal_Int32 nDepth ) const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
new file mode 100644
index 000000000000..8ec895fbd452
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -0,0 +1,1600 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <basegfx/numeric/ftools.hxx>
+
+#include "VCartesianAxis.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "PropertyMapper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "LabelPositionHelper.hxx"
+#include "TrueGuard.hxx"
+#include "BaseGFXHelper.hxx"
+#include "AxisHelper.hxx"
+
+#include <rtl/math.hxx>
+#include <tools/color.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <editeng/unoprnms.hxx>
+
+#include <algorithm>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::rtl::math;
+using ::com::sun::star::uno::Reference;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+VCartesianAxis::VCartesianAxis( const AxisProperties& rAxisProperties
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , PlottingPositionHelper* pPosHelper )//takes ownership
+ : VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, xNumberFormatsSupplier )
+{
+ if( pPosHelper )
+ m_pPosHelper = pPosHelper;
+ else
+ m_pPosHelper = new PlottingPositionHelper();
+}
+
+VCartesianAxis::~VCartesianAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+Reference< drawing::XShape > createSingleLabel(
+ const Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const Reference< drawing::XShapes >& xTarget
+ , const awt::Point& rAnchorScreenPosition2D
+ , const rtl::OUString& rLabel
+ , const AxisLabelProperties& rAxisLabelProperties
+ , const AxisProperties& rAxisProperties
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ )
+{
+ if(!rLabel.getLength())
+ return 0;
+
+ // #i78696# use mathematically correct rotation now
+ const double fRotationAnglePi(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+ uno::Any aATransformation = ShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi );
+ rtl::OUString aLabel = ShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters );
+
+ Reference< drawing::XShape > xShape2DText = ShapeFactory(xShapeFactory)
+ .createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
+
+ //correctPositionForRotation
+ LabelPositionHelper::correctPositionForRotation( xShape2DText
+ , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, false );
+
+ return xShape2DText;
+}
+
+bool lcl_doesShapeOverlapWithTickmark( const Reference< drawing::XShape >& xShape
+ , double fRotationAngleDegree
+ , const basegfx::B2DVector& rTickScreenPosition
+ , bool bIsHorizontalAxis, bool bIsVerticalAxis )
+{
+ if(!xShape.is())
+ return false;
+
+ ::basegfx::B2IRectangle aShapeRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),ShapeFactory::getSizeAfterRotation( xShape, fRotationAngleDegree ));
+
+ if( bIsVerticalAxis )
+ {
+ return ( (rTickScreenPosition.getY() >= aShapeRect.getMinY())
+ && (rTickScreenPosition.getY() <= aShapeRect.getMaxY()) );
+ }
+ if( bIsHorizontalAxis )
+ {
+ return ( (rTickScreenPosition.getX() >= aShapeRect.getMinX())
+ && (rTickScreenPosition.getX() <= aShapeRect.getMaxX()) );
+ }
+
+ basegfx::B2IVector aPosition(
+ static_cast<sal_Int32>( rTickScreenPosition.getX() )
+ , static_cast<sal_Int32>( rTickScreenPosition.getY() ) );
+ return aShapeRect.isInside(aPosition);
+}
+
+bool doesOverlap( const Reference< drawing::XShape >& xShape1
+ , const Reference< drawing::XShape >& xShape2
+ , double fRotationAngleDegree )
+{
+ if( !xShape1.is() || !xShape2.is() )
+ return false;
+
+ ::basegfx::B2IRectangle aRect1( BaseGFXHelper::makeRectangle(xShape1->getPosition(),ShapeFactory::getSizeAfterRotation( xShape1, fRotationAngleDegree )));
+ ::basegfx::B2IRectangle aRect2( BaseGFXHelper::makeRectangle(xShape2->getPosition(),ShapeFactory::getSizeAfterRotation( xShape2, fRotationAngleDegree )));
+ return aRect1.overlaps(aRect2);
+}
+
+void removeShapesAtWrongRhythm( TickIter& rIter
+ , sal_Int32 nCorrectRhythm
+ , sal_Int32 nMaxTickToCheck
+ , const Reference< drawing::XShapes >& xTarget )
+{
+ sal_Int32 nTick = 0;
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo && nTick <= nMaxTickToCheck
+ ; pTickInfo = rIter.nextInfo(), nTick++ )
+ {
+ //remove labels which does not fit into the rhythm
+ if( nTick%nCorrectRhythm != 0)
+ {
+ if(pTickInfo->xTextShape.is())
+ {
+ xTarget->remove(pTickInfo->xTextShape);
+ pTickInfo->xTextShape = NULL;
+ }
+ }
+ }
+}
+
+class EquidistantLabelIterator : public EquidistantTickIter
+{
+ //this Iterator iterates over existing text labels
+
+ //if the labels are staggered and bInnerLine is true
+ //we iterate only through the labels which are lying more inside the diagram
+
+ //if the labels are staggered and bInnerLine is false
+ //we iterate only through the labels which are lying more outside the diagram
+
+ //if the labels are not staggered
+ //we iterate through all labels
+
+public:
+ EquidistantLabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const AxisLabelStaggering eAxisLabelStaggering
+ , bool bInnerLine
+ , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
+
+ virtual TickInfo* firstInfo();
+ virtual TickInfo* nextInfo();
+
+private: //methods
+ EquidistantLabelIterator();
+
+private: //member
+ const AxisLabelStaggering m_eAxisLabelStaggering;
+ bool m_bInnerLine;
+};
+
+EquidistantLabelIterator::EquidistantLabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const AxisLabelStaggering eAxisLabelStaggering
+ , bool bInnerLine
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : EquidistantTickIter( rTickInfos, rIncrement, nMinDepth, nMaxDepth )
+ , m_eAxisLabelStaggering(eAxisLabelStaggering)
+ , m_bInnerLine(bInnerLine)
+{
+}
+
+TickInfo* EquidistantLabelIterator::firstInfo()
+{
+ TickInfo* pTickInfo = EquidistantTickIter::firstInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() )
+ pTickInfo = EquidistantTickIter::nextInfo();
+ if(!pTickInfo)
+ return NULL;
+ if( (STAGGER_EVEN==m_eAxisLabelStaggering && m_bInnerLine)
+ ||
+ (STAGGER_ODD==m_eAxisLabelStaggering && !m_bInnerLine)
+ )
+ {
+ //skip first label
+ do
+ pTickInfo = EquidistantTickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+ }
+ if(!pTickInfo)
+ return NULL;
+ return pTickInfo;
+}
+
+TickInfo* EquidistantLabelIterator::nextInfo()
+{
+ TickInfo* pTickInfo = NULL;
+ //get next label
+ do
+ pTickInfo = EquidistantTickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+
+ if( STAGGER_EVEN==m_eAxisLabelStaggering
+ || STAGGER_ODD==m_eAxisLabelStaggering )
+ {
+ //skip one label
+ do
+ pTickInfo = EquidistantTickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+ }
+ return pTickInfo;
+}
+
+B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDistanceTickToText )
+{
+ //calculates the height or width of a line of labels
+ //thus a following line of labels can be shifted for that distance
+
+ B2DVector aRet(0,0);
+
+ sal_Int32 nDistanceTickToText = static_cast<sal_Int32>( rDistanceTickToText.getLength() );
+ if( nDistanceTickToText==0.0)
+ return aRet;
+
+ B2DVector aStaggerDirection(rDistanceTickToText);
+ aStaggerDirection.normalize();
+
+ sal_Int32 nDistance=0;
+ Reference< drawing::XShape > xShape2DText(NULL);
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rIter.nextInfo() )
+ {
+ xShape2DText = pTickInfo->xTextShape;
+ if( xShape2DText.is() )
+ {
+ awt::Size aSize = xShape2DText->getSize();
+ if(fabs(aStaggerDirection.getX())>fabs(aStaggerDirection.getY()))
+ nDistance = ::std::max(nDistance,aSize.Width);
+ else
+ nDistance = ::std::max(nDistance,aSize.Height);
+ }
+ }
+
+ aRet = aStaggerDirection*nDistance;
+
+ //add extra distance for vertical distance
+ if(fabs(aStaggerDirection.getX())>fabs(aStaggerDirection.getY()))
+ aRet += rDistanceTickToText;
+
+ return aRet;
+}
+
+void lcl_shiftLables( TickIter& rIter, const B2DVector& rStaggerDistance )
+{
+ if(rStaggerDistance.getLength()==0.0)
+ return;
+ Reference< drawing::XShape > xShape2DText(NULL);
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rIter.nextInfo() )
+ {
+ xShape2DText = pTickInfo->xTextShape;
+ if( xShape2DText.is() )
+ {
+ awt::Point aPos = xShape2DText->getPosition();
+ aPos.X += static_cast<sal_Int32>(rStaggerDistance.getX());
+ aPos.Y += static_cast<sal_Int32>(rStaggerDistance.getY());
+ xShape2DText->setPosition( aPos );
+ }
+ }
+}
+
+class MaxLabelEquidistantTickIter : public EquidistantTickIter
+{
+ //iterate over first two and last two labels and the longest label
+public:
+ MaxLabelEquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , sal_Int32 nLongestLabelIndex );
+ virtual ~MaxLabelEquidistantTickIter();
+
+ virtual TickInfo* nextInfo();
+
+private:
+ sal_Int32 m_nLongestLabelIndex;
+};
+
+MaxLabelEquidistantTickIter::MaxLabelEquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , sal_Int32 nLongestLabelIndex )
+ : EquidistantTickIter( rTickInfos, rIncrement, 0//nMinDepth
+ , 0//nMaxDepth
+ )
+ , m_nLongestLabelIndex( nLongestLabelIndex )
+{
+ sal_Int32 nMaxIndex = getMaxIndex();
+
+ //ensure correct value:
+ if( m_nLongestLabelIndex<0 || m_nLongestLabelIndex>nMaxIndex)
+ m_nLongestLabelIndex = 0;
+
+ //last label is checked anyhow
+ if( m_nLongestLabelIndex==nMaxIndex )
+ m_nLongestLabelIndex = 0;
+ //label before last is checked anyhow
+ if( m_nLongestLabelIndex+1==nMaxIndex )
+ m_nLongestLabelIndex = 0;
+}
+MaxLabelEquidistantTickIter::~MaxLabelEquidistantTickIter()
+{
+}
+
+TickInfo* MaxLabelEquidistantTickIter::nextInfo()
+{
+ sal_Int32 nCurrentPos = getCurrentIndex();
+ sal_Int32 nMaxIndex = getMaxIndex();
+ if( nCurrentPos>0 )
+ {
+ if( m_nLongestLabelIndex>1 && nCurrentPos<m_nLongestLabelIndex )
+ gotoIndex( m_nLongestLabelIndex-1 ) ;
+ else
+ {
+ if( nMaxIndex>3 && nCurrentPos<nMaxIndex-1 )
+ gotoIndex( nMaxIndex-2 );
+ else if( nMaxIndex>2 && nCurrentPos<nMaxIndex )
+ gotoIndex( nMaxIndex-1 );
+ }
+ }
+
+ return EquidistantTickIter::nextInfo();
+}
+
+bool VCartesianAxis::isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
+ , bool bIsHorizontalAxis )
+{
+ if( m_aTextLabels.getLength() > 100 )
+ return false;
+ if( !rAxisLabelProperties.bLineBreakAllowed )
+ return false;
+ if( rAxisLabelProperties.bStackCharacters )
+ return false;
+ //no break for value axis
+ if( !m_bUseTextLabels )
+ return false;
+ if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) )
+ return false;
+ //break only for horizontal axis
+ return bIsHorizontalAxis;
+}
+
+bool VCartesianAxis::isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
+ , bool bIsHorizontalAxis, bool bIsVerticalAxis )
+{
+ if( rAxisLabelProperties.eStaggering != STAGGER_AUTO )
+ return false;
+ if( rAxisLabelProperties.bOverlapAllowed )
+ return false;
+ if( rAxisLabelProperties.bLineBreakAllowed ) //auto line break or auto staggering, doing both automatisms they may conflict...
+ return false;
+ if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) )
+ return false;
+ //automatic staggering only for horizontal axis with horizontal text
+ //or vertical axis with vertical text
+ if( bIsHorizontalAxis )
+ return !rAxisLabelProperties.bStackCharacters;
+ if( bIsVerticalAxis )
+ return rAxisLabelProperties.bStackCharacters;
+ return false;
+}
+
+struct ComplexCategoryPlacement
+{
+ rtl::OUString Text;
+ sal_Int32 Count;
+ double TickValue;
+
+ ComplexCategoryPlacement( const rtl::OUString& rText, sal_Int32 nCount, double fTickValue )
+ : Text(rText), Count(nCount), TickValue(fTickValue)
+ {}
+};
+
+void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShiftedPosition )
+{
+ //no minor tickmarks will be generated!
+ //order is: inner labels first , outer labels last (that is different to all other TickIter cases)
+ if(!bShiftedPosition)
+ {
+ rAllTickInfos.clear();
+ sal_Int32 nLevel=0;
+ sal_Int32 nLevelCount = m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoryLevelCount();
+ for( ; nLevel<nLevelCount; nLevel++ )
+ {
+ ::std::vector< TickInfo > aTickInfoVector;
+ std::vector< ComplexCategory > aComplexCategories( m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel( nLevel ) );
+ sal_Int32 nCatIndex = 0;
+ std::vector< ComplexCategory >::const_iterator aIt(aComplexCategories.begin());
+ std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
+ for(;aIt!=aEnd;++aIt)
+ {
+ TickInfo aTickInfo;
+ ComplexCategory aCat(*aIt);
+ sal_Int32 nCount = aCat.Count;
+ if( nCatIndex + 0.5 + nCount >= m_aScale.Maximum )
+ {
+ nCount = static_cast<sal_Int32>(m_aScale.Maximum - 0.5 - nCatIndex);
+ if( nCount <= 0 )
+ nCount = 1;
+ }
+ aTickInfo.fScaledTickValue = nCatIndex + 0.5 + nCount/2.0;
+ aTickInfo.nFactorForLimitedTextWidth = nCount;
+ aTickInfo.aText = aCat.Text;
+ aTickInfoVector.push_back(aTickInfo);
+ nCatIndex += nCount;
+ if( nCatIndex + 0.5 >= m_aScale.Maximum )
+ break;
+ }
+ rAllTickInfos.push_back(aTickInfoVector);
+ }
+ }
+ else //bShiftedPosition==true
+ {
+ rAllTickInfos.clear();
+ sal_Int32 nLevel=0;
+ sal_Int32 nLevelCount = m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoryLevelCount();
+ for( ; nLevel<nLevelCount; nLevel++ )
+ {
+ ::std::vector< TickInfo > aTickInfoVector;
+ std::vector< ComplexCategory > aComplexCategories( m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoriesByLevel( nLevel ) );
+ sal_Int32 nCatIndex = 0;
+ std::vector< ComplexCategory >::const_iterator aIt(aComplexCategories.begin());
+ std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
+ for(;aIt!=aEnd;++aIt)
+ {
+ TickInfo aTickInfo;
+ ComplexCategory aCat(*aIt);
+ aTickInfo.fScaledTickValue = nCatIndex + 0.5;
+ aTickInfoVector.push_back(aTickInfo);
+ nCatIndex += aCat.Count;
+ if( nCatIndex + 0.5 > m_aScale.Maximum )
+ break;
+ }
+ //fill up with single ticks until maximum scale
+ while( nCatIndex + 0.5 < m_aScale.Maximum )
+ {
+ TickInfo aTickInfo;
+ aTickInfo.fScaledTickValue = nCatIndex + 0.5;
+ aTickInfoVector.push_back(aTickInfo);
+ nCatIndex ++;
+ if( nLevel>0 )
+ break;
+ }
+ //add an additional tick at the end
+ {
+ TickInfo aTickInfo;
+ aTickInfo.fScaledTickValue = m_aScale.Maximum;
+ aTickInfoVector.push_back(aTickInfo);
+ }
+ rAllTickInfos.push_back(aTickInfoVector);
+ }
+ }
+}
+
+void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
+{
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ createAllTickInfosFromComplexCategories( rAllTickInfos, false );
+ else
+ VAxisBase::createAllTickInfos(rAllTickInfos);
+}
+
+::std::auto_ptr< TickIter > VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel )
+{
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ {
+ if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) )
+ return ::std::auto_ptr< TickIter >( new PureTickIter( m_aAllTickInfos[nTextLevel] ) );
+ }
+ else
+ {
+ if(nTextLevel==0)
+ return ::std::auto_ptr< TickIter >( new EquidistantTickIter( m_aAllTickInfos, m_aIncrement, 0, 0 ) );
+ }
+ return ::std::auto_ptr< TickIter >();
+}
+::std::auto_ptr< TickIter > VCartesianAxis::createMaximumLabelTickIterator( sal_Int32 nTextLevel )
+{
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ {
+ return createLabelTickIterator( nTextLevel ); //mmmm maybe todo: create less than all texts here
+ }
+ else
+ {
+ if(nTextLevel==0)
+ {
+ sal_Int32 nLongestLabelIndex = m_bUseTextLabels ? this->getIndexOfLongestLabel( m_aTextLabels ) : 0;
+ return ::std::auto_ptr< TickIter >( new MaxLabelEquidistantTickIter( m_aAllTickInfos, m_aIncrement, nLongestLabelIndex ) );
+ }
+ }
+ return ::std::auto_ptr< TickIter >();
+}
+
+sal_Int32 VCartesianAxis::getTextLevelCount() const
+{
+ sal_Int32 nTextLevelCount = 1;
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ nTextLevelCount = m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoryLevelCount();
+ return nTextLevelCount;
+}
+
+bool VCartesianAxis::createTextShapes(
+ const Reference< drawing::XShapes >& xTarget
+ , TickIter& rTickIter
+ , AxisLabelProperties& rAxisLabelProperties
+ , TickmarkHelper_2D* pTickmarkHelper
+ , sal_Int32 nScreenDistanceBetweenTicks )
+{
+ //returns true if the text shapes have been created succesfully
+ //otherwise false - in this case the AxisLabelProperties have changed
+ //and contain new instructions for the next try for text shape creation
+
+ Reference< XScaling > xInverseScaling( NULL );
+ if( m_aScale.Scaling.is() )
+ xInverseScaling = m_aScale.Scaling->getInverseScaling();
+
+ FixedNumberFormatter aFixedNumberFormatter(
+ m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey );
+
+ const bool bIsHorizontalAxis = pTickmarkHelper->isHorizontalAxis();
+ const bool bIsVerticalAxis = pTickmarkHelper->isVerticalAxis();
+ bool bIsStaggered = rAxisLabelProperties.getIsStaggered();
+ B2DVector aTextToTickDistance( pTickmarkHelper->getDistanceAxisTickToText( m_aAxisProperties, true ) );
+ sal_Int32 nLimitedSpaceForText = -1;
+ if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis ) )
+ {
+ nLimitedSpaceForText = nScreenDistanceBetweenTicks;
+ if( bIsStaggered )
+ nLimitedSpaceForText *= 2;
+
+ if( nLimitedSpaceForText > 0 )
+ { //reduce space for a small amount to have a visible distance between the labels:
+ sal_Int32 nReduce = (nLimitedSpaceForText*5)/100;
+ if(!nReduce)
+ nReduce = 1;
+ nLimitedSpaceForText -= nReduce;
+ }
+ }
+
+ std::vector< ComplexCategoryPlacement > aComplexCategoryPlacements;
+ uno::Sequence< rtl::OUString >* pCategories = 0;
+ if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories )
+ pCategories = &m_aTextLabels;
+
+ TickInfo* pPreviousVisibleTickInfo = NULL;
+ TickInfo* pPREPreviousVisibleTickInfo = NULL;
+ TickInfo* pLastVisibleNeighbourTickInfo = NULL;
+
+ //------------------------------------------------
+ //prepare properties for multipropertyset-interface of shape
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
+
+ bool bLimitedHeight = fabs(aTextToTickDistance.getX()) > fabs(aTextToTickDistance.getY());
+ Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false
+ , nLimitedSpaceForText, bLimitedHeight );
+ LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
+ , m_aAxisLabelProperties.m_aFontReferenceSize );
+ LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, m_aAxisProperties.m_aLabelAlignment );
+
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("CharColor"));
+ sal_Int32 nColor = Color( COL_AUTO ).GetColor();
+ if(pColorAny)
+ *pColorAny >>= nColor;
+
+ uno::Any* pLimitedSpaceAny = PropertyMapper::getValuePointerForLimitedSpace(aPropValues,aPropNames,bLimitedHeight);
+ //------------------------------------------------
+
+ sal_Int32 nTick = 0;
+ for( TickInfo* pTickInfo = rTickIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rTickIter.nextInfo(), nTick++ )
+ {
+ pLastVisibleNeighbourTickInfo = bIsStaggered ?
+ pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo;
+
+ //don't create labels which does not fit into the rhythm
+ if( nTick%rAxisLabelProperties.nRhythm != 0)
+ continue;
+
+ //don't create labels for invisible ticks
+ if( !pTickInfo->bPaintIt )
+ continue;
+
+ //if NO OVERLAP -> don't create labels where the tick overlaps
+ //with the text of the last neighbour tickmark
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.fRotationAngleDegree
+ , pTickInfo->aTickScreenPosition
+ , bIsHorizontalAxis, bIsVerticalAxis ) )
+ {
+ bool bOverlapAlsoAfterSwitchingOnAutoStaggering = true;
+ if( !bIsStaggered && isAutoStaggeringOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) )
+ {
+ bIsStaggered = true;
+ rAxisLabelProperties.eStaggering = STAGGER_EVEN;
+ pLastVisibleNeighbourTickInfo = pPREPreviousVisibleTickInfo;
+ if( !pLastVisibleNeighbourTickInfo ||
+ !lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.fRotationAngleDegree
+ , pTickInfo->aTickScreenPosition
+ , bIsHorizontalAxis, bIsVerticalAxis ) )
+ bOverlapAlsoAfterSwitchingOnAutoStaggering = false;
+ }
+ if( bOverlapAlsoAfterSwitchingOnAutoStaggering )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ continue;
+ rAxisLabelProperties.nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+ }
+
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+
+ bool bHasExtraColor=false;
+ sal_Int32 nExtraColor=0;
+
+ rtl::OUString aLabel;
+ if(pCategories)
+ {
+ sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->fUnscaledTickValue) - 1; //first category (index 0) matches with real number 1.0
+ if( nIndex>=0 && nIndex<pCategories->getLength() )
+ aLabel = (*pCategories)[nIndex];
+ }
+ else if( m_aAxisProperties.m_bComplexCategories )
+ {
+ aLabel = pTickInfo->aText;
+ }
+ else
+ aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+
+ if(pColorAny)
+ *pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
+ if(pLimitedSpaceAny)
+ *pLimitedSpaceAny = uno::makeAny(sal_Int32(nLimitedSpaceForText*pTickInfo->nFactorForLimitedTextWidth));
+
+ B2DVector aTickScreenPos2D( pTickInfo->aTickScreenPosition );
+ aTickScreenPos2D += aTextToTickDistance;
+ awt::Point aAnchorScreenPosition2D(
+ static_cast<sal_Int32>(aTickScreenPos2D.getX())
+ ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
+
+ //create single label
+ if(!pTickInfo->xTextShape.is())
+ pTickInfo->xTextShape = createSingleLabel( m_xShapeFactory, xTarget
+ , aAnchorScreenPosition2D, aLabel
+ , rAxisLabelProperties, m_aAxisProperties
+ , aPropNames, aPropValues );
+ if(!pTickInfo->xTextShape.is())
+ continue;
+
+ recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
+
+ //if NO OVERLAP -> remove overlapping shapes
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, m_aAxisLabelProperties.fRotationAngleDegree ) )
+ {
+ bool bOverlapAlsoAfterSwitchingOnAutoStaggering = true;
+ if( !bIsStaggered && isAutoStaggeringOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) )
+ {
+ bIsStaggered = true;
+ rAxisLabelProperties.eStaggering = STAGGER_EVEN;
+ pLastVisibleNeighbourTickInfo = pPREPreviousVisibleTickInfo;
+ if( !pLastVisibleNeighbourTickInfo ||
+ !lcl_doesShapeOverlapWithTickmark( pLastVisibleNeighbourTickInfo->xTextShape
+ , rAxisLabelProperties.fRotationAngleDegree
+ , pTickInfo->aTickScreenPosition
+ , bIsHorizontalAxis, bIsVerticalAxis ) )
+ bOverlapAlsoAfterSwitchingOnAutoStaggering = false;
+ }
+ if( bOverlapAlsoAfterSwitchingOnAutoStaggering )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ {
+ xTarget->remove(pTickInfo->xTextShape);
+ pTickInfo->xTextShape = NULL;
+ continue;
+ }
+ rAxisLabelProperties.nRhythm++;
+ removeShapesAtWrongRhythm( rTickIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+ }
+
+ pPREPreviousVisibleTickInfo = pPreviousVisibleTickInfo;
+ pPreviousVisibleTickInfo = pTickInfo;
+ }
+ return true;
+}
+
+drawing::PointSequenceSequence lcl_makePointSequence( B2DVector& rStart, B2DVector& rEnd )
+{
+ drawing::PointSequenceSequence aPoints(1);
+ aPoints[0].realloc(2);
+ aPoints[0][0].X = static_cast<sal_Int32>(rStart.getX());
+ aPoints[0][0].Y = static_cast<sal_Int32>(rStart.getY());
+ aPoints[0][1].X = static_cast<sal_Int32>(rEnd.getX());
+ aPoints[0][1].Y = static_cast<sal_Int32>(rEnd.getY());
+ return aPoints;
+}
+
+double VCartesianAxis::getLogicValueWhereMainLineCrossesOtherAxis() const
+{
+ double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY();
+ double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY();
+
+ double fCrossesOtherAxis;
+ if(m_aAxisProperties.m_pfMainLinePositionAtOtherAxis)
+ fCrossesOtherAxis = *m_aAxisProperties.m_pfMainLinePositionAtOtherAxis;
+ else
+ {
+ if( ::com::sun::star::chart::ChartAxisPosition_END == m_aAxisProperties.m_eCrossoverType )
+ fCrossesOtherAxis = fMax;
+ else
+ fCrossesOtherAxis = fMin;
+ }
+ return fCrossesOtherAxis;
+}
+
+double VCartesianAxis::getLogicValueWhereLabelLineCrossesOtherAxis() const
+{
+ double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY();
+ double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY();
+
+ double fCrossesOtherAxis;
+ if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_aAxisProperties.m_eLabelPos )
+ fCrossesOtherAxis = fMin;
+ else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_aAxisProperties.m_eLabelPos )
+ fCrossesOtherAxis = fMax;
+ else
+ fCrossesOtherAxis = getLogicValueWhereMainLineCrossesOtherAxis();
+ return fCrossesOtherAxis;
+}
+
+bool VCartesianAxis::getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis ) const
+{
+ if( !m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
+ return false;
+ 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 false;
+ fCrossesOtherAxis = *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
+ return true;
+}
+
+B2DVector VCartesianAxis::getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const
+{
+ B2DVector aRet(0,0);
+
+ if( m_pPosHelper )
+ {
+ drawing::Position3D aScenePos = m_pPosHelper->transformLogicToScene( fLogicX, fLogicY, fLogicZ, true );
+ if(3==m_nDimension)
+ {
+ if( m_xLogicTarget.is() && m_pPosHelper && m_pShapeFactory )
+ {
+ tPropertyNameMap aDummyPropertyNameMap;
+ Reference< drawing::XShape > xShape3DAnchor = m_pShapeFactory->createCube( m_xLogicTarget
+ , aScenePos,drawing::Direction3D(1,1,1), 0, 0, aDummyPropertyNameMap);
+ awt::Point a2DPos = xShape3DAnchor->getPosition(); //get 2D position from xShape3DAnchor
+ m_xLogicTarget->remove(xShape3DAnchor);
+ aRet.setX( a2DPos.X );
+ aRet.setY( a2DPos.Y );
+ }
+ else
+ {
+ DBG_ERROR("cannot calculate scrren position in VCartesianAxis::getScreenPosition");
+ }
+ }
+ else
+ {
+ aRet.setX( aScenePos.PositionX );
+ aRet.setY( aScenePos.PositionY );
+ }
+ }
+
+ return aRet;
+}
+
+VCartesianAxis::ScreenPosAndLogicPos VCartesianAxis::getScreenPosAndLogicPos( double fLogicX_, double fLogicY_, double fLogicZ_ ) const
+{
+ ScreenPosAndLogicPos aRet;
+ aRet.fLogicX = fLogicX_;
+ aRet.fLogicY = fLogicY_;
+ aRet.fLogicZ = fLogicZ_;
+ aRet.aScreenPos = getScreenPosition( fLogicX_, fLogicY_, fLogicZ_ );
+ return aRet;
+}
+
+typedef ::std::vector< VCartesianAxis::ScreenPosAndLogicPos > tScreenPosAndLogicPosList;
+struct lcl_LessXPos : ::std::binary_function< VCartesianAxis::ScreenPosAndLogicPos, VCartesianAxis::ScreenPosAndLogicPos, bool >
+{
+ inline bool operator() ( const VCartesianAxis::ScreenPosAndLogicPos& rPos1, const VCartesianAxis::ScreenPosAndLogicPos& rPos2 )
+ {
+ return ( rPos1.aScreenPos.getX() < rPos2.aScreenPos.getX() );
+ }
+};
+
+struct lcl_GreaterYPos : ::std::binary_function< VCartesianAxis::ScreenPosAndLogicPos, VCartesianAxis::ScreenPosAndLogicPos, bool >
+{
+ inline bool operator() ( const VCartesianAxis::ScreenPosAndLogicPos& rPos1, const VCartesianAxis::ScreenPosAndLogicPos& rPos2 )
+ {
+ return ( rPos1.aScreenPos.getY() > rPos2.aScreenPos.getY() );
+ }
+};
+
+void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, double fCrossesOtherAxis )
+{
+ //m_aAxisProperties might get updated and changed here because
+ // the label alignmant and inner direction sign depends exactly of the choice of the axis line position which is made here in this method
+
+ double fMinX = m_pPosHelper->getLogicMinX();
+ double fMinY = m_pPosHelper->getLogicMinY();
+ double fMinZ = m_pPosHelper->getLogicMinZ();
+ double fMaxX = m_pPosHelper->getLogicMaxX();
+ double fMaxY = m_pPosHelper->getLogicMaxY();
+ double fMaxZ = m_pPosHelper->getLogicMaxZ();
+
+ double fXStart = fMinX;
+ double fYStart = fMinY;
+ double fZStart = fMinZ;
+ double fXEnd = fXStart;
+ double fYEnd = fYStart;
+ double fZEnd = fZStart;
+
+ double fXOnXPlane = fMinX;
+ double fXOther = fMaxX;
+ int nDifferentValue = !m_pPosHelper->isMathematicalOrientationX() ? -1 : 1;
+ if( !m_pPosHelper->isSwapXAndY() )
+ nDifferentValue *= (CuboidPlanePosition_Left != m_eLeftWallPos) ? -1 : 1;
+ else
+ nDifferentValue *= (CuboidPlanePosition_Bottom != m_eBottomPos) ? -1 : 1;
+ if( nDifferentValue<0 )
+ {
+ fXOnXPlane = fMaxX;
+ fXOther = fMinX;
+ }
+
+ double fYOnYPlane = fMinY;
+ double fYOther = fMaxY;
+ nDifferentValue = !m_pPosHelper->isMathematicalOrientationY() ? -1 : 1;
+ if( !m_pPosHelper->isSwapXAndY() )
+ nDifferentValue *= (CuboidPlanePosition_Bottom != m_eBottomPos) ? -1 : 1;
+ else
+ nDifferentValue *= (CuboidPlanePosition_Left != m_eLeftWallPos) ? -1 : 1;
+ if( nDifferentValue<0 )
+ {
+ fYOnYPlane = fMaxY;
+ fYOther = fMinY;
+ }
+
+ double fZOnZPlane = fMaxZ;
+ double fZOther = fMinZ;
+ nDifferentValue = !m_pPosHelper->isMathematicalOrientationZ() ? -1 : 1;
+ nDifferentValue *= (CuboidPlanePosition_Back != m_eBackWallPos) ? -1 : 1;
+ if( nDifferentValue<0 )
+ {
+ fZOnZPlane = fMinZ;
+ fZOther = fMaxZ;
+ }
+
+ if( 0==m_nDimensionIndex ) //x-axis
+ {
+ if( fCrossesOtherAxis < fMinY )
+ fCrossesOtherAxis = fMinY;
+ else if( fCrossesOtherAxis > fMaxY )
+ fCrossesOtherAxis = fMaxY;
+
+ fYStart = fYEnd = fCrossesOtherAxis;
+ fXEnd=m_pPosHelper->getLogicMaxX();
+
+ if(3==m_nDimension)
+ {
+ if( AxisHelper::isAxisPositioningEnabled() )
+ {
+ if( ::rtl::math::approxEqual( fYOther, fYStart) )
+ fZStart = fZEnd = fZOnZPlane;
+ else
+ fZStart = fZEnd = fZOther;
+ }
+ else
+ {
+ rStart = getScreenPosition( fXStart, fYStart, fZStart );
+ rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd );
+
+ double fDeltaX = rEnd.getX() - rStart.getX();
+ 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 ) );
+
+ if( fabs(fDeltaY) > fabs(fDeltaX) )
+ {
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
+ //choose most left positions
+ ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() );
+ m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1;
+ }
+ else
+ {
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
+ //choose most bottom positions
+ ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
+ m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
+ }
+ ScreenPosAndLogicPos aBestPos( aPosList[0] );
+ fYStart = fYEnd = aBestPos.fLogicY;
+ fZStart = fZEnd = aBestPos.fLogicZ;
+ if( !m_pPosHelper->isMathematicalOrientationX() )
+ m_aAxisProperties.m_fLabelDirectionSign *= -1;
+ }
+ }//end 3D x axis
+ }
+ else if( 1==m_nDimensionIndex ) //y-axis
+ {
+ if( fCrossesOtherAxis < fMinX )
+ fCrossesOtherAxis = fMinX;
+ else if( fCrossesOtherAxis > fMaxX )
+ fCrossesOtherAxis = fMaxX;
+
+ fXStart = fXEnd = fCrossesOtherAxis;
+ fYEnd=m_pPosHelper->getLogicMaxY();
+
+ if(3==m_nDimension)
+ {
+ if( AxisHelper::isAxisPositioningEnabled() )
+ {
+ if( ::rtl::math::approxEqual( fXOther, fXStart) )
+ fZStart = fZEnd = fZOnZPlane;
+ else
+ fZStart = fZEnd = fZOther;
+ }
+ else
+ {
+ rStart = getScreenPosition( fXStart, fYStart, fZStart );
+ rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd );
+
+ double fDeltaX = rEnd.getX() - rStart.getX();
+ 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 ) );
+
+ if( fabs(fDeltaY) > fabs(fDeltaX) )
+ {
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
+ //choose most left positions
+ ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() );
+ m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1;
+ }
+ else
+ {
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
+ //choose most bottom positions
+ ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
+ m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
+ }
+ ScreenPosAndLogicPos aBestPos( aPosList[0] );
+ fXStart = fXEnd = aBestPos.fLogicX;
+ fZStart = fZEnd = aBestPos.fLogicZ;
+ if( !m_pPosHelper->isMathematicalOrientationY() )
+ m_aAxisProperties.m_fLabelDirectionSign *= -1;
+ }
+ }//end 3D y axis
+ }
+ else //z-axis
+ {
+ fZEnd = m_pPosHelper->getLogicMaxZ();
+ if( AxisHelper::isAxisPositioningEnabled() )
+ {
+ if( !m_aAxisProperties.m_bSwapXAndY )
+ {
+ if( fCrossesOtherAxis < fMinY )
+ fCrossesOtherAxis = fMinY;
+ else if( fCrossesOtherAxis > fMaxY )
+ fCrossesOtherAxis = fMaxY;
+ fYStart = fYEnd = fCrossesOtherAxis;
+
+ if( ::rtl::math::approxEqual( fYOther, fYStart) )
+ fXStart = fXEnd = fXOnXPlane;
+ else
+ fXStart = fXEnd = fXOther;
+ }
+ else
+ {
+ if( fCrossesOtherAxis < fMinX )
+ fCrossesOtherAxis = fMinX;
+ else if( fCrossesOtherAxis > fMaxX )
+ fCrossesOtherAxis = fMaxX;
+ fXStart = fXEnd = fCrossesOtherAxis;
+
+ if( ::rtl::math::approxEqual( fXOther, fXStart) )
+ fYStart = fYEnd = fYOnYPlane;
+ else
+ fYStart = fYEnd = fYOther;
+ }
+ }
+ else
+ {
+ if( !m_pPosHelper->isSwapXAndY() )
+ {
+ fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMinX();
+ fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMinY() : m_pPosHelper->getLogicMaxY();
+ }
+ else
+ {
+ fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMaxX();
+ fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMaxY() : m_pPosHelper->getLogicMinY();
+ }
+
+ if(3==m_nDimension)
+ {
+ rStart = getScreenPosition( fXStart, fYStart, fZStart );
+ rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd );
+
+ 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 ) );
+
+ ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
+ ScreenPosAndLogicPos aBestPos( aPosList[0] );
+ ScreenPosAndLogicPos aNotSoGoodPos( aPosList[1] );
+
+ //choose most bottom positions
+ if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefere left-right algnments
+ {
+ if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() )
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_RIGHT;
+ else
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
+ }
+ else
+ {
+ if( aBestPos.aScreenPos.getY() > aNotSoGoodPos.aScreenPos.getY() )
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
+ else
+ m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_TOP;
+ }
+
+ m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
+ if( !m_pPosHelper->isMathematicalOrientationZ() )
+ m_aAxisProperties.m_fLabelDirectionSign *= -1;
+
+ fXStart = fXEnd = aBestPos.fLogicX;
+ fYStart = fYEnd = aBestPos.fLogicY;
+ }
+ }//end 3D z axis
+ }
+
+ rStart = getScreenPosition( fXStart, fYStart, fZStart );
+ rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd );
+
+ if(3==m_nDimension && !AxisHelper::isAxisPositioningEnabled() )
+ m_aAxisProperties.m_fInnerDirectionSign = m_aAxisProperties.m_fLabelDirectionSign;//to behave like before
+
+ if(3==m_nDimension && AxisHelper::isAxisPositioningEnabled() )
+ {
+ double fDeltaX = rEnd.getX() - rStart.getX();
+ double fDeltaY = rEnd.getY() - rStart.getY();
+
+ if( 2==m_nDimensionIndex )
+ {
+ if( m_eLeftWallPos != CuboidPlanePosition_Left )
+ {
+ m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+ m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
+ }
+
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
+ LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+
+ if( ( fDeltaY<0 && m_aScale.Orientation == AxisOrientation_REVERSE ) ||
+ ( fDeltaY>0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) )
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_RIGHT ) ?
+ LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+ }
+ else if( fabs(fDeltaY) > fabs(fDeltaX) )
+ {
+ if( m_eBackWallPos != CuboidPlanePosition_Back )
+ {
+ m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+ m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
+ }
+
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
+ LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+
+ if( ( fDeltaY<0 && m_aScale.Orientation == AxisOrientation_REVERSE ) ||
+ ( fDeltaY>0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) )
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_RIGHT ) ?
+ LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+ }
+ else
+ {
+ if( m_eBackWallPos != CuboidPlanePosition_Back )
+ {
+ m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+ m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
+ }
+
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
+ LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
+
+ if( ( fDeltaX>0 && m_aScale.Orientation == AxisOrientation_REVERSE ) ||
+ ( fDeltaX<0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) )
+ m_aAxisProperties.m_aLabelAlignment =
+ ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_TOP ) ?
+ LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP;
+ }
+ }
+}
+
+TickmarkHelper* VCartesianAxis::createTickmarkHelper()
+{
+ return createTickmarkHelper2D();
+}
+
+TickmarkHelper_2D* VCartesianAxis::createTickmarkHelper2D()
+{
+ B2DVector aStart, aEnd;
+ this->get2DAxisMainLine( aStart, aEnd, this->getLogicValueWhereMainLineCrossesOtherAxis() );
+
+ B2DVector aLabelLineStart, aLabelLineEnd;
+ this->get2DAxisMainLine( aLabelLineStart, aLabelLineEnd, this->getLogicValueWhereLabelLineCrossesOtherAxis() );
+
+ return new TickmarkHelper_2D( m_aScale, m_aIncrement, aStart, aEnd, aLabelLineStart-aStart );
+}
+
+void lcl_hideIdenticalScreenValues( TickIter& rTickIter )
+{
+ TickInfo* pPreviousTickInfo = rTickIter.firstInfo();
+ if(!pPreviousTickInfo)
+ return;
+ pPreviousTickInfo->bPaintIt = true;
+ for( TickInfo* pTickInfo = rTickIter.nextInfo(); pTickInfo; pTickInfo = rTickIter.nextInfo())
+ {
+ pTickInfo->bPaintIt =
+ ( static_cast<sal_Int32>(pTickInfo->aTickScreenPosition.getX())
+ != static_cast<sal_Int32>(pPreviousTickInfo->aTickScreenPosition.getX()) )
+ ||
+ ( static_cast<sal_Int32>(pTickInfo->aTickScreenPosition.getY())
+ != static_cast<sal_Int32>(pPreviousTickInfo->aTickScreenPosition.getY()) );
+ pPreviousTickInfo = pTickInfo;
+ }
+}
+
+//'hide' tickmarks with identical screen values in aAllTickInfos
+void VCartesianAxis::hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const
+{
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ {
+ sal_Int32 nCount = rTickInfos.size();
+ for( sal_Int32 nN=0; nN<nCount; nN++ )
+ {
+ PureTickIter aTickIter( rTickInfos[nN] );
+ lcl_hideIdenticalScreenValues( aTickIter );
+ }
+ }
+ else
+ {
+ EquidistantTickIter aTickIter( rTickInfos, m_aIncrement, 0, -1 );
+ lcl_hideIdenticalScreenValues( aTickIter );
+ }
+}
+
+sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount()
+{
+ sal_Int32 nRet = 10;
+
+ if( m_nMaximumTextWidthSoFar==0 && m_nMaximumTextHeightSoFar==0 )
+ return nRet;
+
+ B2DVector aStart, aEnd;
+ this->get2DAxisMainLine( aStart, aEnd, this->getLogicValueWhereMainLineCrossesOtherAxis() );
+
+ sal_Int32 nMaxHeight = static_cast<sal_Int32>(fabs(aEnd.getY()-aStart.getY()));
+ sal_Int32 nMaxWidth = static_cast<sal_Int32>(fabs(aEnd.getX()-aStart.getX()));
+
+ sal_Int32 nTotalAvailable = nMaxHeight;
+ sal_Int32 nSingleNeeded = m_nMaximumTextHeightSoFar;
+
+ //for horizontal axis:
+ if( (m_nDimensionIndex == 0 && !m_aAxisProperties.m_bSwapXAndY)
+ || (m_nDimensionIndex == 1 && m_aAxisProperties.m_bSwapXAndY) )
+ {
+ nTotalAvailable = nMaxWidth;
+ nSingleNeeded = m_nMaximumTextWidthSoFar;
+ }
+
+ if( nSingleNeeded>0 )
+ nRet = nTotalAvailable/nSingleNeeded;
+
+ return nRet;
+}
+
+void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties, TickmarkHelper_2D* pTickmarkHelper2D )
+{
+ if( !pTickmarkHelper2D )
+ return;
+
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ {
+ sal_Int32 nTextLevelCount = getTextLevelCount();
+ B2DVector aCummulatedLabelsDistance(0,0);
+ for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
+ {
+ ::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
+ if(apTickIter.get())
+ {
+ if( nTextLevel>0 )
+ lcl_shiftLables( *apTickIter.get(), aCummulatedLabelsDistance );
+ aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
+ , pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) );
+ }
+ }
+ }
+ else if( rAxisLabelProperties.getIsStaggered() )
+ {
+ EquidistantLabelIterator aInnerIter( m_aAllTickInfos, m_aIncrement
+ , rAxisLabelProperties.eStaggering, true, 0, 0 );
+ EquidistantLabelIterator aOuterIter( m_aAllTickInfos, m_aIncrement
+ , rAxisLabelProperties.eStaggering, false, 0, 0 );
+
+ lcl_shiftLables( aOuterIter
+ , lcl_getLabelsDistance( aInnerIter
+ , pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) ) );
+ }
+}
+
+void SAL_CALL VCartesianAxis::createLabels()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ //-----------------------------------------
+ //create labels
+ if( m_aAxisProperties.m_bDisplayLabels )
+ {
+ std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
+ TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
+ if( !pTickmarkHelper2D )
+ return;
+
+ //-----------------------------------------
+ //get the transformed screen values for all tickmarks in aAllTickInfos
+ pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+ //-----------------------------------------
+ //'hide' tickmarks with identical screen values in aAllTickInfos
+ hideIdenticalScreenValues( m_aAllTickInfos );
+
+ removeTextShapesFromTicks();
+
+ //create tick mark text shapes
+ sal_Int32 nTextLevelCount = getTextLevelCount();
+ sal_Int32 nScreenDistanceBetweenTicks = -1;
+ for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
+ {
+ ::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
+ if(apTickIter.get())
+ {
+ if(nTextLevel==0)
+ {
+ nScreenDistanceBetweenTicks = TickmarkHelper_2D::getTickScreenDistance( *apTickIter.get() );
+ if( nTextLevelCount>1 )
+ nScreenDistanceBetweenTicks*=2; //the above used tick iter does contain also the sub ticks -> thus the given distance is only the half
+ }
+
+ AxisLabelProperties aCopy(m_aAxisLabelProperties);
+ aCopy.bRhythmIsFix = true;
+ aCopy.nRhythm = 1;
+ AxisLabelProperties& rAxisLabelProperties = nTextLevel==0 ? m_aAxisLabelProperties : aCopy;
+ while( !createTextShapes( m_xTextTarget, *apTickIter.get(), rAxisLabelProperties, pTickmarkHelper2D, nScreenDistanceBetweenTicks ) )
+ {
+ };
+ }
+ }
+ doStaggeringOfLabels( m_aAxisLabelProperties, pTickmarkHelper2D );
+ }
+}
+
+void SAL_CALL VCartesianAxis::createMaximumLabels()
+{
+ TrueGuard aRecordMaximumTextSize(m_bRecordMaximumTextSize);
+
+ if( !prepareShapeCreation() )
+ return;
+
+ //-----------------------------------------
+ //create labels
+ if( m_aAxisProperties.m_bDisplayLabels )
+ {
+ std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
+ TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
+ if( !pTickmarkHelper2D )
+ return;
+
+ //-----------------------------------------
+ //get the transformed screen values for all tickmarks in aAllTickInfos
+ pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+
+ //create tick mark text shapes
+ //@todo: iterate through all tick depth wich should be labeled
+
+ AxisLabelProperties aAxisLabelProperties( m_aAxisLabelProperties );
+ if( isAutoStaggeringOfLabelsAllowed( aAxisLabelProperties, pTickmarkHelper2D->isHorizontalAxis(), pTickmarkHelper2D->isVerticalAxis() ) )
+ aAxisLabelProperties.eStaggering = STAGGER_EVEN;
+ aAxisLabelProperties.bOverlapAllowed = true;
+ aAxisLabelProperties.bLineBreakAllowed = false;
+ sal_Int32 nTextLevelCount = getTextLevelCount();
+ for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
+ {
+ ::std::auto_ptr< TickIter > apTickIter = createMaximumLabelTickIterator( nTextLevel );
+ if(apTickIter.get())
+ {
+ while( !createTextShapes( m_xTextTarget, *apTickIter.get(), aAxisLabelProperties, pTickmarkHelper2D, -1 ) )
+ {
+ };
+ }
+ }
+ doStaggeringOfLabels( aAxisLabelProperties, pTickmarkHelper2D );
+ }
+}
+
+void SAL_CALL VCartesianAxis::updatePositions()
+{
+ //-----------------------------------------
+ //update positions of labels
+ if( m_aAxisProperties.m_bDisplayLabels )
+ {
+ std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
+ TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
+ if( !pTickmarkHelper2D )
+ return;
+
+ //-----------------------------------------
+ //update positions of all existing text shapes
+ pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = m_aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = m_aAllTickInfos.end();
+ for( ; aDepthIter != aDepthEnd; aDepthIter++ )
+ {
+ ::std::vector< TickInfo >::iterator aTickIter = aDepthIter->begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = aDepthIter->end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = (*aTickIter);
+ Reference< drawing::XShape > xShape2DText( rTickInfo.xTextShape );
+ if( xShape2DText.is() )
+ {
+ B2DVector aTextToTickDistance( pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
+ B2DVector aTickScreenPos2D( rTickInfo.aTickScreenPosition );
+ aTickScreenPos2D += aTextToTickDistance;
+ awt::Point aAnchorScreenPosition2D(
+ static_cast<sal_Int32>(aTickScreenPos2D.getX())
+ ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
+
+ // #i78696# use mathematically correct rotation now
+ const double fRotationAnglePi(m_aAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+ uno::Any aATransformation = ShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi);
+
+ //set new position
+ uno::Reference< beans::XPropertySet > xProp( xShape2DText, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->setPropertyValue( C2U( "Transformation" ), aATransformation );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ //correctPositionForRotation
+ LabelPositionHelper::correctPositionForRotation( xShape2DText
+ , m_aAxisProperties.m_aLabelAlignment, m_aAxisLabelProperties.fRotationAngleDegree, false );
+ }
+ }
+ }
+
+ doStaggeringOfLabels( m_aAxisLabelProperties, pTickmarkHelper2D );
+ }
+}
+
+void VCartesianAxis::createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickmarkHelper_2D& rTickmarkHelper2D, bool bOnlyAtLabels )
+{
+ sal_Int32 nPointCount = rTickInfos.size();
+ drawing::PointSequenceSequence aPoints(2*nPointCount);
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = rTickInfos.begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = rTickInfos.end();
+ sal_Int32 nN = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+
+ bool bTicksAtLabels = ( m_aAxisProperties.m_eTickmarkPos != ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS );
+ double fInnerDirectionSign = m_aAxisProperties.m_fInnerDirectionSign;
+ if( bTicksAtLabels && m_aAxisProperties.m_eLabelPos == ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END )
+ fInnerDirectionSign *= -1.0;
+ bTicksAtLabels = bTicksAtLabels || bOnlyAtLabels;
+ //add ticks at labels:
+ rTickmarkHelper2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ , fInnerDirectionSign , rTickmarkProperties, bTicksAtLabels );
+ //add ticks at axis (without lables):
+ if( !bOnlyAtLabels && m_aAxisProperties.m_eTickmarkPos == ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
+ rTickmarkHelper2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ , m_aAxisProperties.m_fInnerDirectionSign, rTickmarkProperties, !bTicksAtLabels );
+ }
+ aPoints.realloc(nN);
+ m_pShapeFactory->createLine2D( m_xGroupShape_Shapes, aPoints
+ , &rTickmarkProperties.aLineProperties );
+}
+
+void SAL_CALL VCartesianAxis::createShapes()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
+ TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
+ if( !pTickmarkHelper2D )
+ return;
+
+ //-----------------------------------------
+ //create line shapes
+ if(2==m_nDimension)
+ {
+ //-----------------------------------------
+ //create extra long ticks to separate complex categories (create them only there where the labels are)
+ if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ {
+ ::std::vector< ::std::vector< TickInfo > > aComplexTickInfos;
+ createAllTickInfosFromComplexCategories( aComplexTickInfos, true );
+ pTickmarkHelper2D->updateScreenValues( aComplexTickInfos );
+ hideIdenticalScreenValues( aComplexTickInfos );
+
+ ::std::vector<TickmarkProperties> aTickmarkPropertiesList;
+ static bool bIncludeSpaceBetweenTickAndText = false;
+ sal_Int32 nOffset = static_cast<sal_Int32>(pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, false, bIncludeSpaceBetweenTickAndText ).getLength());
+ sal_Int32 nTextLevelCount = getTextLevelCount();
+ for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
+ {
+ ::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
+ if( apTickIter.get() )
+ {
+ B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, false ) ) );
+ sal_Int32 nCurrentLength = static_cast<sal_Int32>(aLabelsDistance.getLength());
+ aTickmarkPropertiesList.push_back( m_aAxisProperties.makeTickmarkPropertiesForComplexCategories( nOffset + nCurrentLength, 0, nTextLevel ) );
+ nOffset += nCurrentLength;
+ }
+ }
+
+ sal_Int32 nTickmarkPropertiesCount = aTickmarkPropertiesList.size();
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = aComplexTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = aComplexTickInfos.end();
+ for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount; aDepthIter++, nDepth++ )
+ {
+ if(nDepth==0 && !m_aAxisProperties.m_nMajorTickmarks)
+ continue;
+ createTickMarkLineShapes( *aDepthIter, aTickmarkPropertiesList[nDepth], *pTickmarkHelper2D, true /*bOnlyAtLabels*/ );
+ }
+ }
+ //-----------------------------------------
+ //create normal ticks for major and minor intervals
+ {
+ ::std::vector< ::std::vector< TickInfo > > aAllShiftedTickInfos;
+ if( m_aIncrement.ShiftedPosition || ( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels ) )
+ {
+ pTickmarkHelper2D->getAllTicksShifted( aAllShiftedTickInfos );
+ pTickmarkHelper2D->updateScreenValues( aAllShiftedTickInfos );
+ hideIdenticalScreenValues( aAllShiftedTickInfos );
+ }
+ ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos = m_aIncrement.ShiftedPosition ? aAllShiftedTickInfos : m_aAllTickInfos;
+
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAllTickInfos.end();
+ if(aDepthIter == aDepthEnd)//no tickmarks at all
+ return;
+
+ sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
+ for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount; aDepthIter++, nDepth++ )
+ createTickMarkLineShapes( *aDepthIter, m_aAxisProperties.m_aTickmarkPropertiesList[nDepth], *pTickmarkHelper2D, false /*bOnlyAtLabels*/ );
+ }
+ //-----------------------------------------
+ //create axis main lines
+ //it serves also as the handle shape for the axis selection
+ {
+ drawing::PointSequenceSequence aPoints(1);
+ apTickmarkHelper2D->createPointSequenceForAxisMainLine( aPoints );
+ Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ m_xGroupShape_Shapes, aPoints
+ , &m_aAxisProperties.m_aLineProperties );
+ //because of this name this line will be used for marking the axis
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+ //-----------------------------------------
+ //create an additional line at NULL
+ if( !AxisHelper::isAxisPositioningEnabled() )
+ {
+ double fExtraLineCrossesOtherAxis;
+ if( getLogicValueWhereExtraLineCrossesOtherAxis(fExtraLineCrossesOtherAxis) )
+ {
+ B2DVector aStart, aEnd;
+ this->get2DAxisMainLine( aStart, aEnd, fExtraLineCrossesOtherAxis );
+ drawing::PointSequenceSequence aPoints( lcl_makePointSequence(aStart,aEnd) );
+ Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties );
+ }
+ }
+ }
+
+ //createLabels();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx
new file mode 100644
index 000000000000..4fbcd2409196
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCARTESIANAXIS_HXX
+#define _CHART2_VCARTESIANAXIS_HXX
+
+#include "VAxisBase.hxx"
+#include <basegfx/vector/b2dvector.hxx>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VCartesianAxis : public VAxisBase
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ VCartesianAxis( const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , PlottingPositionHelper* pPosHelper = NULL //takes ownership
+ );
+
+ virtual ~VCartesianAxis();
+
+ //-------------------------------------------------------------------------
+ // partly chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ virtual void SAL_CALL createMaximumLabels();
+ virtual void SAL_CALL createLabels();
+ virtual void SAL_CALL updatePositions();
+
+ virtual void SAL_CALL createShapes();
+
+ virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
+ virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
+ void createAllTickInfosFromComplexCategories( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShiftedPosition );
+
+ ::std::auto_ptr< TickIter > createLabelTickIterator( sal_Int32 nTextLevel );
+ ::std::auto_ptr< TickIter > createMaximumLabelTickIterator( sal_Int32 nTextLevel );
+ sal_Int32 getTextLevelCount() const;
+
+ //-------------------------------------------------------------------------
+ virtual TickmarkHelper* createTickmarkHelper();
+
+ //-------------------------------------------------------------------------
+ double getLogicValueWhereMainLineCrossesOtherAxis() const;
+ double getLogicValueWhereLabelLineCrossesOtherAxis() const;
+ bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis) const;
+ void get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis );
+
+ //-------------------------------------------------------------------------
+ //Layout interface for cartesian axes:
+
+ //the returned value describes the minimum size that is necessary
+ //for the text labels in the direction orthogonal to the axis
+ //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
+ //the return value is measured in screen dimension
+ //As an example the MinimumOrthogonalSize of an x-axis equals the
+ //Font Height if the label properties allow for labels parallel to the axis.
+// sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
+ //Minimum->Preferred
+
+ //returns true if the MinimumOrthogonalSize can be calculated
+ //with the creation of at most one text shape
+ //(this is e.g. true if the parameters allow for labels parallel to the axis.)
+// sal_bool canQuicklyCalculateMinimumOrthogonalSize();
+
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+ struct ScreenPosAndLogicPos
+ {
+ double fLogicX;
+ double fLogicY;
+ double fLogicZ;
+
+ B2DVector aScreenPos;
+ };
+
+protected: //methods
+ bool createTextShapes( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , TickIter& rTickIter
+ , AxisLabelProperties& rAxisLabelProperties
+ , TickmarkHelper_2D* pTickmarkHelper
+ , sal_Int32 nScreenDistanceBetweenTicks );
+
+ void createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickmarkHelper_2D& rTickmarkHelper2D, bool bOnlyAtLabels );
+
+ TickmarkHelper_2D* createTickmarkHelper2D();
+ void hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const;
+
+ void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
+ , TickmarkHelper_2D* pTickmarkHelper2D );
+ bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
+ , bool bIsHorizontalAxis, bool bIsVerticalAxis );
+ bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis );
+
+ ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
+ ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
new file mode 100644
index 000000000000..a196397e0e9f
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VCartesianCoordinateSystem.hxx"
+#include "VCartesianGrid.hxx"
+#include "VCartesianAxis.hxx"
+#include "macros.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.hxx"
+#include "ChartTypeHelper.hxx"
+
+//for auto_ptr
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+
+//.............................................................................
+
+class TextualDataProvider : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::chart2::data::XTextualDataSequence
+ >
+{
+public:
+ TextualDataProvider( const uno::Sequence< ::rtl::OUString >& rTextSequence )
+ : m_aTextSequence( rTextSequence )
+ {
+ }
+ virtual ~TextualDataProvider()
+ {
+ }
+
+ //XTextualDataSequence
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData()
+ throw ( uno::RuntimeException)
+ {
+ return m_aTextSequence;
+ }
+
+private: //member
+ uno::Sequence< ::rtl::OUString > m_aTextSequence;
+};
+
+//.............................................................................
+
+VCartesianCoordinateSystem::VCartesianCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
+ : VCoordinateSystem(xCooSys)
+{
+}
+
+VCartesianCoordinateSystem::~VCartesianCoordinateSystem()
+{
+}
+
+void VCartesianCoordinateSystem::createGridShapes()
+{
+ if(!m_xLogicTargetForGrids.is() || !m_xFinalTarget.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ for( sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
+ {
+ sal_Int32 nAxisIndex = MAIN_AXIS_INDEX;
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel ) );
+ if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
+ continue;
+
+ VCartesianGrid aGrid(nDimensionIndex,nDimensionCount,this->getGridListFromAxis( xAxis ));
+ aGrid.setExplicitScaleAndIncrement( this->getExplicitScale(nDimensionIndex,nAxisIndex)
+ , this->getExplicitIncrement(nDimensionIndex,nAxisIndex) );
+ aGrid.set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
+
+ aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory
+ , this->createCIDForGrid( xAxis,nDimensionIndex,nAxisIndex ) );
+ if(2==nDimensionCount)
+ aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aGrid.setScales( this->getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
+ aGrid.createShapes();
+ }
+}
+
+void VCartesianCoordinateSystem::createVAxisList(
+ const uno::Reference< util::XNumberFormatsSupplier > & xNumberFormatsSupplier
+ , const awt::Size& rFontReferenceSize
+ , const awt::Rectangle& rMaximumSpaceForLabels
+ )
+{
+ m_aAxisMap.clear();
+
+ //if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ // return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ if(nDimensionCount<=0)
+ return;
+
+ sal_Int32 nDimensionIndex = 0;
+
+ for( nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
+ {
+ sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
+ {
+ Reference< XAxis > xAxis = this->getAxisByDimension(nDimensionIndex,nAxisIndex);
+ if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
+ continue;
+
+ AxisProperties aAxisProperties(xAxis,this->getExplicitCategoriesProvider());
+ aAxisProperties.m_nDimensionIndex = nDimensionIndex;
+ aAxisProperties.m_bSwapXAndY = bSwapXAndY;
+ aAxisProperties.m_bIsMainAxis = (nAxisIndex==0);
+ Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel ) );
+ if( xCrossingMainAxis.is() )
+ {
+ ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
+ aAxisProperties.m_bCrossingAxisHasReverseDirection = (AxisOrientation_REVERSE==aCrossingScale.Orientation);
+
+ if( aCrossingScale.AxisType == AxisType::CATEGORY )
+ {
+ aAxisProperties.m_bCrossingAxisIsCategoryAxes = true;
+ aAxisProperties.m_bAxisBetweenCategories = ChartTypeHelper::shiftTicksAtXAxisPerDefault( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ) )
+ || ( aAxisProperties.m_pExplicitCategoriesProvider && aAxisProperties.m_pExplicitCategoriesProvider->hasComplexCategories() );
+ }
+ }
+
+ if( nDimensionIndex == 2 )
+ {
+ 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) );
+ }
+ aAxisProperties.init(true);
+ if(aAxisProperties.m_bDisplayLabels)
+ aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier );
+
+ if( nDimensionIndex == 0 && aAxisProperties.m_nAxisType == AxisType::CATEGORY
+ && aAxisProperties.m_pExplicitCategoriesProvider )
+ {
+ if( aAxisProperties.m_pExplicitCategoriesProvider->hasComplexCategories() )
+ aAxisProperties.m_bComplexCategories = true;
+ }
+ //-------------------
+ ::boost::shared_ptr< VAxisBase > apVAxis( new VCartesianAxis(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) );
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+ m_aAxisMap[aFullAxisIndex] = apVAxis;
+ apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
+
+ //apVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
+ //apVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
+ // , this->createCIDForAxis( xAxis, nDimensionIndex, nAxisIndex ) );
+ //if(2==nDimensionCount)
+ // apVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ //apVAxis->setScales( this->getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
+ apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
+ }
+ }
+}
+
+void VCartesianCoordinateSystem::initVAxisInList()
+{
+ if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ sal_Int32 nDimensionIndex = aIt->first.first;
+ sal_Int32 nAxisIndex = aIt->first.second;
+ pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
+ pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
+ , this->createCIDForAxis( getAxisByDimension( nDimensionIndex, nAxisIndex ), nDimensionIndex, nAxisIndex ) );
+ if(2==nDimensionCount)
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->setScales( this->getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
+ }
+ }
+}
+
+void VCartesianCoordinateSystem::updateScalesAndIncrementsOnAxes()
+{
+ if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ sal_Int32 nDimensionIndex = aIt->first.first;
+ sal_Int32 nAxisIndex = aIt->first.second;
+ pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
+ if(2==nDimensionCount)
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->setScales( this->getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
new file mode 100644
index 000000000000..b28400c6f906
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCARTESIAN_COORDINATESYSTEM_HXX
+#define _CHART2_VCARTESIAN_COORDINATESYSTEM_HXX
+
+#include "VCoordinateSystem.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VCartesianCoordinateSystem : public VCoordinateSystem
+{
+public:
+ VCartesianCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+ virtual ~VCartesianCoordinateSystem();
+
+ virtual void createVAxisList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier
+ , const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
+
+ virtual void initVAxisInList();
+ virtual void updateScalesAndIncrementsOnAxes();
+
+ virtual void createGridShapes();
+
+private:
+ VCartesianCoordinateSystem();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx
new file mode 100644
index 000000000000..7fe6b9937ca6
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VCartesianGrid.hxx"
+#include "TickmarkHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "AxisHelper.hxx"
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <vector>
+#include <memory>
+
+//.............................................................................
+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;
+
+struct GridLinePoints
+{
+ Sequence< double > P0;
+ Sequence< double > P1;
+ Sequence< double > P2;
+
+ GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_Int32 nDimensionIndex
+ , CuboidPlanePosition eLeftWallPos=CuboidPlanePosition_Left
+ , CuboidPlanePosition eBackWallPos=CuboidPlanePosition_Back
+ , CuboidPlanePosition eBottomPos=CuboidPlanePosition_Bottom );
+ void update( double fScaledTickValue );
+
+ sal_Int32 m_nDimensionIndex;
+};
+
+GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_Int32 nDimensionIndex
+ , CuboidPlanePosition eLeftWallPos
+ , CuboidPlanePosition eBackWallPos
+ , CuboidPlanePosition eBottomPos )
+ : m_nDimensionIndex(nDimensionIndex)
+{
+ double MinX = pPosHelper->getLogicMinX();
+ double MinY = pPosHelper->getLogicMinY();
+ double MinZ = pPosHelper->getLogicMinZ();
+ double MaxX = pPosHelper->getLogicMaxX();
+ double MaxY = pPosHelper->getLogicMaxY();
+ double MaxZ = pPosHelper->getLogicMaxZ();
+
+ pPosHelper->doLogicScaling( &MinX,&MinY,&MinZ );
+ pPosHelper->doLogicScaling( &MaxX,&MaxY,&MaxZ );
+
+ if(!pPosHelper->isMathematicalOrientationX())
+ {
+ double fHelp = MinX;
+ MinX = MaxX;
+ MaxX = fHelp;
+ }
+ if(!pPosHelper->isMathematicalOrientationY())
+ {
+ double fHelp = MinY;
+ MinY = MaxY;
+ MaxY = fHelp;
+ }
+ if(pPosHelper->isMathematicalOrientationZ())//z axis in draw is reverse to mathematical
+ {
+ double fHelp = MinZ;
+ MinZ = MaxZ;
+ MaxZ = fHelp;
+ }
+ bool bSwapXY = pPosHelper->isSwapXAndY();
+
+ P0.realloc(3);
+ P1.realloc(3);
+ P2.realloc(3);
+
+ //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]= (CuboidPlanePosition_Left == eLeftWallPos || bSwapXY) ? MinX : MaxX;
+ P0[1]=P1[1]=P2[1]= (CuboidPlanePosition_Left == eLeftWallPos || !bSwapXY) ? MinY : MaxY;
+ P0[2]=P1[2]=P2[2]= (CuboidPlanePosition_Back == eBackWallPos) ? MinZ : MaxZ;
+
+ if(m_nDimensionIndex==0)
+ {
+ P0[1]= (CuboidPlanePosition_Left == eLeftWallPos || !bSwapXY) ? MaxY : MinY;
+ P2[2]= (CuboidPlanePosition_Back == eBackWallPos) ? MaxZ : MinZ;
+ if( CuboidPlanePosition_Bottom != eBottomPos && !bSwapXY )
+ P2=P1;
+ }
+ else if(m_nDimensionIndex==1)
+ {
+ P0[0]= (CuboidPlanePosition_Left == eLeftWallPos || bSwapXY) ? MaxX : MinX;
+ P2[2]= (CuboidPlanePosition_Back == eBackWallPos) ? MaxZ : MinZ;
+ if( CuboidPlanePosition_Bottom != eBottomPos && bSwapXY )
+ P2=P1;
+ }
+ else if(m_nDimensionIndex==2)
+ {
+ P0[0]= (CuboidPlanePosition_Left == eLeftWallPos || bSwapXY) ? MaxX : MinX;
+ P2[1]= (CuboidPlanePosition_Left == eLeftWallPos || !bSwapXY) ? MaxY : MinY;
+ if( CuboidPlanePosition_Bottom != eBottomPos )
+ {
+ if( !bSwapXY )
+ P0=P1;
+ else
+ P2=P1;
+ }
+ }
+}
+
+void GridLinePoints::update( double fScaledTickValue )
+{
+ P0[m_nDimensionIndex] = P1[m_nDimensionIndex] = P2[m_nDimensionIndex] = fScaledTickValue;
+}
+
+void addLine2D( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex
+ , const GridLinePoints& rScaledLogicPoints
+ , const Reference< XTransformation > & xTransformation
+ )
+{
+ 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);
+}
+
+void addLine3D( drawing::PolyPolygonShape3D& rPoints, sal_Int32 nIndex
+ , const GridLinePoints& rBasePoints
+ , const Reference< XTransformation > & xTransformation )
+{
+ drawing::Position3D aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P0 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+ aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P1 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+ aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P2 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+}
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+VCartesianGrid::VCartesianGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , const Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList )
+ : VAxisOrGridBase( nDimensionIndex, nDimensionCount )
+ , m_aGridPropertiesList( rGridPropertiesList )
+{
+ m_pPosHelper = new PlottingPositionHelper();
+}
+
+VCartesianGrid::~VCartesianGrid()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+//static
+void VCartesianGrid::fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList
+ , const Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList )
+{
+ rLinePropertiesList.clear();
+ if( !rGridPropertiesList.getLength() )
+ return;
+
+ VLineProperties aLineProperties;
+ for( sal_Int32 nN=0; nN < rGridPropertiesList.getLength(); nN++ )
+ {
+ if(!AxisHelper::isGridVisible( rGridPropertiesList[nN] ))
+ aLineProperties.LineStyle = uno::makeAny( drawing::LineStyle_NONE );
+ else
+ aLineProperties.initFromPropertySet( rGridPropertiesList[nN] );
+ rLinePropertiesList.push_back(aLineProperties);
+ }
+};
+
+void SAL_CALL VCartesianGrid::createShapes()
+{
+ if(!m_aGridPropertiesList.getLength())
+ return;
+ //somehow equal to axis tickmarks
+
+ //-----------------------------------------
+ //create named group shape
+ Reference< drawing::XShapes > xGroupShape_Shapes(
+ this->createGroupShape( m_xLogicTarget, m_aCID ) );
+
+ if(!xGroupShape_Shapes.is())
+ return;
+ //-----------------------------------------
+
+ ::std::vector<VLineProperties> aLinePropertiesList;
+ fillLinePropertiesFromGridModel( aLinePropertiesList, m_aGridPropertiesList );
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ TickmarkHelper& aTickmarkHelper = *apTickmarkHelper.get();
+ ::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
+ if( m_aIncrement.ShiftedPosition )
+ aTickmarkHelper.getAllTicksShifted( aAllTickInfos );
+ else
+ aTickmarkHelper.getAllTicks( aAllTickInfos );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = aAllTickInfos.end();
+
+ if(aDepthIter == aDepthEnd)//no tickmarks at all
+ return;
+
+
+ sal_Int32 nLinePropertiesCount = aLinePropertiesList.size();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ if( !aLinePropertiesList[nDepth].isLineVisible() )
+ continue;
+
+ Reference< drawing::XShapes > xTarget( xGroupShape_Shapes );
+ if( nDepth > 0 )
+ {
+ xTarget.set( this->createGroupShape( m_xLogicTarget
+ , ObjectIdentifier::addChildParticle( m_aCID, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_SUBGRID, nDepth-1 ) )
+ ) );
+ if(!xTarget.is())
+ xTarget.set( xGroupShape_Shapes );
+ }
+
+ if(2==m_nDimension)
+ {
+
+ GridLinePoints aGridLinePoints( m_pPosHelper, m_nDimensionIndex );
+
+ sal_Int32 nPointCount = (*aDepthIter).size();
+ drawing::PointSequenceSequence aPoints(nPointCount);
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+ aGridLinePoints.update( (*aTickIter).fScaledTickValue );
+ addLine2D( aPoints, nRealPointCount, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
+ nRealPointCount++;
+ }
+ aPoints.realloc(nRealPointCount);
+ m_pShapeFactory->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);
+ for( sal_Int32 nN = 0; nN<nRealPointCount; nN++)
+ aHandlesPoints[0][nOldHandleCount+nN] = aPoints[nN][1];
+
+ //create handle shape:
+ VLineProperties aHandleLineProperties;
+ aHandleLineProperties.LineStyle = uno::makeAny( drawing::LineStyle_NONE );
+ Reference< drawing::XShape > xHandleShape =
+ m_pShapeFactory->createLine2D( xTarget, aHandlesPoints, &aHandleLineProperties );
+ m_pShapeFactory->setShapeName( xHandleShape, C2U("HandlesOnly") );
+ }
+ //-----------------------------------------
+ else //if(2!=m_nDimension)
+ {
+ 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< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ sal_Int32 nPolyIndex = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++, nPolyIndex++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+
+ aGridLinePoints.update( (*aTickIter).fScaledTickValue );
+ addLine3D( aPoints, nPolyIndex, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
+ nRealPointCount+=3;
+ }
+ aPoints.SequenceX.realloc(nRealPointCount);
+ aPoints.SequenceY.realloc(nRealPointCount);
+ aPoints.SequenceZ.realloc(nRealPointCount);
+ m_pShapeFactory->createLine3D( xTarget, aPoints, aLinePropertiesList[nDepth] );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianGrid.hxx b/chart2/source/view/axes/VCartesianGrid.hxx
new file mode 100644
index 000000000000..274b543900e3
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianGrid.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCARTESIANGRID_HXX
+#define _CHART2_VCARTESIANGRID_HXX
+
+#include "VAxisOrGridBase.hxx"
+#include "VLineProperties.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VCartesianGrid : public VAxisOrGridBase
+{
+//-------------------------------------------------------------------------
+// public methods
+//-------------------------------------------------------------------------
+public:
+ VCartesianGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > >& rGridPropertiesList //main grid, subgrid, subsubgrid etc
+ );
+ virtual ~VCartesianGrid();
+
+ virtual void SAL_CALL createShapes();
+
+ static void fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > >& rGridPropertiesList );
+
+private:
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > m_aGridPropertiesList; //main grid, subgrid, subsubgrid etc
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
new file mode 100644
index 000000000000..bc908acdf85a
--- /dev/null
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -0,0 +1,598 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VCoordinateSystem.hxx"
+#include "VCartesianCoordinateSystem.hxx"
+#include "VPolarCoordinateSystem.hxx"
+#include "ScaleAutomatism.hxx"
+#include "VSeriesPlotter.hxx"
+#include "ShapeFactory.hxx"
+#include "servicenames_coosystems.hxx"
+#include "macros.hxx"
+#include "AxisIndexDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+#include "AxisHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "VAxisBase.hxx"
+#include "ViewDefines.hxx"
+#include "DataSeriesHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+
+//.............................................................................
+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;
+
+//static
+VCoordinateSystem* VCoordinateSystem::createCoordinateSystem(
+ const Reference< XCoordinateSystem >& xCooSysModel )
+{
+ if( !xCooSysModel.is() )
+ return 0;
+
+ rtl::OUString aViewServiceName = xCooSysModel->getViewServiceName();
+
+ //@todo: in future the coordinatesystems should be instanciated via service factory
+ VCoordinateSystem* pRet=NULL;
+ if( aViewServiceName.equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ) )
+ pRet = new VCartesianCoordinateSystem(xCooSysModel);
+ else if( aViewServiceName.equals( CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ) )
+ pRet = new VPolarCoordinateSystem(xCooSysModel);
+ if(!pRet)
+ pRet = new VCoordinateSystem(xCooSysModel);
+ return pRet;
+}
+
+VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
+ : m_xCooSysModel(xCooSys)
+ , m_xLogicTargetForGrids(0)
+ , m_xLogicTargetForAxes(0)
+ , m_xFinalTarget(0)
+ , m_xShapeFactory(0)
+ , m_aMatrixSceneToScreen()
+ , m_eLeftWallPos(CuboidPlanePosition_Left)
+ , m_eBackWallPos(CuboidPlanePosition_Back)
+ , m_eBottomPos(CuboidPlanePosition_Bottom)
+ , m_aMergedMinimumAndMaximumSupplier()
+ , m_aExplicitScales(3)
+ , m_aExplicitIncrements(3)
+ , m_apExplicitCategoriesProvider(NULL)
+{
+ if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 )
+ {
+ m_aExplicitScales[2].Minimum = -0.5;
+ m_aExplicitScales[2].Maximum = 0.5;
+ m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL;
+ }
+}
+VCoordinateSystem::~VCoordinateSystem()
+{
+}
+
+void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
+ , const Reference< drawing::XShapes >& xFinalTarget
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
+ throw (uno::RuntimeException)
+{
+ DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.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 aShapeFactory(xShapeFactory);
+ if(nDimensionCount==2)
+ {
+ //create and add to target
+ m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget );
+ m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget );
+ }
+ else
+ {
+ //create and added to target
+ m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget );
+ m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget );
+ }
+ m_xFinalTarget = xFinalTarget;
+ m_xShapeFactory = xShapeFactory;
+}
+
+void VCoordinateSystem::setParticle( const rtl::OUString& rCooSysParticle )
+{
+ m_aCooSysParticle = rCooSysParticle;
+}
+
+void VCoordinateSystem::setTransformationSceneToScreen(
+ const drawing::HomogenMatrix& rMatrix )
+{
+ m_aMatrixSceneToScreen = rMatrix;
+
+ //correct transformation for axis
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ if(2==pVAxis->getDimensionCount())
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ }
+ }
+}
+
+drawing::HomogenMatrix VCoordinateSystem::getTransformationSceneToScreen()
+{
+ return m_aMatrixSceneToScreen;
+}
+
+//better performance for big data
+uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
+ const awt::Size& rPageSize, const awt::Size& rPageResolution )
+{
+ uno::Sequence< sal_Int32 > aResolution(2);
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ if(nDimensionCount>2)
+ aResolution.realloc(nDimensionCount);
+ sal_Int32 nN = 0;
+ for( nN = 0 ;nN<aResolution.getLength(); nN++ )
+ aResolution[nN]=1000;
+
+ ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
+ BaseGFXHelper::HomogenMatrixToB3DHomMatrix(
+ m_aMatrixSceneToScreen ) ) );
+
+ double fCoosysWidth = static_cast< double >( fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
+ double fCoosysHeight = static_cast< double >( fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
+
+ double fPageWidth = rPageSize.Width;
+ double fPageHeight = rPageSize.Height;
+
+ //factor 2 to avoid rounding problems
+ sal_Int32 nXResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Width)*fCoosysWidth/fPageWidth);
+ sal_Int32 nYResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Height)*fCoosysHeight/fPageHeight);
+
+ if( nXResolution < 10 )
+ nXResolution = 10;
+ if( nYResolution < 10 )
+ nYResolution = 10;
+
+ if( this->getPropertySwapXAndYAxis() )
+ std::swap(nXResolution,nYResolution);
+
+ //2D
+ if( 2 == aResolution.getLength() )
+ {
+ aResolution[0]=nXResolution;
+ aResolution[1]=nYResolution;
+ }
+ else
+ {
+ //this maybe can be optimized further ...
+ sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
+ nMaxResolution*=2;
+ for( nN = 0 ;nN<aResolution.getLength(); nN++ )
+ aResolution[nN]=nMaxResolution;
+ }
+
+ return aResolution;
+}
+
+Reference< XCoordinateSystem > VCoordinateSystem::getModel() const
+{
+ return m_xCooSysModel;
+}
+
+Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ if( m_xCooSysModel.is() )
+ return m_xCooSysModel->getAxisByDimension( nDimensionIndex, nAxisIndex );
+ return 0;
+}
+
+Sequence< Reference< beans::XPropertySet > > VCoordinateSystem::getGridListFromAxis( const Reference< XAxis >& xAxis )
+{
+ std::vector< Reference< beans::XPropertySet > > aRet;
+
+ if( xAxis.is() )
+ {
+ aRet.push_back( xAxis->getGridProperties() );
+ std::vector< Reference< beans::XPropertySet > > aSubGrids( ContainerHelper::SequenceToVector( xAxis->getSubGridProperties() ) );
+ aRet.insert( aRet.end(), aSubGrids.begin(), aSubGrids.end() );
+ }
+
+ return ContainerHelper::ContainerToSequence( aRet );
+}
+
+void VCoordinateSystem::impl_adjustDimension( sal_Int32& rDimensionIndex ) const
+{
+ if( rDimensionIndex<0 )
+ rDimensionIndex=0;
+ if( rDimensionIndex>2 )
+ rDimensionIndex=2;
+}
+
+void VCoordinateSystem::impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const
+{
+ impl_adjustDimension( rDimensionIndex );
+
+ if( rAxisIndex < 0 || rAxisIndex > this->getMaximumAxisIndexByDimension(rDimensionIndex) )
+ rAxisIndex = 0;
+}
+
+void VCoordinateSystem::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider /*takes ownership*/ )
+{
+ m_apExplicitCategoriesProvider = ::std::auto_ptr< ExplicitCategoriesProvider >(pExplicitCategoriesProvider);
+}
+
+ExplicitCategoriesProvider* VCoordinateSystem::getExplicitCategoriesProvider()
+{
+ return m_apExplicitCategoriesProvider.get();
+}
+
+Sequence< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ Sequence< ExplicitScaleData > aRet(m_aExplicitScales);
+
+ impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
+ aRet[nDimensionIndex]=this->getExplicitScale( nDimensionIndex, nAxisIndex );
+
+ return aRet;
+}
+
+Sequence< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ Sequence< ExplicitIncrementData > aRet(m_aExplicitIncrements);
+
+ impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
+ aRet[nDimensionIndex]=this->getExplicitIncrement( nDimensionIndex, nAxisIndex );
+
+ return aRet;
+}
+
+ExplicitScaleData VCoordinateSystem::getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ ExplicitScaleData aRet;
+
+ impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
+
+ if( nAxisIndex == 0)
+ {
+ aRet = m_aExplicitScales[nDimensionIndex];
+ }
+ else
+ {
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+ tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.find( aFullAxisIndex );
+ if( aIt != m_aSecondaryExplicitScales.end() )
+ aRet = aIt->second;
+ else
+ aRet = m_aExplicitScales[nDimensionIndex];
+ }
+
+ return aRet;
+}
+
+ExplicitIncrementData VCoordinateSystem::getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+{
+ ExplicitIncrementData aRet;
+
+ impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
+
+ if( nAxisIndex == 0)
+ {
+ aRet = m_aExplicitIncrements[nDimensionIndex];
+ }
+ else
+ {
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+ tFullExplicitIncrementMap::const_iterator aIt = m_aSecondaryExplicitIncrements.find( aFullAxisIndex );
+ if( aIt != m_aSecondaryExplicitIncrements.end() )
+ aRet = aIt->second;
+ else
+ aRet = m_aExplicitIncrements[nDimensionIndex];
+ }
+
+ return aRet;
+}
+
+rtl::OUString VCoordinateSystem::createCIDForAxis( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ rtl::OUString aAxisParticle( ObjectIdentifier::createParticleForAxis( nDimensionIndex, nAxisIndex ) );
+ return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aAxisParticle );
+}
+rtl::OUString VCoordinateSystem::createCIDForGrid( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ rtl::OUString aGridParticle( ObjectIdentifier::createParticleForGrid( nDimensionIndex, nAxisIndex ) );
+ return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aGridParticle );
+}
+
+sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const
+{
+ sal_Int32 nRet = 0;
+ tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.begin();
+ tFullExplicitScaleMap::const_iterator aEnd = m_aSecondaryExplicitScales.end();
+ for(; aIt!=aEnd; ++aIt)
+ {
+ if(aIt->first.first==nDimensionIndex)
+ {
+ sal_Int32 nLocalIdx = aIt->first.second;
+ if( nRet < nLocalIdx )
+ nRet = nLocalIdx;
+ }
+ }
+ return nRet;
+}
+
+void VCoordinateSystem::createVAxisList(
+ const uno::Reference< util::XNumberFormatsSupplier > & /* xNumberFormatsSupplier */
+ , const awt::Size& /* rFontReferenceSize */
+ , const awt::Rectangle& /* rMaximumSpaceForLabels */
+ )
+{
+}
+
+void VCoordinateSystem::initVAxisInList()
+{
+}
+void VCoordinateSystem::updateScalesAndIncrementsOnAxes()
+{
+}
+
+void VCoordinateSystem::prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
+{
+ double fMin = 0.0;
+ double fMax = 0.0;
+ ::rtl::math::setInf(&fMin, false);
+ ::rtl::math::setInf(&fMax, true);
+ if( 0 == nDimIndex )
+ {
+ fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumX();
+ fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumX();
+ }
+ else if( 1 == nDimIndex )
+ {
+ ExplicitScaleData aScale = getExplicitScale( 0, 0 );
+ fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
+ fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
+ }
+ else if( 2 == nDimIndex )
+ {
+ fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumZ();
+ fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumZ();
+ }
+
+ this->prepareScaleAutomatism( rScaleAutomatism, fMin, fMax, nDimIndex, nAxisIndex );
+}
+
+void VCoordinateSystem::prepareScaleAutomatism( ScaleAutomatism& rScaleAutomatism, double fMin, double fMax, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
+{
+ //merge our values with those already contained in rScaleAutomatism
+ rScaleAutomatism.expandValueRange( fMin, fMax );
+
+ rScaleAutomatism.setAutoScalingOptions(
+ m_aMergedMinimumAndMaximumSupplier.isExpandBorderToIncrementRhythm( nDimIndex ),
+ m_aMergedMinimumAndMaximumSupplier.isExpandIfValuesCloseToBorder( nDimIndex ),
+ m_aMergedMinimumAndMaximumSupplier.isExpandWideValuesToZero( nDimIndex ),
+ m_aMergedMinimumAndMaximumSupplier.isExpandNarrowValuesTowardZero( nDimIndex ) );
+
+ VAxisBase* pVAxis( this->getVAxis( nDimIndex, nAxisIndex ) );
+ if( pVAxis )
+ rScaleAutomatism.setMaximumAutoMainIncrementCount( pVAxis->estimateMaximumAutoMainIncrementCount() );
+}
+
+VAxisBase* VCoordinateSystem::getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ VAxisBase* pRet = 0;
+
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+
+ tVAxisMap::const_iterator aIt = m_aAxisMap.find( aFullAxisIndex );
+ if( aIt != m_aAxisMap.end() )
+ pRet = aIt->second.get();
+
+ return pRet;
+}
+
+void VCoordinateSystem::setExplicitScaleAndIncrement(
+ sal_Int32 nDimensionIndex
+ , sal_Int32 nAxisIndex
+ , const ExplicitScaleData& rExplicitScale
+ , const ExplicitIncrementData& rExplicitIncrement )
+{
+ impl_adjustDimension( nDimensionIndex );
+
+ if( nAxisIndex==0 )
+ {
+ m_aExplicitScales[nDimensionIndex]=rExplicitScale;
+ m_aExplicitIncrements[nDimensionIndex]=rExplicitIncrement;
+ }
+ else
+ {
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+ m_aSecondaryExplicitScales[aFullAxisIndex] = rExplicitScale;
+ m_aSecondaryExplicitIncrements[aFullAxisIndex] = rExplicitIncrement;
+ }
+}
+
+void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos )
+{
+ m_eLeftWallPos = eLeftWallPos;
+ m_eBackWallPos = eBackWallPos;
+ m_eBottomPos = eBottomPos;
+}
+
+void VCoordinateSystem::createMaximumAxesLabels()
+{
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ if(2==pVAxis->getDimensionCount())
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->createMaximumLabels();
+ }
+ }
+}
+void VCoordinateSystem::createAxesLabels()
+{
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ if(2==pVAxis->getDimensionCount())
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->createLabels();
+ }
+ }
+}
+
+void VCoordinateSystem::updatePositions()
+{
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ if(2==pVAxis->getDimensionCount())
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->updatePositions();
+ }
+ }
+}
+
+void VCoordinateSystem::createAxesShapes()
+{
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ if(2==pVAxis->getDimensionCount())
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+
+ tFullAxisIndex aFullAxisIndex = aIt->first;
+ if( aFullAxisIndex.second == 0 )
+ {
+ if( aFullAxisIndex.first == 0 )
+ {
+ if( AxisType::CATEGORY!=m_aExplicitScales[1].AxisType )
+ pVAxis->setExrtaLinePositionAtOtherAxis(
+ m_aExplicitScales[1].Origin );
+ }
+ else if( aFullAxisIndex.first == 1 )
+ {
+ if( AxisType::CATEGORY!=m_aExplicitScales[0].AxisType )
+ pVAxis->setExrtaLinePositionAtOtherAxis(
+ m_aExplicitScales[0].Origin );
+ }
+ }
+
+ pVAxis->createShapes();
+ }
+ }
+}
+void VCoordinateSystem::createGridShapes()
+{
+}
+void VCoordinateSystem::addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
+{
+ m_aMergedMinimumAndMaximumSupplier.addMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
+}
+
+bool VCoordinateSystem::hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
+{
+ return m_aMergedMinimumAndMaximumSupplier.hasMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
+}
+
+void VCoordinateSystem::clearMinimumAndMaximumSupplierList()
+{
+ m_aMergedMinimumAndMaximumSupplier.clearMinimumAndMaximumSupplierList();
+}
+
+bool VCoordinateSystem::getPropertySwapXAndYAxis() const
+{
+ Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY );
+ sal_Bool bSwapXAndY = false;
+ if( xProp.is()) try
+ {
+ xProp->getPropertyValue( C2U( "SwapXAndYAxis" ) ) >>= bSwapXAndY;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bSwapXAndY;
+}
+
+bool VCoordinateSystem::needSeriesNamesForAxis() const
+{
+ return ( m_xCooSysModel.is() && m_xCooSysModel->getDimension() == 3 );
+}
+void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< rtl::OUString >& rSeriesNames )
+{
+ m_aSeriesNamesForZAxis = rSeriesNames;
+}
+
+sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ xAxis, m_xCooSysModel, xNumberFormatsSupplier );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx
new file mode 100644
index 000000000000..865a7848aa9a
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <basegfx/numeric/ftools.hxx>
+
+#include "VPolarAngleAxis.hxx"
+#include "VPolarGrid.hxx"
+#include "ShapeFactory.hxx"
+#include "macros.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "PolarLabelPositionHelper.hxx"
+#include <tools/color.hxx>
+
+#include <memory>
+
+//.............................................................................
+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
+ , sal_Int32 nDimensionCount )
+ : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 0/*nDimensionIndex*/, nDimensionCount )
+{
+}
+
+VPolarAngleAxis::~VPolarAngleAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+bool VPolarAngleAxis::createTextShapes_ForAngleAxis(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , EquidistantTickIter& rTickIter
+ , AxisLabelProperties& rAxisLabelProperties
+ , double fLogicRadius
+ , double fLogicZ )
+{
+ sal_Int32 nDimensionCount = 2;
+ ShapeFactory aShapeFactory(m_xShapeFactory);
+
+ FixedNumberFormatter aFixedNumberFormatter(
+ m_xNumberFormatsSupplier, rAxisLabelProperties.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 );
+ PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false );
+ LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
+ , rAxisLabelProperties.m_aFontReferenceSize );
+
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("CharColor"));
+ sal_Int32 nColor = Color( COL_AUTO ).GetColor();
+ if(pColorAny)
+ *pColorAny >>= nColor;
+
+ const uno::Sequence< rtl::OUString >* pLabels = m_bUseTextLabels? &m_aTextLabels : 0;
+
+ //------------------------------------------------
+
+ //TickInfo* pLastVisibleNeighbourTickInfo = NULL;
+ sal_Int32 nTick = 0;
+
+ for( TickInfo* pTickInfo = rTickIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rTickIter.nextInfo(), nTick++ )
+ {
+ //don't create labels which does not fit into the rhythm
+ if( nTick%rAxisLabelProperties.nRhythm != 0)
+ continue;
+
+ //don't create labels for invisible ticks
+ if( !pTickInfo->bPaintIt )
+ continue;
+
+ //if NO OVERLAP -> don't create labels where the
+ //anchor position is the same as for the last label
+ //@todo
+
+ if(!pTickInfo->xTextShape.is())
+ {
+ //create single label
+ bool bHasExtraColor=false;
+ sal_Int32 nExtraColor=0;
+
+ rtl::OUString aLabel;
+ if(pLabels)
+ {
+ sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->fUnscaledTickValue) - 1; //first category (index 0) matches with real number 1.0
+ if( nIndex>=0 && nIndex<pLabels->getLength() )
+ aLabel = (*pLabels)[nIndex];
+ }
+ else
+ aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+
+ if(pColorAny)
+ *pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
+
+ double fLogicAngle = pTickInfo->fUnscaledTickValue;
+
+ LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
+ PolarLabelPositionHelper aPolarLabelPositionHelper(m_pPosHelper,nDimensionCount,xTarget,&aShapeFactory);
+ 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(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+
+ uno::Any aATransformation = ShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi );
+ rtl::OUString aStackedLabel = ShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters );
+
+ pTickInfo->xTextShape = aShapeFactory.createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation );
+ }
+
+ //if NO OVERLAP -> remove overlapping shapes
+ //@todo
+ }
+ return true;
+}
+
+void SAL_CALL VPolarAngleAxis::createMaximumLabels()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ createLabels();
+}
+
+void SAL_CALL VPolarAngleAxis::updatePositions()
+{
+ //todo: really only update the positions
+
+ if( !prepareShapeCreation() )
+ return;
+
+ createLabels();
+}
+
+void SAL_CALL VPolarAngleAxis::createLabels()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicZ = -0.5;//as defined
+
+ if( m_aAxisProperties.m_bDisplayLabels )
+ {
+ //-----------------------------------------
+ //get the transformed screen values for all tickmarks in aAllTickInfos
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+
+ //create tick mark text shapes
+ //@todo: iterate through all tick depth wich should be labeled
+
+ EquidistantTickIter aTickIter( m_aAllTickInfos, m_aIncrement, 0, 0 );
+ this->updateUnscaledValuesAtTicks( aTickIter );
+
+ removeTextShapesFromTicks();
+
+ AxisLabelProperties aAxisLabelProperties( m_aAxisLabelProperties );
+ aAxisLabelProperties.bOverlapAllowed = true;
+ while( !createTextShapes_ForAngleAxis( m_xTextTarget, aTickIter
+ , aAxisLabelProperties
+ , fLogicRadius, fLogicZ
+ ) )
+ {
+ };
+
+ //no staggering for polar angle axis
+ }
+}
+
+void SAL_CALL VPolarAngleAxis::createShapes()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicZ = -0.5;//as defined
+
+ //-----------------------------------------
+ //create axis main lines
+ drawing::PointSequenceSequence aPoints(1);
+ VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, m_aAllTickInfos, m_aIncrement, m_aScale, m_pPosHelper, fLogicRadius, fLogicZ );
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties );
+ //because of this name this line will be used for marking the axis
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+
+ //-----------------------------------------
+ //create labels
+ createLabels();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarAngleAxis.hxx b/chart2/source/view/axes/VPolarAngleAxis.hxx
new file mode 100644
index 000000000000..c03cf533e22c
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAngleAxis.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARANGLEAXIS_HXX
+#define _CHART2_VPOLARANGLEAXIS_HXX
+
+#include "VPolarAxis.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VPolarAngleAxis : public VPolarAxis
+{
+public:
+ VPolarAngleAxis( const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionCount );
+ virtual ~VPolarAngleAxis();
+
+ virtual void SAL_CALL createMaximumLabels();
+ virtual void SAL_CALL createLabels();
+ virtual void SAL_CALL updatePositions();
+
+ virtual void SAL_CALL createShapes();
+
+private: //methods
+ bool createTextShapes_ForAngleAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , EquidistantTickIter& rTickIter
+ , AxisLabelProperties& rAxisLabelProperties
+ , double fLogicRadius, double fLogicZ );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx
new file mode 100644
index 000000000000..23908585ec3a
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAxis.cxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VPolarAxis.hxx"
+#include "VPolarAngleAxis.hxx"
+#include "VPolarRadiusAxis.hxx"
+#include "macros.hxx"
+#include "TickmarkHelper.hxx"
+#include "ShapeFactory.hxx"
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+VPolarAxis* VPolarAxis::createAxis( const AxisProperties& rAxisProperties
+ , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount )
+{
+ if( 0==nDimensionIndex )
+ return new VPolarAngleAxis( rAxisProperties, xNumberFormatsSupplier, nDimensionCount );
+ return new VPolarRadiusAxis( rAxisProperties, xNumberFormatsSupplier, nDimensionCount );
+}
+
+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;
+}
+
+VPolarAxis::~VPolarAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+void VPolarAxis::setIncrements( const uno::Sequence< ExplicitIncrementData >& rIncrements )
+{
+ m_aIncrements = rIncrements;
+}
+
+sal_Bool SAL_CALL VPolarAxis::isAnythingToDraw()
+{
+ return ( 2==m_nDimension && VAxisBase::isAnythingToDraw() );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarAxis.hxx b/chart2/source/view/axes/VPolarAxis.hxx
new file mode 100644
index 000000000000..8d4c14188258
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAxis.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARAXIS_HXX
+#define _CHART2_VPOLARAXIS_HXX
+
+#include "VAxisBase.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class PolarPlottingPositionHelper;
+
+class VPolarAxis : public VAxisBase
+{
+public:
+ static VPolarAxis* createAxis( const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
+
+ void setIncrements( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitIncrementData >& rIncrements );
+
+ virtual sal_Bool SAL_CALL isAnythingToDraw();
+
+ virtual ~VPolarAxis();
+
+protected:
+ VPolarAxis( const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
+
+protected: //member
+ PolarPlottingPositionHelper* m_pPosHelper;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitIncrementData > m_aIncrements;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
new file mode 100644
index 000000000000..76e057a2b32d
--- /dev/null
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VPolarCoordinateSystem.hxx"
+#include "VPolarGrid.hxx"
+#include "VPolarAxis.hxx"
+#include "AxisIndexDefines.hxx"
+#include "AxisHelper.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 )
+ : VCoordinateSystem(xCooSys)
+{
+}
+
+VPolarCoordinateSystem::~VPolarCoordinateSystem()
+{
+}
+
+//better performance for big data
+uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution(
+ const awt::Size& rPageSize, const awt::Size& rPageResolution )
+{
+ uno::Sequence< sal_Int32 > aResolution( VCoordinateSystem::getCoordinateSystemResolution( rPageSize, rPageResolution) );
+
+ if( aResolution.getLength() >= 2 )
+ {
+ if( this->getPropertySwapXAndYAxis() )
+ {
+ aResolution[0]/=2;//radius
+ aResolution[1]*=4;//outer circle resolution
+ }
+ else
+ {
+ aResolution[0]*=4;//outer circle resolution
+ aResolution[1]/=2;//radius
+ }
+ }
+
+ return aResolution;
+}
+
+void VPolarCoordinateSystem::createVAxisList(
+ const uno::Reference< util::XNumberFormatsSupplier > & xNumberFormatsSupplier
+ , const awt::Size& rFontReferenceSize
+ , const awt::Rectangle& rMaximumSpaceForLabels
+ )
+{
+ m_aAxisMap.clear();
+
+ //if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ // return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+// bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ sal_Int32 nDimensionIndex = 0;
+
+ //create angle axis (dimension index 0)
+ for( nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
+ {
+ sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
+ {
+ Reference< XAxis > xAxis( this->getAxisByDimension(nDimensionIndex,nAxisIndex) );
+ if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
+ continue;
+ AxisProperties aAxisProperties(xAxis,this->getExplicitCategoriesProvider());
+ aAxisProperties.init();
+ if(aAxisProperties.m_bDisplayLabels)
+ aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier );
+ //-------------------
+ ::boost::shared_ptr< VAxisBase > apVAxis( VPolarAxis::createAxis( aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) );
+ tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
+ m_aAxisMap[aFullAxisIndex] = apVAxis;
+
+ //apVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
+ //apVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
+ // , this->createCIDForAxis( xAxis, nDimensionIndex, nAxisIndex ) );
+ //VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( apVAxis.get() );
+ //if( pVPolarAxis )
+ // pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
+ //if(2==nDimensionCount)
+ // apVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ //apVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
+ apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
+ }
+ }
+}
+
+void VPolarCoordinateSystem::initVAxisInList()
+{
+ if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ sal_Int32 nDimensionIndex = aIt->first.first;
+ sal_Int32 nAxisIndex = aIt->first.second;
+ pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
+ pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
+ , this->createCIDForAxis( getAxisByDimension( nDimensionIndex, nAxisIndex ), nDimensionIndex, nAxisIndex ) );
+ VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
+ if( pVPolarAxis )
+ pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
+ if(2==nDimensionCount)
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
+ }
+ }
+}
+
+void VPolarCoordinateSystem::updateScalesAndIncrementsOnAxes()
+{
+ if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ tVAxisMap::iterator aIt( m_aAxisMap.begin() );
+ tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
+ for( ; aIt != aEnd; ++aIt )
+ {
+ VAxisBase* pVAxis = aIt->second.get();
+ if( pVAxis )
+ {
+ sal_Int32 nDimensionIndex = aIt->first.first;
+ sal_Int32 nAxisIndex = aIt->first.second;
+ pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
+ VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
+ if( pVPolarAxis )
+ pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
+ if(2==nDimensionCount)
+ pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ pVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
+ }
+ }
+}
+
+void VPolarCoordinateSystem::createGridShapes()
+{
+ if(!m_xLogicTargetForGrids.is() || !m_xFinalTarget.is() )
+ return;
+
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ bool bSwapXAndY = this->getPropertySwapXAndYAxis();
+
+ for( sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
+ {
+ sal_Int32 nAxisIndex = MAIN_AXIS_INDEX;
+
+ Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel ) );
+ if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
+ continue;
+
+ VPolarGrid aGrid(nDimensionIndex,nDimensionCount,this->getGridListFromAxis( xAxis ));
+ aGrid.setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
+ aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory
+ , this->createCIDForGrid( xAxis, nDimensionIndex, nAxisIndex ) );
+ if(2==nDimensionCount)
+ aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aGrid.setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex), bSwapXAndY );
+ aGrid.createShapes();
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
new file mode 100644
index 000000000000..f1ba84c5469e
--- /dev/null
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLAR_COORDINATESYSTEM_HXX
+#define _CHART2_VPOLAR_COORDINATESYSTEM_HXX
+
+#include "VCoordinateSystem.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VPolarCoordinateSystem : public VCoordinateSystem
+{
+public:
+ VPolarCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+ virtual ~VPolarCoordinateSystem();
+
+ //better performance for big data
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
+ , const ::com::sun::star::awt::Size& rPageResolution );
+
+ virtual void createVAxisList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier
+ , const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
+
+ virtual void initVAxisInList();
+ virtual void updateScalesAndIncrementsOnAxes();
+
+ virtual void createGridShapes();
+
+private:
+ VPolarCoordinateSystem();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx
new file mode 100644
index 000000000000..0bd98b642acb
--- /dev/null
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VPolarGrid.hxx"
+#include "VCartesianGrid.hxx"
+#include "TickmarkHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <vector>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+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 )
+ : VAxisOrGridBase( nDimensionIndex, nDimensionCount )
+ , m_aGridPropertiesList( rGridPropertiesList )
+ , m_pPosHelper( new PolarPlottingPositionHelper() )
+ , m_aIncrements()
+{
+ PlotterBase::m_pPosHelper = m_pPosHelper;
+}
+
+VPolarGrid::~VPolarGrid()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+void VPolarGrid::setIncrements( const uno::Sequence< ExplicitIncrementData >& rIncrements )
+{
+ m_aIncrements = rIncrements;
+}
+
+void VPolarGrid::getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ TickmarkHelper aTickmarkHelper(
+ m_pPosHelper->getScales()[nDimensionIndex], m_aIncrements[nDimensionIndex] );
+ aTickmarkHelper.getAllTicks( rAllTickInfos );
+}
+
+//static
+void VPolarGrid::createLinePointSequence_ForAngleAxis(
+ drawing::PointSequenceSequence& rPoints
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ExplicitIncrementData& rIncrement
+ , const ExplicitScaleData& rScale
+ , PolarPlottingPositionHelper* pPosHelper
+ , double fLogicRadius, double fLogicZ )
+{
+ Reference< XScaling > xInverseScaling( NULL );
+ if( rScale.Scaling.is() )
+ xInverseScaling = rScale.Scaling->getInverseScaling();
+
+ sal_Int32 nTick = 0;
+ EquidistantTickIter aIter( rAllTickInfos, rIncrement, 0, 0 );
+ for( TickInfo* pTickInfo = aIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = aIter.nextInfo(), nTick++ )
+ {
+ if(nTick>=rPoints[0].getLength())
+ rPoints[0].realloc(rPoints[0].getLength()+30);
+
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = pTickInfo->fUnscaledTickValue;
+
+ 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);
+ }
+ 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;
+ }
+ else
+ rPoints[0].realloc(0);
+}
+#ifdef NOTYET
+void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicTarget
+ , ::std::vector< ::std::vector< TickInfo > >& /* rRadiusTickInfos */
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList )
+{
+ Reference< drawing::XShapes > xMainTarget(
+ this->createGroupShape( xLogicTarget, m_aCID ) );
+
+ const ExplicitScaleData& rAngleScale = m_pPosHelper->getScales()[0];
+ Reference< XScaling > xInverseScaling( NULL );
+ if( rAngleScale.Scaling.is() )
+ xInverseScaling = rAngleScale.Scaling->getInverseScaling();
+
+ double fLogicInnerRadius = m_pPosHelper->getInnerLogicRadius();
+ double fLogicOuterRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicZ = -0.5;//as defined
+
+ sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAngleTickInfos.begin();
+ sal_Int32 nDepth=0;
+ /*
+ //no subgrids so far for polar angle grid (need different radii)
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAngleTickInfos.end();
+ for( ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ */
+ if(nLinePropertiesCount)
+ {
+ //create axis main lines
+ drawing::PointSequenceSequence aAllPoints;
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = *aTickIter;
+ if( !rTickInfo.bPaintIt )
+ continue;
+
+ rTickInfo.updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = rTickInfo.fUnscaledTickValue;
+
+ drawing::PointSequenceSequence aPoints(1);
+ aPoints[0].realloc(2);
+ drawing::Position3D aScenePositionStart( m_pPosHelper->transformAngleRadiusToScene( fLogicAngle, fLogicInnerRadius, fLogicZ ) );
+ drawing::Position3D aScenePositionEnd( m_pPosHelper->transformAngleRadiusToScene( fLogicAngle, fLogicOuterRadius, fLogicZ ) );
+ aPoints[0][0].X = static_cast<sal_Int32>(aScenePositionStart.PositionX);
+ aPoints[0][0].Y = static_cast<sal_Int32>(aScenePositionStart.PositionY);
+ aPoints[0][1].X = static_cast<sal_Int32>(aScenePositionEnd.PositionX);
+ aPoints[0][1].Y = static_cast<sal_Int32>(aScenePositionEnd.PositionY);
+ appendPointSequence( aAllPoints, aPoints );
+ }
+
+ Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xMainTarget, aAllPoints, &rLinePropertiesList[nDepth] );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+}
+#endif
+
+void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogicTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList )
+{
+ Reference< drawing::XShapes > xMainTarget(
+ this->createGroupShape( xLogicTarget, m_aCID ) );
+
+ const ExplicitScaleData& rRadiusScale = m_pPosHelper->getScales()[1];
+ const ExplicitScaleData& rAngleScale = m_pPosHelper->getScales()[0];
+ const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
+ Reference< XScaling > xInverseRadiusScaling( NULL );
+ if( rRadiusScale.Scaling.is() )
+ xInverseRadiusScaling = rRadiusScale.Scaling->getInverseScaling();
+
+ sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rRadiusTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rRadiusTickInfos.end();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ if( !rLinePropertiesList[nDepth].isLineVisible() )
+ continue;
+
+ Reference< drawing::XShapes > xTarget( xMainTarget );
+ if( nDepth > 0 )
+ {
+ xTarget.set( this->createGroupShape( xLogicTarget
+ , ObjectIdentifier::addChildParticle( m_aCID, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_SUBGRID, nDepth-1 ) )
+ ) );
+ if(!xTarget.is())
+ xTarget.set( xMainTarget );
+ }
+
+ //create axis main lines
+ drawing::PointSequenceSequence aAllPoints;
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = *aTickIter;
+ if( !rTickInfo.bPaintIt )
+ continue;
+
+ rTickInfo.updateUnscaledValue( xInverseRadiusScaling );
+ double fLogicRadius = rTickInfo.fUnscaledTickValue;
+ double fLogicZ = -0.5;//as defined
+
+ drawing::PointSequenceSequence aPoints(1);
+ VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAngleTickInfos
+ , rAngleIncrement, rAngleScale, m_pPosHelper, fLogicRadius, fLogicZ );
+ if(aPoints[0].getLength())
+ appendPointSequence( aAllPoints, aPoints );
+ }
+
+ Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xTarget, aAllPoints, &rLinePropertiesList[nDepth] );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+}
+
+void SAL_CALL VPolarGrid::createShapes()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+ if(!m_aGridPropertiesList.getLength())
+ return;
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ ::std::vector< ::std::vector< TickInfo > > aAngleTickInfos;
+ ::std::vector< ::std::vector< TickInfo > > aRadiusTickInfos;
+ getAllTickInfos( 0, aAngleTickInfos );
+ getAllTickInfos( 1, aRadiusTickInfos );
+
+ //-----------------------------------------
+ ::std::vector<VLineProperties> aLinePropertiesList;
+ VCartesianGrid::fillLinePropertiesFromGridModel( aLinePropertiesList, m_aGridPropertiesList );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ if(2==m_nDimension)
+ {
+ if(m_nDimensionIndex==1)
+ this->create2DRadiusGrid( m_xLogicTarget, aRadiusTickInfos, aAngleTickInfos, aLinePropertiesList );
+ //else //no Angle Grid so far as this equals exactly the y axis positions
+ // this->create2DAngleGrid( m_xLogicTarget, aRadiusTickInfos, aAngleTickInfos, aLinePropertiesList );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarGrid.hxx b/chart2/source/view/axes/VPolarGrid.hxx
new file mode 100644
index 000000000000..3289d6c88be8
--- /dev/null
+++ b/chart2/source/view/axes/VPolarGrid.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARGRID_HXX
+#define _CHART2_VPOLARGRID_HXX
+
+#include "VAxisOrGridBase.hxx"
+#include "TickmarkHelper.hxx"
+#include "VLineProperties.hxx"
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class PolarPlottingPositionHelper;
+
+class VPolarGrid : public VAxisOrGridBase
+{
+//-------------------------------------------------------------------------
+// public methods
+//-------------------------------------------------------------------------
+public:
+ VPolarGrid( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
+ , const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > & rGridPropertiesList //main grid, subgrid, subsubgrid etc
+ );
+ virtual ~VPolarGrid();
+
+ virtual void SAL_CALL createShapes();
+
+ void setIncrements( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitIncrementData >& rIncrements );
+
+ static void createLinePointSequence_ForAngleAxis(
+ ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , PolarPlottingPositionHelper* pPosHelper
+ , double fLogicRadius, double fLogicZ );
+
+private: //member
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > > m_aGridPropertiesList;//main grid, subgrid, subsubgrid etc
+ PolarPlottingPositionHelper* m_pPosHelper;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitIncrementData > m_aIncrements;
+
+ void getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+ void create2DRadiusGrid( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList );
+#if NOTYET
+ void create2DAngleGrid( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList );
+#endif
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx
new file mode 100644
index 000000000000..2206d4d8f559
--- /dev/null
+++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VPolarRadiusAxis.hxx"
+#include "VCartesianAxis.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "CommonConverters.hxx"
+#include <rtl/math.hxx>
+
+//.............................................................................
+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
+ , sal_Int32 nDimensionCount )
+ : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount )
+{
+ m_aAxisProperties.m_fLabelDirectionSign=0.0;
+ m_aAxisProperties.m_fInnerDirectionSign=0.0;
+ m_aAxisProperties.m_bIsMainAxis=false;
+ m_aAxisProperties.m_aLabelAlignment=LABEL_ALIGN_RIGHT;
+ m_aAxisProperties.init();
+
+ m_apAxisWithLabels = std::auto_ptr<VCartesianAxis>( new VCartesianAxis(
+ m_aAxisProperties,xNumberFormatsSupplier,1/*nDimensionIndex*/,nDimensionCount
+ ,new PolarPlottingPositionHelper() ) );
+}
+
+VPolarRadiusAxis::~VPolarRadiusAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+void VPolarRadiusAxis::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
+{
+ VPolarAxis::setTransformationSceneToScreen( rMatrix );
+ m_apAxisWithLabels->setTransformationSceneToScreen( rMatrix );
+}
+
+void SAL_CALL VPolarRadiusAxis::setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
+ throw (uno::RuntimeException)
+{
+ VPolarAxis::setExplicitScaleAndIncrement( rScale, rIncrement );
+ m_apAxisWithLabels->setExplicitScaleAndIncrement( rScale, rIncrement );
+}
+
+void SAL_CALL VPolarRadiusAxis::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
+ , const uno::Reference< drawing::XShapes >& xFinalTarget
+ , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const rtl::OUString& rCID )
+ throw (uno::RuntimeException)
+{
+ VPolarAxis::initPlotter( xLogicTarget, xFinalTarget, xShapeFactory, rCID );
+ m_apAxisWithLabels->initPlotter( xLogicTarget, xFinalTarget, xShapeFactory, rCID );
+}
+
+void SAL_CALL VPolarRadiusAxis::setScales( const uno::Sequence< ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis )
+ throw (uno::RuntimeException)
+{
+ VPolarAxis::setScales( rScales, bSwapXAndYAxis );
+ m_apAxisWithLabels->setScales( rScales, bSwapXAndYAxis );
+}
+
+void SAL_CALL VPolarRadiusAxis::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels )
+{
+ VPolarAxis::initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
+ m_apAxisWithLabels->initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
+}
+
+sal_Int32 VPolarRadiusAxis::estimateMaximumAutoMainIncrementCount()
+{
+ return 2;
+}
+
+bool VPolarRadiusAxis::prepareShapeCreation()
+{
+ //returns true if all is ready for further shape creation and any shapes need to be created
+ if( !isAnythingToDraw() )
+ return false;
+
+ if( m_xGroupShape_Shapes.is() )
+ return true;
+
+ return true;
+}
+
+void SAL_CALL VPolarRadiusAxis::createMaximumLabels()
+{
+ m_apAxisWithLabels->createMaximumLabels();
+}
+
+void SAL_CALL VPolarRadiusAxis::updatePositions()
+{
+ m_apAxisWithLabels->updatePositions();
+}
+
+void SAL_CALL VPolarRadiusAxis::createLabels()
+{
+ m_apAxisWithLabels->createLabels();
+}
+
+void SAL_CALL VPolarRadiusAxis::createShapes()
+{
+ if( !prepareShapeCreation() )
+ return;
+
+ const ExplicitScaleData& rAngleScale = m_pPosHelper->getScales()[0];
+ const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
+
+ ::std::vector< ::std::vector< TickInfo > > aAngleTickInfos;
+ TickmarkHelper aAngleTickmarkHelper( rAngleScale, rAngleIncrement );
+ aAngleTickmarkHelper.getAllTicks( aAngleTickInfos );
+
+ uno::Reference< XScaling > xInverseScaling( NULL );
+ if( rAngleScale.Scaling.is() )
+ xInverseScaling = rAngleScale.Scaling->getInverseScaling();
+
+ AxisProperties aAxisProperties(m_aAxisProperties);
+
+ sal_Int32 nTick = 0;
+ EquidistantTickIter aIter( aAngleTickInfos, rAngleIncrement, 0, 0 );
+ for( TickInfo* pTickInfo = aIter.firstInfo()
+ ; pTickInfo; pTickInfo = aIter.nextInfo(), nTick++ )
+ {
+ if( nTick == 0 )
+ {
+ m_apAxisWithLabels->createShapes();
+ continue;
+ }
+
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+ aAxisProperties.m_pfMainLinePositionAtOtherAxis = new double( pTickInfo->fUnscaledTickValue );
+ aAxisProperties.m_bDisplayLabels=false;
+
+ //-------------------
+ 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.setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( m_aMatrixScreenToScene ) );
+ aAxis.setScales( m_pPosHelper->getScales(), false );
+ aAxis.initAxisLabelProperties(m_aAxisLabelProperties.m_aFontReferenceSize,m_aAxisLabelProperties.m_aMaximumSpaceForLabels);
+ aAxis.createShapes();
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.hxx b/chart2/source/view/axes/VPolarRadiusAxis.hxx
new file mode 100644
index 000000000000..b5c5191e4c98
--- /dev/null
+++ b/chart2/source/view/axes/VPolarRadiusAxis.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARRADIUSAXIS_HXX
+#define _CHART2_VPOLARRADIUSAXIS_HXX
+
+#include "VPolarAxis.hxx"
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VCartesianAxis;
+
+class VPolarRadiusAxis : public VPolarAxis
+{
+public:
+ VPolarRadiusAxis( const AxisProperties& rAxisProperties
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , sal_Int32 nDimensionCount );
+ virtual ~VPolarRadiusAxis();
+
+ virtual void SAL_CALL initPlotter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xFinalTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , const rtl::OUString& rCID
+ ) throw (::com::sun::star::uno::RuntimeException );
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
+
+ virtual void SAL_CALL setScales(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setExplicitScaleAndIncrement(
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL initAxisLabelProperties(
+ const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
+
+ virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
+
+ virtual void SAL_CALL createMaximumLabels();
+ virtual void SAL_CALL createLabels();
+ virtual void SAL_CALL updatePositions();
+
+ virtual void SAL_CALL createShapes();
+
+protected: //methods
+ virtual bool prepareShapeCreation();
+
+private: //member
+ std::auto_ptr<VCartesianAxis> m_apAxisWithLabels;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/makefile.mk b/chart2/source/view/axes/makefile.mk
new file mode 100644
index 000000000000..96191a3a3a25
--- /dev/null
+++ b/chart2/source/view/axes/makefile.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chvaxes
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+.INCLUDE: $(PRJ)$/chartview.pmk
+
+#.IF "$(GUI)" == "WNT"
+#CFLAGS+=-GR
+#.ENDIF
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES = \
+ $(SLO)$/VAxisOrGridBase.obj \
+ $(SLO)$/VAxisBase.obj \
+ $(SLO)$/TickmarkHelper.obj \
+ $(SLO)$/MinimumAndMaximumSupplier.obj \
+ $(SLO)$/ScaleAutomatism.obj \
+ $(SLO)$/VAxisProperties.obj \
+ $(SLO)$/VCartesianAxis.obj \
+ $(SLO)$/VCartesianGrid.obj \
+ $(SLO)$/VCartesianCoordinateSystem.obj \
+ $(SLO)$/VPolarAxis.obj \
+ $(SLO)$/VPolarAngleAxis.obj \
+ $(SLO)$/VPolarRadiusAxis.obj \
+ $(SLO)$/VPolarGrid.obj \
+ $(SLO)$/VPolarCoordinateSystem.obj \
+ $(SLO)$/VCoordinateSystem.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
new file mode 100644
index 000000000000..fd1aaa81c3a0
--- /dev/null
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -0,0 +1,1005 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AreaChart.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+//#include "chartview/servicenames_charttypes.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "Splines.hxx"
+#include "ChartTypeHelper.hxx"
+#include "LabelPositionHelper.hxx"
+#include "Clipping.hxx"
+#include "Stripe.hxx"
+#include "PolarLabelPositionHelper.hxx"
+
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <tools/debug.hxx>
+#include <editeng/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bCategoryXAxis
+ , bool bNoArea
+ , PlottingPositionHelper* pPlottingPositionHelper
+ , bool bConnectLastToFirstPoint
+ , bool bExpandIfValuesCloseToBorder
+ , sal_Int32 nKeepAspectRatio
+ , const drawing::Direction3D& rAspectRatio
+ )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
+ , m_pMainPosHelper(pPlottingPositionHelper)
+ , m_bArea(!bNoArea)
+ , m_bLine(bNoArea)
+ , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
+ , m_bIsPolarCooSys( bConnectLastToFirstPoint )
+ , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint )
+ , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
+ , m_nKeepAspectRatio(nKeepAspectRatio)
+ , m_aGivenAspectRatio(rAspectRatio)
+ , m_eCurveStyle(CurveStyle_LINES)
+ , m_nCurveResolution(20)
+ , m_nSplineOrder(3)
+ , m_xSeriesTarget(0)
+ , m_xErrorBarTarget(0)
+ , m_xTextTarget(0)
+ , m_xRegressionCurveEquationTarget(0)
+{
+ if( !m_pMainPosHelper )
+ m_pMainPosHelper = new PlottingPositionHelper();
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+
+ try
+ {
+ if( m_xChartTypeModelProps.is() )
+ {
+ m_xChartTypeModelProps->getPropertyValue( C2U( "CurveStyle" ) ) >>= m_eCurveStyle;
+ m_xChartTypeModelProps->getPropertyValue( C2U( "CurveResolution" ) ) >>= m_nCurveResolution;
+ m_xChartTypeModelProps->getPropertyValue( C2U( "SplineOrder" ) ) >>= m_nSplineOrder;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ //the above properties are not supported by all charttypes supported by this class (e.g. area or net chart)
+ //in that cases this exception is ok
+ e.Context.is();//to have debug information without compilation warnings
+ }
+}
+
+AreaChart::~AreaChart()
+{
+ delete m_pMainPosHelper;
+}
+
+double AreaChart::getMinimumX()
+{
+ if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling
+ return 1.0;//first category (index 0) matches with real number 1.0
+ return VSeriesPlotter::getMinimumX();
+}
+
+double AreaChart::getMaximumX()
+{
+ if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling
+ return getPointCount()+1;
+ return VSeriesPlotter::getMaximumX();
+}
+
+bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
+{
+ return m_bExpandIfValuesCloseToBorder &&
+ VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex );
+}
+
+bool AreaChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
+{
+ // no separate stacking in all types of line/area charts
+ return false;
+}
+
+//-----------------------------------------------------------------
+
+LegendSymbolStyle AreaChart::getLegendSymbolStyle()
+{
+ if( m_bArea || m_nDimension == 3 )
+ return chart2::LegendSymbolStyle_BOX;
+ return chart2::LegendSymbolStyle_LINE_WITH_SYMBOL;
+}
+
+uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex )
+{
+ uno::Any aRet;
+
+ Symbol* pSymbolProperties = rSeries.getSymbolProperties( nPointIndex );
+ if( pSymbolProperties )
+ {
+ aRet = uno::makeAny(*pSymbolProperties);
+ }
+
+ return aRet;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+/*
+APPHELPER_XSERVICEINFO_IMPL(AreaChart,CHART2_VIEW_AREACHART_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > AreaChart
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART2_VIEW_AREACHART_SERVICE_NAME;
+ return aSNS;
+}
+*/
+/*
+//-----------------------------------------------------------------
+// chart2::XPlotter
+//-----------------------------------------------------------------
+
+ ::rtl::OUString SAL_CALL AreaChart
+::getCoordinateSystemTypeID()
+ throw (uno::RuntimeException)
+{
+ return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+}
+*/
+drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
+{
+ if( m_nKeepAspectRatio == 1 )
+ return m_aGivenAspectRatio;
+ drawing::Direction3D aRet(1,-1,1);
+ if( m_nDimension == 2 )
+ aRet = drawing::Direction3D(-1,-1,-1);
+ else
+ {
+ drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
+ aRet.DirectionZ = aScale.DirectionZ*0.2;
+ if(aRet.DirectionZ>1.0)
+ aRet.DirectionZ=1.0;
+ if(aRet.DirectionZ>10)
+ aRet.DirectionZ=10;
+ }
+ return aRet;
+}
+
+bool AreaChart::keepAspectRatio() const
+{
+ if( m_nKeepAspectRatio == 0 )
+ return false;
+ if( m_nKeepAspectRatio == 1 )
+ return true;
+ if( m_nDimension == 2 )
+ {
+ if( !m_bSymbol )
+ return false;
+ }
+ return true;
+}
+
+void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ if( m_bArea && !m_bIsPolarCooSys && pSeries )
+ {
+ sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
+ }
+ if( m_nDimension == 3 && !m_bCategoryXAxis )
+ {
+ //3D xy always deep
+ DBG_ASSERT( zSlot==-1,"3D xy charts should be deep stacked in model also" );
+ zSlot=-1;
+ xSlot=0;
+ ySlot=0;
+ }
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
+{
+ sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
+ if(!nPolyCount)
+ return;
+
+ drawing::PolyPolygonShape3D aTmp;
+ aTmp.SequenceX.realloc(nPolyCount);
+ aTmp.SequenceY.realloc(nPolyCount);
+ aTmp.SequenceZ.realloc(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];
+
+ 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();
+ if( !nPointCount )
+ continue;
+
+ pOuterTargetX->realloc(nPointCount);
+ pOuterTargetY->realloc(nPointCount);
+ pOuterTargetZ->realloc(nPointCount);
+
+ double* pSourceX = pOuterSourceX->getArray();
+ double* pSourceY = pOuterSourceY->getArray();
+ double* pSourceZ = pOuterSourceZ->getArray();
+
+ double* pTargetX = pOuterTargetX->getArray();
+ double* pTargetY = pOuterTargetY->getArray();
+ double* pTargetZ = pOuterTargetZ->getArray();
+
+ //copy first point
+ *pTargetX=*pSourceX++;
+ *pTargetY=*pSourceY++;
+ *pTargetZ=*pSourceZ++;
+ sal_Int32 nTargetPointCount=1;
+
+ for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
+ {
+ if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
+ , *pSourceX, *pSourceY, *pSourceZ ) )
+ {
+ pTargetX++; pTargetY++; pTargetZ++;
+ *pTargetX=*pSourceX;
+ *pTargetY=*pSourceY;
+ *pTargetZ=*pSourceZ;
+ nTargetPointCount++;
+ }
+ pSourceX++; pSourceY++; pSourceZ++;
+ }
+
+ //free unused space
+ if( nTargetPointCount<nPointCount )
+ {
+ pOuterTargetX->realloc(nTargetPointCount);
+ pOuterTargetY->realloc(nTargetPointCount);
+ pOuterTargetZ->realloc(nTargetPointCount);
+ }
+
+ pOuterSourceX->realloc(0);
+ pOuterSourceY->realloc(0);
+ pOuterSourceZ->realloc(0);
+ }
+
+ //free space
+ rPolyPoly.SequenceX.realloc(nPolyCount);
+ rPolyPoly.SequenceY.realloc(nPolyCount);
+ rPolyPoly.SequenceZ.realloc(nPolyCount);
+
+ rPolyPoly=aTmp;
+}
+
+bool AreaChart::impl_createLine( VDataSeries* pSeries
+ , drawing::PolyPolygonShape3D* pSeriesPoly
+ , PlottingPositionHelper* pPosHelper )
+{
+ //return true if a line was created successfully
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+
+ drawing::PolyPolygonShape3D aPoly;
+ if(CurveStyle_CUBIC_SPLINES==m_eCurveStyle)
+ {
+ drawing::PolyPolygonShape3D aSplinePoly;
+ SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
+ lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
+ Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
+ }
+ else if(CurveStyle_B_SPLINES==m_eCurveStyle)
+ {
+ drawing::PolyPolygonShape3D aSplinePoly;
+ SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
+ lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
+ Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
+ }
+ else
+ {
+ bool bIsClipped = false;
+ if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
+ {
+ // do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP
+ double fFirstY = pSeries->getYValue( 0 );
+ double fLastY = pSeries->getYValue( VSeriesPlotter::getPointCount() - 1 );
+ if( (pSeries->getMissingValueTreatment() != ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
+ {
+ // 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]);
+ // add connector line to last polygon
+ AddPointToPoly( aTmpPoly, aLast, pSeriesPoly->SequenceX.getLength() - 1 );
+ Clipping::clipPolygonAtRectangle( aTmpPoly, aScaledLogicClipDoubleRect, aPoly );
+ bIsClipped = true;
+ }
+ }
+
+ if( !bIsClipped )
+ Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
+ }
+
+ if(!ShapeFactory::hasPolygonAnyLines(aPoly))
+ return false;
+
+ //transformation 3) -> 4)
+ pPosHelper->transformScaledLogicToScene( aPoly );
+
+ //create line:
+ uno::Reference< drawing::XShape > xShape(NULL);
+ if(m_nDimension==3)
+ {
+ double fDepth = this->getTransformedDepth();
+ sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
+ for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
+ {
+ sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
+ 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];
+
+ aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
+ aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
+ aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
+
+ Stripe aStripe( aPoint1, aPoint2, fDepth );
+
+ m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
+ , Stripe( aPoint1, aPoint2, fDepth )
+ , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
+ }
+ }
+ }
+ else //m_nDimension!=3
+ {
+ xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
+ , PolyToPointSequence( aPoly ) );
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfSeries()
+ , PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+ return true;
+}
+
+bool AreaChart::impl_createArea( VDataSeries* pSeries
+ , drawing::PolyPolygonShape3D* pSeriesPoly
+ , drawing::PolyPolygonShape3D* pPreviousSeriesPoly
+ , PlottingPositionHelper* pPosHelper )
+{
+ //return true if an area was created successfully
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ double zValue = pSeries->m_fLogicZPos;
+
+ drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
+ //add second part to the polygon (grounding points or previous series points)
+ if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
+ {
+ if( pPreviousSeriesPoly )
+ addPolygon( aPoly, *pPreviousSeriesPoly );
+ }
+ else if(!pPreviousSeriesPoly)
+ {
+ double fMinX = pSeries->m_fLogicMinX;
+ double fMaxX = pSeries->m_fLogicMaxX;
+ double fY = pPosHelper->getBaseValueY();//logic grounding
+ if( m_nDimension==3 )
+ fY = pPosHelper->getLogicMinY();
+
+ //clip to scale
+ if(fMaxX<pPosHelper->getLogicMinX() || fMinX>pPosHelper->getLogicMaxX())
+ return false;//no visible shape needed
+ pPosHelper->clipLogicValues( &fMinX, &fY, 0 );
+ pPosHelper->clipLogicValues( &fMaxX, 0, 0 );
+
+ //apply scaling
+ {
+ pPosHelper->doLogicScaling( &fMinX, &fY, &zValue );
+ pPosHelper->doLogicScaling( &fMaxX, 0, 0 );
+ }
+
+ AddPointToPoly( aPoly, drawing::Position3D( fMaxX,fY,zValue) );
+ AddPointToPoly( aPoly, drawing::Position3D( fMinX,fY,zValue) );
+ }
+ else
+ {
+ appendPoly( aPoly, *pPreviousSeriesPoly );
+ }
+ ShapeFactory::closePolygon(aPoly);
+
+ //apply clipping
+ {
+ drawing::PolyPolygonShape3D aClippedPoly;
+ Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
+ ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
+ aPoly = aClippedPoly;
+ }
+
+ if(!ShapeFactory::hasPolygonAnyLines(aPoly))
+ return false;
+
+ //transformation 3) -> 4)
+ pPosHelper->transformScaledLogicToScene( aPoly );
+
+ //create area:
+ uno::Reference< drawing::XShape > xShape(NULL);
+ if(m_nDimension==3)
+ {
+ xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
+ , aPoly, this->getTransformedDepth() );
+ }
+ else //m_nDimension!=3
+ {
+ xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
+ , aPoly );
+ }
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfSeries()
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ return true;
+}
+
+void AreaChart::impl_createSeriesShapes()
+{
+ //the polygon shapes for each series need to be created before
+
+ //iterate through all series again to create the series shapes
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+//=============================================================================
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ //=============================================================================
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ //=============================================================================
+
+ std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
+ drawing::PolyPolygonShape3D* pSeriesPoly = NULL;
+
+ //iterate through all series
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ createRegressionCurvesShapes( **aSeriesIter, m_xErrorBarTarget, m_xRegressionCurveEquationTarget,
+ m_pPosHelper->maySkipPointsInRegressionCalculation());
+
+ pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
+ if( m_bArea )
+ {
+ if( !impl_createArea( *aSeriesIter, pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
+ continue;
+ }
+ if( m_bLine )
+ {
+ if( !impl_createLine( *aSeriesIter, pSeriesPoly, pPosHelper ) )
+ continue;
+ }
+ aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+}
+
+namespace
+{
+
+void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >& rZSlots )
+{
+ ::std::vector< ::std::vector< VDataSeriesGroup > > aRet( rZSlots.size() );
+
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZIt( rZSlots.rbegin() );
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZEnd( rZSlots.rend() );
+ for( ; aZIt != aZEnd; ++aZIt )
+ {
+ ::std::vector< VDataSeriesGroup > aXSlot( aZIt->size() );
+
+ ::std::vector< VDataSeriesGroup >::reverse_iterator aXIt( aZIt->rbegin() );
+ ::std::vector< VDataSeriesGroup >::reverse_iterator aXEnd( aZIt->rend() );
+ for( ; aXIt != aXEnd; ++aXIt )
+ aXSlot.push_back(*aXIt);
+
+ aRet.push_back(aXSlot);
+ }
+
+ rZSlots.clear();
+ rZSlots = aRet;
+}
+
+}//anonymous namespace
+
+//better performance for big data
+struct FormerPoint
+{
+ FormerPoint( double fX, double fY, double fZ )
+ : m_fX(fX), m_fY(fY), m_fZ(fZ)
+ {}
+ FormerPoint()
+ {
+ ::rtl::math::setNan( &m_fX );
+ ::rtl::math::setNan( &m_fY );
+ ::rtl::math::setNan( &m_fZ );
+ }
+
+ double m_fX;
+ double m_fY;
+ double m_fZ;
+};
+
+void AreaChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ if( m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
+ lcl_reorderSeries( m_aZSlots );
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ //the text labels should be always on top of the other series shapes
+ //for area chart the error bars should be always on top of the other series shapes
+
+ //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,rtl::OUString() );
+ if( m_bArea )
+ m_xErrorBarTarget = createGroupShape( m_xLogicTarget,rtl::OUString() );
+ else
+ m_xErrorBarTarget = m_xSeriesTarget;
+ m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() );
+ m_xRegressionCurveEquationTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() );
+
+ //---------------------------------------------
+ //check necessary here that different Y axis can not be stacked in the same group? ... hm?
+
+ //update/create information for current group
+ double fLogicZ = 0.5;//as defined
+
+ sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ if(nEndIndex<=0)
+ nEndIndex=1;
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+//=============================================================================
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ std::map< sal_Int32, double > aLogicYSumMap;//one for each different nAttachedAxisIndex
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ //iterate through all x slots in this category to get 100percent sum
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
+ aLogicYSumMap[nAttachedAxisIndex]=0.0;
+
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ double fAdd = pSeries->getYValue( nIndex );
+ if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
+ aLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
+ }
+ }
+ }
+
+//=============================================================================
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ //for the area chart there should be at most one x slot (no side by side stacking available)
+ //attention different: xSlots are always interpreted as independent areas one behind the other: @todo this doesn't work why not???
+ aXSlotIter = aZSlotIter->begin();
+ for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, nX++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ std::map< sal_Int32, double > aLogicYForNextSeriesMap;//one for each different nAttachedAxisIndex
+ //=============================================================================
+ //iterate through all series
+ for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; aSeriesIter++, nSeriesIndex++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ /* #i70133# ignore points outside of series length in standard area
+ charts. Stacked area charts will use missing points as zeros. In
+ standard charts, pSeriesList contains only one series. */
+ if( m_bArea && (pSeriesList->size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
+ continue;
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(*aSeriesIter, m_xSeriesTarget);
+
+ sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+ (*aSeriesIter)->m_fLogicZPos = fLogicZ;
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = (*aSeriesIter)->getXValue(nIndex);
+ double fLogicY = (*aSeriesIter)->getYValue(nIndex);
+
+ if( m_bIsPolarCooSys && m_bArea &&
+ ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) )
+ {
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ {
+ if( pSeriesList->size() == 1 || nSeriesIndex == 0 )
+ {
+ fLogicY = pPosHelper->getLogicMinY();
+ if( !pPosHelper->isMathematicalOrientationY() )
+ fLogicY = pPosHelper->getLogicMaxY();
+ }
+ else
+ fLogicY = 0.0;
+ }
+ }
+
+ if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
+ fLogicY = fabs( fLogicY );
+
+ if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
+ {
+ fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
+ }
+
+ if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
+ || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
+ || ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
+ {
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ {
+ drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
+ sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
+ if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
+ {
+ if( rPolygon.SequenceX[ rIndex ].getLength() )
+ rIndex++; //start a new polygon for the next point if the current poly is not empty
+ }
+ }
+ continue;
+ }
+
+ if( aLogicYForNextSeriesMap.find(nAttachedAxisIndex) == aLogicYForNextSeriesMap.end() )
+ aLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0;
+
+ double fLogicValueForLabeDisplay = fLogicY;
+
+ fLogicY += aLogicYForNextSeriesMap[nAttachedAxisIndex];
+ aLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
+
+ bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+
+ //remind minimal and maximal x values for area 'grounding' points
+ //only for filled area
+ {
+ double& rfMinX = (*aSeriesIter)->m_fLogicMinX;
+ if(!nIndex||fLogicX<rfMinX)
+ rfMinX=fLogicX;
+ double& rfMaxX = (*aSeriesIter)->m_fLogicMaxX;
+ if(!nIndex||fLogicX>rfMaxX)
+ rfMaxX=fLogicX;
+ }
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
+ drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
+ pPosHelper->doLogicScaling( aScaledLogicPosition );
+
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+
+ //better performance for big data
+ FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+ , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ {
+ nSkippedPoints++;
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
+ //
+
+ //store point information for series polygon
+ //for area and/or line (symbols only do not need this)
+ if( isValidPosition(aScaledLogicPosition) )
+ {
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+
+ //prepare clipping for filled net charts
+ if( !bIsVisible && m_bIsPolarCooSys && m_bArea )
+ {
+ drawing::Position3D aClippedPos(aScaledLogicPosition);
+ pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 );
+ if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) )
+ {
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex );
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+ }
+ }
+ }
+
+ //create a single datapoint if point is visible
+ //apply clipping:
+ if( !bIsVisible )
+ continue;
+
+ bool bCreateErrorBar = false;
+ {
+ uno::Reference< beans::XPropertySet > xErrorBarProp(pSeries->getYErrorBarProperties(nIndex));
+ if( xErrorBarProp.is() )
+ {
+ bool bShowPositive = false;
+ bool bShowNegative = false;
+ xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= bShowPositive;
+ xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= bShowNegative;
+ bCreateErrorBar = bShowPositive || bShowNegative;
+ }
+ }
+
+ Symbol* pSymbolProperties = m_bSymbol ? (*aSeriesIter)->getSymbolProperties( nIndex ) : 0;
+ bool bCreateSymbol = pSymbolProperties && (pSymbolProperties->Style != SymbolStyle_NONE);
+
+ if( !bCreateSymbol && !bCreateErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
+ continue;
+
+ //create a group shape for this point and add to the series shape:
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
+ (*aSeriesIter)->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
+ uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+ uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+
+ {
+ nCreatedPoints++;
+
+ //create data point
+ drawing::Direction3D aSymbolSize(0,0,0);
+ if( bCreateSymbol )
+ {
+ if(m_nDimension!=3)
+ {
+ if( pSymbolProperties )
+ {
+ if( pSymbolProperties->Style != SymbolStyle_NONE )
+ {
+ aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
+ aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
+ }
+
+ if( pSymbolProperties->Style == SymbolStyle_STANDARD )
+ {
+ sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
+ m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
+ , aScenePosition, aSymbolSize
+ , nSymbol
+ , pSymbolProperties->BorderColor
+ , pSymbolProperties->FillColor );
+ }
+ else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
+ {
+ m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
+ , aScenePosition , aSymbolSize
+ , pSymbolProperties->Graphic );
+ }
+ //@todo other symbol styles
+ }
+ }
+ }
+ //create error bar
+ createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ LabelAlignment eAlignment = LABEL_ALIGN_TOP;
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_BOTTOM;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_LEFT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_RIGHT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ eAlignment = LABEL_ALIGN_CENTER;
+ //todo implement this different for area charts
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ }
+
+ awt::Point aScreenPosition2D;//get the screen position for the labels
+ sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
+ if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE )
+ {
+ PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper);
+ if( pPolarPosHelper )
+ {
+ PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
+ eAlignment, fLogicX, fLogicY, fLogicZ, nOffset ));
+ }
+ }
+ else
+ {
+ if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
+ nOffset = 0;
+ aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ }
+
+ this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
+ , fLogicValueForLabeDisplay
+ , aLogicYSumMap[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)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+
+ impl_createSeriesShapes();
+
+ /* @todo remove series shapes if empty
+ //remove and delete point-group-shape if empty
+ if(!xSeriesGroupShape_Shapes->getCount())
+ {
+ (*aSeriesIter)->m_xShape.set(NULL);
+ m_xLogicTarget->remove(xSeriesGroupShape_Shape);
+ }
+ */
+
+ //remove and delete series-group-shape if empty
+
+ //... todo
+
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
new file mode 100644
index 000000000000..6924509a62a1
--- /dev/null
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_AREACHART_HXX
+#define _CHART2_AREACHART_HXX
+
+#include "VSeriesPlotter.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class AreaPositionHelper;
+
+class AreaChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ AreaChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bCategoryXAxis, bool bNoArea=false
+ , PlottingPositionHelper* pPlottingPositionHelper=NULL //takes owner ship
+ , bool bConnectLastToFirstPoint=false
+ , bool bExpandIfValuesCloseToBorder=true
+ , sal_Int32 nKeepAspectRatio=-1 //0->no 1->yes other value->automatic
+ , const ::com::sun::star::drawing::Direction3D& rAspectRatio=::com::sun::star::drawing::Direction3D(1,1,1)//only taken into account if nKeepAspectRatio==1
+ );
+ virtual ~AreaChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+ virtual bool keepAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+ virtual ::com::sun::star::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex=-1/*-1 for series symbol*/ );
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ AreaChart();
+
+ void impl_createSeriesShapes();
+ bool impl_createArea( VDataSeries* pSeries
+ , ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
+ , ::com::sun::star::drawing::PolyPolygonShape3D* pPreviousSeriesPoly
+ , PlottingPositionHelper* pPosHelper );
+ bool impl_createLine( VDataSeries* pSeries
+ , ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
+ , PlottingPositionHelper* pPosHelper );
+
+private: //member
+ PlottingPositionHelper* m_pMainPosHelper;
+
+ bool m_bArea;//false -> line or symbol only
+ bool m_bLine;
+ bool m_bSymbol;
+ bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different)
+ bool m_bConnectLastToFirstPoint;//used e.g. for net chart
+ bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts
+
+ sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic
+ ::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
+
+ //Properties for splines:
+ ::com::sun::star::chart2::CurveStyle m_eCurveStyle;
+ sal_Int32 m_nCurveResolution;
+ sal_Int32 m_nSplineOrder;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xSeriesTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xErrorBarTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xTextTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xRegressionCurveEquationTarget;
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
new file mode 100755
index 000000000000..0d7ef403f87d
--- /dev/null
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -0,0 +1,1019 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BarChart.hxx"
+#include "ShapeFactory.hxx"
+//#include "chartview/servicenames_charttypes.hxx"
+//#include "servicenames_coosystems.hxx"
+#include "CommonConverters.hxx"
+#include "ObjectIdentifier.hxx"
+#include "LabelPositionHelper.hxx"
+#include "BarPositionHelper.hxx"
+#include "macros.hxx"
+#include "AxisIndexDefines.hxx"
+#include "Clipping.hxx"
+
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+BarChart::BarChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount )
+ , m_pMainPosHelper( new BarPositionHelper() )
+{
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+
+ try
+ {
+ if( m_xChartTypeModelProps.is() )
+ {
+ m_xChartTypeModelProps->getPropertyValue( C2U( "OverlapSequence" ) ) >>= m_aOverlapSequence;
+ m_xChartTypeModelProps->getPropertyValue( C2U( "GapwidthSequence" ) ) >>= m_aGapwidthSequence;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+BarChart::~BarChart()
+{
+ delete m_pMainPosHelper;
+}
+
+//-------------------------------------------------------------------------
+
+PlottingPositionHelper& BarChart::getPlottingPositionHelper( sal_Int32 nAxisIndex ) const
+{
+ PlottingPositionHelper& rPosHelper = VSeriesPlotter::getPlottingPositionHelper( nAxisIndex );
+
+ BarPositionHelper* pBarPosHelper = dynamic_cast<BarPositionHelper*>(&rPosHelper);
+ if( pBarPosHelper && nAxisIndex >= 0 )
+ {
+ if( nAxisIndex < m_aOverlapSequence.getLength() )
+ pBarPosHelper->setInnerDistance( -m_aOverlapSequence[nAxisIndex]/100.0 );
+ if( nAxisIndex < m_aGapwidthSequence.getLength() )
+ pBarPosHelper->setOuterDistance( m_aGapwidthSequence[nAxisIndex]/100.0 );
+ }
+
+ return rPosHelper;
+}
+
+drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
+{
+ drawing::Direction3D aRet(1.0,1.0,1.0);
+ if( m_nDimension == 3 )
+ {
+ aRet = drawing::Direction3D(1.0,-1.0,1.0);
+ BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) );
+ drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() );
+ if(aScale.DirectionX!=0.0)
+ {
+ double fXSlotCount = 1.0;
+ if(!m_aZSlots.empty())
+ fXSlotCount = m_aZSlots.begin()->size();
+
+ aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getSlotWidth());
+ }
+ else
+ return VSeriesPlotter::getPreferredDiagramAspectRatio();
+ if(aRet.DirectionZ<0.05)
+ aRet.DirectionZ=0.05;
+ if(aRet.DirectionZ>10)
+ aRet.DirectionZ=10;
+
+ if( m_pMainPosHelper && m_pMainPosHelper->isSwapXAndY() )
+ {
+ double fTemp = aRet.DirectionX;
+ aRet.DirectionX = aRet.DirectionY;
+ aRet.DirectionY = fTemp;
+ }
+ }
+ else
+ aRet = drawing::Direction3D(-1,-1,-1);
+ return aRet;
+}
+
+bool BarChart::keepAspectRatio() const
+{
+ if( m_nDimension == 3 )
+ return true;
+ return true;
+}
+
+//-------------------------------------------------------------------------
+// MinimumAndMaximumSupplier
+//-------------------------------------------------------------------------
+
+double BarChart::getMinimumX()
+{
+ if( m_bCategoryXAxis )
+ return 0.5;//first category (index 0) matches with real number 1.0
+ return VSeriesPlotter::getMinimumX();
+}
+double BarChart::getMaximumX()
+{
+ if( m_bCategoryXAxis )
+ {
+ //return category count
+ sal_Int32 nPointCount = getPointCount();
+ return nPointCount+0.5;//first category (index 0) matches with real number 1.0
+ }
+ return VSeriesPlotter::getMaximumX();
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+/*
+APPHELPER_XSERVICEINFO_IMPL(BarChart,CHART2_VIEW_BARCHART_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > BarChart
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART2_VIEW_BARCHART_SERVICE_NAME;
+ return aSNS;
+}
+*/
+/*
+//-----------------------------------------------------------------
+// chart2::XPlotter
+//-----------------------------------------------------------------
+
+ ::rtl::OUString SAL_CALL BarChart
+::getCoordinateSystemTypeID()
+ throw (uno::RuntimeException)
+{
+ return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+}
+*/
+
+awt::Point BarChart::getLabelScreenPositionAndAlignment(
+ LabelAlignment& rAlignment, sal_Int32 nLabelPlacement
+ , double fScaledX, double fScaledLowerYValue, double fScaledUpperYValue, double fScaledZ
+ , double fScaledLowerBarDepth, double fScaledUpperBarDepth, double fBaseValue
+ , BarPositionHelper* pPosHelper
+ ) const
+{
+ double fX = fScaledX;
+ double fY = fScaledUpperYValue;
+ double fZ = fScaledZ;
+ bool bReverse = !pPosHelper->isMathematicalOrientationY();
+ bool bNormalOutside = (!bReverse == !!(fBaseValue < fScaledUpperYValue));
+ double fDepth = fScaledUpperBarDepth;
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ {
+ if( !pPosHelper->isSwapXAndY() )
+ {
+ fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue;
+ rAlignment = LABEL_ALIGN_TOP;
+ if(3==m_nDimension)
+ fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth);
+ }
+ else
+ {
+ fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
+ rAlignment = LABEL_ALIGN_CENTER;
+ DBG_ERROR( "top label placement is not really supported by horizontal bar charts" );
+ }
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ {
+ if(!pPosHelper->isSwapXAndY())
+ {
+ fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue;
+ rAlignment = LABEL_ALIGN_BOTTOM;
+ if(3==m_nDimension)
+ fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth);
+ }
+ else
+ {
+ fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
+ rAlignment = LABEL_ALIGN_CENTER;
+ DBG_ERROR( "bottom label placement is not supported by horizontal bar charts" );
+ }
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ {
+ if( pPosHelper->isSwapXAndY() )
+ {
+ fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue;
+ rAlignment = LABEL_ALIGN_LEFT;
+ if(3==m_nDimension)
+ fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth);
+ }
+ else
+ {
+ fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
+ rAlignment = LABEL_ALIGN_CENTER;
+ DBG_ERROR( "left label placement is not supported by column charts" );
+ }
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ {
+ if( pPosHelper->isSwapXAndY() )
+ {
+ fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue;
+ rAlignment = LABEL_ALIGN_RIGHT;
+ if(3==m_nDimension)
+ fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth);
+ }
+ else
+ {
+ fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
+ rAlignment = LABEL_ALIGN_CENTER;
+ DBG_ERROR( "right label placement is not supported by column charts" );
+ }
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::OUTSIDE:
+ {
+ fY = (fBaseValue < fScaledUpperYValue) ? fScaledUpperYValue : fScaledLowerYValue;
+ if( pPosHelper->isSwapXAndY() )
+ rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
+ else
+ rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
+ if(3==m_nDimension)
+ fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth);
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::INSIDE:
+ {
+ fY = (fBaseValue < fScaledUpperYValue) ? fScaledUpperYValue : fScaledLowerYValue;
+ if( pPosHelper->isSwapXAndY() )
+ rAlignment = bNormalOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+ else
+ rAlignment = bNormalOutside ? LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP;
+ if(3==m_nDimension)
+ fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth);
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN:
+ {
+ fY = (fBaseValue < fScaledUpperYValue) ? fScaledLowerYValue : fScaledUpperYValue;
+ if( pPosHelper->isSwapXAndY() )
+ rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
+ else
+ rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
+ if(3==m_nDimension)
+ fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth);
+ }
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
+ rAlignment = LABEL_ALIGN_CENTER;
+ if(3==m_nDimension)
+ fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0;
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+
+ break;
+ }
+ if(3==m_nDimension)
+ fZ -= fDepth/2.0;
+
+ drawing::Position3D aScenePosition3D( pPosHelper->
+ transformScaledLogicToScene( fX, fY, fZ, true ) );
+ return LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D );
+}
+
+uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
+ , const uno::Reference< beans::XPropertySet >& xObjectProperties
+ , sal_Int32 nGeometry3D )
+{
+ bool bRoundedEdges = true;
+ try
+ {
+ if( xObjectProperties.is() )
+ {
+ sal_Int16 nPercentDiagonal = 0;
+ xObjectProperties->getPropertyValue( C2U( "PercentDiagonal" ) ) >>= nPercentDiagonal;
+ if( nPercentDiagonal < 5 )
+ bRoundedEdges = false;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ uno::Reference< drawing::XShape > xShape(NULL);
+ switch( nGeometry3D )
+ {
+ case DataPointGeometry3D::CYLINDER:
+ xShape = m_pShapeFactory->createCylinder( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree );
+ break;
+ case DataPointGeometry3D::CONE:
+ xShape = m_pShapeFactory->createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
+ break;
+ case DataPointGeometry3D::PYRAMID:
+ xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0
+ , xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ break;
+ case DataPointGeometry3D::CUBOID:
+ default:
+ xShape = m_pShapeFactory->createCube( xTarget, rPosition, rSize
+ , nRotateZAngleHundredthDegree, xObjectProperties
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), bRoundedEdges );
+ return xShape;
+ }
+ if( nGeometry3D != DataPointGeometry3D::PYRAMID )
+ this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ return xShape;
+}
+
+namespace
+{
+bool lcl_hasGeometry3DVariableWidth( sal_Int32 nGeometry3D )
+{
+ bool bRet = false;
+ switch( nGeometry3D )
+ {
+ case DataPointGeometry3D::PYRAMID:
+ case DataPointGeometry3D::CONE:
+ bRet = true;
+ break;
+ case DataPointGeometry3D::CUBOID:
+ case DataPointGeometry3D::CYLINDER:
+ default:
+ bRet = false;
+ break;
+ }
+ return bRet;
+}
+}// end anonymous namespace
+
+void BarChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ if( !pSeries )
+ return;
+ if(m_nDimension==2)
+ {
+ //2ND_AXIS_IN_BARS put series on second scales to different z slot as temporary workaround
+ //this needs to be redesigned if 3d bars are also able to display secondary axes
+
+ sal_Int32 nAxisIndex = pSeries->getAttachedAxisIndex();
+ zSlot = nAxisIndex;
+
+ if( !pSeries->getGroupBarsPerAxis() )
+ zSlot = 0;
+ if(zSlot>=static_cast<sal_Int32>(m_aZSlots.size()))
+ m_aZSlots.resize(zSlot+1);
+ }
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+//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() )
+ {
+ sal_Int32 nAxisIndex = pFirstSeries->getAttachedAxisIndex();
+ sal_Int32 nN = 0;
+ sal_Int32 nUseThisIndex = nAxisIndex;
+ if( nUseThisIndex < 0 || nUseThisIndex >= m_aOverlapSequence.getLength() )
+ nUseThisIndex = 0;
+ for( nN = 0; nN < m_aOverlapSequence.getLength(); nN++ )
+ {
+ if(nN!=nUseThisIndex)
+ m_aOverlapSequence[nN] = m_aOverlapSequence[nUseThisIndex];
+ }
+
+ nUseThisIndex = nAxisIndex;
+ if( nUseThisIndex < 0 || nUseThisIndex >= m_aGapwidthSequence.getLength() )
+ nUseThisIndex = 0;
+ for( nN = 0; nN < m_aGapwidthSequence.getLength(); nN++ )
+ {
+ if(nN!=nUseThisIndex)
+ m_aGapwidthSequence[nN] = m_aGapwidthSequence[nUseThisIndex];
+ }
+ }
+}
+
+void BarChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BarChart is not proper initialized");
+ if(!(m_pShapeFactory&&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)
+
+ //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,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xRegressionCurveTarget(
+ createGroupShape( m_xLogicTarget,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+
+ //---------------------------------------------
+ uno::Reference< drawing::XShapes > xRegressionCurveEquationTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+ //check necessary here that different Y axis can not be stacked in the same group? ... hm?
+
+ double fLogicZ = 0.0;//as defined
+
+ bool bDrawConnectionLines = false;
+ bool bDrawConnectionLinesInited = false;
+ bool bOnlyConnectionLinesForThisPoint = false;
+
+ adaptOverlapAndGapwidthForGroupBarsPerAxis();
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerBarPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+ //(@todo maybe different iteration for breaks in axis ?)
+ sal_Int32 nStartCategoryIndex = m_pMainPosHelper->getStartCategoryIndex(); // inclusive
+ sal_Int32 nEndCategoryIndex = m_pMainPosHelper->getEndCategoryIndex(); //inclusive
+//=============================================================================
+ //iterate through all shown categories
+ for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex < nEndCategoryIndex; nCatIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ //sum up the values for all series in a complete z zlot per attached axis
+ ::std::map< sal_Int32, double > aLogicYSumMap;
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ for( aXSlotIter = aZSlotIter->begin(); aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ sal_Int32 nAttachedAxisIndex = aXSlotIter->getAttachedAxisIndexForFirstSeries();
+ if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
+ aLogicYSumMap[nAttachedAxisIndex]=0.0;
+
+ double fMinimumY = 0.0, fMaximumY = 0.0;
+ aXSlotIter->calculateYMinAndMaxForCategory( nCatIndex
+ , isSeperateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
+
+ if( !::rtl::math::isNan( fMaximumY ) && fMaximumY > 0)
+ aLogicYSumMap[nAttachedAxisIndex] += fMaximumY;
+ if( !::rtl::math::isNan( fMinimumY ) && fMinimumY < 0)
+ aLogicYSumMap[nAttachedAxisIndex] += fabs(fMinimumY);
+ }
+ }
+
+//=============================================================================
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+//=============================================================================
+ //iterate through all x slots in this category
+ double fSlotX=0;
+ for( aXSlotIter = aZSlotIter->begin(); aXSlotIter != aXSlotEnd; aXSlotIter++, fSlotX+=1.0 )
+ {
+ sal_Int32 nAttachedAxisIndex = 0;
+ BarPositionHelper* pPosHelper = m_pMainPosHelper;
+ if( aXSlotIter != aXSlotEnd )
+ {
+ nAttachedAxisIndex = aXSlotIter->getAttachedAxisIndexForFirstSeries();
+ //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
+ pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( nAttachedAxisIndex ) ) );
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ }
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ //update/create information for current group
+ pPosHelper->updateSeriesCount( aZSlotIter->size() );
+ double fLogicBaseWidth = pPosHelper->getSlotWidth();
+
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+
+ // get distance from base value to maximum and minimum
+
+ double fMinimumY = 0.0, fMaximumY = 0.0;
+ aXSlotIter->calculateYMinAndMaxForCategory( nCatIndex
+ , isSeperateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
+
+ double fLogicPositiveYSum = 0.0;
+ if( !::rtl::math::isNan( fMaximumY ) )
+ fLogicPositiveYSum = fMaximumY;
+
+ double fLogicNegativeYSum = 0.0;
+ if( !::rtl::math::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() && pSeriesList->size()<=1 )
+ fBaseValue = pPosHelper->getBaseValueY();
+ double fPositiveLogicYForNextSeries = fBaseValue;
+ double fNegativeLogicYForNextSeries = fBaseValue;
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ aSeriesIter = pSeriesList->begin();
+ //=============================================================================
+ //iterate through all series in this x slot
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ bOnlyConnectionLinesForThisPoint = false;
+
+ if(nCatIndex==nStartCategoryIndex)//do not create a regression line for each point
+ createRegressionCurvesShapes( **aSeriesIter, xRegressionCurveTarget, xRegressionCurveEquationTarget,
+ m_pPosHelper->maySkipPointsInRegressionCalculation());
+
+ if( !bDrawConnectionLinesInited )
+ {
+ bDrawConnectionLines = pSeries->getConnectBars();
+ if( m_nDimension==3 )
+ bDrawConnectionLines = false;
+ if( bDrawConnectionLines && pSeriesList->size()==1 )
+ {
+ //detect wether 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(*aSeriesIter, xSeriesTarget) );
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nCatIndex ), fSlotX );
+ double fLogicBarHeight = (*aSeriesIter)->getYValue( nCatIndex );
+ if( ::rtl::math::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;
+ }
+
+ //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;
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, 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< drawing::XShapes > xPointGroupShape_Shapes = xSeriesGroupShape_Shapes;
+ uno::Reference< beans::XPropertySet > xDataPointProperties( (*aSeriesIter)->getPropertiesOfPoint( nCatIndex ) );
+ sal_Int32 nGeometry3D = DataPointGeometry3D::CUBOID;
+ if(m_nDimension==3) try
+ {
+ xDataPointProperties->getPropertyValue( C2U( "Geometry3D" )) >>= nGeometry3D;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //@todo iterate through all subsystems to create partial points
+ {
+ //@todo select a suiteable 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(NULL,&fLowerYValue,NULL);
+ pSubPosHelper->doLogicScaling(NULL,&fUpperYValue,NULL);
+ //scaling of X and Z is not provided as the created objects should be symmetric in that dimensions
+
+ pSubPosHelper->doLogicScaling(NULL,&fUnclippedUpperYValue,NULL);
+
+ //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] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nCatIndex)
+ &&
+ 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] = 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( (*aSeriesIter)->m_aPolyPolygonShape3D, aLeftUpperPoint );
+ if( isValidPosition(aRightUpperPoint) )
+ AddPointToPoly( (*aSeriesIter)->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(
+ xPointGroupShape_Shapes, aTransformedBottom, aSize, fTopHeight, nRotateZAngleHundredthDegree
+ , xDataPointProperties, nGeometry3D );
+ }
+ else //m_nDimension!=3
+ {
+ //if( bCreateLineInsteadOfComplexGeometryDueToMissingSpace )
+ //{
+ // drawing::PolyPolygonShape3D aPoly;
+ // drawing::Position3D aUpperPoint( fLogicX,fUpperYValue,fLogicZ );
+ // drawing::Position3D aLowerPoint( fLogicX,fLowerYValue,fLogicZ );
+
+ // AddPointToPoly( aPoly, aUpperPoint );
+ // AddPointToPoly( aPoly, aLowerPoint );
+
+ // VLineProperties aLineProperties;
+ // aLineProperties.initFromPropertySet( xDataPointProperties, true /*bUseSeriesPropertyNames*/ );
+ // if( !aLineProperties.isLineVisible() )
+ // {
+ // //todo
+ // //aLineProperties.Color =
+ // }
+
+ // xShape = m_pShapeFactory->createLine2D( xPointGroupShape_Shapes
+ // , PolyToPointSequence(aPoly), &aLineProperties );
+ //}
+
+ drawing::PolyPolygonShape3D aPoly;
+ 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( xPointGroupShape_Shapes, aPoly );
+ this->setMappedProperties( xShape, xDataPointProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ }
+ //set name/classified ObjectID (CID)
+ ShapeFactory::setShapeName(xShape
+ , ObjectIdentifier::createPointCID(
+ (*aSeriesIter)->getPointCID_Stub(),nCatIndex) );
+ }
+
+ //create error bar
+ createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nCatIndex, m_xLogicTarget );
+
+ //------------
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nCatIndex) )
+ {
+ double fLogicSum = aLogicYSumMap[nAttachedAxisIndex];
+
+ LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nCatIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ double fLowerBarDepth = fLogicBarDepth;
+ double fUpperBarDepth = fLogicBarDepth;
+ {
+ double fOuterBarDepth = fLogicBarDepth;
+ if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
+ {
+ fOuterBarDepth = fLogicBarDepth * (fTopHeight)/(fabs(fCompleteHeight));
+ fLowerBarDepth = (fBaseValue < fUpperYValue) ? fabs(fLogicBarDepth) : fabs(fOuterBarDepth);
+ fUpperBarDepth = (fBaseValue < fUpperYValue) ? fabs(fOuterBarDepth) : fabs(fLogicBarDepth);
+ }
+ }
+
+ awt::Point aScreenPosition2D( this->getLabelScreenPositionAndAlignment(
+ eAlignment, nLabelPlacement
+ , fLogicX, fLowerYValue, fUpperYValue, fLogicZ
+ , fLowerBarDepth, fUpperBarDepth, fBaseValue, pPosHelper ));
+ sal_Int32 nOffset = 0;
+ if(LABEL_ALIGN_CENTER!=eAlignment)
+ {
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ if( m_nDimension == 3 )
+ nOffset = 260;
+ }
+ this->createDataLabel( xTextTarget, **aSeriesIter, nCatIndex
+ , fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset );
+ }
+
+ }//end iteration through partial points
+
+ //remove PointGroupShape if empty
+ // if(!xPointGroupShape_Shapes->getCount())
+ // xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ if( bDrawConnectionLines )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+//=============================================================================
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ BarPositionHelper* pPosHelper = m_pMainPosHelper;
+ if( aXSlotIter != aXSlotEnd )
+ {
+ sal_Int32 nAttachedAxisIndex = aXSlotIter->getAttachedAxisIndexForFirstSeries();
+ //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
+ pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( nAttachedAxisIndex ) ) );
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ }
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+//=============================================================================
+ //iterate through all x slots in this category
+ for( double fSlotX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, fSlotX+=1.0 )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ aSeriesIter = pSeriesList->begin();
+//=============================================================================
+ //iterate through all series in this x slot
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+ drawing::PolyPolygonShape3D* pSeriesPoly = &pSeries->m_aPolyPolygonShape3D;
+ if(!ShapeFactory::hasPolygonAnyLines(*pSeriesPoly))
+ continue;
+
+ drawing::PolyPolygonShape3D aPoly;
+ Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
+
+ if(!ShapeFactory::hasPolygonAnyLines(aPoly))
+ continue;
+
+ //transformation 3) -> 4)
+ pPosHelper->transformScaledLogicToScene( aPoly );
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes(
+ getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
+ uno::Reference< drawing::XShape > xShape( m_pShapeFactory->createLine2D(
+ xSeriesGroupShape_Shapes, PolyToPointSequence( aPoly ) ) );
+ this->setMappedProperties( xShape, pSeries->getPropertiesOfSeries()
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ }
+ }
+ }
+ }
+
+ /* @todo remove series shapes if empty
+ //remove and delete point-group-shape if empty
+ if(!xSeriesGroupShape_Shapes->getCount())
+ {
+ (*aSeriesIter)->m_xShape.set(NULL);
+ m_xLogicTarget->remove(xSeriesGroupShape_Shape);
+ }
+ */
+
+ //remove and delete series-group-shape if empty
+
+ //... todo
+
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< bar chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BarChart.hxx b/chart2/source/view/charttypes/BarChart.hxx
new file mode 100644
index 000000000000..403628f7fc43
--- /dev/null
+++ b/chart2/source/view/charttypes/BarChart.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_BARCHART_HXX
+#define _CHART2_BARCHART_HXX
+
+#include "VSeriesPlotter.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class BarPositionHelper;
+
+class BarChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ BarChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount );
+ virtual ~BarChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+ virtual bool keepAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+private: //methods
+ //no default constructor
+ BarChart();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createDataPoint3D_Bar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xObjectProperties
+ , sal_Int32 nGeometry3D );
+
+ ::com::sun::star::awt::Point getLabelScreenPositionAndAlignment(
+ LabelAlignment& rAlignment, sal_Int32 nLabelPlacement
+ , double fScaledX, double fScaledLowerYValue, double fScaledUpperYValue, double fScaledZ
+ , double fScaledLowerBarDepth, double fScaledUpperBarDepth, double fBaseValue
+ , BarPositionHelper* pPosHelper ) const;
+
+ virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const;//nAxisIndex indicates wether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 )
+
+ void adaptOverlapAndGapwidthForGroupBarsPerAxis();
+
+private: //member
+ BarPositionHelper* m_pMainPosHelper;
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aOverlapSequence;
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aGapwidthSequence;
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/BarPositionHelper.cxx b/chart2/source/view/charttypes/BarPositionHelper.cxx
new file mode 100644
index 000000000000..b1735e99de5d
--- /dev/null
+++ b/chart2/source/view/charttypes/BarPositionHelper.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BarPositionHelper.hxx"
+#include "Linear3DTransformation.hxx"
+#include "ViewDefines.hxx"
+#include "CommonConverters.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+BarPositionHelper::BarPositionHelper( bool /* bSwapXAndY */ )
+ : CategoryPositionHelper( 1 )
+{
+}
+
+BarPositionHelper::BarPositionHelper( const BarPositionHelper& rSource )
+ : CategoryPositionHelper( rSource )
+ , PlottingPositionHelper( rSource )
+{
+}
+
+BarPositionHelper::~BarPositionHelper()
+{
+}
+
+PlottingPositionHelper* BarPositionHelper::clone() const
+{
+ BarPositionHelper* pRet = new BarPositionHelper(*this);
+ return pRet;
+}
+
+void BarPositionHelper::updateSeriesCount( double fSeriesCount )
+{
+ m_fSeriesCount = fSeriesCount;
+}
+
+uno::Reference< XTransformation > BarPositionHelper::getTransformationScaledLogicToScene() const
+{
+ //transformation from 2) to 4) //@todo 2) and 4) need a link to a document
+
+ //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 an double )
+
+ if( !m_xTransformationLogicToScene.is() )
+ {
+ ::basegfx::B3DHomMatrix aMatrix;
+
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MinZ = getLogicMinZ();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MaxZ = getLogicMaxZ();
+
+ AxisOrientation nXAxisOrientation = m_aScales[0].Orientation;
+ AxisOrientation nYAxisOrientation = m_aScales[1].Orientation;
+ AxisOrientation nZAxisOrientation = m_aScales[2].Orientation;
+
+ //apply scaling
+ //scaling of x axis is refused/ignored
+ doLogicScaling( NULL, &MinY, &MinZ );
+ doLogicScaling( NULL, &MaxY, &MaxZ);
+
+ if(m_bSwapXAndY)
+ {
+ std::swap(MinX,MinY);
+ std::swap(MaxX,MaxY);
+ std::swap(nXAxisOrientation,nYAxisOrientation);
+ }
+
+ if( AxisOrientation_MATHEMATICAL==nXAxisOrientation )
+ aMatrix.translate(-MinX,0.0,0.0);
+ else
+ aMatrix.translate(-MaxX,0.0,0.0);
+ if( AxisOrientation_MATHEMATICAL==nYAxisOrientation )
+ aMatrix.translate(0.0,-MinY,0.0);
+ else
+ aMatrix.translate(0.0,-MaxY,0.0);
+ if( AxisOrientation_MATHEMATICAL==nZAxisOrientation )
+ aMatrix.translate(0.0,0.0,-MaxZ);//z direction in draw is reverse mathematical direction
+ else
+ aMatrix.translate(0.0,0.0,-MinZ);
+
+ double fWidthX = MaxX - MinX;
+ double fWidthY = MaxY - MinY;
+ double fWidthZ = MaxZ - MinZ;
+
+ double fScaleDirectionX = AxisOrientation_MATHEMATICAL==nXAxisOrientation ? 1.0 : -1.0;
+ double fScaleDirectionY = AxisOrientation_MATHEMATICAL==nYAxisOrientation ? 1.0 : -1.0;
+ double fScaleDirectionZ = AxisOrientation_MATHEMATICAL==nZAxisOrientation ? -1.0 : 1.0;
+
+ aMatrix.scale(fScaleDirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthX
+ , fScaleDirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthY
+ , fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ);
+
+ //if(nDim==2)
+ aMatrix = m_aMatrixScreenToScene*aMatrix;
+
+ m_xTransformationLogicToScene = new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix ),m_bSwapXAndY);
+ }
+ return m_xTransformationLogicToScene;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BarPositionHelper.hxx b/chart2/source/view/charttypes/BarPositionHelper.hxx
new file mode 100644
index 000000000000..32899de62aef
--- /dev/null
+++ b/chart2/source/view/charttypes/BarPositionHelper.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_BARPOSITIONHELPER_HXX
+#define _CHART2_BARPOSITIONHELPER_HXX
+
+#include "PlottingPositionHelper.hxx"
+#include "CategoryPositionHelper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class BarPositionHelper : public CategoryPositionHelper, public PlottingPositionHelper
+{
+public:
+ BarPositionHelper( bool bSwapXAndY=true );
+ BarPositionHelper( const BarPositionHelper& rSource );
+ virtual ~BarPositionHelper();
+
+ virtual PlottingPositionHelper* clone() const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >
+ getTransformationScaledLogicToScene() const;
+
+ void updateSeriesCount( double fSeriesCount ); /*only enter the size of x stacked series*/
+
+ sal_Int32 getStartCategoryIndex() const {
+ //first category (index 0) matches with real number 1.0
+ sal_Int32 nStart = static_cast<sal_Int32>(getLogicMinX() - 0.5);
+ if( nStart < 0 )
+ nStart = 0;
+ return nStart;
+ }
+ sal_Int32 getEndCategoryIndex() const {
+ //first category (index 0) matches with real number 1.0
+ sal_Int32 nEnd = static_cast<sal_Int32>(getLogicMaxX() - 0.5);
+ if( nEnd < 0 )
+ nEnd = 0;
+ return nEnd;
+ }
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
new file mode 100644
index 000000000000..c5454edcc6fd
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "BubbleChart.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "Splines.hxx"
+#include "LabelPositionHelper.hxx"
+#include "Clipping.hxx"
+#include "Stripe.hxx"
+
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <tools/debug.hxx>
+#include <editeng/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount, false )
+ , m_bShowNegativeValues(false)
+ , m_bBubbleSizeAsArea(true)
+ , m_fBubbleSizeScaling(1.0)
+ , m_fMaxLogicBubbleSize( 0.0 )
+ , m_fBubbleSizeFactorToScreen( 1.0 )
+{
+ if( !m_pMainPosHelper )
+ m_pMainPosHelper = new PlottingPositionHelper();
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+}
+
+BubbleChart::~BubbleChart()
+{
+ delete m_pMainPosHelper;
+}
+
+void BubbleChart::calculateMaximumLogicBubbleSize()
+{
+ double fMaxSize = 0.0;
+
+ sal_Int32 nStartIndex = 0;
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ double fSize = pSeries->getBubble_Size( nIndex );
+ if( m_bShowNegativeValues )
+ fSize = fabs(fSize);
+ if( fSize > fMaxSize )
+ fMaxSize = fSize;
+ }
+ }
+ }
+ }
+
+ m_fMaxLogicBubbleSize = fMaxSize;
+}
+
+void BubbleChart::calculateBubbleSizeScalingFactor()
+{
+ double fLogicZ=0.5;
+ 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_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMinPos ) );
+ awt::Point aScreenMaxPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMaxPos ) );
+
+ sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
+ sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
+
+ sal_Int32 nMinExtend = std::min( nWidth, nHeight );
+ m_fBubbleSizeFactorToScreen = nMinExtend * 0.25;//max bubble size is 25 percent of diagram size
+}
+
+drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize )
+{
+ drawing::Direction3D aRet(0,0,0);
+
+ if( ::rtl::math::isNan(fLogicSize) || ::rtl::math::isInf(fLogicSize) )
+ return aRet;
+
+ if( m_bShowNegativeValues )
+ fLogicSize = fabs(fLogicSize);
+
+ double fMaxSize = m_fMaxLogicBubbleSize;
+
+ double fMaxRadius = fMaxSize;
+ double fRaduis = fLogicSize;
+ if( m_bBubbleSizeAsArea )
+ {
+ fMaxRadius = sqrt( fMaxSize / F_PI );
+ fRaduis = sqrt( fLogicSize / F_PI );
+ }
+
+ aRet.DirectionX = m_fBubbleSizeScaling * m_fBubbleSizeFactorToScreen * fRaduis / fMaxRadius;
+ aRet.DirectionY = aRet.DirectionX;
+
+ return aRet;
+}
+
+bool BubbleChart::isExpandIfValuesCloseToBorder( sal_Int32 /*nDimensionIndex*/ )
+{
+ return true;
+}
+
+bool BubbleChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
+{
+ return false;
+}
+
+//-----------------------------------------------------------------
+
+LegendSymbolStyle BubbleChart::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_CIRCLE;
+}
+
+drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const
+{
+ return drawing::Direction3D(-1,-1,-1);
+}
+
+void BubbleChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+//better performance for big data
+struct FormerPoint
+{
+ FormerPoint( double fX, double fY, double fZ )
+ : m_fX(fX), m_fY(fY), m_fZ(fZ)
+ {}
+ FormerPoint()
+ {
+ ::rtl::math::setNan( &m_fX );
+ ::rtl::math::setNan( &m_fY );
+ ::rtl::math::setNan( &m_fZ );
+ }
+
+ double m_fX;
+ double m_fY;
+ double m_fZ;
+};
+
+void BubbleChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
+ if(!(m_pShapeFactory&&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,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+ //update/create information for current group
+ double fLogicZ = 0.5;//as defined
+
+ sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ if(nEndIndex<=0)
+ nEndIndex=1;
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+ calculateMaximumLogicBubbleSize();
+ calculateBubbleSizeScalingFactor();
+ if( m_fMaxLogicBubbleSize <= 0 || m_fBubbleSizeFactorToScreen <= 0 )
+ return;
+
+//=============================================================================
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ aXSlotIter = aZSlotIter->begin();
+ for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, nX++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ //=============================================================================
+ //iterate through all series
+ for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; aSeriesIter++, nSeriesIndex++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
+
+ sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pSeries->getXValue(nIndex);
+ double fLogicY = pSeries->getYValue(nIndex);
+ double fBubbleSize = pSeries->getBubble_Size( nIndex );
+
+ if( !m_bShowNegativeValues && fBubbleSize<0.0 )
+ continue;
+
+ if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) )
+ continue;
+
+ if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
+ || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) )
+ continue;
+
+ bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
+ drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
+ pPosHelper->doLogicScaling( aScaledLogicPosition );
+
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+
+ //better performance for big data
+ FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+ , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ {
+ nSkippedPoints++;
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
+
+ //create a single datapoint if point is visible
+ if( !bIsVisible )
+ continue;
+
+ //create a group shape for this point and add to the series shape:
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
+ uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+ uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+
+ {
+ nCreatedPoints++;
+
+ //create data point
+ drawing::Direction3D aSymbolSize = transformToScreenBubbleSize( fBubbleSize );
+ if(m_nDimension!=3)
+ {
+ uno::Reference<drawing::XShape> xShape;
+ xShape = m_pShapeFactory->createCircle2D( xPointGroupShape_Shapes
+ , aScenePosition, aSymbolSize );
+
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfPoint( nIndex )
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ LabelAlignment eAlignment = LABEL_ALIGN_TOP;
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_BOTTOM;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_LEFT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_RIGHT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ eAlignment = LABEL_ALIGN_CENTER;
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ }
+
+
+ awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ sal_Int32 nOffset = 0;
+ if(LABEL_ALIGN_CENTER!=eAlignment)
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fBubbleSize, fBubbleSize, aScreenPosition2D, eAlignment, nOffset );
+ }
+ }
+
+ //remove PointGroupShape if empty
+ if(!xPointGroupShape_Shapes->getCount())
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
new file mode 100644
index 000000000000..9c04ce8d3719
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_BUBBLECHART_HXX
+#define _CHART2_BUBBLECHART_HXX
+
+#include "VSeriesPlotter.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BubbleChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ BubbleChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount );
+ virtual ~BubbleChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ BubbleChart();
+
+ void calculateMaximumLogicBubbleSize();
+ void calculateBubbleSizeScalingFactor();
+
+ com::sun::star::drawing::Direction3D transformToScreenBubbleSize( double fLogicSize );
+
+private: //member
+
+ bool m_bShowNegativeValues;//input parameter
+ bool m_bBubbleSizeAsArea;//input parameter
+ double m_fBubbleSizeScaling;//input parameter
+
+ double m_fMaxLogicBubbleSize;//calculated values
+ double m_fBubbleSizeFactorToScreen;//calculated values
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
new file mode 100644
index 000000000000..ddfe50deed2f
--- /dev/null
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -0,0 +1,398 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "CandleStickChart.hxx"
+#include "ShapeFactory.hxx"
+//#include "chartview/servicenames_charttypes.hxx"
+//#include "servicenames_coosystems.hxx"
+#include "CommonConverters.hxx"
+#include "ObjectIdentifier.hxx"
+#include "LabelPositionHelper.hxx"
+#include "BarPositionHelper.hxx"
+#include "macros.hxx"
+#include "VLegendSymbolFactory.hxx"
+#include "FormattedStringHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+#include <editeng/unoprnms.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+CandleStickChart::CandleStickChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount )
+ , m_pMainPosHelper( new BarPositionHelper() )
+{
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+}
+
+CandleStickChart::~CandleStickChart()
+{
+ delete m_pMainPosHelper;
+}
+
+//-------------------------------------------------------------------------
+// MinimumAndMaximumSupplier
+//-------------------------------------------------------------------------
+
+double CandleStickChart::getMinimumX()
+{
+ if( m_bCategoryXAxis )
+ return 0.5;//first category (index 0) matches with real number 1.0
+ return VSeriesPlotter::getMinimumX();
+}
+double CandleStickChart::getMaximumX()
+{
+ if( m_bCategoryXAxis )
+ {
+ //return category count
+ sal_Int32 nPointCount = getPointCount();
+ return nPointCount+0.5;//first category (index 0) matches with real number 1.0
+ }
+ return VSeriesPlotter::getMaximumX();
+}
+bool CandleStickChart::isSeperateStackingForDifferentSigns( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+//-----------------------------------------------------------------
+//-----------------------------------------------------------------
+//-----------------------------------------------------------------
+
+LegendSymbolStyle CandleStickChart::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_VERTICAL_LINE;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+/*
+APPHELPER_XSERVICEINFO_IMPL(CandleStickChart,CHART2_VIEW_CANDLESTICKCHART_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > CandleStickChart
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART2_VIEW_CANDLESTICKCHART_SERVICE_NAME;
+ return aSNS;
+}
+*/
+/*
+//-----------------------------------------------------------------
+// chart2::XPlotter
+//-----------------------------------------------------------------
+
+ ::rtl::OUString SAL_CALL CandleStickChart
+::getCoordinateSystemTypeID()
+ throw (uno::RuntimeException)
+{
+ return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
+}
+*/
+
+drawing::Direction3D CandleStickChart::getPreferredDiagramAspectRatio() const
+{
+ return drawing::Direction3D(-1,-1,-1);
+}
+
+void CandleStickChart::addSeries( VDataSeries* pSeries, sal_Int32 /* zSlot */, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ //ignore y stacking for candle stick chart
+ VSeriesPlotter::addSeries( pSeries, 0, xSlot, ySlot );
+}
+
+void CandleStickChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ if( m_nDimension!=2 )
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"CandleStickChart is not proper initialized");
+ if(!(m_pShapeFactory&&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,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xLossTarget(
+ createGroupShape( m_xLogicTarget, ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_DATA_STOCK_LOSS, rtl::OUString() )));
+ uno::Reference< drawing::XShapes > xGainTarget(
+ createGroupShape( m_xLogicTarget, ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_DATA_STOCK_GAIN, rtl::OUString() )));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+ //---------------------------------------------
+ //check necessary here that different Y axis can not be stacked in the same group? ... hm?
+
+ bool bJapaneseStyle=true;//@todo is this the correct default?
+ bool bShowFirst = true;//is only important if bJapaneseStyle == false
+ tNameSequence aWhiteBox_Names, aBlackBox_Names;
+ tAnySequence aWhiteBox_Values, aBlackBox_Values;
+ try
+ {
+ if( m_xChartTypeModelProps.is() )
+ {
+ m_xChartTypeModelProps->getPropertyValue( C2U( "ShowFirst" ) ) >>= bShowFirst;
+
+ uno::Reference< beans::XPropertySet > xWhiteDayProps(0);
+ uno::Reference< beans::XPropertySet > xBlackDayProps(0);
+ m_xChartTypeModelProps->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle;
+ m_xChartTypeModelProps->getPropertyValue( C2U( "WhiteDay" ) ) >>= xWhiteDayProps;
+ m_xChartTypeModelProps->getPropertyValue( C2U( "BlackDay" ) ) >>= xBlackDayProps;
+
+ tPropertyNameValueMap aWhiteBox_Map;
+ PropertyMapper::getValueMap( aWhiteBox_Map, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xWhiteDayProps );
+ PropertyMapper::getMultiPropertyListsFromValueMap( aWhiteBox_Names, aWhiteBox_Values, aWhiteBox_Map );
+
+ tPropertyNameValueMap aBlackBox_Map;
+ PropertyMapper::getValueMap( aBlackBox_Map, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xBlackDayProps );
+ PropertyMapper::getMultiPropertyListsFromValueMap( aBlackBox_Names, aBlackBox_Values, aBlackBox_Map );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //(@todo maybe different iteration for breaks in axis ?)
+ sal_Int32 nStartCategoryIndex = m_pMainPosHelper->getStartCategoryIndex(); // inclusive
+ sal_Int32 nEndCategoryIndex = m_pMainPosHelper->getEndCategoryIndex(); //inclusive
+//=============================================================================
+ //iterate through all shown categories
+ for( sal_Int32 nIndex = nStartCategoryIndex; nIndex < nEndCategoryIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+//=============================================================================
+ for( sal_Int32 nZ=0; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ sal_Int32 nAttachedAxisIndex = 0;
+ BarPositionHelper* pPosHelper = m_pMainPosHelper;
+ if( aXSlotIter != aXSlotEnd )
+ {
+ nAttachedAxisIndex = aXSlotIter->getAttachedAxisIndexForFirstSeries();
+ //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
+ pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( nAttachedAxisIndex ) ) );
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ }
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ //update/create information for current group
+ pPosHelper->updateSeriesCount( aZSlotIter->size() );
+//=============================================================================
+ //iterate through all x slots in this category
+ for( double fSlotX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, fSlotX+=1.0 )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ aSeriesIter = pSeriesList->begin();
+ //=============================================================================
+ //iterate through all series in this x slot
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nIndex ), fSlotX );
+ double fY_First = (*aSeriesIter)->getY_First( nIndex );
+ double fY_Last = (*aSeriesIter)->getY_Last( nIndex );
+ double fY_Min = (*aSeriesIter)->getY_Min( nIndex );
+ double fY_Max = (*aSeriesIter)->getY_Max( nIndex );
+
+ bool bBlack=false;
+ if(fY_Last<=fY_First)
+ {
+ std::swap(fY_First,fY_Last);
+ bBlack=true;
+ }
+ if(fY_Max<fY_Min)
+ std::swap(fY_Min,fY_Max);
+ //transformation 3) -> 4)
+ double fHalfWidth = pPosHelper->getSlotWidth()/2.0;
+ drawing::Position3D aPosLeftFirst( pPosHelper->transformLogicToScene( fLogicX-fHalfWidth, fY_First ,0 ,true ) );
+ drawing::Position3D aPosRightLast( pPosHelper->transformLogicToScene( fLogicX+fHalfWidth, fY_Last ,0 ,true ) );
+ drawing::Position3D aPosMiddleFirst( pPosHelper->transformLogicToScene( fLogicX, fY_First ,0 ,true ) );
+ drawing::Position3D aPosMiddleLast( pPosHelper->transformLogicToScene( fLogicX, fY_Last ,0 ,true ) );
+ drawing::Position3D aPosMiddleMinimum( pPosHelper->transformLogicToScene( fLogicX, fY_Min ,0 ,true ) );
+ drawing::Position3D aPosMiddleMaximum( pPosHelper->transformLogicToScene( fLogicX, fY_Max ,0 ,true ) );
+
+ uno::Reference< drawing::XShapes > xLossGainTarget( xGainTarget );
+ if(bBlack)
+ xLossGainTarget = xLossTarget;
+
+ uno::Reference< beans::XPropertySet > xPointProp( (*aSeriesIter)->getPropertiesOfPoint( nIndex ));
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(0);
+ {
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID( (*aSeriesIter)->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes( getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
+ xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
+ }
+
+ //create min-max line
+ if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) )
+ {
+ uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.PolyLineShape" ) ) ), uno::UNO_QUERY );
+ xPointGroupShape_Shapes->add(xShape);
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ if(xProp.is())
+ {
+ drawing::PolyPolygonShape3D aPoly;
+ sal_Int32 nLineIndex =0;
+ AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex);
+ AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex);
+ xProp->setPropertyValue( C2U( UNO_NAME_POLYPOLYGON ), uno::makeAny( PolyToPointSequence(aPoly) ) );
+ }
+ this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
+ }
+
+ //create first-last shape
+ if(bJapaneseStyle && isValidPosition(aPosLeftFirst) && isValidPosition(aPosRightLast) )
+ {
+ uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.RectangleShape" ) ) ), uno::UNO_QUERY );
+ xLossGainTarget->add(xShape);
+
+ xShape->setPosition( Position3DToAWTPoint( aPosLeftFirst ) );
+ drawing::Direction3D aDiff = aPosRightLast-aPosLeftFirst;
+ awt::Size aAWTSize( Direction3DToAWTSize( aDiff ));
+ // workaround for bug in drawing: if height is 0 the box gets infinitely large
+ if( aAWTSize.Height == 0 )
+ aAWTSize.Height = 1;
+ xShape->setSize( aAWTSize );
+
+ 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 );
+ }
+ }
+ else
+ {
+ drawing::PolyPolygonShape3D aPoly;
+
+ sal_Int32 nLineIndex = 0;
+ if( bShowFirst && pPosHelper->isLogicVisible( fLogicX, fY_First ,0 )
+ && isValidPosition(aPosLeftFirst) && isValidPosition(aPosMiddleFirst) )
+ {
+ AddPointToPoly( aPoly, aPosLeftFirst, nLineIndex );
+ AddPointToPoly( aPoly, aPosMiddleFirst, nLineIndex++ );
+ }
+ if( pPosHelper->isLogicVisible( fLogicX, fY_Last ,0 )
+ && isValidPosition(aPosMiddleLast) && isValidPosition(aPosRightLast) )
+ {
+ AddPointToPoly( aPoly, aPosMiddleLast, nLineIndex );
+ AddPointToPoly( aPoly, aPosRightLast, nLineIndex );
+ }
+
+ if( aPoly.SequenceX.getLength() )
+ {
+ uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.PolyLineShape" ) ) ), uno::UNO_QUERY );
+ xPointGroupShape_Shapes->add(xShape);
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ if(xProp.is())
+ {
+ xProp->setPropertyValue( C2U( UNO_NAME_POLYPOLYGON ), uno::makeAny( PolyToPointSequence(aPoly) ) );
+ this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
+ }
+ }
+ }
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ if(isValidPosition(aPosMiddleFirst))
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fY_First, 1.0, Position3DToAWTPoint(aPosMiddleFirst), LABEL_ALIGN_LEFT_BOTTOM );
+ if(isValidPosition(aPosMiddleLast))
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fY_Last, 1.0, Position3DToAWTPoint(aPosMiddleLast), LABEL_ALIGN_RIGHT_TOP );
+ if(isValidPosition(aPosMiddleMinimum))
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fY_Min, 1.0, Position3DToAWTPoint(aPosMiddleMinimum), LABEL_ALIGN_BOTTOM );
+ if(isValidPosition(aPosMiddleMaximum))
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fY_Max, 1.0, Position3DToAWTPoint(aPosMiddleMaximum), LABEL_ALIGN_TOP );
+ }
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ /* @todo remove series shapes if empty
+ //remove and delete point-group-shape if empty
+ if(!xSeriesGroupShape_Shapes->getCount())
+ {
+ (*aSeriesIter)->m_xShape.set(NULL);
+ m_xLogicTarget->remove(xSeriesGroupShape_Shape);
+ }
+ */
+
+ //remove and delete series-group-shape if empty
+
+ //... todo
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx b/chart2/source/view/charttypes/CandleStickChart.hxx
new file mode 100644
index 000000000000..60018dbe8621
--- /dev/null
+++ b/chart2/source/view/charttypes/CandleStickChart.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CANDLESTICKCHART_HXX
+#define _CHART2_CANDLESTICKCHART_HXX
+
+#include "VSeriesPlotter.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class BarPositionHelper;
+
+class CandleStickChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ CandleStickChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount );
+ virtual ~CandleStickChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+private: //methods
+ //no default constructor
+ CandleStickChart();
+
+private: //member
+ BarPositionHelper* m_pMainPosHelper;
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/CategoryPositionHelper.cxx b/chart2/source/view/charttypes/CategoryPositionHelper.cxx
new file mode 100644
index 000000000000..d43fd0856e02
--- /dev/null
+++ b/chart2/source/view/charttypes/CategoryPositionHelper.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "CategoryPositionHelper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+//using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+CategoryPositionHelper::CategoryPositionHelper( double fSeriesCount, double fCategoryWidth )
+ : m_fSeriesCount(fSeriesCount)
+ , m_fCategoryWidth(fCategoryWidth)
+ , m_fInnerDistance(0.0)
+ , m_fOuterDistance(1.0)
+{
+}
+
+CategoryPositionHelper::CategoryPositionHelper( const CategoryPositionHelper& rSource )
+ : m_fSeriesCount( rSource.m_fSeriesCount )
+ , m_fCategoryWidth( rSource.m_fCategoryWidth )
+ , m_fInnerDistance( rSource.m_fInnerDistance )
+ , m_fOuterDistance( rSource.m_fOuterDistance )
+{
+}
+
+CategoryPositionHelper::~CategoryPositionHelper()
+{
+}
+
+double CategoryPositionHelper::getSlotWidth() const
+{
+ double fWidth = m_fCategoryWidth /
+ ( m_fSeriesCount
+ + m_fOuterDistance
+ + m_fInnerDistance*( m_fSeriesCount - 1.0) );
+ return fWidth;
+}
+
+double CategoryPositionHelper::getSlotPos( double fCategoryX, double fSeriesNumber ) const
+{
+ //the returned position is in the middle of the rect
+ //fSeriesNumber 0...n-1
+ double fPos = fCategoryX - (m_fCategoryWidth/2.0)
+ + (m_fOuterDistance/2.0 + fSeriesNumber*(1.0+m_fInnerDistance)) * getSlotWidth()
+ + getSlotWidth()/2.0;
+
+ return fPos;
+}
+
+void CategoryPositionHelper::setInnerDistance( double fInnerDistance )
+{
+ if( fInnerDistance < -1.0 )
+ fInnerDistance = -1.0;
+ if( fInnerDistance > 1.0 )
+ fInnerDistance = 1.0;
+ m_fInnerDistance = fInnerDistance;
+}
+
+void CategoryPositionHelper::setOuterDistance( double fOuterDistance )
+{
+ if( fOuterDistance < 0.0 )
+ fOuterDistance = 0.0;
+ if( fOuterDistance > 6.0 )
+ fOuterDistance = 6.0;
+ m_fOuterDistance = fOuterDistance;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/CategoryPositionHelper.hxx b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
new file mode 100644
index 000000000000..08cb1978faa1
--- /dev/null
+++ b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CATEGORYPOSITIONHELPER_HXX
+#define _CHART2_CATEGORYPOSITIONHELPER_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class CategoryPositionHelper
+{
+public:
+ CategoryPositionHelper( double fSeriesCount, double CategoryWidth = 1.0);
+ CategoryPositionHelper( const CategoryPositionHelper& rSource );
+ virtual ~CategoryPositionHelper();
+
+ double getSlotWidth() const;
+ double getSlotPos( double fCategoryX, double fSeriesNumber ) const;
+
+ //Distance between two neighboring bars in same category, seen relative to width of the bar
+ void setInnerDistance( double fInnerDistance );
+
+ //Distance between two neighboring bars in different category, seen relative to width of the bar:
+ 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
+ //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
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
new file mode 100644
index 000000000000..eee13848b11b
--- /dev/null
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -0,0 +1,897 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "PieChart.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "PolarLabelPositionHelper.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart2/XColorScheme.hpp>
+
+#include <com/sun/star/container/XChild.hpp>
+
+//#include "chartview/servicenames_charttypes.hxx"
+//#include "servicenames_coosystems.hxx"
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+class PiePositionHelper : public PolarPlottingPositionHelper
+{
+public:
+ PiePositionHelper( NormalAxis eNormalAxis, double fAngleDegreeOffset );
+ virtual ~PiePositionHelper();
+
+ bool getInnerAndOuterRadius( double fCategoryX, double& fLogicInnerRadius, double& fLogicOuterRadius, bool bUseRings, double fMaxOffset ) const;
+
+public:
+ //Distance between different category rings, seen relative to width of a ring:
+ double m_fRingDistance; //>=0 m_fRingDistance=1 --> distance == width
+};
+
+PiePositionHelper::PiePositionHelper( NormalAxis eNormalAxis, double fAngleDegreeOffset )
+ : PolarPlottingPositionHelper(eNormalAxis)
+ , m_fRingDistance(0.0)
+{
+ m_fRadiusOffset = 0.0;
+ m_fAngleDegreeOffset = fAngleDegreeOffset;
+}
+
+PiePositionHelper::~PiePositionHelper()
+{
+}
+
+bool PiePositionHelper::getInnerAndOuterRadius( double fCategoryX
+ , double& fLogicInnerRadius, double& fLogicOuterRadius
+ , bool bUseRings, double fMaxOffset ) const
+{
+ if( !bUseRings )
+ fCategoryX = 1.0;
+
+ bool bIsVisible = true;
+ double fLogicInner = fCategoryX -0.5+m_fRingDistance/2.0;
+ double fLogicOuter = fCategoryX +0.5-m_fRingDistance/2.0;
+
+ if( !isMathematicalOrientationRadius() )
+ {
+ //in this case the given getMaximumX() was not corrcect instead the minimum should have been smaller by fMaxOffset
+ //but during getMaximumX and getMimumX we do not know the axis orientation
+ fLogicInner += fMaxOffset;
+ fLogicOuter += fMaxOffset;
+ }
+
+ if( fLogicInner >= getLogicMaxX() )
+ return false;
+ if( fLogicOuter <= getLogicMinX() )
+ return false;
+
+ if( fLogicInner < getLogicMinX() )
+ fLogicInner = getLogicMinX();
+ if( fLogicOuter > getLogicMaxX() )
+ fLogicOuter = getLogicMaxX();
+
+ fLogicInnerRadius = fLogicInner;
+ fLogicOuterRadius = fLogicOuter;
+ if( !isMathematicalOrientationRadius() )
+ std::swap(fLogicInnerRadius,fLogicOuterRadius);
+ return bIsVisible;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bExcludingPositioning )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount )
+ , m_pPosHelper( new PiePositionHelper( NormalAxis_Z, (m_nDimension==3)?0.0:90.0 ) )
+ , m_bUseRings(false)
+ , m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
+{
+ ::rtl::math::setNan(&m_fMaxOffset);
+
+ PlotterBase::m_pPosHelper = m_pPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pPosHelper;
+ m_pPosHelper->m_fRadiusOffset = 0.0;
+ m_pPosHelper->m_fRingDistance = 0.0;
+
+ uno::Reference< beans::XPropertySet > xChartTypeProps( xChartTypeModel, uno::UNO_QUERY );
+ if( xChartTypeProps.is() ) try
+ {
+ xChartTypeProps->getPropertyValue( C2U( "UseRings" )) >>= m_bUseRings;
+ if( m_bUseRings )
+ {
+ m_pPosHelper->m_fRadiusOffset = 1.0;
+ if( nDimensionCount==3 )
+ m_pPosHelper->m_fRingDistance = 0.1;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+PieChart::~PieChart()
+{
+ delete m_pPosHelper;
+}
+
+//-----------------------------------------------------------------
+
+void SAL_CALL PieChart::setScales( const uno::Sequence< ExplicitScaleData >& rScales
+ , sal_Bool /* bSwapXAndYAxis */ )
+ throw (uno::RuntimeException)
+{
+ DBG_ASSERT(m_nDimension<=rScales.getLength(),"Dimension of Plotter does not fit two dimension of given scale sequence");
+ m_pPosHelper->setScales( rScales, true );
+}
+
+//-----------------------------------------------------------------
+
+drawing::Direction3D PieChart::getPreferredDiagramAspectRatio() const
+{
+ if( m_nDimension == 3 )
+ return drawing::Direction3D(1,1,0.25);
+ return drawing::Direction3D(1,1,1);
+}
+
+bool PieChart::keepAspectRatio() const
+{
+ if( m_nDimension == 3 )
+ return false;
+ return true;
+}
+
+bool PieChart::shouldSnapRectToUsedArea()
+{
+ return true;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+//-----------------------------------------------------------------
+/*
+APPHELPER_XSERVICEINFO_IMPL(PieChart,CHART2_VIEW_PIECHART_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > PieChart
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART2_VIEW_PIECHART_SERVICE_NAME;
+ return aSNS;
+}
+*/
+
+uno::Reference< drawing::XShape > PieChart::createDataPoint(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const uno::Reference< beans::XPropertySet >& xObjectProperties
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , double fLogicZ, double fDepth, double fExplodePercentage
+ , tPropertyNameValueMap* pOverwritePropertiesMap )
+{
+ //---------------------------
+ //transform position:
+ drawing::Direction3D aOffset;
+ if( !::rtl::math::approxEqual( fExplodePercentage, 0.0 ) )
+ {
+ double fAngle = fUnitCircleStartAngleDegree + fUnitCircleWidthAngleDegree/2.0;
+ double fRadius = (fUnitCircleOuterRadius-fUnitCircleInnerRadius)*fExplodePercentage;
+ drawing::Position3D aOrigin = m_pPosHelper->transformUnitCircleToScene( 0, 0, fLogicZ );
+ drawing::Position3D aNewOrigin = m_pPosHelper->transformUnitCircleToScene( fAngle, fRadius, fLogicZ );
+ aOffset = aNewOrigin - aOrigin;
+ }
+
+ //---------------------------
+ //create point
+ uno::Reference< drawing::XShape > xShape(0);
+ if(m_nDimension==3)
+ {
+ xShape = m_pShapeFactory->createPieSegment( xTarget
+ , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
+ , fUnitCircleInnerRadius, fUnitCircleOuterRadius
+ , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() )
+ , fDepth );
+ }
+ else
+ {
+ xShape = m_pShapeFactory->createPieSegment2D( xTarget
+ , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
+ , fUnitCircleInnerRadius, fUnitCircleOuterRadius
+ , aOffset, B3DHomMatrixToHomogenMatrix( m_pPosHelper->getUnitCartesianToScene() ) );
+ }
+ this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), pOverwritePropertiesMap );
+ return xShape;
+}
+
+void PieChart::addSeries( VDataSeries* pSeries, sal_Int32 /* zSlot */, sal_Int32 /* xSlot */, sal_Int32 /* ySlot */ )
+{
+ VSeriesPlotter::addSeries( pSeries, 0, -1, 0 );
+}
+
+double PieChart::getMinimumX()
+{
+ return 0.5;
+}
+double PieChart::getMaxOffset()
+{
+ if (!::rtl::math::isNan(m_fMaxOffset))
+ // Value already cached. Use it.
+ return m_fMaxOffset;
+
+ m_fMaxOffset = 0.0;
+ if( m_aZSlots.size()<=0 )
+ return m_fMaxOffset;
+ if( m_aZSlots[0].size()<=0 )
+ return m_fMaxOffset;
+
+ const ::std::vector< VDataSeries* >& rSeriesList( m_aZSlots[0][0].m_aSeriesVector );
+ if( rSeriesList.size()<=0 )
+ return m_fMaxOffset;
+
+ VDataSeries* pSeries = rSeriesList[0];
+ uno::Reference< beans::XPropertySet > xSeriesProp( pSeries->getPropertiesOfSeries() );
+ if( !xSeriesProp.is() )
+ return m_fMaxOffset;
+
+ double fExplodePercentage=0.0;
+ xSeriesProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage;
+ if(fExplodePercentage>m_fMaxOffset)
+ m_fMaxOffset=fExplodePercentage;
+
+ if(!m_bSizeExcludesLabelsAndExplodedSegments)
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint(aAttributedDataPointIndexList[nN]) );
+ if(xPointProp.is())
+ {
+ fExplodePercentage=0.0;
+ xPointProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage;
+ if(fExplodePercentage>m_fMaxOffset)
+ m_fMaxOffset=fExplodePercentage;
+ }
+ }
+ }
+ }
+ return m_fMaxOffset;
+}
+double PieChart::getMaximumX()
+{
+ double fMaxOffset = getMaxOffset();
+ if( m_aZSlots.size()>0 && m_bUseRings)
+ return m_aZSlots[0].size()+0.5+fMaxOffset;
+ return 1.5+fMaxOffset;
+}
+double PieChart::getMinimumYInRange( double /* fMinimumX */, double /* fMaximumX */, sal_Int32 /* nAxisIndex */ )
+{
+ return 0.0;
+}
+
+double PieChart::getMaximumYInRange( double /* fMinimumX */, double /* fMaximumX */, sal_Int32 /* nAxisIndex */ )
+{
+ return 1.0;
+}
+
+bool PieChart::isExpandBorderToIncrementRhythm( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+bool PieChart::isExpandIfValuesCloseToBorder( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+bool PieChart::isExpandWideValuesToZero( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+bool PieChart::isExpandNarrowValuesTowardZero( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+bool PieChart::isSeperateStackingForDifferentSigns( sal_Int32 /* nDimensionIndex */ )
+{
+ return false;
+}
+
+void PieChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"PieChart is not proper initialized");
+ if(!(m_pShapeFactory&&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,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+ //---------------------------------------------
+ //check necessary here that different Y axis can not be stacked in the same group? ... hm?
+
+//=============================================================================
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = m_aZSlots[0].begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = m_aZSlots[0].end();
+
+ ::std::vector< VDataSeriesGroup >::size_type nExplodeableSlot = 0;
+ if( m_pPosHelper->isMathematicalOrientationRadius() && m_bUseRings )
+ nExplodeableSlot = m_aZSlots[0].size()-1;
+
+ m_aLabelInfoList.clear();
+ ::rtl::math::setNan(&m_fMaxOffset);
+
+//=============================================================================
+ for( double fSlotX=0; aXSlotIter != aXSlotEnd && (m_bUseRings||fSlotX<0.5 ); aXSlotIter++, fSlotX+=1.0 )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ if( pSeriesList->size()<=0 )//there should be only one series in each x slot
+ continue;
+ VDataSeries* pSeries = (*pSeriesList)[0];
+ if(!pSeries)
+ continue;
+
+ m_pPosHelper->m_fAngleDegreeOffset = pSeries->getStartingAngle();
+
+ double fLogicYSum = 0.0;
+ //iterate through all points to get the sum
+ sal_Int32 nPointIndex=0;
+ sal_Int32 nPointCount=pSeries->getTotalPointCount();
+ for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
+ {
+ double fY = pSeries->getYValue( nPointIndex );
+ if(fY<0.0)
+ {
+ //@todo warn somehow that negative values are treated as positive
+ }
+ if( ::rtl::math::isNan(fY) )
+ continue;
+ fLogicYSum += fabs(fY);
+ }
+ if(fLogicYSum==0.0)
+ continue;
+ double fLogicYForNextPoint = 0.0;
+ //iterate through all points to create shapes
+ for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
+ {
+ double fLogicInnerRadius, fLogicOuterRadius;
+ double fOffset = getMaxOffset();
+ bool bIsVisible = m_pPosHelper->getInnerAndOuterRadius( fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset );
+ if( !bIsVisible )
+ continue;
+
+ double fLogicZ = -0.5;//as defined
+ double fDepth = this->getTransformedDepth();
+//=============================================================================
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
+ //collect data point information (logic coordinates, style ):
+ double fLogicYValue = fabs(pSeries->getYValue( nPointIndex ));
+ if( ::rtl::math::isNan(fLogicYValue) )
+ continue;
+ if(fLogicYValue==0.0)//@todo: continue also if the resolution to small
+ continue;
+ double fLogicYPos = fLogicYForNextPoint;
+ fLogicYForNextPoint += fLogicYValue;
+
+ uno::Reference< beans::XPropertySet > xPointProperties = pSeries->getPropertiesOfPoint( nPointIndex );
+
+ //iterate through all subsystems to create partial points
+ {
+ //logic values on angle axis:
+ double fLogicStartAngleValue = fLogicYPos/fLogicYSum;
+ double fLogicEndAngleValue = (fLogicYPos+fLogicYValue)/fLogicYSum;
+
+ double fExplodePercentage=0.0;
+ bool bDoExplode = ( nExplodeableSlot == static_cast< ::std::vector< VDataSeriesGroup >::size_type >(fSlotX) );
+ if(bDoExplode) try
+ {
+ xPointProperties->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //---------------------------
+ //transforme to unit circle:
+ double fUnitCircleWidthAngleDegree = m_pPosHelper->getWidthAngleDegree( fLogicStartAngleValue, fLogicEndAngleValue );
+ double fUnitCircleStartAngleDegree = m_pPosHelper->transformToAngleDegree( fLogicStartAngleValue );
+ double fUnitCircleInnerRadius = m_pPosHelper->transformToRadius( fLogicInnerRadius );
+ double fUnitCircleOuterRadius = m_pPosHelper->transformToRadius( fLogicOuterRadius );
+
+ //---------------------------
+ //point color:
+ std::auto_ptr< tPropertyNameValueMap > apOverwritePropertiesMap(0);
+ {
+ if(!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is())
+ {
+ apOverwritePropertiesMap = std::auto_ptr< tPropertyNameValueMap >( new tPropertyNameValueMap() );
+ (*apOverwritePropertiesMap)[C2U("FillColor")] = uno::makeAny(
+ m_xColorScheme->getColorByIndex( nPointIndex ));
+ }
+ }
+
+ //create data point
+ uno::Reference<drawing::XShape> xPointShape(
+ createDataPoint( xSeriesGroupShape_Shapes, xPointProperties
+ , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
+ , fUnitCircleInnerRadius, fUnitCircleOuterRadius
+ , fLogicZ, fDepth, fExplodePercentage, apOverwritePropertiesMap.get() ) );
+
+ //create label
+ if( pSeries->getDataPointLabelIfLabel(nPointIndex) )
+ {
+ if( !::rtl::math::approxEqual( fExplodePercentage, 0.0 ) )
+ {
+ double fExplodeOffset = (fUnitCircleOuterRadius-fUnitCircleInnerRadius)*fExplodePercentage;
+ fUnitCircleInnerRadius += fExplodeOffset;
+ fUnitCircleOuterRadius += fExplodeOffset;
+ }
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, m_nDimension, m_pPosHelper->isSwapXAndY() );
+ bool bMovementAllowed = ( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP );
+ if( bMovementAllowed )
+ nLabelPlacement = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+
+ LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
+ sal_Int32 nScreenValueOffsetInRadiusDirection = 0 ;
+ if( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE )
+ nScreenValueOffsetInRadiusDirection = (3!=m_nDimension) ? 150 : 0;//todo maybe calculate this font height dependent
+ else if( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::INSIDE )
+ nScreenValueOffsetInRadiusDirection = (3!=m_nDimension) ? -150 : 0;//todo maybe calculate this font height dependent
+ PolarLabelPositionHelper aPolarPosHelper(m_pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ awt::Point aScreenPosition2D(
+ aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, nLabelPlacement
+ , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
+ , fUnitCircleInnerRadius, fUnitCircleOuterRadius, 0.0, 0 ));
+
+ PieLabelInfo aPieLabelInfo;
+ aPieLabelInfo.aFirstPosition = basegfx::B2IVector( aScreenPosition2D.X, aScreenPosition2D.Y );
+ awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, 0.5 ) ) );
+ aPieLabelInfo.aOrigin = basegfx::B2IVector( aOrigin.X, aOrigin.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();
+ }
+
+ aPieLabelInfo.xTextShape = this->createDataLabel( xTextTarget, *pSeries, nPointIndex
+ , fLogicYValue, fLogicYSum, aScreenPosition2D, eAlignment );
+
+ uno::Reference< container::XChild > xChild( aPieLabelInfo.xTextShape, uno::UNO_QUERY );
+ if( xChild.is() )
+ aPieLabelInfo.xLabelGroupShape = uno::Reference<drawing::XShape>( xChild->getParent(), uno::UNO_QUERY );
+ aPieLabelInfo.fValue = fLogicYValue;
+ aPieLabelInfo.bMovementAllowed = bMovementAllowed;
+ aPieLabelInfo.bMoved= false;
+ aPieLabelInfo.xTextTarget = xTextTarget;
+ m_aLabelInfoList.push_back(aPieLabelInfo);
+ }
+
+ if(!bDoExplode)
+ {
+ ShapeFactory::setShapeName( xPointShape
+ , ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(), nPointIndex ) );
+ }
+ else try
+ {
+ //enable dragging of outer segments
+
+ double fAngle = fUnitCircleStartAngleDegree + fUnitCircleWidthAngleDegree/2.0;
+ double fMaxDeltaRadius = fUnitCircleOuterRadius-fUnitCircleInnerRadius;
+ drawing::Position3D aOrigin = m_pPosHelper->transformUnitCircleToScene( fAngle, fUnitCircleOuterRadius, fLogicZ );
+ drawing::Position3D aNewOrigin = m_pPosHelper->transformUnitCircleToScene( fAngle, fUnitCircleOuterRadius + fMaxDeltaRadius, fLogicZ );
+
+ sal_Int32 nOffsetPercent( static_cast<sal_Int32>(fExplodePercentage * 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 draging of piesegments
+ rtl::OUString aPointCIDStub( ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT
+ , pSeries->getSeriesParticle()
+ , ObjectIdentifier::getPieSegmentDragMethodServiceName()
+ , ObjectIdentifier::createPieSegmentDragParameterString(
+ nOffsetPercent, aMinimumPosition, aMaximumPosition )
+ ) );
+
+ ShapeFactory::setShapeName( xPointShape
+ , ObjectIdentifier::createPointCID( aPointCIDStub, nPointIndex ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }//next series in x slot (next y slot)
+ }//next category
+ }//next x slot
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ /* @todo remove series shapes if empty
+ //remove and delete point-group-shape if empty
+ if(!xSeriesGroupShape_Shapes->getCount())
+ {
+ (*aSeriesIter)->m_xShape.set(NULL);
+ m_xLogicTarget->remove(xSeriesGroupShape_Shape);
+ }
+ */
+
+ //remove and delete series-group-shape if empty
+
+ //... todo
+}
+
+namespace
+{
+
+::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;
+}
+
+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;
+}
+
+}//end anonymous namespace
+
+PieChart::PieLabelInfo::PieLabelInfo()
+ : xTextShape(0), xLabelGroupShape(0), aFirstPosition(), aOrigin(), fValue(0.0)
+ , bMovementAllowed(false), bMoved(false), xTextTarget(0), pPrevious(0),pNext(0)
+{
+}
+
+bool PieChart::PieLabelInfo::moveAwayFrom( const PieChart::PieLabelInfo* pFix, const awt::Size& rPageSize, bool bMoveHalfWay, bool bMoveClockwise, bool bAlternativeMoveDirection )
+{
+ //return true if the move was successful
+ if(!this->bMovementAllowed)
+ return false;
+
+ const sal_Int32 nLabelDistanceX = rPageSize.Width/50;
+ const sal_Int32 nLabelDistanceY = rPageSize.Height/50;
+
+ ::basegfx::B2IRectangle aOverlap( lcl_getRect( this->xLabelGroupShape ) );
+ aOverlap.intersect( lcl_getRect( pFix->xLabelGroupShape ) );
+ if( !aOverlap.isEmpty() )
+ {
+ (void)bAlternativeMoveDirection;//todo
+
+ basegfx::B2IVector aRadiusDirection = this->aFirstPosition - this->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());
+ nShift += (bShiftHorizontal ? nLabelDistanceX : nLabelDistanceY);
+ if( bMoveHalfWay )
+ nShift/=2;
+ if(!bMoveClockwise)
+ nShift*=-1;
+ awt::Point aOldPos( this->xLabelGroupShape->getPosition() );
+ basegfx::B2IVector aNewPos = basegfx::B2IVector( aOldPos.X, aOldPos.Y ) + nShift*aTangentialDirection;
+
+ //check whether the new position is ok
+ awt::Point aNewAWTPos( aNewPos.getX(), aNewPos.getY() );
+ if( !lcl_isInsidePage( aNewAWTPos, this->xLabelGroupShape->getSize(), rPageSize ) )
+ return false;
+
+ this->xLabelGroupShape->setPosition( aNewAWTPos );
+ this->bMoved = true;
+ }
+ return true;
+}
+
+void PieChart::resetLabelPositionsToPreviousState()
+{
+ std::vector< PieLabelInfo >::iterator aIt = m_aLabelInfoList.begin();
+ std::vector< PieLabelInfo >::const_iterator aEnd = m_aLabelInfoList.end();
+ for( ;aIt!=aEnd; ++aIt )
+ aIt->xLabelGroupShape->setPosition(aIt->aPreviousPosition);
+}
+
+bool PieChart::detectLabelOverlapsAndMove( const awt::Size& rPageSize )
+{
+ //returns true when there might be more to do
+
+ //find borders of a group of overlapping labels
+ bool bOverlapFound = false;
+ PieLabelInfo* pStart = &(*(m_aLabelInfoList.rbegin()));
+ PieLabelInfo* pFirstBorder = 0;
+ PieLabelInfo* pSecondBorder = 0;
+ PieLabelInfo* pCurrent = pStart;
+ do
+ {
+ ::basegfx::B2IRectangle aPreviousOverlap( lcl_getRect( pCurrent->xLabelGroupShape ) );
+ ::basegfx::B2IRectangle aNextOverlap( aPreviousOverlap );
+ aPreviousOverlap.intersect( lcl_getRect( pCurrent->pPrevious->xLabelGroupShape ) );
+ aNextOverlap.intersect( lcl_getRect( pCurrent->pNext->xLabelGroupShape ) );
+
+ bool bPreviousOverlap = !aPreviousOverlap.isEmpty();
+ bool bNextOverlap = !aNextOverlap.isEmpty();
+ if( bPreviousOverlap || bNextOverlap )
+ bOverlapFound = true;
+ if( !bPreviousOverlap && bNextOverlap )
+ {
+ pFirstBorder = pCurrent;
+ break;
+ }
+ pCurrent = pCurrent->pNext;
+ }
+ while( pCurrent != pStart );
+
+ if( !bOverlapFound )
+ return false;
+
+ if( pFirstBorder )
+ {
+ pCurrent = pFirstBorder;
+ do
+ {
+ ::basegfx::B2IRectangle aPreviousOverlap( lcl_getRect( pCurrent->xLabelGroupShape ) );
+ ::basegfx::B2IRectangle aNextOverlap( aPreviousOverlap );
+ aPreviousOverlap.intersect( lcl_getRect( pCurrent->pPrevious->xLabelGroupShape ) );
+ aNextOverlap.intersect( lcl_getRect( pCurrent->pNext->xLabelGroupShape ) );
+
+ if( !aPreviousOverlap.isEmpty() && aNextOverlap.isEmpty() )
+ {
+ pSecondBorder = pCurrent;
+ break;
+ }
+ pCurrent = pCurrent->pNext;
+ }
+ while( pCurrent != pFirstBorder );
+ }
+
+ if( !pFirstBorder || !pSecondBorder )
+ {
+ pFirstBorder = &(*(m_aLabelInfoList.rbegin()));
+ pSecondBorder = &(*(m_aLabelInfoList.begin()));
+ }
+
+ //find center
+ PieLabelInfo* pCenter = pFirstBorder;
+ sal_Int32 nOverlapGroupCount = 1;
+ for( pCurrent = pFirstBorder ;pCurrent != pSecondBorder; pCurrent = pCurrent->pNext )
+ nOverlapGroupCount++;
+ sal_Int32 nCenterPos = nOverlapGroupCount/2;
+ bool bSingleCenter = nOverlapGroupCount%2 != 0;
+ if( bSingleCenter )
+ nCenterPos++;
+ if(nCenterPos>1)
+ {
+ pCurrent = pFirstBorder;
+ while( --nCenterPos )
+ pCurrent = pCurrent->pNext;
+ pCenter = pCurrent;
+ }
+
+ //remind current positions
+ pCurrent = pStart;
+ do
+ {
+ pCurrent->aPreviousPosition = pCurrent->xLabelGroupShape->getPosition();
+ pCurrent = pCurrent->pNext;
+ }
+ while( pCurrent != pStart );
+
+ //
+ bool bAlternativeMoveDirection = false;
+ if( !tryMoveLabels( pFirstBorder, pSecondBorder, pCenter, bSingleCenter, bAlternativeMoveDirection, rPageSize ) )
+ tryMoveLabels( pFirstBorder, pSecondBorder, pCenter, bSingleCenter, bAlternativeMoveDirection, rPageSize );
+ return true;
+}
+
+bool PieChart::tryMoveLabels( PieLabelInfo* pFirstBorder, PieLabelInfo* pSecondBorder
+ , PieLabelInfo* pCenter
+ , bool bSingleCenter, bool& rbAlternativeMoveDirection, const awt::Size& rPageSize )
+{
+ PieLabelInfo* p1 = bSingleCenter ? pCenter->pPrevious : pCenter;
+ PieLabelInfo* p2 = pCenter->pNext;
+ //return true when successful
+
+ bool bLabelOrderIsAntiClockWise = m_pPosHelper->isMathematicalOrientationAngle();
+
+ PieLabelInfo* pCurrent = 0;
+ for( pCurrent = p2 ;pCurrent->pPrevious != pSecondBorder; pCurrent = pCurrent->pNext )
+ {
+ PieLabelInfo* pFix = 0;
+ for( pFix = p2->pPrevious ;pFix != pCurrent; pFix = pFix->pNext )
+ {
+ if( !pCurrent->moveAwayFrom( pFix, rPageSize, !bSingleCenter && pCurrent == p2, !bLabelOrderIsAntiClockWise, rbAlternativeMoveDirection ) )
+ {
+ if( !rbAlternativeMoveDirection )
+ {
+ rbAlternativeMoveDirection = true;
+ resetLabelPositionsToPreviousState();
+ return false;
+ }
+ }
+ }
+ }
+ for( pCurrent = p1 ;pCurrent->pNext != pFirstBorder; pCurrent = pCurrent->pPrevious )
+ {
+ PieLabelInfo* pFix = 0;
+ for( pFix = p2->pNext ;pFix != pCurrent; pFix = pFix->pPrevious )
+ {
+ if( !pCurrent->moveAwayFrom( pFix, rPageSize, false, bLabelOrderIsAntiClockWise, rbAlternativeMoveDirection ) )
+ {
+ if( !rbAlternativeMoveDirection )
+ {
+ rbAlternativeMoveDirection = true;
+ resetLabelPositionsToPreviousState();
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+
+void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSize )
+{
+ //------------------------------------------------------------------
+ //check whether there are any labels that should be moved
+ std::vector< PieLabelInfo >::iterator aIt1 = m_aLabelInfoList.begin();
+ std::vector< PieLabelInfo >::const_iterator aEnd = m_aLabelInfoList.end();
+ bool bMoveableFound = false;
+ for( ;aIt1!=aEnd; ++aIt1 )
+ {
+ if(aIt1->bMovementAllowed)
+ {
+ bMoveableFound = true;
+ break;
+ }
+ }
+ if(!bMoveableFound)
+ return;
+
+ double fPageDiagonaleLength = sqrt( double( rPageSize.Width*rPageSize.Width + rPageSize.Height*rPageSize.Height) );
+ if( ::rtl::math::approxEqual( fPageDiagonaleLength, 0.0 ) )
+ return;
+
+ //------------------------------------------------------------------
+ //init next and previous
+ aIt1 = m_aLabelInfoList.begin();
+ std::vector< PieLabelInfo >::iterator aIt2 = aIt1;
+ if( aIt1==aEnd )//no need to do anything when we only have one label
+ return;
+ aIt1->pPrevious = &(*(m_aLabelInfoList.rbegin()));
+ ++aIt2;
+ for( ;aIt2!=aEnd; ++aIt1, ++aIt2 )
+ {
+ PieLabelInfo& rInfo1( *aIt1 );
+ PieLabelInfo& rInfo2( *aIt2 );
+ rInfo1.pNext = &rInfo2;
+ rInfo2.pPrevious = &rInfo1;
+ }
+ aIt1->pNext = &(*(m_aLabelInfoList.begin()));
+
+
+ //------------------------------------------------------------------
+ //detect overlaps and move
+ sal_Int32 nMaxIterations = 50;
+ while( detectLabelOverlapsAndMove( rPageSize ) && nMaxIterations > 0 )
+ nMaxIterations--;
+
+ //------------------------------------------------------------------
+ //create connection lines for the moved labels
+ aEnd = m_aLabelInfoList.end();
+ VLineProperties aVLineProperties;
+ for( aIt1 = m_aLabelInfoList.begin(); aIt1!=aEnd; ++aIt1 )
+ {
+ PieLabelInfo& rInfo( *aIt1 );
+ if( rInfo.bMoved )
+ {
+ sal_Int32 nX1 = rInfo.aFirstPosition.getX();
+ sal_Int32 nY1 = rInfo.aFirstPosition.getY();
+ sal_Int32 nX2 = nX1;
+ sal_Int32 nY2 = nY1;
+ ::basegfx::B2IRectangle aRect( lcl_getRect( rInfo.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();
+
+
+ //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;
+
+ uno::Reference< beans::XPropertySet > xProp( rInfo.xTextShape, uno::UNO_QUERY);
+ if( xProp.is() )
+ {
+ sal_Int32 nColor = 0;
+ xProp->getPropertyValue(C2U("CharColor")) >>= nColor;
+ if( nColor != -1 )//automatic font color does not work for lines -> fallback to black
+ aVLineProperties.Color = uno::makeAny(nColor);
+ }
+ m_pShapeFactory->createLine2D( rInfo.xTextTarget, aPoints, &aVLineProperties );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
new file mode 100644
index 000000000000..e6fedb05d52e
--- /dev/null
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_PIECHART_HXX
+#define _CHART2_PIECHART_HXX
+
+#include "VSeriesPlotter.hxx"
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2irectangle.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+class PiePositionHelper;
+
+class PieChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ PieChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount, bool bExcludingPositioning );
+ virtual ~PieChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+ virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
+
+ virtual void SAL_CALL setScales(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis )
+ throw (::com::sun::star::uno::RuntimeException);
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+ virtual bool keepAspectRatio() const;
+ virtual bool shouldSnapRectToUsedArea();
+
+ //MinimumAndMaximumSupplier
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+ virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+ virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+
+ virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex );
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex );
+ virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ PieChart();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createDataPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xObjectProperties
+ , double fUnitCircleStartAngleDegree, double fWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , double fLogicZ, double fDepth, double fExplodePercentage
+ , tPropertyNameValueMap* pOverWritePropertiesMap );
+
+ double getMaxOffset();
+ bool detectLabelOverlapsAndMove(const ::com::sun::star::awt::Size& rPageSize);//returns true when there might be more to do
+ void resetLabelPositionsToPreviousState();
+struct PieLabelInfo;
+ bool tryMoveLabels( PieLabelInfo* pFirstBorder, PieLabelInfo* pSecondBorder
+ , PieLabelInfo* pCenter, bool bSingleCenter, bool& rbAlternativeMoveDirection
+ , const ::com::sun::star::awt::Size& rPageSize );
+
+private: //member
+ PiePositionHelper* m_pPosHelper;
+ bool m_bUseRings;
+ bool m_bSizeExcludesLabelsAndExplodedSegments;
+
+ struct PieLabelInfo
+ {
+ PieLabelInfo();
+ bool moveAwayFrom( const PieLabelInfo* pFix, const ::com::sun::star::awt::Size& rPageSize
+ , bool bMoveHalfWay, bool bMoveClockwise, bool bAlternativeMoveDirection );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xTextShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xLabelGroupShape;
+ ::basegfx::B2IVector aFirstPosition;
+ ::basegfx::B2IVector aOrigin;
+ double fValue;
+ bool bMovementAllowed;
+ bool bMoved;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > xTextTarget;
+ PieLabelInfo* pPrevious;
+ PieLabelInfo* pNext;
+ ::com::sun::star::awt::Point aPreviousPosition;
+ };
+
+ ::std::vector< PieLabelInfo > m_aLabelInfoList;
+
+ double m_fMaxOffset; /// cached max offset value (init'ed to NaN)
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
new file mode 100644
index 000000000000..67ecac93b64c
--- /dev/null
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -0,0 +1,545 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "Splines.hxx"
+#include <rtl/math.hxx>
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+// header for DBG_ASSERT
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+namespace
+{
+
+template< typename T >
+struct lcl_EqualsFirstDoubleOfPair : ::std::binary_function< ::std::pair< double, T >, ::std::pair< double, T >, bool >
+{
+ inline bool operator() ( const ::std::pair< double, T > & rOne, const ::std::pair< double, T > & rOther )
+ {
+ return ( ::rtl::math::approxEqual( rOne.first, rOther.first ) );
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+typedef ::std::pair< double, double > tPointType;
+typedef ::std::vector< tPointType > tPointVecType;
+typedef tPointVecType::size_type lcl_tSizeType;
+
+class lcl_SplineCalculation
+{
+public:
+ /** @descr creates an object that calculates cublic splines on construction
+
+ @param rSortedPoints the points for which splines shall be calculated, they need to be sorted in x values
+ @param fY1FirstDerivation the resulting spline should have the first
+ derivation equal to this value at the x-value of the first point
+ of rSortedPoints. If fY1FirstDerivation is set to infinity, a natural
+ spline is calculated.
+ @param fYnFirstDerivation the resulting spline should have the first
+ derivation equal to this value at the x-value of the last point
+ of rSortedPoints
+ */
+ lcl_SplineCalculation( const tPointVecType & rSortedPoints,
+ double fY1FirstDerivation,
+ double fYnFirstDerivation );
+
+ /** @descr this function corresponds to the function splint in [1].
+
+ [1] Numerical Recipies in C, 2nd edition
+ William H. Press, et al.,
+ Section 3.3, page 116
+ */
+ double GetInterpolatedValue( double x );
+
+private:
+ /// a copy of the points given in the CTOR
+ tPointVecType m_aPoints;
+
+ /// the result of the Calculate() method
+ ::std::vector< double > m_aSecDerivY;
+
+ double m_fYp1;
+ double m_fYpN;
+
+ // these values are cached for performance reasons
+ tPointVecType::size_type m_nKLow;
+ tPointVecType::size_type m_nKHigh;
+ double m_fLastInterpolatedValue;
+
+ /** @descr this function corresponds to the function spline in [1].
+
+ [1] Numerical Recipies in C, 2nd edition
+ William H. Press, et al.,
+ Section 3.3, page 115
+ */
+ void Calculate();
+};
+
+//-----------------------------------------------------------------------------
+
+lcl_SplineCalculation::lcl_SplineCalculation(
+ const tPointVecType & rSortedPoints,
+ double fY1FirstDerivation,
+ double fYnFirstDerivation )
+ : m_aPoints( rSortedPoints ),
+ m_fYp1( fY1FirstDerivation ),
+ m_fYpN( fYnFirstDerivation ),
+ m_nKLow( 0 ),
+ m_nKHigh( rSortedPoints.size() - 1 )
+{
+ ::rtl::math::setInf( &m_fLastInterpolatedValue, sal_False );
+
+ // #108301# remove points that have equal x-values
+ m_aPoints.erase( ::std::unique( m_aPoints.begin(), m_aPoints.end(),
+ lcl_EqualsFirstDoubleOfPair< double >() ),
+ m_aPoints.end() );
+ Calculate();
+}
+
+void lcl_SplineCalculation::Calculate()
+{
+ if( m_aPoints.size() <= 1 )
+ return;
+
+ // n is the last valid index to m_aPoints
+ const tPointVecType::size_type n = m_aPoints.size() - 1;
+ ::std::vector< double > u( n );
+ m_aSecDerivY.resize( n + 1, 0.0 );
+
+ if( ::rtl::math::isInf( m_fYp1 ) )
+ {
+ // natural spline
+ m_aSecDerivY[ 0 ] = 0.0;
+ u[ 0 ] = 0.0;
+ }
+ else
+ {
+ m_aSecDerivY[ 0 ] = -0.5;
+ double xDiff = ( m_aPoints[ 1 ].first - m_aPoints[ 0 ].first );
+ u[ 0 ] = ( 3.0 / xDiff ) *
+ ((( m_aPoints[ 1 ].second - m_aPoints[ 0 ].second ) / xDiff ) - m_fYp1 );
+ }
+
+ for( tPointVecType::size_type i = 1; i < n; ++i )
+ {
+ ::std::pair< double, double >
+ p_i = m_aPoints[ i ],
+ p_im1 = m_aPoints[ i - 1 ],
+ p_ip1 = m_aPoints[ i + 1 ];
+
+ double sig = ( p_i.first - p_im1.first ) /
+ ( p_ip1.first - p_im1.first );
+ double p = sig * m_aSecDerivY[ i - 1 ] + 2.0;
+
+ m_aSecDerivY[ i ] = ( sig - 1.0 ) / p;
+ u[ i ] =
+ ( ( p_ip1.second - p_i.second ) /
+ ( p_ip1.first - p_i.first ) ) -
+ ( ( p_i.second - p_im1.second ) /
+ ( p_i.first - p_im1.first ) );
+ u[ i ] =
+ ( 6.0 * u[ i ] / ( p_ip1.first - p_im1.first )
+ - sig * u[ i - 1 ] ) / p;
+ }
+
+ // initialize to values for natural splines (used for m_fYpN equal to
+ // infinity)
+ double qn = 0.0;
+ double un = 0.0;
+
+ if( ! ::rtl::math::isInf( m_fYpN ) )
+ {
+ qn = 0.5;
+ double xDiff = ( m_aPoints[ n ].first - m_aPoints[ n - 1 ].first );
+ un = ( 3.0 / xDiff ) *
+ ( 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 );
+
+ // note: the algorithm in [1] iterates from n-1 to 0, but as size_type
+ // may be (usuall is) an unsigned type, we can not write k >= 0, as this
+ // is always true.
+ for( tPointVecType::size_type k = n; k > 0; --k )
+ {
+ ( m_aSecDerivY[ k - 1 ] *= m_aSecDerivY[ k ] ) += u[ k - 1 ];
+ }
+}
+
+double lcl_SplineCalculation::GetInterpolatedValue( double x )
+{
+ DBG_ASSERT( ( m_aPoints[ 0 ].first <= x ) &&
+ ( x <= m_aPoints[ m_aPoints.size() - 1 ].first ),
+ "Trying to extrapolate" );
+
+ const tPointVecType::size_type n = m_aPoints.size() - 1;
+ if( x < m_fLastInterpolatedValue )
+ {
+ m_nKLow = 0;
+ m_nKHigh = n;
+
+ // calculate m_nKLow and m_nKHigh
+ // first initialization is done in CTOR
+ while( m_nKHigh - m_nKLow > 1 )
+ {
+ tPointVecType::size_type k = ( m_nKHigh + m_nKLow ) / 2;
+ if( m_aPoints[ k ].first > x )
+ m_nKHigh = k;
+ else
+ m_nKLow = k;
+ }
+ }
+ else
+ {
+ while( ( m_aPoints[ m_nKHigh ].first < x ) &&
+ ( m_nKHigh <= n ) )
+ {
+ ++m_nKHigh;
+ ++m_nKLow;
+ }
+ DBG_ASSERT( m_nKHigh <= n, "Out of Bounds" );
+ }
+ m_fLastInterpolatedValue = x;
+
+ double h = m_aPoints[ m_nKHigh ].first - m_aPoints[ m_nKLow ].first;
+ DBG_ASSERT( h != 0, "Bad input to GetInterpolatedValue()" );
+
+ double a = ( m_aPoints[ m_nKHigh ].first - x ) / h;
+ double b = ( x - m_aPoints[ m_nKLow ].first ) / h;
+
+ return ( a * m_aPoints[ m_nKLow ].second +
+ b * m_aPoints[ m_nKHigh ].second +
+ (( a*a*a - a ) * m_aSecDerivY[ m_nKLow ] +
+ ( b*b*b - b ) * m_aSecDerivY[ m_nKHigh ] ) *
+ ( h*h ) / 6.0 );
+}
+
+//-----------------------------------------------------------------------------
+
+//create knot vector for B-spline
+double* createTVector( sal_Int32 n, sal_Int32 k )
+{
+ double* t = new double [n + k + 1];
+ for (sal_Int32 i=0; i<=n+k; i++ )
+ {
+ if(i < k)
+ t[i] = 0;
+ else if(i <= n)
+ t[i] = i-k+1;
+ else
+ t[i] = n-k+2;
+ }
+ return t;
+}
+
+//calculate left knot vector
+double TLeft (double x, sal_Int32 i, sal_Int32 k, const double *t )
+{
+ double deltaT = t[i + k - 1] - t[i];
+ return (deltaT == 0.0)
+ ? 0.0
+ : (x - t[i]) / deltaT;
+}
+
+//calculate right knot vector
+double TRight(double x, sal_Int32 i, sal_Int32 k, const double *t )
+{
+ double deltaT = t[i + k] - t[i + 1];
+ return (deltaT == 0.0)
+ ? 0.0
+ : (t[i + k] - x) / deltaT;
+}
+
+//calculate weight vector
+void BVector(double x, sal_Int32 n, sal_Int32 k, double *b, const double *t)
+{
+ sal_Int32 i = 0;
+ for( i=0; i<=n+k; i++ )
+ b[i]=0;
+
+ sal_Int32 i0 = (sal_Int32)floor(x) + k - 1;
+ b [i0] = 1;
+
+ for( sal_Int32 j=2; j<=k; j++ )
+ for( i=0; i<=i0; i++ )
+ b[i] = TLeft(x, i, j, t) * b[i] + TRight(x, i, j, t) * b [i + 1];
+}
+
+} // anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void SplineCalculater::CalculateCubicSplines(
+ const drawing::PolyPolygonShape3D& rInput
+ , drawing::PolyPolygonShape3D& rResult
+ , sal_Int32 nGranularity )
+{
+ DBG_ASSERT( nGranularity > 0, "Granularity is invalid" );
+
+ rResult.SequenceX.realloc(0);
+ rResult.SequenceY.realloc(0);
+ rResult.SequenceZ.realloc(0);
+
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength();
+ if( !nOuterCount )
+ return;
+
+ rResult.SequenceX.realloc(nOuterCount);
+ rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
+ {
+ if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ continue; //we need at least two points
+
+ sal_Int32 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();
+
+ // #i13699# The curve gets a parameter and then for each coordinate a
+ // separate spline will be calculated using the parameter as first argument
+ // and the point coordinate as second argument. Therefore the points need
+ // not to be sorted in its x-coordinates. The parameter is sorted by
+ // construction.
+
+ ::std::vector < double > aParameter(nMaxIndexPoints+1);
+ aParameter[0]=0.0;
+ for( sal_Int32 nIndex=1; nIndex<=nMaxIndexPoints; nIndex++ )
+ {
+ // The euclidian distance leads to curve loops for functions having single extreme points
+ //aParameter[nIndex]=aParameter[nIndex-1]+
+ //sqrt( (pOldX[nIndex]-pOldX[nIndex-1])*(pOldX[nIndex]-pOldX[nIndex-1])+
+ //(pOldY[nIndex]-pOldY[nIndex-1])*(pOldY[nIndex]-pOldY[nIndex-1])+
+ //(pOldZ[nIndex]-pOldZ[nIndex-1])*(pOldZ[nIndex]-pOldZ[nIndex-1]));
+
+ // use increment of 1 instead
+ aParameter[nIndex]=aParameter[nIndex-1]+1;
+ }
+ // Split the calculation to X, Y and Z coordinate
+ tPointVecType aInputX;
+ aInputX.resize(nMaxIndexPoints+1);
+ tPointVecType aInputY;
+ aInputY.resize(nMaxIndexPoints+1);
+ tPointVecType aInputZ;
+ aInputZ.resize(nMaxIndexPoints+1);
+ for (sal_Int32 nN=0;nN<=nMaxIndexPoints; nN++ )
+ {
+ aInputX[ nN ].first=aParameter[nN];
+ aInputX[ nN ].second=pOldX[ nN ];
+ aInputY[ nN ].first=aParameter[nN];
+ aInputY[ nN ].second=pOldY[ nN ];
+ aInputZ[ nN ].first=aParameter[nN];
+ aInputZ[ nN ].second=pOldZ[ nN ];
+ }
+
+ // generate a spline for each coordinate. It holds the complete
+ // information to calculate each point of the curve
+ double fXDerivation;
+ double fYDerivation;
+ double fZDerivation;
+ if( pOldX[ 0 ] == pOldX[nMaxIndexPoints] &&
+ pOldY[ 0 ] == pOldY[nMaxIndexPoints] &&
+ pOldZ[ 0 ] == pOldZ[nMaxIndexPoints] )
+ {
+ // #i101050# avoid a corner in closed lines, which are smoothed by spline
+ // This derivation are special for parameter of kind 0,1,2,3... If you
+ // change generating parameters (see above), then adapt derivations too.)
+ fXDerivation = 0.5 * (pOldX[1]-pOldX[nMaxIndexPoints-1]);
+ fYDerivation = 0.5 * (pOldY[1]-pOldY[nMaxIndexPoints-1]);
+ fZDerivation = 0.5 * (pOldZ[1]-pOldZ[nMaxIndexPoints-1]);
+ }
+ else // generate the kind "natural spline"
+ {
+ double fInfty;
+ ::rtl::math::setInf( &fInfty, sal_False );
+ fXDerivation = fInfty;
+ fYDerivation = fInfty;
+ fZDerivation = fInfty;
+ }
+ lcl_SplineCalculation aSplineX( aInputX, fXDerivation, fXDerivation );
+ lcl_SplineCalculation aSplineY( aInputY, fYDerivation, fYDerivation );
+ lcl_SplineCalculation aSplineZ( aInputZ, fZDerivation, fZDerivation );
+
+ // 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);
+
+ double* pNewX = rResult.SequenceX[nOuter].getArray();
+ double* pNewY = rResult.SequenceY[nOuter].getArray();
+ double* pNewZ = rResult.SequenceZ[nOuter].getArray();
+
+ sal_Int32 nNewPointIndex = 0; // Index in result points
+ // needed for inner loop
+ double fInc; // step for intermediate points
+ sal_Int32 nj; // for loop
+ double fParam; // a intermediate parameter value
+
+ for( sal_Int32 ni = 0; ni < nMaxIndexPoints; ni++ )
+ {
+ // given point is surely a curve point
+ pNewX[nNewPointIndex] = pOldX[ni];
+ pNewY[nNewPointIndex] = pOldY[ni];
+ pNewZ[nNewPointIndex] = pOldZ[ni];
+ nNewPointIndex++;
+
+ // calculate intermediate points
+ fInc = ( aParameter[ ni+1 ] - aParameter[ni] ) / static_cast< double >( nGranularity );
+ for(nj = 1; nj < nGranularity; nj++)
+ {
+ fParam = aParameter[ni] + ( fInc * static_cast< double >( nj ) );
+
+ pNewX[nNewPointIndex]=aSplineX.GetInterpolatedValue( fParam );
+ pNewY[nNewPointIndex]=aSplineY.GetInterpolatedValue( fParam );
+ pNewZ[nNewPointIndex]=aSplineZ.GetInterpolatedValue( fParam );
+ nNewPointIndex++;
+ }
+ }
+ // add last point
+ pNewX[nNewPointIndex] = pOldX[nMaxIndexPoints];
+ pNewY[nNewPointIndex] = pOldY[nMaxIndexPoints];
+ pNewZ[nNewPointIndex] = pOldZ[nMaxIndexPoints];
+ }
+}
+
+void SplineCalculater::CalculateBSplines(
+ const ::com::sun::star::drawing::PolyPolygonShape3D& rInput
+ , ::com::sun::star::drawing::PolyPolygonShape3D& rResult
+ , sal_Int32 nGranularity
+ , sal_Int32 nDegree )
+{
+ // #issue 72216#
+ // k is the order of the BSpline, nDegree is the degree of its polynoms
+ sal_Int32 k = nDegree + 1;
+
+ rResult.SequenceX.realloc(0);
+ rResult.SequenceY.realloc(0);
+ rResult.SequenceZ.realloc(0);
+
+ sal_Int32 nOuterCount = rInput.SequenceX.getLength();
+ if( !nOuterCount )
+ return; // no input
+
+ rResult.SequenceX.realloc(nOuterCount);
+ rResult.SequenceY.realloc(nOuterCount);
+ rResult.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
+ {
+ if( rInput.SequenceX[nOuter].getLength() <= 1 )
+ continue; // need at least 2 control points
+
+ sal_Int32 n = rInput.SequenceX[nOuter].getLength()-1; // maximum index of control points
+
+ double fCurveparam =0.0; // parameter for the curve
+ // 0<= fCurveparam < fMaxCurveparam
+ double fMaxCurveparam = 2.0+ n - k;
+ if (fMaxCurveparam <= 0.0)
+ return; // not enough control points for desired spline order
+
+ if (nGranularity < 1)
+ return; //need at least 1 line for each part beween the control points
+
+ const double* pOldX = rInput.SequenceX[nOuter].getConstArray();
+ const double* pOldY = rInput.SequenceY[nOuter].getConstArray();
+ const double* pOldZ = rInput.SequenceZ[nOuter].getConstArray();
+
+ // keep this amount of steps to go well with old version
+ sal_Int32 nNewSectorCount = nGranularity * n;
+ double fCurveStep = fMaxCurveparam/static_cast< double >(nNewSectorCount);
+
+ double *b = new double [n + k + 1]; // values of blending functions
+
+ const double* t = createTVector(n, k); // knot vector
+
+ rResult.SequenceX[nOuter].realloc(nNewSectorCount+1);
+ rResult.SequenceY[nOuter].realloc(nNewSectorCount+1);
+ rResult.SequenceZ[nOuter].realloc(nNewSectorCount+1);
+ double* pNewX = rResult.SequenceX[nOuter].getArray();
+ double* pNewY = rResult.SequenceY[nOuter].getArray();
+ double* pNewZ = rResult.SequenceZ[nOuter].getArray();
+
+ // variables needed inside loop, when calculating one point of output
+ sal_Int32 nPointIndex =0; //index of given contol points
+ double fX=0.0;
+ double fY=0.0;
+ double fZ=0.0; //coordinates of a new BSpline point
+
+ for(sal_Int32 nNewSector=0; nNewSector<nNewSectorCount; nNewSector++)
+ { // in first looping fCurveparam has value 0.0
+
+ // Calculate the values of the blending functions for actual curve parameter
+ BVector(fCurveparam, n, k, b, t);
+
+ // output point(fCurveparam) = sum over {input point * value of blending function}
+ fX = 0.0;
+ fY = 0.0;
+ fZ = 0.0;
+ for (nPointIndex=0;nPointIndex<=n;nPointIndex++)
+ {
+ fX +=pOldX[nPointIndex]*b[nPointIndex];
+ fY +=pOldY[nPointIndex]*b[nPointIndex];
+ fZ +=pOldZ[nPointIndex]*b[nPointIndex];
+ }
+ pNewX[nNewSector] = fX;
+ pNewY[nNewSector] = fY;
+ pNewZ[nNewSector] = fZ;
+
+ fCurveparam += fCurveStep; //for next looping
+ }
+ // add last control point to BSpline curve
+ pNewX[nNewSectorCount] = pOldX[n];
+ pNewY[nNewSectorCount] = pOldY[n];
+ pNewZ[nNewSectorCount] = pOldZ[n];
+
+ delete[] t;
+ delete[] b;
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/view/charttypes/Splines.hxx b/chart2/source/view/charttypes/Splines.hxx
new file mode 100644
index 000000000000..642522f53ebe
--- /dev/null
+++ b/chart2/source/view/charttypes/Splines.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_SPLINECALCULATOR_HXX
+#define _CHART2_SPLINECALCULATOR_HXX
+
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class SplineCalculater
+{
+public:
+ static void CalculateCubicSplines(
+ const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
+ , ::com::sun::star::drawing::PolyPolygonShape3D& rResult
+ , sal_Int32 nGranularity );
+
+ static void CalculateBSplines(
+ const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
+ , ::com::sun::star::drawing::PolyPolygonShape3D& rResult
+ , sal_Int32 nGranularity
+ , sal_Int32 nSplineDepth );
+};
+
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
new file mode 100644
index 000000000000..840cbbe3e1e1
--- /dev/null
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -0,0 +1,2110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VSeriesPlotter.hxx"
+#include "ShapeFactory.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "StatisticsHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "LabelPositionHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "Clipping.hxx"
+#include "servicenames_charttypes.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "VLegendSymbolFactory.hxx"
+#include "FormattedStringHelper.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "RelativePositionHelper.hxx"
+
+//only for creation: @todo remove if all plotter are uno components and instanciated via servicefactory
+#include "BarChart.hxx"
+#include "PieChart.hxx"
+#include "AreaChart.hxx"
+#include "CandleStickChart.hxx"
+#include "BubbleChart.hxx"
+//
+
+#include <com/sun/star/chart/ErrorBarStyle.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 <tools/color.hxx>
+// header for class OUStringBuffer
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <com/sun/star/util/XCloneable.hpp>
+
+#include <svx/unoshape.hxx>
+
+#include <functional>
+
+//.............................................................................
+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 rtl::OUString;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+VDataSeriesGroup::CachedYValues::CachedYValues()
+ : m_bValuesDirty(true)
+ , m_fMinimumY(0.0)
+ , m_fMaximumY(0.0)
+{
+}
+
+VDataSeriesGroup::VDataSeriesGroup()
+ : m_aSeriesVector()
+ , m_bMaxPointCountDirty(true)
+ , m_nMaxPointCount(0)
+ , m_aListOfCachedYValues()
+
+{
+}
+
+VDataSeriesGroup::VDataSeriesGroup( VDataSeries* pSeries )
+ : m_aSeriesVector(1,pSeries)
+ , m_bMaxPointCountDirty(true)
+ , m_nMaxPointCount(0)
+ , m_aListOfCachedYValues()
+{
+}
+
+VDataSeriesGroup::~VDataSeriesGroup()
+{
+}
+
+void VDataSeriesGroup::deleteSeries()
+{
+ //delete all data series help objects:
+ ::std::vector< VDataSeries* >::const_iterator aIter = m_aSeriesVector.begin();
+ const ::std::vector< VDataSeries* >::const_iterator aEnd = m_aSeriesVector.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ delete *aIter;
+ }
+ m_aSeriesVector.clear();
+}
+
+void VDataSeriesGroup::addSeries( VDataSeries* pSeries )
+{
+ m_aSeriesVector.push_back(pSeries);
+ m_bMaxPointCountDirty=true;
+}
+
+sal_Int32 VDataSeriesGroup::getSeriesCount() const
+{
+ return m_aSeriesVector.size();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount, bool bCategoryXAxis )
+ : PlotterBase( nDimensionCount )
+ , m_pMainPosHelper( 0 )
+ , m_xChartTypeModel(xChartTypeModel)
+ , m_xChartTypeModelProps( uno::Reference< beans::XPropertySet >::query( xChartTypeModel ))
+ , m_aZSlots()
+ , m_bCategoryXAxis(bCategoryXAxis)
+ , m_xColorScheme()
+ , m_pExplicitCategoriesProvider(0)
+ , m_bPointsWereSkipped(false)
+{
+ DBG_ASSERT(m_xChartTypeModel.is(),"no XChartType available in view, fallback to default values may be wrong");
+}
+
+VSeriesPlotter::~VSeriesPlotter()
+{
+ //delete all data series help objects:
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ aXSlotIter->deleteSeries();
+ }
+ aZSlotIter->clear();
+ }
+ m_aZSlots.clear();
+
+ tSecondaryPosHelperMap::iterator aPosIt = m_aSecondaryPosHelperMap.begin();
+ while( aPosIt != m_aSecondaryPosHelperMap.end() )
+ {
+ PlottingPositionHelper* pPosHelper = aPosIt->second;
+ if( pPosHelper )
+ delete pPosHelper;
+ ++aPosIt;
+ }
+ m_aSecondaryPosHelperMap.clear();
+
+ m_aSecondaryValueScales.clear();
+}
+
+void VSeriesPlotter::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ //take ownership of pSeries
+
+ DBG_ASSERT( pSeries, "series to add is NULL" );
+ if(!pSeries)
+ return;
+
+ if(m_bCategoryXAxis)
+ pSeries->setCategoryXAxis();
+
+ if(zSlot<0 || zSlot>=static_cast<sal_Int32>(m_aZSlots.size()))
+ {
+ //new z slot
+ ::std::vector< VDataSeriesGroup > aZSlot;
+ aZSlot.push_back( VDataSeriesGroup(pSeries) );
+ m_aZSlots.push_back( aZSlot );
+ }
+ else
+ {
+ //existing zslot
+ ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[zSlot];
+
+ if(xSlot<0 || xSlot>=static_cast<sal_Int32>(rXSlots.size()))
+ {
+ //append the series to already existing x series
+ rXSlots.push_back( VDataSeriesGroup(pSeries) );
+ }
+ else
+ {
+ //x slot is already occupied
+ //y slot decides what to do:
+
+ VDataSeriesGroup& rYSlots = rXSlots[xSlot];
+ sal_Int32 nYSlotCount = rYSlots.getSeriesCount();
+
+ if( ySlot < -1 )
+ {
+ //move all existing series in the xSlot to next slot
+ //@todo
+ OSL_ENSURE( false, "Not implemented yet");
+ }
+ else if( ySlot == -1 || ySlot >= nYSlotCount)
+ {
+ //append the series to already existing y series
+ rYSlots.addSeries(pSeries);
+ }
+ else
+ {
+ //y slot is already occupied
+ //insert at given y and x position
+
+ //@todo
+ OSL_ENSURE( false, "Not implemented yet");
+ }
+ }
+ }
+}
+
+drawing::Direction3D VSeriesPlotter::getPreferredDiagramAspectRatio() const
+{
+ drawing::Direction3D aRet(1.0,1.0,1.0);
+ drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
+ aRet.DirectionZ = aScale.DirectionZ*0.2;
+ if(aRet.DirectionZ>1.0)
+ aRet.DirectionZ=1.0;
+ if(aRet.DirectionZ>10)
+ aRet.DirectionZ=10;
+ return aRet;
+}
+
+bool VSeriesPlotter::keepAspectRatio() const
+{
+ return true;
+}
+
+void VSeriesPlotter::releaseShapes()
+{
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+
+ ::std::vector< VDataSeries* >::iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ //iterate through all series in this x slot
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ pSeries->releaseShapes();
+ }
+ }
+ }
+}
+
+uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShape( VDataSeries* pDataSeries
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xGroupShape );
+ if( !xShapes.is() )
+ {
+ //create a group shape for this series and add to logic target:
+ xShapes = createGroupShape( xTarget,pDataSeries->getCID() );
+ pDataSeries->m_xGroupShape = xShapes;
+ }
+ return xShapes;
+}
+
+uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xFrontSubGroupShape );
+ if(!xShapes.is())
+ {
+ //ensure that the series group shape is already created
+ uno::Reference< drawing::XShapes > xSeriesShapes( this->getSeriesGroupShape( pDataSeries, xTarget ) );
+ //ensure that the back child is created first
+ this->getSeriesGroupShapeBackChild( pDataSeries, xTarget );
+ //use series group shape as parent for the new created front group shape
+ xShapes = createGroupShape( xSeriesShapes );
+ pDataSeries->m_xFrontSubGroupShape = xShapes;
+ }
+ return xShapes;
+}
+
+uno::Reference< drawing::XShapes > VSeriesPlotter::getSeriesGroupShapeBackChild( VDataSeries* pDataSeries
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ uno::Reference< drawing::XShapes > xShapes( pDataSeries->m_xBackSubGroupShape );
+ if(!xShapes.is())
+ {
+ //ensure that the series group shape is already created
+ uno::Reference< drawing::XShapes > xSeriesShapes( this->getSeriesGroupShape( pDataSeries, xTarget ) );
+ //use series group shape as parent for the new created back group shape
+ xShapes = createGroupShape( xSeriesShapes );
+ pDataSeries->m_xBackSubGroupShape = xShapes;
+ }
+ return xShapes;
+}
+
+uno::Reference< drawing::XShapes > VSeriesPlotter::getLabelsGroupShape( VDataSeries& rDataSeries
+ , const uno::Reference< drawing::XShapes >& xTextTarget )
+{
+ //xTextTarget needs to be a 2D shape container always!
+
+ uno::Reference< drawing::XShapes > xShapes( rDataSeries.m_xLabelsGroupShape );
+ if(!xShapes.is())
+ {
+ //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;
+ }
+ return xShapes;
+}
+
+uno::Reference< drawing::XShapes > VSeriesPlotter::getErrorBarsGroupShape( VDataSeries& rDataSeries
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ uno::Reference< drawing::XShapes > xShapes( rDataSeries.m_xErrorBarsGroupShape );
+ if(!xShapes.is())
+ {
+ //create a group shape for this series and add to logic target:
+ xShapes = this->createGroupShape( xTarget,rDataSeries.getErrorBarsCID() );
+ rDataSeries.m_xErrorBarsGroupShape = xShapes;
+ }
+ return xShapes;
+
+}
+
+OUString VSeriesPlotter::getLabelTextForValue( VDataSeries& rDataSeries
+ , sal_Int32 nPointIndex
+ , double fValue
+ , bool bAsPercentage )
+{
+ OUString aNumber;
+
+ if( m_apNumberFormatterWrapper.get())
+ {
+ sal_Int32 nNumberFormatKey = 0;
+ if( rDataSeries.hasExplicitNumberFormat(nPointIndex,bAsPercentage) )
+ nNumberFormatKey = rDataSeries.getExplicitNumberFormat(nPointIndex,bAsPercentage);
+ else if( bAsPercentage )
+ {
+ sal_Int32 nPercentFormat = ExplicitValueProvider::getPercentNumberFormat( m_apNumberFormatterWrapper->getNumberFormatsSupplier() );
+ if( nPercentFormat != -1 )
+ nNumberFormatKey = nPercentFormat;
+ }
+ else
+ {
+ if( rDataSeries.shouldLabelNumberFormatKeyBeDetectedFromYAxis() && m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis
+ nNumberFormatKey = m_aAxesNumberFormats.getFormat(1,rDataSeries.getAttachedAxisIndex());
+ else
+ nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex );
+ }
+ if(nNumberFormatKey<0)
+ nNumberFormatKey=0;
+
+ sal_Int32 nLabelCol = 0;
+ bool bColChanged;
+ aNumber = m_apNumberFormatterWrapper->getFormattedString(
+ nNumberFormatKey, fValue, nLabelCol, bColChanged );
+ //@todo: change color of label if bColChanged is true
+ }
+ else
+ {
+ sal_Unicode cDecSeparator = '.';//@todo get this locale dependent
+ aNumber = ::rtl::math::doubleToUString( fValue, rtl_math_StringFormat_G /*rtl_math_StringFormat*/
+ , 3/*DecPlaces*/ , cDecSeparator /*,sal_Int32 const * pGroups*/ /*,sal_Unicode cGroupSeparator*/ ,false /*bEraseTrailingDecZeros*/ );
+ }
+ return aNumber;
+}
+
+uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Reference< drawing::XShapes >& xTarget
+ , VDataSeries& rDataSeries
+ , sal_Int32 nPointIndex
+ , double fValue
+ , double fSumValue
+ , const awt::Point& rScreenPosition2D
+ , LabelAlignment eAlignment
+ , sal_Int32 nOffset )
+{
+ uno::Reference< drawing::XShape > xTextShape;
+
+ try
+ {
+ awt::Point aScreenPosition2D(rScreenPosition2D);
+ if(LABEL_ALIGN_LEFT==eAlignment)
+ aScreenPosition2D.X -= nOffset;
+ else if(LABEL_ALIGN_RIGHT==eAlignment)
+ aScreenPosition2D.X += nOffset;
+ else if(LABEL_ALIGN_TOP==eAlignment)
+ aScreenPosition2D.Y -= nOffset;
+ else if(LABEL_ALIGN_BOTTOM==eAlignment)
+ aScreenPosition2D.Y += nOffset;
+
+ uno::Reference< drawing::XShapes > xTarget_(
+ m_pShapeFactory->createGroup2D( this->getLabelsGroupShape(rDataSeries, xTarget)
+ , ObjectIdentifier::createPointCID( rDataSeries.getLabelCID_Stub(),nPointIndex ) ) );
+
+ //check wether the label needs to be created and how:
+ DataPointLabel* pLabel = rDataSeries.getDataPointLabelIfLabel( nPointIndex );
+
+ if( !pLabel )
+ return xTextShape;
+
+ //------------------------------------------------
+ //prepare legend symbol
+
+ Reference< drawing::XShape > xSymbol;
+ if(pLabel->ShowLegendSymbol)
+ {
+ if( rDataSeries.isVaryColorsByPoint() )
+ xSymbol.set( VSeriesPlotter::createLegendSymbolForPoint( rDataSeries, nPointIndex, xTarget_, m_xShapeFactory ) );
+ else
+ xSymbol.set( VSeriesPlotter::createLegendSymbolForSeries( rDataSeries, xTarget_, m_xShapeFactory ) );
+
+ }
+ //prepare text
+ ::rtl::OUStringBuffer aText;
+ ::rtl::OUString aSeparator(sal_Unicode(' '));
+ double fRotationDegrees = 0.0;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPointProps( rDataSeries.getPropertiesOfPoint( nPointIndex ) );
+ if(xPointProps.is())
+ {
+ xPointProps->getPropertyValue( C2U( "LabelSeparator" ) ) >>= aSeparator;
+ xPointProps->getPropertyValue( C2U( "TextRotation" ) ) >>= fRotationDegrees;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ bool bMultiLineLabel = aSeparator.equals(C2U("\n"));;
+ sal_Int32 nLineCountForSymbolsize = 0;
+ {
+ if(pLabel->ShowCategoryName)
+ {
+ if( m_pExplicitCategoriesProvider )
+ {
+ Sequence< OUString > aCategories( m_pExplicitCategoriesProvider->getSimpleCategories() );
+ if( nPointIndex >= 0 && nPointIndex < aCategories.getLength() )
+ {
+ aText.append( aCategories[nPointIndex] );
+ ++nLineCountForSymbolsize;
+ }
+ }
+ }
+
+ if(pLabel->ShowNumber)
+ {
+ OUString aNumber( this->getLabelTextForValue( rDataSeries
+ , nPointIndex, fValue, false /*bAsPercentage*/ ) );
+ if( aNumber.getLength() )
+ {
+ if(aText.getLength())
+ aText.append(aSeparator);
+ aText.append(aNumber);
+ ++nLineCountForSymbolsize;
+ }
+ }
+
+ if(pLabel->ShowNumberInPercent)
+ {
+ if(fSumValue==0.0)
+ fSumValue=1.0;
+ fValue /= fSumValue;
+ if( fValue < 0 )
+ fValue*=-1.0;
+
+ OUString aPercentage( this->getLabelTextForValue( rDataSeries
+ , nPointIndex, fValue, true /*bAsPercentage*/ ) );
+ if( aPercentage.getLength() )
+ {
+ if(aText.getLength())
+ aText.append(aSeparator);
+ aText.append(aPercentage);
+ ++nLineCountForSymbolsize;
+ }
+ }
+ }
+ //------------------------------------------------
+ //prepare properties for multipropertyset-interface of shape
+ tNameSequence* pPropNames;
+ tAnySequence* pPropValues;
+ if( !rDataSeries.getTextLabelMultiPropertyLists( nPointIndex, pPropNames, pPropValues ) )
+ return xTextShape;
+ LabelPositionHelper::changeTextAdjustment( *pPropValues, *pPropNames, eAlignment );
+
+ //------------------------------------------------
+ //create text shape
+ xTextShape = ShapeFactory(m_xShapeFactory).
+ createText( xTarget_, aText.makeStringAndClear()
+ , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) );
+
+ if( !xTextShape.is() )
+ return xTextShape;
+
+ const awt::Point aUnrotatedTextPos( xTextShape->getPosition() );
+ if( fRotationDegrees != 0.0 )
+ {
+ const double fDegreesPi( fRotationDegrees * ( F_PI / -180.0 ) );
+ uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "Transformation" ), ShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) );
+ LabelPositionHelper::correctPositionForRotation( xTextShape, eAlignment, fRotationDegrees, true /*bRotateAroundCenter*/ );
+ }
+
+ if( xSymbol.is() )
+ {
+ const awt::Point aOldTextPos( xTextShape->getPosition() );
+ awt::Point aNewTextPos( aOldTextPos );
+
+ awt::Size aSymbolSize( xSymbol->getSize() );
+ awt::Size aTextSize( xTextShape->getSize() );
+
+ if( !bMultiLineLabel || nLineCountForSymbolsize <= 0 )
+ nLineCountForSymbolsize = 1;
+ sal_Int32 nYDiff = aTextSize.Height/nLineCountForSymbolsize;
+ sal_Int32 nXDiff = aSymbolSize.Width * nYDiff/aSymbolSize.Height;
+
+ // #i109336# Improve auto positioning in chart
+ nXDiff = nXDiff * 80 / 100;
+ nYDiff = nYDiff * 80 / 100;
+
+ aSymbolSize.Width = nXDiff * 75/100;
+ aSymbolSize.Height = nYDiff * 75/100;
+
+ awt::Point aSymbolPosition( aUnrotatedTextPos );
+
+ // #i109336# Improve auto positioning in chart
+ aSymbolPosition.Y += ( nYDiff / 4 );
+
+ if(LABEL_ALIGN_LEFT==eAlignment
+ || LABEL_ALIGN_LEFT_TOP==eAlignment
+ || LABEL_ALIGN_LEFT_BOTTOM==eAlignment)
+ {
+ aSymbolPosition.X -= nXDiff;
+ }
+ else if(LABEL_ALIGN_RIGHT==eAlignment
+ || LABEL_ALIGN_RIGHT_TOP==eAlignment
+ || LABEL_ALIGN_RIGHT_BOTTOM==eAlignment )
+ {
+ aNewTextPos.X += nXDiff;
+ }
+ else if(LABEL_ALIGN_TOP==eAlignment
+ || LABEL_ALIGN_BOTTOM==eAlignment
+ || LABEL_ALIGN_CENTER==eAlignment )
+ {
+ aSymbolPosition.X -= nXDiff/2;
+ aNewTextPos.X += nXDiff/2;
+ }
+
+ xSymbol->setSize( aSymbolSize );
+ xSymbol->setPosition( aSymbolPosition );
+
+ //set position
+ xTextShape->setPosition( aNewTextPos );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ return xTextShape;
+}
+
+namespace
+{
+double lcl_getErrorBarLogicLength(
+ const uno::Sequence< double > & rData,
+ uno::Reference< beans::XPropertySet > xProp,
+ sal_Int32 nErrorBarStyle,
+ sal_Int32 nIndex,
+ bool bPositive )
+{
+ double fResult;
+ ::rtl::math::setNan( & fResult );
+ try
+ {
+ switch( nErrorBarStyle )
+ {
+ case ::com::sun::star::chart::ErrorBarStyle::NONE:
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
+ fResult = StatisticsHelper::getVariance( rData );
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
+ fResult = StatisticsHelper::getStandardDeviation( rData );
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
+ {
+ double fPercent = 0;
+ if( xProp->getPropertyValue( bPositive
+ ? C2U("PositiveError")
+ : C2U("NegativeError")) >>= fPercent )
+ {
+ if( nIndex >=0 && nIndex < rData.getLength() &&
+ ! ::rtl::math::isNan( rData[nIndex] ) &&
+ ! ::rtl::math::isNan( fPercent ))
+ {
+ fResult = rData[nIndex] * fPercent / 100.0;
+ }
+ }
+ }
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
+ xProp->getPropertyValue( bPositive
+ ? C2U("PositiveError")
+ : C2U("NegativeError")) >>= fResult;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ {
+ // todo: check if this is really what's called error-margin
+ double fPercent = 0;
+ if( xProp->getPropertyValue( bPositive
+ ? C2U("PositiveError")
+ : C2U("NegativeError")) >>= fPercent )
+ {
+ double fMaxValue;
+ ::rtl::math::setInf(&fMaxValue, true);
+ const double* pValues = rData.getConstArray();
+ for(sal_Int32 i=0; i<rData.getLength(); ++i, ++pValues)
+ {
+ if(fMaxValue<*pValues)
+ fMaxValue=*pValues;
+ }
+ if( ::rtl::math::isFinite( fMaxValue ) &&
+ ::rtl::math::isFinite( fPercent ))
+ {
+ fResult = fMaxValue * fPercent / 100.0;
+ }
+ }
+ }
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
+ fResult = StatisticsHelper::getStandardError( rData );
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
+ {
+ uno::Reference< chart2::data::XDataSource > xErrorBarData( xProp, uno::UNO_QUERY );
+ if( xErrorBarData.is())
+ fResult = StatisticsHelper::getErrorFromDataSource(
+ xErrorBarData, nIndex, bPositive /*, true */ /* y-error */ );
+ }
+ break;
+ }
+ }
+ catch( uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ return fResult;
+}
+
+void lcl_AddErrorBottomLine( const drawing::Position3D& rPosition, ::basegfx::B2DVector aMainDirection
+ , drawing::PolyPolygonShape3D& rPoly, sal_Int32 nSequenceIndex )
+{
+ double fFixedWidth = 200.0;
+
+ aMainDirection.normalize();
+ ::basegfx::B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX());
+ aOrthoDirection.normalize();
+
+ ::basegfx::B2DVector aAnchor( rPosition.PositionX, rPosition.PositionY );
+ ::basegfx::B2DVector aStart = aAnchor + aOrthoDirection*fFixedWidth/2.0;
+ ::basegfx::B2DVector aEnd = aAnchor - aOrthoDirection*fFixedWidth/2.0;
+
+ AddPointToPoly( rPoly, drawing::Position3D( aStart.getX(), aStart.getY(), rPosition.PositionZ), nSequenceIndex );
+ AddPointToPoly( rPoly, drawing::Position3D( aEnd.getX(), aEnd.getY(), rPosition.PositionZ), nSequenceIndex );
+}
+
+::basegfx::B2DVector lcl_getErrorBarMainDirection(
+ const drawing::Position3D& rStart
+ , const drawing::Position3D& rBottomEnd
+ , PlottingPositionHelper* pPosHelper
+ , const drawing::Position3D& rUnscaledLogicPosition
+ , bool bYError )
+{
+ ::basegfx::B2DVector aMainDirection = ::basegfx::B2DVector( rStart.PositionX - rBottomEnd.PositionX
+ , rStart.PositionY - rBottomEnd.PositionY );
+ if( !aMainDirection.getLength() )
+ {
+ //get logic clip values:
+ double MinX = pPosHelper->getLogicMinX();
+ double MinY = pPosHelper->getLogicMinY();
+ double MaxX = pPosHelper->getLogicMaxX();
+ double MaxY = pPosHelper->getLogicMaxY();
+ double fZ = pPosHelper->getLogicMinZ();
+
+
+ if( bYError )
+ {
+ //main direction has constant x value
+ MinX = rUnscaledLogicPosition.PositionX;
+ MaxX = rUnscaledLogicPosition.PositionX;
+ }
+ else
+ {
+ //main direction has constant y value
+ MinY = rUnscaledLogicPosition.PositionY;
+ MaxY = rUnscaledLogicPosition.PositionY;
+ }
+
+ drawing::Position3D aStart = pPosHelper->transformLogicToScene( MinX, MinY, fZ, false );
+ drawing::Position3D aEnd = pPosHelper->transformLogicToScene( MaxX, MaxY, fZ, false );
+
+ aMainDirection = ::basegfx::B2DVector( aStart.PositionX - aEnd.PositionX
+ , aStart.PositionY - aEnd.PositionY );
+ }
+ if( !aMainDirection.getLength() )
+ {
+ //@todo
+ }
+ return aMainDirection;
+}
+
+} // anonymous namespace
+
+// virtual
+void VSeriesPlotter::createErrorBar(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rUnscaledLogicPosition
+ , const uno::Reference< beans::XPropertySet > & xErrorBarProperties
+ , const VDataSeries& rVDataSeries
+ , sal_Int32 nIndex
+ , bool bYError /* = true */
+ )
+{
+ if( !ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ) )
+ return;
+
+ if( ! xErrorBarProperties.is())
+ return;
+
+ try
+ {
+ sal_Bool bShowPositive = sal_False;
+ sal_Bool bShowNegative = sal_False;
+ sal_Int32 nErrorBarStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
+
+ xErrorBarProperties->getPropertyValue( C2U( "ShowPositiveError" )) >>= bShowPositive;
+ xErrorBarProperties->getPropertyValue( C2U( "ShowNegativeError" )) >>= bShowNegative;
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nErrorBarStyle;
+
+ if(!bShowPositive && !bShowNegative)
+ return;
+
+ if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::NONE)
+ return;
+
+ drawing::Position3D aUnscaledLogicPosition(rUnscaledLogicPosition);
+ if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION)
+ aUnscaledLogicPosition.PositionY = rVDataSeries.getYMeanValue();
+
+ bool bCreateNegativeBorder = false;//make a vertical line at the negative end of the error bar
+ bool bCreatePositiveBorder = false;//make a vertical line at the positive end of the error bar
+ drawing::Position3D aMiddle(aUnscaledLogicPosition);
+ const double fX = aUnscaledLogicPosition.PositionX;
+ const double fY = aUnscaledLogicPosition.PositionY;
+ const double fZ = aUnscaledLogicPosition.PositionZ;
+ aMiddle = m_pPosHelper->transformLogicToScene( fX, fY, fZ, true );
+
+ drawing::Position3D aNegative(aMiddle);
+ drawing::Position3D aPositive(aMiddle);
+
+ uno::Sequence< double > aData( bYError ? rVDataSeries.getAllY() : rVDataSeries.getAllX() );
+
+ if( bShowPositive )
+ {
+ double fLength = lcl_getErrorBarLogicLength( aData, xErrorBarProperties, nErrorBarStyle, nIndex, true );
+ if( ::rtl::math::isFinite( fLength ) )
+ {
+ double fLocalX = fX;
+ double fLocalY = fY;
+ if( bYError )
+ fLocalY+=fLength;
+ else
+ fLocalX+=fLength;
+ bCreatePositiveBorder = m_pPosHelper->isLogicVisible(fLocalX, fLocalY, fZ);
+ aPositive = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
+ }
+ else
+ bShowPositive = false;
+ }
+
+ if( bShowNegative )
+ {
+ double fLength = lcl_getErrorBarLogicLength( aData, xErrorBarProperties, nErrorBarStyle, nIndex, false );
+ if( ::rtl::math::isFinite( fLength ) )
+ {
+ double fLocalX = fX;
+ double fLocalY = fY;
+ if( bYError )
+ fLocalY-=fLength;
+ else
+ fLocalX-=fLength;
+
+ bCreateNegativeBorder = m_pPosHelper->isLogicVisible( fLocalX, fLocalY, fZ);
+ aNegative = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
+ }
+ else
+ bShowNegative = false;
+ }
+
+ if(!bShowPositive && !bShowNegative)
+ return;
+
+ drawing::PolyPolygonShape3D aPoly;
+
+ sal_Int32 nSequenceIndex=0;
+ if( bShowNegative )
+ AddPointToPoly( aPoly, aNegative, nSequenceIndex );
+ AddPointToPoly( aPoly, aMiddle, nSequenceIndex );
+ if( bShowPositive )
+ AddPointToPoly( aPoly, aPositive, nSequenceIndex );
+
+ if( bShowNegative && bCreateNegativeBorder )
+ {
+ ::basegfx::B2DVector aMainDirection = lcl_getErrorBarMainDirection( aMiddle, aNegative, m_pPosHelper, aUnscaledLogicPosition, bYError );
+ nSequenceIndex++;
+ lcl_AddErrorBottomLine( aNegative, aMainDirection, aPoly, nSequenceIndex );
+ }
+ if( bShowPositive && bCreatePositiveBorder )
+ {
+ ::basegfx::B2DVector aMainDirection = lcl_getErrorBarMainDirection( aMiddle, aPositive, m_pPosHelper, aUnscaledLogicPosition, bYError );
+ nSequenceIndex++;
+ lcl_AddErrorBottomLine( aPositive, aMainDirection, aPoly, nSequenceIndex );
+ }
+
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D( xTarget, PolyToPointSequence( aPoly) );
+ this->setMappedProperties( xShape, xErrorBarProperties, PropertyMapper::getPropertyNameMapForLineProperties() );
+ }
+ catch( uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+}
+
+// virtual
+void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogicPosition
+ , VDataSeries& rVDataSeries, sal_Int32 nPointIndex
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ if(m_nDimension!=2)
+ return;
+ // error bars
+ uno::Reference< beans::XPropertySet > xErrorBarProp(rVDataSeries.getYErrorBarProperties(nPointIndex));
+ if( xErrorBarProp.is())
+ {
+ uno::Reference< drawing::XShapes > xErrorBarsGroup_Shapes(
+ this->getErrorBarsGroupShape(rVDataSeries, xTarget) );
+
+ createErrorBar( xErrorBarsGroup_Shapes
+ , rUnscaledLogicPosition, xErrorBarProp
+ , rVDataSeries, nPointIndex
+ , true /* bYError */ );
+ }
+}
+
+void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries& rVDataSeries
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , const uno::Reference< drawing::XShapes >& xEquationTarget
+ , bool bMaySkipPointsInRegressionCalculation )
+{
+ if(m_nDimension!=2)
+ return;
+ uno::Reference< XRegressionCurveContainer > xRegressionContainer(
+ rVDataSeries.getModel(), uno::UNO_QUERY );
+ if(!xRegressionContainer.is())
+ return;
+ double fMinX = m_pPosHelper->getLogicMinX();
+ double fMaxX = m_pPosHelper->getLogicMaxX();
+
+ uno::Sequence< uno::Reference< XRegressionCurve > > aCurveList =
+ xRegressionContainer->getRegressionCurves();
+ for(sal_Int32 nN=0; nN<aCurveList.getLength(); nN++)
+ {
+ uno::Reference< XRegressionCurveCalculator > xRegressionCurveCalculator(
+ aCurveList[nN]->getCalculator() );
+ if( ! xRegressionCurveCalculator.is())
+ continue;
+ xRegressionCurveCalculator->recalculateRegression( rVDataSeries.getAllX(), rVDataSeries.getAllY() );
+
+ sal_Int32 nRegressionPointCount = 50;//@todo find a more optimal solution if more complicated curve types are introduced
+ drawing::PolyPolygonShape3D aRegressionPoly;
+ aRegressionPoly.SequenceX.realloc(1);
+ aRegressionPoly.SequenceY.realloc(1);
+ aRegressionPoly.SequenceZ.realloc(1);
+ aRegressionPoly.SequenceX[0].realloc(nRegressionPointCount);
+ aRegressionPoly.SequenceY[0].realloc(nRegressionPointCount);
+ aRegressionPoly.SequenceZ[0].realloc(nRegressionPointCount);
+ sal_Int32 nRealPointCount=0;
+
+ uno::Sequence< chart2::ExplicitScaleData > aScaleDataSeq( m_pPosHelper->getScales());
+ uno::Reference< chart2::XScaling > xScalingX;
+ uno::Reference< chart2::XScaling > xScalingY;
+ if( aScaleDataSeq.getLength() >= 2 )
+ {
+ xScalingX.set( aScaleDataSeq[0].Scaling );
+ xScalingY.set( aScaleDataSeq[1].Scaling );
+ }
+
+ uno::Sequence< geometry::RealPoint2D > aCalculatedPoints(
+ xRegressionCurveCalculator->getCurveValues(
+ fMinX, fMaxX, nRegressionPointCount, xScalingX, xScalingY, bMaySkipPointsInRegressionCalculation ));
+ nRegressionPointCount = aCalculatedPoints.getLength();
+ for(sal_Int32 nP=0; nP<nRegressionPointCount; nP++)
+ {
+ double fLogicX = aCalculatedPoints[nP].X;
+ double fLogicY = aCalculatedPoints[nP].Y;
+ double fLogicZ = 0.0;//dummy
+
+ m_pPosHelper->doLogicScaling( &fLogicX, &fLogicY, &fLogicZ );
+
+ if( !::rtl::math::isNan(fLogicX) && !::rtl::math::isInf(fLogicX)
+ && !::rtl::math::isNan(fLogicY) && !::rtl::math::isInf(fLogicY)
+ && !::rtl::math::isNan(fLogicZ) && !::rtl::math::isInf(fLogicZ) )
+ {
+ aRegressionPoly.SequenceX[0][nRealPointCount] = fLogicX;
+ aRegressionPoly.SequenceY[0][nRealPointCount] = fLogicY;
+ nRealPointCount++;
+ }
+ }
+ aRegressionPoly.SequenceX[0].realloc(nRealPointCount);
+ aRegressionPoly.SequenceY[0].realloc(nRealPointCount);
+ aRegressionPoly.SequenceZ[0].realloc(nRealPointCount);
+
+ drawing::PolyPolygonShape3D aClippedPoly;
+ Clipping::clipPolygonAtRectangle( aRegressionPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly );
+ aRegressionPoly = aClippedPoly;
+ m_pPosHelper->transformScaledLogicToScene( aRegressionPoly );
+
+ awt::Point aDefaultPos;
+ if( aRegressionPoly.SequenceX.getLength() && aRegressionPoly.SequenceX[0].getLength() )
+ {
+ uno::Reference< beans::XPropertySet > xCurveModelProp( aCurveList[nN], uno::UNO_QUERY );
+ VLineProperties aVLineProperties;
+ aVLineProperties.initFromPropertySet( xCurveModelProp );
+
+ //create an extra group shape for each curve for selection handling
+ bool bAverageLine = RegressionCurveHelper::isMeanValueLine( aCurveList[nN] );
+ uno::Reference< drawing::XShapes > xRegressionGroupShapes =
+ createGroupShape( xTarget, rVDataSeries.getDataCurveCID( nN, bAverageLine ) );
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xRegressionGroupShapes, PolyToPointSequence( aRegressionPoly ), &aVLineProperties );
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ aDefaultPos = xShape->getPosition();
+ }
+
+ // curve equation and correlation coefficient
+ uno::Reference< beans::XPropertySet > xEqProp( aCurveList[nN]->getEquationProperties());
+ if( xEqProp.is())
+ {
+ createRegressionCurveEquationShapes(
+ rVDataSeries.getDataCurveEquationCID( nN ),
+ xEqProp, xEquationTarget, xRegressionCurveCalculator,
+ aDefaultPos );
+ }
+ }
+}
+
+void VSeriesPlotter::createRegressionCurveEquationShapes(
+ const OUString & rEquationCID,
+ const uno::Reference< beans::XPropertySet > & xEquationProperties,
+ const uno::Reference< drawing::XShapes >& xEquationTarget,
+ const uno::Reference< chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator,
+ awt::Point aDefaultPos )
+{
+ OSL_ASSERT( xEquationProperties.is());
+ if( !xEquationProperties.is())
+ return;
+
+ bool bShowEquation = false;
+ bool bShowCorrCoeff = false;
+ OUString aSep( sal_Unicode('\n'));
+ if(( xEquationProperties->getPropertyValue( C2U("ShowEquation")) >>= bShowEquation ) &&
+ ( xEquationProperties->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCorrCoeff ))
+ {
+ if( ! (bShowEquation || bShowCorrCoeff))
+ return;
+
+ ::rtl::OUStringBuffer aFormula;
+ sal_Int32 nNumberFormatKey = 0;
+ xEquationProperties->getPropertyValue( C2U("NumberFormat")) >>= nNumberFormatKey;
+
+ if( bShowEquation )
+ {
+ if( m_apNumberFormatterWrapper.get())
+ {
+ aFormula = xRegressionCurveCalculator->getFormattedRepresentation(
+ m_apNumberFormatterWrapper->getNumberFormatsSupplier(),
+ nNumberFormatKey );
+ }
+ else
+ {
+ aFormula = xRegressionCurveCalculator->getRepresentation();
+ }
+
+ if( bShowCorrCoeff )
+ {
+// xEquationProperties->getPropertyValue( C2U("Separator")) >>= aSep;
+ aFormula.append( aSep );
+ }
+ }
+ if( bShowCorrCoeff )
+ {
+ aFormula.append( sal_Unicode( 'R' ));
+ aFormula.append( sal_Unicode( 0x00b2 ));
+ aFormula.append( C2U( " = " ));
+ double fR( xRegressionCurveCalculator->getCorrelationCoefficient());
+ if( m_apNumberFormatterWrapper.get())
+ {
+ sal_Int32 nLabelCol = 0;
+ bool bColChanged;
+ aFormula.append(
+ m_apNumberFormatterWrapper->getFormattedString(
+ nNumberFormatKey, fR*fR, nLabelCol, bColChanged ));
+ //@todo: change color of label if bColChanged is true
+ }
+ else
+ {
+ sal_Unicode aDecimalSep( '.' );//@todo get this locale dependent
+ aFormula.append( ::rtl::math::doubleToUString(
+ fR*fR, rtl_math_StringFormat_G, 4, aDecimalSep, true ));
+ }
+ }
+
+ awt::Point aScreenPosition2D;
+ chart2::RelativePosition aRelativePosition;
+ if( xEquationProperties->getPropertyValue( C2U("RelativePosition")) >>= aRelativePosition )
+ {
+ //@todo decide wether x is primary or secondary
+ double fX = aRelativePosition.Primary*m_aPageReferenceSize.Width;
+ double fY = aRelativePosition.Secondary*m_aPageReferenceSize.Height;
+ aScreenPosition2D.X = static_cast< sal_Int32 >( ::rtl::math::round( fX ));
+ aScreenPosition2D.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY ));
+ }
+ else
+ aScreenPosition2D = aDefaultPos;
+
+ if( aFormula.getLength())
+ {
+ // set fill and line properties on creation
+ tNameSequence aNames;
+ tAnySequence aValues;
+ PropertyMapper::getPreparedTextShapePropertyLists( xEquationProperties, aNames, aValues );
+
+ uno::Reference< drawing::XShape > xTextShape = m_pShapeFactory->createText(
+ xEquationTarget, aFormula.makeStringAndClear(),
+ aNames, aValues, ShapeFactory::makeTransformation( aScreenPosition2D ));
+
+// // adapt font sizes
+// awt::Size aOldRefSize;
+// if( xTitleProperties->getPropertyValue( C2U("ReferencePageSize")) >>= aOldRefSize )
+// {
+// uno::Reference< beans::XPropertySet > xShapeProp( xTextShape, uno::UNO_QUERY );
+// if( xShapeProp.is())
+// RelativeSizeHelper::adaptFontSizes( xShapeProp, aOldRefSize, m_aPageReferenceSize );
+// }
+
+ OSL_ASSERT( xTextShape.is());
+ if( xTextShape.is())
+ {
+ ShapeFactory::setShapeName( xTextShape, rEquationCID );
+ xTextShape->setPosition(
+ RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ aScreenPosition2D, xTextShape->getSize(), aRelativePosition.Anchor ));
+ }
+ }
+ }
+}
+
+
+void VSeriesPlotter::setMappedProperties(
+ const uno::Reference< drawing::XShape >& xTargetShape
+ , const uno::Reference< beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap
+ , tPropertyNameValueMap* pOverwriteMap )
+{
+ uno::Reference< beans::XPropertySet > xTargetProp( xTargetShape, uno::UNO_QUERY );
+ PropertyMapper::setMappedProperties(xTargetProp,xSource,rMap,pOverwriteMap);
+}
+
+//-------------------------------------------------------------------------
+// MinimumAndMaximumSupplier
+//-------------------------------------------------------------------------
+
+double VSeriesPlotter::getMinimumX()
+{
+ if( m_bCategoryXAxis )
+ {
+ double fRet = 1.0;//first category (index 0) matches with real number 1.0
+ if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
+ fRet -= 0.5;
+ return fRet;
+ }
+
+ double fMinimum, fMaximum;
+ this->getMinimumAndMaximiumX( fMinimum, fMaximum );
+ return fMinimum;
+}
+double VSeriesPlotter::getMaximumX()
+{
+ if( m_bCategoryXAxis )
+ {
+ //return category count
+ double fRet = getPointCount();//first category (index 0) matches with real number 1.0
+ if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
+ fRet += 0.5;
+ return fRet;
+ }
+
+ double fMinimum, fMaximum;
+ this->getMinimumAndMaximiumX( fMinimum, fMaximum );
+ return fMaximum;
+}
+
+double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
+{
+ if( !m_bCategoryXAxis )
+ {
+ double fMinY, fMaxY;
+ this->getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
+ return fMinY;
+ }
+
+ double fMinimum, fMaximum;
+ ::rtl::math::setInf(&fMinimum, false);
+ ::rtl::math::setInf(&fMaximum, true);
+ for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
+ for(size_t nN =0; nN<rXSlots.size();nN++ )
+ {
+ double fLocalMinimum, fLocalMaximum;
+ rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+ static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
+ , static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
+ , isSeperateStackingForDifferentSigns( 1 )
+ , fLocalMinimum, fLocalMaximum, nAxisIndex );
+ if(fMaximum<fLocalMaximum)
+ fMaximum=fLocalMaximum;
+ if(fMinimum>fLocalMinimum)
+ fMinimum=fLocalMinimum;
+ }
+ }
+ if(::rtl::math::isInf(fMinimum))
+ ::rtl::math::setNan(&fMinimum);
+ return fMinimum;
+}
+
+double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
+{
+ if( !m_bCategoryXAxis )
+ {
+ double fMinY, fMaxY;
+ this->getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
+ return fMaxY;
+ }
+
+ double fMinimum, fMaximum;
+ ::rtl::math::setInf(&fMinimum, false);
+ ::rtl::math::setInf(&fMaximum, true);
+ for(size_t nZ =0; nZ<m_aZSlots.size();nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >& rXSlots = m_aZSlots[nZ];
+ for(size_t nN =0; nN<rXSlots.size();nN++ )
+ {
+ double fLocalMinimum, fLocalMaximum;
+ rXSlots[nN].calculateYMinAndMaxForCategoryRange(
+ static_cast<sal_Int32>(fMinimumX-1.0) //first category (index 0) matches with real number 1.0
+ , static_cast<sal_Int32>(fMaximumX-1.0) //first category (index 0) matches with real number 1.0
+ , isSeperateStackingForDifferentSigns( 1 )
+ , fLocalMinimum, fLocalMaximum, nAxisIndex );
+ if(fMaximum<fLocalMaximum)
+ fMaximum=fLocalMaximum;
+ if(fMinimum>fLocalMinimum)
+ fMinimum=fLocalMinimum;
+ }
+ }
+ if(::rtl::math::isInf(fMaximum))
+ ::rtl::math::setNan(&fMaximum);
+ return fMaximum;
+}
+
+double VSeriesPlotter::getMinimumZ()
+{
+ //this is the default for all charts without a meaningfull z axis
+ return 0.5;
+}
+double VSeriesPlotter::getMaximumZ()
+{
+ if( 3!=m_nDimension )
+ return 0.5;
+ return m_aZSlots.size()+0.5;
+}
+
+namespace
+{
+ bool lcl_isValueAxis( sal_Int32 nDimensionIndex, bool bCategoryXAxis )
+ {
+ // default implementation: true for Y axes, and for value X axis
+ if( nDimensionIndex == 0 )
+ return !bCategoryXAxis;
+ if( nDimensionIndex == 1 )
+ return true;
+ return false;
+ }
+}
+
+bool VSeriesPlotter::isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex )
+{
+ return lcl_isValueAxis( nDimensionIndex, m_bCategoryXAxis );
+}
+
+bool VSeriesPlotter::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
+{
+ // do not expand axes in 3D charts
+ return (m_nDimension < 3) && lcl_isValueAxis( nDimensionIndex, m_bCategoryXAxis );
+}
+
+bool VSeriesPlotter::isExpandWideValuesToZero( sal_Int32 nDimensionIndex )
+{
+ // default implementation: only for Y axis
+ return nDimensionIndex == 1;
+}
+
+bool VSeriesPlotter::isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex )
+{
+ // default implementation: only for Y axis
+ return nDimensionIndex == 1;
+}
+
+bool VSeriesPlotter::isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex )
+{
+ // default implementation: only for Y axis
+ return nDimensionIndex == 1;
+}
+
+void VSeriesPlotter::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const
+{
+ ::rtl::math::setInf(&rfMinimum, false);
+ ::rtl::math::setInf(&rfMaximum, true);
+
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ double fLocalMinimum, fLocalMaximum;
+ aXSlotIter->getMinimumAndMaximiumX( fLocalMinimum, fLocalMaximum );
+ if( !::rtl::math::isNan(fLocalMinimum) && fLocalMinimum< rfMinimum )
+ rfMinimum = fLocalMinimum;
+ if( !::rtl::math::isNan(fLocalMaximum) && fLocalMaximum> rfMaximum )
+ rfMaximum = fLocalMaximum;
+ }
+ }
+ if(::rtl::math::isInf(rfMinimum))
+ ::rtl::math::setNan(&rfMinimum);
+ if(::rtl::math::isInf(rfMaximum))
+ ::rtl::math::setNan(&rfMaximum);
+}
+
+void VSeriesPlotter::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
+{
+ ::rtl::math::setInf(&rfMinY, false);
+ ::rtl::math::setInf(&rfMaxY, true);
+
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ double fLocalMinimum, fLocalMaximum;
+ aXSlotIter->getMinimumAndMaximiumYInContinuousXRange( fLocalMinimum, fLocalMaximum, fMinX, fMaxX, nAxisIndex );
+ if( !::rtl::math::isNan(fLocalMinimum) && fLocalMinimum< rfMinY )
+ rfMinY = fLocalMinimum;
+ if( !::rtl::math::isNan(fLocalMaximum) && fLocalMaximum> rfMaxY )
+ rfMaxY = fLocalMaximum;
+ }
+ }
+ if(::rtl::math::isInf(rfMinY))
+ ::rtl::math::setNan(&rfMinY);
+ if(::rtl::math::isInf(rfMaxY))
+ ::rtl::math::setNan(&rfMaxY);
+}
+
+sal_Int32 VSeriesPlotter::getPointCount() const
+{
+ sal_Int32 nRet = 0;
+
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ sal_Int32 nPointCount = aXSlotIter->getPointCount();
+ if( nPointCount>nRet )
+ nRet = nPointCount;
+ }
+ }
+ return nRet;
+}
+
+void VSeriesPlotter::setNumberFormatsSupplier(
+ const uno::Reference< util::XNumberFormatsSupplier > & xNumFmtSupplier )
+{
+ m_apNumberFormatterWrapper.reset( new NumberFormatterWrapper( xNumFmtSupplier ));
+}
+
+void VSeriesPlotter::setColorScheme( const uno::Reference< XColorScheme >& xColorScheme )
+{
+ m_xColorScheme = xColorScheme;
+}
+
+void VSeriesPlotter::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider )
+{
+ m_pExplicitCategoriesProvider = pExplicitCategoriesProvider;
+}
+
+sal_Int32 VDataSeriesGroup::getPointCount() const
+{
+ if(!m_bMaxPointCountDirty)
+ return m_nMaxPointCount;
+
+ sal_Int32 nRet = 0;
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = m_aSeriesVector.begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = m_aSeriesVector.end();
+
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ sal_Int32 nPointCount = (*aSeriesIter)->getTotalPointCount();
+ if( nPointCount>nRet )
+ nRet = nPointCount;
+ }
+ m_nMaxPointCount=nRet;
+ m_aListOfCachedYValues.clear();
+ m_aListOfCachedYValues.resize(m_nMaxPointCount);
+ m_bMaxPointCountDirty=false;
+ return nRet;
+}
+
+sal_Int32 VDataSeriesGroup::getAttachedAxisIndexForFirstSeries() const
+{
+ sal_Int32 nRet = 0;
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = m_aSeriesVector.begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = m_aSeriesVector.end();
+
+ if( aSeriesIter != aSeriesEnd )
+ nRet = (*aSeriesIter)->getAttachedAxisIndex();
+
+ return nRet;
+}
+
+void VDataSeriesGroup::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const
+{
+ const ::std::vector< VDataSeries* >* pSeriesList = &this->m_aSeriesVector;
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ ::rtl::math::setInf(&rfMinimum, false);
+ ::rtl::math::setInf(&rfMaximum, true);
+
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ sal_Int32 nPointCount = (*aSeriesIter)->getTotalPointCount();
+ for(sal_Int32 nN=0;nN<nPointCount;nN++)
+ {
+ double fX = (*aSeriesIter)->getXValue( nN );
+ if( ::rtl::math::isNan(fX) )
+ continue;
+ if(rfMaximum<fX)
+ rfMaximum=fX;
+ if(rfMinimum>fX)
+ rfMinimum=fX;
+ }
+ }
+ if(::rtl::math::isInf(rfMinimum))
+ ::rtl::math::setNan(&rfMinimum);
+ if(::rtl::math::isInf(rfMaximum))
+ ::rtl::math::setNan(&rfMaximum);
+}
+void VDataSeriesGroup::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const
+{
+ const ::std::vector< VDataSeries* >* pSeriesList = &this->m_aSeriesVector;
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ ::rtl::math::setInf(&rfMinY, false);
+ ::rtl::math::setInf(&rfMaxY, true);
+
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ sal_Int32 nPointCount = (*aSeriesIter)->getTotalPointCount();
+ for(sal_Int32 nN=0;nN<nPointCount;nN++)
+ {
+ if( nAxisIndex != (*aSeriesIter)->getAttachedAxisIndex() )
+ continue;
+
+ double fX = (*aSeriesIter)->getXValue( nN );
+ if( ::rtl::math::isNan(fX) )
+ continue;
+ if( fX < fMinX || fX > fMaxX )
+ continue;
+ double fY = (*aSeriesIter)->getYValue( nN );
+ if( ::rtl::math::isNan(fY) )
+ continue;
+ if(rfMaxY<fY)
+ rfMaxY=fY;
+ if(rfMinY>fY)
+ rfMinY=fY;
+ }
+ }
+ if(::rtl::math::isInf(rfMinY))
+ ::rtl::math::setNan(&rfMinY);
+ if(::rtl::math::isInf(rfMaxY))
+ ::rtl::math::setNan(&rfMaxY);
+}
+
+void VDataSeriesGroup::calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
+ , bool bSeperateStackingForDifferentSigns
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex )
+{
+ ::rtl::math::setInf(&rfMinimumY, false);
+ ::rtl::math::setInf(&rfMaximumY, true);
+
+ sal_Int32 nPointCount = getPointCount();//necessary to create m_aListOfCachedYValues
+ if(nCategoryIndex<0 || nCategoryIndex>=nPointCount || m_aSeriesVector.empty())
+ return;
+
+ CachedYValues aCachedYValues = m_aListOfCachedYValues[nCategoryIndex][nAxisIndex];
+ if( !aCachedYValues.m_bValuesDirty )
+ {
+ //return cached values
+ rfMinimumY = aCachedYValues.m_fMinimumY;
+ rfMaximumY = aCachedYValues.m_fMaximumY;
+ 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 );
+
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = m_aSeriesVector.begin();
+ ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = m_aSeriesVector.end();
+
+ if( bSeperateStackingForDifferentSigns )
+ {
+ for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
+ {
+ if( nAxisIndex != (*aSeriesIter)->getAttachedAxisIndex() )
+ continue;
+
+ double fValueMinY = (*aSeriesIter)->getMinimumofAllDifferentYValues( nCategoryIndex );
+ double fValueMaxY = (*aSeriesIter)->getMaximumofAllDifferentYValues( nCategoryIndex );
+
+ if( fValueMaxY >= 0 )
+ {
+ if( ::rtl::math::isNan( fPositiveSum ) )
+ fPositiveSum = fFirstPositiveY = fValueMaxY;
+ else
+ fPositiveSum += fValueMaxY;
+ }
+ if( fValueMinY < 0 )
+ {
+ if(::rtl::math::isNan( fNegativeSum ))
+ fNegativeSum = fFirstNegativeY = fValueMinY;
+ else
+ fNegativeSum += fValueMinY;
+ }
+ }
+ rfMinimumY = ::rtl::math::isNan( fNegativeSum ) ? fFirstPositiveY : fNegativeSum;
+ rfMaximumY = ::rtl::math::isNan( fPositiveSum ) ? fFirstNegativeY : fPositiveSum;
+ }
+ else
+ {
+ for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
+ {
+ if( nAxisIndex != (*aSeriesIter)->getAttachedAxisIndex() )
+ continue;
+
+ double fValueMinY = (*aSeriesIter)->getMinimumofAllDifferentYValues( nCategoryIndex );
+ double fValueMaxY = (*aSeriesIter)->getMaximumofAllDifferentYValues( nCategoryIndex );
+
+ if( ::rtl::math::isNan( fTotalSum ) )
+ {
+ rfMinimumY = fValueMinY;
+ rfMaximumY = fTotalSum = fValueMaxY;
+ }
+ else
+ {
+ fTotalSum += fValueMaxY;
+ if( rfMinimumY > fTotalSum )
+ rfMinimumY = fTotalSum;
+ if( rfMaximumY < fTotalSum )
+ rfMaximumY = fTotalSum;
+ }
+ }
+ }
+
+ aCachedYValues.m_fMinimumY = rfMinimumY;
+ aCachedYValues.m_fMaximumY = rfMaximumY;
+ aCachedYValues.m_bValuesDirty = false;
+ m_aListOfCachedYValues[nCategoryIndex][nAxisIndex]=aCachedYValues;
+}
+
+void VDataSeriesGroup::calculateYMinAndMaxForCategoryRange(
+ sal_Int32 nStartCategoryIndex, sal_Int32 nEndCategoryIndex
+ , bool bSeperateStackingForDifferentSigns
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex )
+{
+ //@todo maybe cache these values
+ ::rtl::math::setInf(&rfMinimumY, false);
+ ::rtl::math::setInf(&rfMaximumY, true);
+
+ //iterate through the given categories
+ if(nStartCategoryIndex<0)
+ nStartCategoryIndex=0;
+ if(nEndCategoryIndex<0)
+ nEndCategoryIndex=0;
+ for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex <= nEndCategoryIndex; nCatIndex++ )
+ {
+ double fMinimumY; ::rtl::math::setNan(&fMinimumY);
+ double fMaximumY; ::rtl::math::setNan(&fMaximumY);
+
+ this->calculateYMinAndMaxForCategory( nCatIndex
+ , bSeperateStackingForDifferentSigns, fMinimumY, fMaximumY, nAxisIndex );
+
+ if(rfMinimumY > fMinimumY)
+ rfMinimumY = fMinimumY;
+ if(rfMaximumY < fMaximumY)
+ rfMaximumY = fMaximumY;
+ }
+}
+
+double VSeriesPlotter::getTransformedDepth() const
+{
+ double MinZ = m_pMainPosHelper->getLogicMinZ();
+ double MaxZ = m_pMainPosHelper->getLogicMaxZ();
+ m_pMainPosHelper->doLogicScaling( 0, 0, &MinZ );
+ m_pMainPosHelper->doLogicScaling( 0, 0, &MaxZ );
+ return FIXED_SIZE_FOR_3D_CHART_VOLUME/(MaxZ-MinZ);
+}
+
+void SAL_CALL VSeriesPlotter::addSecondaryValueScale( const ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
+ throw (uno::RuntimeException)
+{
+ if( nAxisIndex<1 )
+ return;
+
+ m_aSecondaryValueScales[nAxisIndex]=rScale;
+}
+
+PlottingPositionHelper& VSeriesPlotter::getPlottingPositionHelper( sal_Int32 nAxisIndex ) const
+{
+ PlottingPositionHelper* pRet = 0;
+ if(nAxisIndex>0)
+ {
+ tSecondaryPosHelperMap::const_iterator aPosIt = m_aSecondaryPosHelperMap.find( nAxisIndex );
+ if( aPosIt != m_aSecondaryPosHelperMap.end() )
+ {
+ pRet = aPosIt->second;
+ }
+ else
+ {
+ tSecondaryValueScales::const_iterator aScaleIt = m_aSecondaryValueScales.find( nAxisIndex );
+ if( aScaleIt != m_aSecondaryValueScales.end() )
+ {
+ pRet = m_pPosHelper->createSecondaryPosHelper( aScaleIt->second );
+ m_aSecondaryPosHelperMap[nAxisIndex] = pRet;
+ }
+ }
+ }
+ if( !pRet )
+ {
+ pRet = m_pMainPosHelper;
+ }
+ return *pRet;
+}
+
+void VSeriesPlotter::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& /*rPageSize*/ )
+{
+}
+
+VDataSeries* VSeriesPlotter::getFirstSeries() const
+{
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter( m_aZSlots.begin() );
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd( m_aZSlots.end() );
+ for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
+ {
+ ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ if( aXSlotIter != aXSlotEnd )
+ {
+ VDataSeriesGroup aSeriesGroup( *aXSlotIter );
+ if( aSeriesGroup.m_aSeriesVector.size() )
+ {
+ VDataSeries* pSeries = aSeriesGroup.m_aSeriesVector[0];
+ if(pSeries)
+ return pSeries;
+ }
+ }
+ }
+ return 0;
+}
+
+uno::Sequence< rtl::OUString > VSeriesPlotter::getSeriesNames() const
+{
+ ::std::vector< rtl::OUString > aRetVector;
+
+ rtl::OUString aRole;
+ if( m_xChartTypeModel.is() )
+ aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
+
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter( m_aZSlots.begin() );
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd( m_aZSlots.end() );
+ for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
+ {
+ ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ if( aXSlotIter != aXSlotEnd )
+ {
+ VDataSeriesGroup aSeriesGroup( *aXSlotIter );
+ if( aSeriesGroup.m_aSeriesVector.size() )
+ {
+ VDataSeries* pSeries = aSeriesGroup.m_aSeriesVector[0];
+ uno::Reference< XDataSeries > xSeries( pSeries ? pSeries->getModel() : 0 );
+ if( xSeries.is() )
+ {
+ rtl::OUString aSeriesName( DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ) );
+ aRetVector.push_back( aSeriesName );
+ }
+ }
+ }
+ }
+ return ContainerHelper::ContainerToSequence( aRetVector );
+}
+
+namespace
+{
+struct lcl_setRefSizeAtSeriesGroup : public ::std::unary_function< VDataSeriesGroup, void >
+{
+ lcl_setRefSizeAtSeriesGroup( awt::Size aRefSize ) : m_aRefSize( aRefSize ) {}
+ void operator()( VDataSeriesGroup & rGroup )
+ {
+ ::std::vector< VDataSeries* >::iterator aIt( rGroup.m_aSeriesVector.begin());
+ const ::std::vector< VDataSeries* >::iterator aEndIt( rGroup.m_aSeriesVector.end());
+ for( ; aIt != aEndIt; ++aIt )
+ (*aIt)->setPageReferenceSize( m_aRefSize );
+ }
+
+private:
+ awt::Size m_aRefSize;
+};
+} // anonymous namespace
+
+void VSeriesPlotter::setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize )
+{
+ m_aPageReferenceSize = rPageRefSize;
+
+ // set reference size also at all data series
+
+ ::std::vector< VDataSeriesGroup > aSeriesGroups( FlattenVector( m_aZSlots ));
+ ::std::for_each( aSeriesGroups.begin(), aSeriesGroups.end(),
+ lcl_setRefSizeAtSeriesGroup( m_aPageReferenceSize ));
+}
+
+//better performance for big data
+void VSeriesPlotter::setCoordinateSystemResolution( const Sequence< sal_Int32 >& rCoordinateSystemResolution )
+{
+ m_aCoordinateSystemResolution = rCoordinateSystemResolution;
+}
+
+bool VSeriesPlotter::PointsWereSkipped() const
+{
+ return m_bPointsWereSkipped;
+}
+
+bool VSeriesPlotter::WantToPlotInFrontOfAxisLine()
+{
+ return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel );
+}
+
+bool VSeriesPlotter::shouldSnapRectToUsedArea()
+{
+ if( m_nDimension == 3 )
+ return false;
+ return true;
+}
+
+Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries(
+ LegendExpansion eLegendExpansion
+ , const Reference< beans::XPropertySet >& xTextProperties
+ , const Reference< drawing::XShapes >& xTarget
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const Reference< uno::XComponentContext >& xContext
+ ) throw (uno::RuntimeException)
+{
+ std::vector< ViewLegendEntry > aResult;
+
+ if( xTarget.is() )
+ {
+ //iterate through all series
+ bool bBreak = false;
+ bool bFirstSeries = true;
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter!=aZSlotEnd && !bBreak; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter!=aXSlotEnd && !bBreak; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ //iterate through all series in this x slot
+ for( ; aSeriesIter!=aSeriesEnd && !bBreak; ++aSeriesIter )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ std::vector< ViewLegendEntry > aSeriesEntries( this->createLegendEntriesForSeries(
+ *pSeries, xTextProperties, xTarget, xShapeFactory, 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;
+
+ // add entries reverse if chart is stacked in y-direction and the legend is not wide.
+ // If the legend is wide and we have a stacked bar-chart the normal order
+ // is the correct one
+ bool bReverse = false;
+ if( eLegendExpansion != LegendExpansion_WIDE )
+ {
+ StackingDirection eStackingDirection( pSeries->getStackingDirection() );
+ bReverse = ( eStackingDirection == StackingDirection_Y_STACKING );
+
+ //todo: respect direction of axis in future
+ }
+
+ if(bReverse)
+ aResult.insert( aResult.begin(), aSeriesEntries.begin(), aSeriesEntries.end() );
+ else
+ aResult.insert( aResult.end(), aSeriesEntries.begin(), aSeriesEntries.end() );
+ }
+ }
+ }
+
+ //add charttype specific entries if any
+ {
+ std::vector< ViewLegendEntry > aChartTypeEntries( this->createLegendEntriesForChartType(
+ xTextProperties, xTarget, xShapeFactory, xContext ) );
+ aResult.insert( aResult.end(), aChartTypeEntries.begin(), aChartTypeEntries.end() );
+ }
+ }
+
+ return ::chart::ContainerHelper::ContainerToSequence( aResult );
+}
+
+
+LegendSymbolStyle VSeriesPlotter::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_BOX;
+}
+
+
+uno::Any VSeriesPlotter::getExplicitSymbol( const VDataSeries& /*rSeries*/, sal_Int32 /*nPointIndex*/ )
+{
+ return uno::Any();
+}
+
+Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForSeries(
+ const VDataSeries& rSeries
+ , const Reference< drawing::XShapes >& xTarget
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+{
+
+ LegendSymbolStyle eLegendSymbolStyle = this->getLegendSymbolStyle();
+ uno::Any aExplicitSymbol( this->getExplicitSymbol( rSeries ) );
+
+ VLegendSymbolFactory::tPropertyType ePropType =
+ VLegendSymbolFactory::PROP_TYPE_FILLED_SERIES;
+
+ // todo: maybe the property-style does not solely depend on the
+ // legend-symbol type
+ switch( eLegendSymbolStyle )
+ {
+ case LegendSymbolStyle_HORIZONTAL_LINE:
+ case LegendSymbolStyle_VERTICAL_LINE:
+ case LegendSymbolStyle_DIAGONAL_LINE:
+ case LegendSymbolStyle_LINE_WITH_BOX:
+ case LegendSymbolStyle_LINE_WITH_SYMBOL:
+ ePropType = VLegendSymbolFactory::PROP_TYPE_LINE_SERIES;
+ break;
+ default:
+ break;
+ };
+ Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol(
+ xTarget, eLegendSymbolStyle, xShapeFactory
+ , rSeries.getPropertiesOfSeries(), ePropType, aExplicitSymbol ));
+
+ return xShape;
+}
+
+Reference< drawing::XShape > VSeriesPlotter::createLegendSymbolForPoint(
+ const VDataSeries& rSeries
+ , sal_Int32 nPointIndex
+ , const Reference< drawing::XShapes >& xTarget
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+{
+
+ LegendSymbolStyle eLegendSymbolStyle = this->getLegendSymbolStyle();
+ uno::Any aExplicitSymbol( this->getExplicitSymbol(rSeries,nPointIndex) );
+
+ VLegendSymbolFactory::tPropertyType ePropType =
+ VLegendSymbolFactory::PROP_TYPE_FILLED_SERIES;
+
+ // todo: maybe the property-style does not solely depend on the
+ // legend-symbol type
+ switch( eLegendSymbolStyle )
+ {
+ case LegendSymbolStyle_HORIZONTAL_LINE:
+ case LegendSymbolStyle_VERTICAL_LINE:
+ case LegendSymbolStyle_DIAGONAL_LINE:
+ case LegendSymbolStyle_LINE_WITH_BOX:
+ case LegendSymbolStyle_LINE_WITH_SYMBOL:
+ ePropType = VLegendSymbolFactory::PROP_TYPE_LINE_SERIES;
+ break;
+ default:
+ break;
+ };
+
+ // the default properties for the data point are the data series properties.
+ // If a data point has own attributes overwrite them
+ Reference< beans::XPropertySet > xSeriesProps( rSeries.getPropertiesOfSeries() );
+ Reference< beans::XPropertySet > xPointSet( xSeriesProps );
+ if( rSeries.isAttributedDataPoint( nPointIndex ) )
+ xPointSet.set( rSeries.getPropertiesOfPoint( nPointIndex ));
+
+ // if a data point has no own color use a color fom the diagram's color scheme
+ if( ! rSeries.hasPointOwnColor( nPointIndex ))
+ {
+ Reference< util::XCloneable > xCloneable( xPointSet,uno::UNO_QUERY );
+ if( xCloneable.is() && m_xColorScheme.is() )
+ {
+ xPointSet.set( xCloneable->createClone(), uno::UNO_QUERY );
+ Reference< container::XChild > xChild( xPointSet, uno::UNO_QUERY );
+ if( xChild.is())
+ xChild->setParent( xSeriesProps );
+
+ OSL_ASSERT( xPointSet.is());
+ xPointSet->setPropertyValue(
+ C2U("Color"), uno::makeAny( m_xColorScheme->getColorByIndex( nPointIndex )));
+ }
+ }
+
+ Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol(
+ xTarget, eLegendSymbolStyle, xShapeFactory, xPointSet, ePropType, aExplicitSymbol ));
+
+ return xShape;
+}
+
+std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForSeries(
+ const VDataSeries& rSeries
+ , const Reference< beans::XPropertySet >& xTextProperties
+ , const Reference< drawing::XShapes >& xTarget
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const Reference< uno::XComponentContext >& xContext
+ )
+{
+ std::vector< ViewLegendEntry > aResult;
+
+ if( ! ( xShapeFactory.is() && xTarget.is() && xContext.is() ) )
+ return aResult;
+
+ try
+ {
+ ViewLegendEntry aEntry;
+ OUString aLabelText;
+ bool bVaryColorsByPoint = rSeries.isVaryColorsByPoint();
+ if( bVaryColorsByPoint )
+ {
+ Sequence< OUString > aCategoryNames;
+ if( m_pExplicitCategoriesProvider )
+ aCategoryNames = m_pExplicitCategoriesProvider->getSimpleCategories();
+
+ for( sal_Int32 nIdx=0; nIdx<aCategoryNames.getLength(); ++nIdx )
+ {
+ // symbol
+ uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget ));
+
+ // create the symbol
+ Reference< drawing::XShape > xShape( this->createLegendSymbolForPoint(
+ rSeries, nIdx, xSymbolGroup, xShapeFactory ) );
+
+ // set CID to symbol for selection
+ if( xShape.is() )
+ {
+ aEntry.aSymbol = uno::Reference< drawing::XShape >( xSymbolGroup, uno::UNO_QUERY );
+
+ OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_DATA_POINT, nIdx ) );
+ aChildParticle = ObjectIdentifier::addChildParticle( aChildParticle, ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
+ OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
+ ShapeFactory::setShapeName( xShape, aCID );
+ }
+
+ // label
+ aLabelText = aCategoryNames[nIdx];
+ if( xShape.is() || aLabelText.getLength() )
+ {
+ aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aLabelText, xTextProperties );
+ aResult.push_back(aEntry);
+ }
+ }
+ }
+ else
+ {
+ // symbol
+ uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget ));
+
+ // create the symbol
+ Reference< drawing::XShape > xShape( this->createLegendSymbolForSeries(
+ rSeries, xSymbolGroup, xShapeFactory ) );
+
+ // set CID to symbol for selection
+ if( xShape.is())
+ {
+ aEntry.aSymbol = uno::Reference< drawing::XShape >( xSymbolGroup, uno::UNO_QUERY );
+
+ OUString aChildParticle( ObjectIdentifier::createChildParticleWithIndex( OBJECTTYPE_LEGEND_ENTRY, 0 ) );
+ OUString aCID = ObjectIdentifier::createClassifiedIdentifierForParticles( rSeries.getSeriesParticle(), aChildParticle );
+ ShapeFactory::setShapeName( xShape, aCID );
+ }
+
+ // label
+ aLabelText = ( DataSeriesHelper::getDataSeriesLabel( rSeries.getModel(), m_xChartTypeModel.is() ? m_xChartTypeModel->getRoleOfSequenceForSeriesLabel() : C2U("values-y")) );
+ aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aLabelText, xTextProperties );
+
+ aResult.push_back(aEntry);
+ }
+
+ // regression curves
+ if ( 3 == m_nDimension ) // #i63016#
+ return aResult;
+
+ Reference< XRegressionCurveContainer > xRegrCont( rSeries.getModel(), uno::UNO_QUERY );
+ if( xRegrCont.is())
+ {
+ Sequence< Reference< XRegressionCurve > > aCurves( xRegrCont->getRegressionCurves());
+ sal_Int32 i = 0, nCount = aCurves.getLength();
+ for( i=0; i<nCount; ++i )
+ {
+ if( aCurves[i].is() && !RegressionCurveHelper::isMeanValueLine( aCurves[i] ) )
+ {
+ //label
+ OUString aResStr( SchResId::getResString( STR_STATISTICS_IN_LEGEND ));
+ replaceParamterInString( aResStr, C2U("%REGRESSIONCURVE"), RegressionCurveHelper::getUINameForRegressionCurve( aCurves[i] ));
+ replaceParamterInString( aResStr, C2U("%SERIESNAME"), aLabelText );
+ aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aResStr, xTextProperties );
+
+ // symbol
+ uno::Reference< drawing::XShapes > xSymbolGroup( ShapeFactory(xShapeFactory).createGroup2D( xTarget ));
+
+ // create the symbol
+ Reference< drawing::XShape > xShape( VLegendSymbolFactory::createSymbol(
+ xSymbolGroup, chart2::LegendSymbolStyle_DIAGONAL_LINE, xShapeFactory,
+ Reference< beans::XPropertySet >( aCurves[i], uno::UNO_QUERY ),
+ VLegendSymbolFactory::PROP_TYPE_LINE, uno::Any() ));
+
+ // set CID to symbol for selection
+ if( xShape.is())
+ {
+ aEntry.aSymbol = uno::Reference< drawing::XShape >( xSymbolGroup, uno::UNO_QUERY );
+
+ bool bAverageLine = false;//@todo find out wether this is an average line or a regression curve
+ 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);
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aResult;
+}
+
+std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForChartType(
+ const Reference< beans::XPropertySet >& /* xTextProperties */,
+ const Reference< drawing::XShapes >& /* xTarget */,
+ const Reference< lang::XMultiServiceFactory >& /* xShapeFactory */,
+ const Reference< uno::XComponentContext >& /* xContext */
+ )
+{
+ return std::vector< ViewLegendEntry >();
+}
+
+//static
+VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
+ const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bExcludingPositioning )
+{
+ rtl::OUString aChartType = xChartTypeModel->getChartType();
+
+ //@todo: in future the plotter should be instanciated via service factory
+ VSeriesPlotter* pRet=NULL;
+ if( aChartType.equalsIgnoreAsciiCase( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ) )
+ pRet = new BarChart(xChartTypeModel,nDimensionCount);
+ else if( aChartType.equalsIgnoreAsciiCase( CHART2_SERVICE_NAME_CHARTTYPE_BAR ) )
+ pRet = new BarChart(xChartTypeModel,nDimensionCount);
+ else if( aChartType.equalsIgnoreAsciiCase( CHART2_SERVICE_NAME_CHARTTYPE_AREA ) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true);
+ else if( aChartType.equalsIgnoreAsciiCase( CHART2_SERVICE_NAME_CHARTTYPE_LINE ) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true);
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true);
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ pRet = new BubbleChart(xChartTypeModel,nDimensionCount);
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ pRet = new PieChart(xChartTypeModel,nDimensionCount, bExcludingPositioning );
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,false,1,drawing::Direction3D(1,1,1) );
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,false,1,drawing::Direction3D(1,1,1) );
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ pRet = new CandleStickChart(xChartTypeModel,nDimensionCount);
+ else
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true);
+ return pRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/makefile.mk b/chart2/source/view/charttypes/makefile.mk
new file mode 100644
index 000000000000..b6cb14edbf14
--- /dev/null
+++ b/chart2/source/view/charttypes/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chvtypes
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+.INCLUDE: $(PRJ)$/chartview.pmk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES = $(SLO)$/Splines.obj \
+ $(SLO)$/CategoryPositionHelper.obj \
+ $(SLO)$/BarPositionHelper.obj \
+ $(SLO)$/VSeriesPlotter.obj \
+ $(SLO)$/BarChart.obj \
+ $(SLO)$/PieChart.obj \
+ $(SLO)$/AreaChart.obj \
+ $(SLO)$/CandleStickChart.obj \
+ $(SLO)$/BubbleChart.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/view/chartview.component b/chart2/source/view/chartview.component
new file mode 100644
index 000000000000..773666150651
--- /dev/null
+++ b/chart2/source/view/chartview.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.chart2.ChartView">
+ <service name="com.sun.star.chart2.ChartView"/>
+ </implementation>
+</component>
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
new file mode 100644
index 000000000000..4174226b6f62
--- /dev/null
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -0,0 +1,811 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VDiagram.hxx"
+#include "PropertyMapper.hxx"
+#include "ViewDefines.hxx"
+#include "Stripe.hxx"
+#include "macros.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "BaseGFXHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ThreeDHelper.hxx"
+#include <editeng/unoprnms.hxx>
+#include <tools/color.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+// header for class SvxShape
+#include <svx/unoshape.hxx>
+// header for GetSdrObjectFromXShape
+#include <svx/unoapi.hxx>
+// header for class E3dScene
+#include <svx/scene3d.hxx>
+#include <rtl/math.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+VDiagram::VDiagram(
+ const uno::Reference< XDiagram > & xDiagram
+ , const drawing::Direction3D& rPreferredAspectRatio
+ , sal_Int32 nDimension, sal_Bool bPolar )
+ : m_xLogicTarget(NULL)
+ , m_xFinalTarget(NULL)
+ , m_xShapeFactory(NULL)
+ , m_pShapeFactory(NULL)
+ , m_xOuterGroupShape(NULL)
+ , m_xCoordinateRegionShape(NULL)
+ , m_xWall2D(NULL)
+ , m_nDimensionCount(nDimension)
+ , m_bPolar(bPolar)
+ , m_xDiagram(xDiagram)
+ , m_aPreferredAspectRatio(rPreferredAspectRatio)
+ , m_xAspectRatio3D()
+ , m_fXAnglePi(0)
+ , m_fYAnglePi(0)
+ , m_fZAnglePi(0)
+ , m_bRightAngledAxes(sal_False)
+{
+ if( m_nDimensionCount == 3)
+ {
+ uno::Reference< beans::XPropertySet > xSourceProp( m_xDiagram, uno::UNO_QUERY );
+ ThreeDHelper::getRotationAngleFromDiagram( xSourceProp, m_fXAnglePi, m_fYAnglePi, m_fZAnglePi );
+ if( ChartTypeHelper::isSupportingRightAngledAxes(
+ DiagramHelper::getChartTypeByIndex( m_xDiagram, 0 ) ) )
+ {
+ if(xSourceProp.is())
+ xSourceProp->getPropertyValue(C2U( "RightAngledAxes" )) >>= m_bRightAngledAxes;
+ if( m_bRightAngledAxes )
+ {
+ ThreeDHelper::adaptRadAnglesForRightAngledAxes( m_fXAnglePi, m_fYAnglePi );
+ m_fZAnglePi=0.0;
+ }
+ }
+ }
+}
+
+VDiagram::~VDiagram()
+{
+ delete m_pShapeFactory;
+}
+
+void SAL_CALL VDiagram::init(
+ const uno::Reference< drawing::XShapes >& xLogicTarget
+ , const uno::Reference< drawing::XShapes >& xFinalTarget
+ , const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+{
+ DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xFactory.is(),"no proper initialization parameters");
+
+ m_xLogicTarget = xLogicTarget;
+ m_xFinalTarget = xFinalTarget;
+ m_xShapeFactory = xFactory;
+ m_pShapeFactory = new ShapeFactory(xFactory);
+}
+
+void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize )
+{
+ m_aAvailablePosIncludingAxes = rPos;
+ m_aAvailableSizeIncludingAxes = rSize;
+
+ if( m_nDimensionCount == 3 )
+ createShapes_3d();
+ else
+ createShapes_2d();
+}
+
+::basegfx::B2IRectangle VDiagram::adjustPosAndSize( const awt::Point& rPos, const awt::Size& rSize )
+{
+ ::basegfx::B2IRectangle aAllowedRect( BaseGFXHelper::makeRectangle(m_aAvailablePosIncludingAxes,m_aAvailableSizeIncludingAxes) );
+ ::basegfx::B2IRectangle aNewInnerRect( BaseGFXHelper::makeRectangle(rPos,rSize) );
+ aNewInnerRect.intersect( aAllowedRect );
+
+ if( m_nDimensionCount == 3 )
+ aNewInnerRect = adjustPosAndSize_3d( BaseGFXHelper::B2IRectangleToAWTPoint(aNewInnerRect), BaseGFXHelper::B2IRectangleToAWTSize(aNewInnerRect) );
+ else
+ aNewInnerRect = adjustPosAndSize_2d( BaseGFXHelper::B2IRectangleToAWTPoint(aNewInnerRect), BaseGFXHelper::B2IRectangleToAWTSize(aNewInnerRect) );
+
+ return aNewInnerRect;
+}
+
+::basegfx::B2IRectangle VDiagram::adjustPosAndSize_2d( const awt::Point& rPos, const awt::Size& rAvailableSize )
+{
+ m_aCurrentPosWithoutAxes = rPos;
+ m_aCurrentSizeWithoutAxes = rAvailableSize;
+ if( m_aPreferredAspectRatio.DirectionX > 0 && m_aPreferredAspectRatio.DirectionY > 0)
+ {
+ //do not change aspect ratio
+ awt::Size aAspectRatio( static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME),
+ static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME ));
+ m_aCurrentSizeWithoutAxes = awt::Size( ShapeFactory::calculateNewSizeRespectingAspectRatio(
+ rAvailableSize, aAspectRatio ) );
+ //center diagram position
+ m_aCurrentPosWithoutAxes = awt::Point( ShapeFactory::calculateTopLeftPositionToCenterObject(
+ rPos, rAvailableSize, m_aCurrentSizeWithoutAxes ) );
+
+ }
+
+ if( m_xWall2D.is() )
+ {
+ m_xWall2D->setSize( m_aCurrentSizeWithoutAxes);
+ m_xWall2D->setPosition(m_aCurrentPosWithoutAxes);
+ }
+
+ return ::basegfx::B2IRectangle( BaseGFXHelper::makeRectangle(m_aCurrentPosWithoutAxes,m_aCurrentSizeWithoutAxes) );
+}
+
+void VDiagram::createShapes_2d()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is(),"is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is()))
+ return;
+
+ //create group shape
+ uno::Reference< drawing::XShapes > xOuterGroup_Shapes = m_pShapeFactory->createGroup2D(m_xLogicTarget);
+ m_xOuterGroupShape = uno::Reference<drawing::XShape>( xOuterGroup_Shapes, uno::UNO_QUERY );
+
+ uno::Reference< drawing::XShapes > xGroupForWall( m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,C2U("PlotAreaExcludingAxes")) );
+
+ //create independent group shape as container for datapoints and such things
+ {
+ uno::Reference< drawing::XShapes > xShapes = m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,C2U("testonly;CooContainer=XXX_CID"));
+ m_xCoordinateRegionShape = uno::Reference<drawing::XShape>( xShapes, uno::UNO_QUERY );
+ }
+
+ //---------------------------
+ bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram );
+
+ //add back wall
+ {
+ m_xWall2D = uno::Reference< drawing::XShape >(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.RectangleShape" ) ), uno::UNO_QUERY );
+ //m_xWall2D->setPosition(m_aAvailablePosIncludingAxes);
+ //m_xWall2D->setSize(m_aAvailableSizeIncludingAxes);
+ xGroupForWall->add(m_xWall2D);
+ uno::Reference< beans::XPropertySet > xProp( m_xWall2D, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ DBG_ASSERT( 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
+ rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model
+ xProp->setPropertyValue( C2U( UNO_NAME_MISC_OBJ_NAME ), uno::makeAny( aWallCID ) );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ }
+
+ //---------------------------
+ //position and size for diagram
+ adjustPosAndSize_2d( m_aAvailablePosIncludingAxes, m_aAvailableSizeIncludingAxes );
+}
+
+E3dScene* lcl_getE3dScene( const uno::Reference< drawing::XShape >& xShape )
+{
+ E3dScene* pRet=NULL;
+ uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
+ uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
+ if(xUnoTunnel.is()&&xTypeProvider.is())
+ {
+ SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ if( pObj && pObj->ISA(E3dScene) )
+ pRet = (E3dScene*)pObj;
+ }
+ }
+ return pRet;
+}
+
+void lcl_setLightSources(
+ const uno::Reference< beans::XPropertySet > & xSource,
+ const uno::Reference< beans::XPropertySet > & xDest )
+{
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_1 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_1 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_2 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_2 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_3 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_3 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_4 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_4 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_5 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_5 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_6 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_6 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_7 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_7 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_8 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTON_8 )));
+
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 )));
+
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_1 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_1 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_3 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_3 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_4 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_4 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_5 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_5 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_6 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_6 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_7 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_7 )));
+ xDest->setPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_8 ),
+ xSource->getPropertyValue( C2U( UNO_NAME_3D_SCENE_LIGHTCOLOR_8 )));
+}
+
+namespace
+{
+
+void lcl_ensureScaleValue( double& rfScale )
+{
+ DBG_ASSERT(rfScale>0, "calculation error for automatic 3D height in chart");
+ if( rfScale<0 )
+ rfScale = 1.0;
+ else if( rfScale<0.2 )
+ rfScale = 0.2;
+ else if( rfScale>5.0 )
+ rfScale = 5.0;
+}
+
+}
+
+void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize )
+{
+ DBG_ASSERT(m_xAspectRatio3D.is(), "created shape offers no XPropertySet");
+ if( m_xAspectRatio3D.is())
+ {
+ try
+ {
+ double fScaleX = m_aPreferredAspectRatio.DirectionX;
+ double fScaleY = m_aPreferredAspectRatio.DirectionY;
+ double fScaleZ = m_aPreferredAspectRatio.DirectionZ;
+
+ //normalize scale factors
+ {
+ double fMax = std::max( std::max( fScaleX, fScaleY) , fScaleZ );
+ fScaleX/=fMax;
+ fScaleY/=fMax;
+ fScaleZ/=fMax;
+ }
+
+ if( fScaleX<0 || fScaleY<0 || fScaleZ<0 )
+ {
+ //calculate automatic 3D aspect ratio that fits good into the given 2D area
+ double fW = rAvailableSize.Width;
+ double fH = rAvailableSize.Height;
+
+// double cx = fabs(cos(m_fXAnglePi));
+ double sx = fabs(sin(m_fXAnglePi));
+// double cy = fabs(cos(m_fYAnglePi));
+ double sy = fabs(sin(m_fYAnglePi));
+ double cz = fabs(cos(m_fZAnglePi));
+ double sz = fabs(sin(m_fZAnglePi));
+
+ if(m_bRightAngledAxes)
+ {
+ //base equations:
+ //fH*zoomfactor == sx*fScaleZ + fScaleY;
+ //fW*zoomfactor == sy*fScaleZ + fScaleX;
+
+ if( fScaleX>0 && fScaleZ>0 )
+ {
+ //calculate fScaleY:
+ if( !::basegfx::fTools::equalZero(fW) )
+ {
+ fScaleY = (fH/fW)*(sy*fScaleZ+fScaleX)-(sx*fScaleZ);
+ lcl_ensureScaleValue( fScaleY );
+ }
+ else
+ fScaleY = 1.0;//looking from top or bottom the height is irrelevant
+ }
+ else if( fScaleY>0 && fScaleZ>0 )
+ {
+ //calculate fScaleX:
+ if( !::basegfx::fTools::equalZero(fH) )
+ {
+ fScaleX = (fW/fH)*(sx*fScaleZ+fScaleY)-(sy*fScaleZ);
+ lcl_ensureScaleValue(fScaleX);
+ }
+ else
+ fScaleX = 1.0;//looking from top or bottom hieght is irrelevant
+ }
+ else
+ {
+ //todo
+ DBG_ASSERT(false, "not implemented yet");
+
+ if( fScaleX<0 )
+ fScaleX = 1.0;
+ if( fScaleY<0 )
+ fScaleY = 1.0;
+ if( fScaleZ<0 )
+ fScaleZ = 1.0;
+ }
+ }
+ else
+ {
+ //base equations:
+ //fH*zoomfactor == cz*fScaleY + sz*fScaleX;
+ //fW*zoomfactor == cz*fScaleX + sz*fScaleY;
+ //==> fScaleY*(fH*sz-fW*cz) == fScaleX*(fW*sz-fH*cz);
+ if( fScaleX>0 && fScaleZ>0 )
+ {
+ //calculate fScaleY:
+ double fDivide = fH*sz-fW*cz;
+ if( !::basegfx::fTools::equalZero(fDivide) )
+ {
+ fScaleY = fScaleX*(fW*sz-fH*cz) / fDivide;
+ lcl_ensureScaleValue(fScaleY);
+ }
+ else
+ fScaleY = 1.0;//looking from top or bottom the height is irrelevant
+
+ /*
+ //fW*zoomfactor == fScaleX*cy*cz + fScaleY*sz*cy + fScaleZ*sy*cx;
+ //fH*zoomfactor == fScaleY*cx*cz + fScaleX*sz*cy + fScaleZ*sx*cz;
+ //==> fScaleY*(sz*cy*fH -cx*cz*fW) = fScaleX*(sz*cy*fW - cy*cz*fH) + fScaleZ*(sx*cz*fW - sy*cx*fH);
+ double fDivide = sz*cy*fH -cx*cz*fW;
+ if( !::basegfx::fTools::equalZero(fDivide) )
+ {
+ fScaleY = ( fScaleX*(sz*cy*fW - cy*cz*fH)
+ + fScaleZ*(sx*cz*fW - sy*cx*fH) ) / fDivide;
+ lcl_ensureScaleValue(fScaleY);
+ }
+ else
+ fScaleY = 1.0;//looking from top or bottom hieght is irrelevant
+ */
+ }
+ else if( fScaleY>0 && fScaleZ>0 )
+ {
+ //calculate fScaleX:
+ double fDivide = fW*sz-fH*cz;
+ if( !::basegfx::fTools::equalZero(fDivide) )
+ {
+ fScaleX = fScaleY*(fH*sz-fW*cz) / fDivide;
+ lcl_ensureScaleValue(fScaleX);
+ }
+ else
+ fScaleX = 1.0;//looking from top or bottom hieght is irrelevant
+ }
+ else
+ {
+ //todo
+ DBG_ASSERT(false, "not implemented yet");
+
+ if( fScaleX<0 )
+ fScaleX = 1.0;
+ if( fScaleY<0 )
+ fScaleY = 1.0;
+ if( fScaleZ<0 )
+ fScaleZ = 1.0;
+ }
+ }
+ }
+
+ //normalize scale factors
+ {
+ double fMax = std::max( std::max( fScaleX, fScaleY) , fScaleZ );
+ fScaleX/=fMax;
+ fScaleY/=fMax;
+ fScaleZ/=fMax;
+ }
+
+ // identity matrix
+ ::basegfx::B3DHomMatrix aResult;
+ aResult.translate( -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0 );
+ aResult.scale( fScaleX, fScaleY, fScaleZ );
+ aResult.translate( FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0,
+ FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0 );
+
+ // To get the 3D aspect ratio's effect on the 2D scene size, the scene's 2D size needs to be adapted to
+ // 3D content changes here. The tooling class remembers the current 3D transformation stack
+ // and in it's destructor, calculates a new 2D SnapRect for the scene and it's modified 3D geometry.
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+
+ m_xAspectRatio3D->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aResult )) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+::basegfx::B2IRectangle VDiagram::adjustPosAndSize_3d( const awt::Point& rPos, const awt::Size& rAvailableSize )
+{
+ adjustAspectRatio3d( rAvailableSize );
+
+ //do not change aspect ratio of 3D scene with 2D bound rect
+ m_aCurrentSizeWithoutAxes = ShapeFactory::calculateNewSizeRespectingAspectRatio(
+ rAvailableSize, m_xOuterGroupShape->getSize() );
+ m_xOuterGroupShape->setSize( m_aCurrentSizeWithoutAxes );
+
+ //center diagram position
+ m_aCurrentPosWithoutAxes= ShapeFactory::calculateTopLeftPositionToCenterObject(
+ rPos, rAvailableSize, m_aCurrentSizeWithoutAxes );
+ m_xOuterGroupShape->setPosition(m_aCurrentPosWithoutAxes);
+
+ return ::basegfx::B2IRectangle( BaseGFXHelper::makeRectangle(m_aCurrentPosWithoutAxes,m_aCurrentSizeWithoutAxes) );
+}
+
+void VDiagram::createShapes_3d()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is(),"is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is()))
+ return;
+
+ //create shape
+ m_xOuterGroupShape = uno::Reference< drawing::XShape >(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DSceneObject" ) ), uno::UNO_QUERY );
+ ShapeFactory::setShapeName( m_xOuterGroupShape, C2U("PlotAreaExcludingAxes") );
+ m_xLogicTarget->add(m_xOuterGroupShape);
+
+ uno::Reference< drawing::XShapes > xOuterGroup_Shapes =
+ uno::Reference<drawing::XShapes>( m_xOuterGroupShape, uno::UNO_QUERY );
+
+
+ //-------------------------------------------------------------------------
+ //create additional group to manipulate the aspect ratio of the whole diagram:
+ xOuterGroup_Shapes = m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, rtl::OUString() );
+
+ m_xAspectRatio3D = uno::Reference< beans::XPropertySet >( xOuterGroup_Shapes, uno::UNO_QUERY );
+
+ //---------------------------
+
+ bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram );
+
+ const bool bDoubleSided = false;
+ const bool bFlatNormals = true;
+
+ //add walls
+ {
+ uno::Reference< beans::XPropertySet > xWallProp( NULL );
+ if( m_xDiagram.is() )
+ xWallProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getWall());
+
+ rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model
+ if( !bAddFloorAndWall )
+ aWallCID = rtl::OUString();
+ uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->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 ) ) );
+
+ //add left wall
+ {
+ short nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 3 : 1;
+ double xPos = 0.0;
+ if( CuboidPlanePosition_Right==eLeftWallPos )
+ xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ Stripe aStripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
+ if( CuboidPlanePosition_Right==eLeftWallPos )
+ {
+ nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 2 : 0;
+ aStripe = Stripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) );
+ }
+ aStripe.InvertNormal(true);
+
+ uno::Reference< drawing::XShape > xShape =
+ m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe
+ , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals );
+ 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( xShape );
+ }
+ }
+ //add back wall
+ {
+ short nRotatedTexture = 0;
+ double zPos = 0.0;
+ if( CuboidPlanePosition_Front==eBackWallPos )
+ zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ Stripe aStripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
+ if( CuboidPlanePosition_Front==eBackWallPos )
+ {
+ aStripe = Stripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos)
+ , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
+ nRotatedTexture = 3;
+ }
+ aStripe.InvertNormal(true);
+
+ uno::Reference< drawing::XShape > xShape =
+ m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe
+ , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals );
+ 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( xShape );
+ }
+ }
+ }
+
+ 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 comcpletely
+ //use vrp only to indicate the distance of the camera and thus influence the perspecitve
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_SCENE_DISTANCE ), uno::makeAny(
+ static_cast<sal_Int32>(ThreeDHelper::getCameraDistance( xSourceProp ))));
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_SCENE_PERSPECTIVE ),
+ xSourceProp->getPropertyValue( C2U( UNO_NAME_3D_SCENE_PERSPECTIVE )));
+ }
+
+ //light
+ {
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_SCENE_SHADE_MODE ),
+ xSourceProp->getPropertyValue( C2U( UNO_NAME_3D_SCENE_SHADE_MODE )));
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_SCENE_AMBIENTCOLOR ),
+ xSourceProp->getPropertyValue( C2U( UNO_NAME_3D_SCENE_AMBIENTCOLOR )));
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING ),
+ xSourceProp->getPropertyValue( C2U( UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING )));
+ lcl_setLightSources( xSourceProp, xDestProp );
+ }
+
+ //rotation
+ {
+ //set diagrams rotation is set exclusively vie the transformation matrix
+ //don't set a camera at all!
+ //the cameras rotation is incorporated into this matrix
+
+ ::basegfx::B3DHomMatrix aEffectiveTranformation;
+ aEffectiveTranformation.translate(-FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0, -FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0);
+
+ if(!m_bRightAngledAxes)
+ aEffectiveTranformation.rotate(m_fXAnglePi,m_fYAnglePi,m_fZAnglePi);
+ else
+ aEffectiveTranformation.shearXY(m_fYAnglePi,-m_fXAnglePi);
+
+ //#i98497# 3D charts are rendered with wrong size
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ xDestProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX ),
+ uno::makeAny( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aEffectiveTranformation ) ) );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ //add floor plate
+ {
+ uno::Reference< beans::XPropertySet > xFloorProp( NULL );
+ if( m_xDiagram.is() )
+ xFloorProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getFloor());
+
+ Stripe aStripe( drawing::Position3D(0,0,0)
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME)
+ , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
+ aStripe.InvertNormal(true);
+
+ uno::Reference< drawing::XShape > xShape =
+ m_pShapeFactory->createStripe(xOuterGroup_Shapes, aStripe
+ , xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, 0, bFlatNormals );
+
+ CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
+ if( !bAddFloorAndWall || (CuboidPlanePosition_Bottom!=eBottomPos) )
+ {
+ //we always need this object as dummy object for correct scene dimensions
+ //but it should not be visible in this case:
+ ShapeFactory::makeShapeInvisible( xShape );
+ }
+ else
+ {
+ rtl::OUString aFloorCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, rtl::OUString() ) );//@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,C2U("testonly;CooContainer=XXX_CID") );
+ m_xCoordinateRegionShape = uno::Reference< drawing::XShape >( xShapes, uno::UNO_QUERY );
+
+ uno::Reference< beans::XPropertySet > xShapeProp( m_xCoordinateRegionShape, uno::UNO_QUERY );
+ DBG_ASSERT(xShapeProp.is(), "created shape offers no XPropertySet");
+ if( xShapeProp.is())
+ {
+ 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;
+
+ ::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( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ m_aCurrentPosWithoutAxes = m_aAvailablePosIncludingAxes;
+ m_aCurrentSizeWithoutAxes = m_aAvailableSizeIncludingAxes;
+ adjustPosAndSize_3d( m_aAvailablePosIncludingAxes, m_aAvailableSizeIncludingAxes );
+}
+
+uno::Reference< drawing::XShapes > VDiagram::getCoordinateRegion()
+{
+ return uno::Reference<drawing::XShapes>( m_xCoordinateRegionShape, uno::UNO_QUERY );
+}
+
+::basegfx::B2IRectangle VDiagram::getCurrentRectangle()
+{
+ return BaseGFXHelper::makeRectangle(m_aCurrentPosWithoutAxes,m_aCurrentSizeWithoutAxes);
+}
+
+void VDiagram::reduceToMimimumSize()
+{
+ if( m_xOuterGroupShape.is() )
+ {
+ awt::Size aMaxSize( m_aAvailableSizeIncludingAxes );
+ awt::Point aMaxPos( m_aAvailablePosIncludingAxes );
+
+ sal_Int32 nNewWidth = aMaxSize.Width/3;
+ sal_Int32 nNewHeight = aMaxSize.Height/3;
+ awt::Size aNewSize( nNewWidth, nNewHeight );
+ awt::Point aNewPos( aMaxPos );
+ aNewPos.X += nNewWidth;
+ aNewPos.Y += nNewHeight;
+
+ adjustPosAndSize( aNewPos, aNewSize );
+ }
+}
+
+::basegfx::B2IRectangle VDiagram::adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect )
+{
+ awt::Point aNewPos( m_aCurrentPosWithoutAxes );
+ awt::Size aNewSize( m_aCurrentSizeWithoutAxes );
+
+ ::basegfx::B2IRectangle rAvailableOuterRect(
+ BaseGFXHelper::makeRectangle(m_aAvailablePosIncludingAxes,m_aAvailableSizeIncludingAxes) );
+
+ sal_Int32 nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth() - rConsumedOuterRect.getWidth());
+ sal_Int32 nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight() - rConsumedOuterRect.getHeight());
+ if( (aNewSize.Width + nDeltaWidth) < rAvailableOuterRect.getWidth()/3 )
+ nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth()/3 - aNewSize.Width);
+ aNewSize.Width += nDeltaWidth;
+
+ if( (aNewSize.Height + nDeltaHeight) < rAvailableOuterRect.getHeight()/3 )
+ nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight()/3 - aNewSize.Height);
+ aNewSize.Height += nDeltaHeight;
+
+ sal_Int32 nDiffLeft = rConsumedOuterRect.getMinX() - rAvailableOuterRect.getMinX();
+ sal_Int32 nDiffRight = rAvailableOuterRect.getMaxX() - rConsumedOuterRect.getMaxX();
+ if( nDiffLeft >= 0 )
+ aNewPos.X -= nDiffLeft;
+ else if( nDiffRight >= 0 )
+ {
+ if( nDiffRight > -nDiffLeft )
+ aNewPos.X += abs(nDiffLeft);
+ else if( nDiffRight > abs(nDeltaWidth) )
+ aNewPos.X += nDiffRight;
+ else
+ aNewPos.X += abs(nDeltaWidth);
+ }
+
+ sal_Int32 nDiffUp = rConsumedOuterRect.getMinY() - rAvailableOuterRect.getMinY();
+ sal_Int32 nDiffDown = rAvailableOuterRect.getMaxY() - rConsumedOuterRect.getMaxY();
+ if( nDiffUp >= 0 )
+ aNewPos.Y -= nDiffUp;
+ else if( nDiffDown >= 0 )
+ {
+ if( nDiffDown > -nDiffUp )
+ aNewPos.Y += abs(nDiffUp);
+ else if( nDiffDown > abs(nDeltaHeight) )
+ aNewPos.Y += nDiffDown;
+ else
+ aNewPos.Y += abs(nDeltaHeight);
+ }
+
+ return adjustPosAndSize( aNewPos, aNewSize );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/view/diagram/makefile.mk b/chart2/source/view/diagram/makefile.mk
new file mode 100644
index 000000000000..652f203b2267
--- /dev/null
+++ b/chart2/source/view/diagram/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chvdiagram
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+.INCLUDE: $(PRJ)$/chartview.pmk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES = $(SLO)$/VDiagram.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/chart2/source/view/exports.flt b/chart2/source/view/exports.flt
new file mode 100644
index 000000000000..56fa90f75bb1
--- /dev/null
+++ b/chart2/source/view/exports.flt
@@ -0,0 +1,4 @@
+lcl_
+_real@
+_TI1
+_TI2
diff --git a/chart2/source/view/inc/Clipping.hxx b/chart2/source/view/inc/Clipping.hxx
new file mode 100644
index 000000000000..d04a576737bf
--- /dev/null
+++ b/chart2/source/view/inc/Clipping.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_CLIPPING_HXX
+#define _CHART2_CLIPPING_HXX
+
+#include <basegfx/range/b2drectangle.hxx>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class Clipping
+{
+ /** This class uses the Liang-Biarsky parametric line-clipping algorithm as described in:
+ Computer Graphics: principles and practice, 2nd ed.,
+ James D. Foley et al.,
+ Section 3.12.4 on page 117.
+ */
+
+public:
+ /** @descr The intersection between an open polygon and a rectangle is
+ calculated and the resulting lines are placed into the poly-polygon aResult.
+ @param rPolygon The polygon is required to be open, ie. it's start and end point
+ have different coordinates and that it is continuous, ie. has no holes.
+ @param rRectangle The clipping area.
+ @param aResult The resulting lines that are the parts of the given polygon lying inside
+ the clipping area are stored into aResult whose prior content is deleted first.
+ */
+ static void clipPolygonAtRectangle(
+ const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon
+ , const ::basegfx::B2DRectangle& rRectangle
+ , ::com::sun::star::drawing::PolyPolygonShape3D& aResult
+ , bool bSplitPiecesToDifferentPolygons = true );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/LabelAlignment.hxx b/chart2/source/view/inc/LabelAlignment.hxx
new file mode 100644
index 000000000000..26ec703db302
--- /dev/null
+++ b/chart2/source/view/inc/LabelAlignment.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_VIEW_LabelAlignment_HXX
+#define _CHART2_VIEW_LabelAlignment_HXX
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+enum LabelAlignment { LABEL_ALIGN_CENTER, LABEL_ALIGN_LEFT, LABEL_ALIGN_TOP, LABEL_ALIGN_RIGHT, LABEL_ALIGN_BOTTOM, LABEL_ALIGN_LEFT_TOP, LABEL_ALIGN_LEFT_BOTTOM, LABEL_ALIGN_RIGHT_TOP, LABEL_ALIGN_RIGHT_BOTTOM };
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx b/chart2/source/view/inc/LabelPositionHelper.hxx
new file mode 100644
index 000000000000..a240736018bc
--- /dev/null
+++ b/chart2/source/view/inc/LabelPositionHelper.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_VIEW_LABELPOSITIONHELPER_HXX
+#define _CHART2_VIEW_LABELPOSITIONHELPER_HXX
+
+#include "LabelAlignment.hxx"
+#include "PropertyMapper.hxx"
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class PlottingPositionHelper;
+class ShapeFactory;
+
+class LabelPositionHelper
+{
+public:
+ LabelPositionHelper(
+ PlottingPositionHelper* pPosHelper
+ , sal_Int32 nDimensionCount
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , ShapeFactory* pShapeFactory );
+ virtual ~LabelPositionHelper();
+
+ ::com::sun::star::awt::Point transformSceneToScreenPosition(
+ const ::com::sun::star::drawing::Position3D& rScenePosition3D ) const;
+
+ static void changeTextAdjustment( tAnySequence& rPropValues, const tNameSequence& rPropNames, LabelAlignment eAlignment);
+ static void doDynamicFontResize( tAnySequence& rPropValues, const tNameSequence& rPropNames
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisModelProps
+ , const ::com::sun::star::awt::Size& rNewReferenceSize );
+
+ static void correctPositionForRotation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape2DText
+ , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter );
+
+private:
+ LabelPositionHelper();
+
+protected:
+ PlottingPositionHelper* m_pPosHelper;
+ sal_Int32 m_nDimensionCount;
+
+private:
+ //these members are only necessary for transformation from 3D to 2D
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xLogicTarget;
+ ShapeFactory* m_pShapeFactory;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx
new file mode 100644
index 000000000000..14b6cda47870
--- /dev/null
+++ b/chart2/source/view/inc/LegendEntryProvider.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_VIEW_LEGENDENTRYPROVIDER_HXX
+#define CHART2_VIEW_LEGENDENTRYPROVIDER_HXX
+
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+
+#ifndef _COM_SUN_STAR_CHART2_VIEWLEGENDENTRYP_HPP_
+#include <com/sun/star/chart2/ViewLegendEntry.hpp>
+#endif
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace chart
+{
+
+class LegendEntryProvider
+{
+public:
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries(
+ ::com::sun::star::chart2::LegendExpansion eLegendExpansion,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTextProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+
+private:
+};
+
+} // namespace chart
+
+// CHART2_VIEW_LEGENDENTRYPROVIDER_HXX
+#endif
diff --git a/chart2/source/view/inc/Linear3DTransformation.hxx b/chart2/source/view/inc/Linear3DTransformation.hxx
new file mode 100644
index 000000000000..71a728d2dc73
--- /dev/null
+++ b/chart2/source/view/inc/Linear3DTransformation.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_LINEAR3DTRANSFORMATION_HXX
+#define _CHART_LINEAR3DTRANSFORMATION_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/chart2/XTransformation.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+
+namespace chart
+{
+
+class Linear3DTransformation : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::chart2::XTransformation
+ >
+{
+public:
+ Linear3DTransformation( const ::com::sun::star::drawing::HomogenMatrix& rHomMatrix, bool bSwapXAndY );
+ virtual ~Linear3DTransformation();
+
+ // ____ XTransformation ____
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL transform(
+ const ::com::sun::star::uno::Sequence< double >& rSourceValues )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getSourceDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getTargetDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::drawing::HomogenMatrix m_Matrix;
+ bool m_bSwapXAndY;
+};
+
+} // namespace chart
+
+// _CHART_LINEAR3DTRANSFORMATION_HXX
+#endif
+
diff --git a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
new file mode 100644
index 000000000000..1e53d5c144c5
--- /dev/null
+++ b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX
+#define _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX
+
+#include <sal/types.h>
+
+#include <set>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class MinimumAndMaximumSupplier
+{
+public:
+ virtual double getMinimumX() = 0;
+ virtual double getMaximumX() = 0;
+
+ //problem y maybe not is always the second border to ask for
+ virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0;
+ virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex ) = 0;
+
+ //problem: z maybe not independent in future
+ virtual double getMinimumZ() = 0;
+ virtual double getMaximumZ() = 0;
+
+ virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex ) = 0;
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ) = 0;
+ virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ) = 0;
+ virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) = 0;
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) = 0;
+};
+
+class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier
+{
+public:
+ MergedMinimumAndMaximumSupplier();
+ virtual ~MergedMinimumAndMaximumSupplier();
+
+ void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
+ bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
+ void clearMinimumAndMaximumSupplierList();
+
+ //--MinimumAndMaximumSupplier
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+ virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+ virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+ virtual double getMinimumZ();
+ virtual double getMaximumZ();
+
+ virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex );
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex );
+ virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+private:
+ typedef ::std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet;
+ MinimumAndMaximumSupplierSet m_aMinimumAndMaximumSupplierList;
+
+ inline MinimumAndMaximumSupplierSet::iterator begin() { return m_aMinimumAndMaximumSupplierList.begin(); }
+ inline MinimumAndMaximumSupplierSet::iterator end() { return m_aMinimumAndMaximumSupplierList.end(); }
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/PlotterBase.hxx b/chart2/source/view/inc/PlotterBase.hxx
new file mode 100644
index 000000000000..63e276b19e44
--- /dev/null
+++ b/chart2/source/view/inc/PlotterBase.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_PLOTTERBASE_HXX
+#define _CHART2_PLOTTERBASE_HXX
+
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+/*
+#include <com/sun/star/lang/XComponent.hpp>
+*/
+
+//----
+#include <vector>
+
+//---- chart2
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/XTransformation.hpp>
+/*
+#include <com/sun/star/chart2/XPlotter.hpp>
+*/
+
+//----
+#include <cppuhelper/implbase1.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ShapeFactory;
+class PlottingPositionHelper;
+
+class PlotterBase
+{
+public:
+ PlotterBase( sal_Int32 nDimension );
+ virtual ~PlotterBase();
+
+ // ___chart2::XPlotter___
+ virtual void SAL_CALL initPlotter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xFinalTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , const rtl::OUString& rCID
+ ) throw (::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setScales(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
+
+ virtual void SAL_CALL createShapes() = 0;
+
+ static bool isValidPosition( const ::com::sun::star::drawing::Position3D& rPos );
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ PlotterBase();
+
+protected: //methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroupShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , ::rtl::OUString rName=::rtl::OUString() );
+
+protected: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xLogicTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xFinalTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
+ ShapeFactory* m_pShapeFactory;
+ //::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
+
+ rtl::OUString m_aCID;
+
+ sal_Int32 m_nDimension;
+ // needs to be created and deleted by the derived class
+ PlottingPositionHelper* m_pPosHelper;
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx
new file mode 100644
index 000000000000..a1f16883b779
--- /dev/null
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_PLOTTINGPOSITIONHELPER_HXX
+#define _CHART2_PLOTTINGPOSITIONHELPER_HXX
+
+#include "LabelAlignment.hxx"
+#include <basegfx/range/b2drectangle.hxx>
+#include <rtl/math.hxx>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/XTransformation.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+/*
+//for WeakImplHelper1
+#include <cppuhelper/implbase1.hxx>
+*/
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ShapeFactory;
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class PlottingPositionHelper
+{
+public:
+ PlottingPositionHelper();
+ PlottingPositionHelper( const PlottingPositionHelper& rSource );
+ virtual ~PlottingPositionHelper();
+
+ virtual PlottingPositionHelper* clone() const;
+ virtual PlottingPositionHelper* createSecondaryPosHelper( const ::com::sun::star::chart2::ExplicitScaleData& rSecondaryScale );
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix);
+
+ virtual void setScales( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis );
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& getScales() const;
+
+ //better performance for big data
+ inline void setCoordinateSystemResolution( const ::com::sun::star::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution );
+ inline bool isSameForGivenResolution( double fX, double fY, double fZ
+ , double fX2, double fY2, double fZ2 );
+
+ inline bool isLogicVisible( double fX, double fY, double fZ ) const;
+ inline void doLogicScaling( double* pX, double* pY, double* pZ, bool bClip=false ) const;
+ inline void clipLogicValues( double* pX, double* pY, double* pZ ) const;
+ void clipScaledLogicValues( double* pX, double* pY, double* pZ ) const;
+ inline bool clipYRange( double& rMin, double& rMax ) const;
+
+ inline void doLogicScaling( ::com::sun::star::drawing::Position3D& rPos, bool bClip=false ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >
+ getTransformationScaledLogicToScene() const;
+
+ virtual ::com::sun::star::drawing::Position3D
+ transformLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
+
+ virtual ::com::sun::star::drawing::Position3D
+ transformScaledLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
+
+ void transformScaledLogicToScene( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly ) const;
+
+ static com::sun::star::awt::Point transformSceneToScreenPosition(
+ const com::sun::star::drawing::Position3D& rScenePosition3D
+ , const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& xSceneTarget
+ , ShapeFactory* pShapeFactory, sal_Int32 nDimensionCount );
+
+ inline double getLogicMinX() const;
+ inline double getLogicMinY() const;
+ inline double getLogicMinZ() const;
+ inline double getLogicMaxX() const;
+ inline double getLogicMaxY() const;
+ inline double getLogicMaxZ() const;
+
+ inline bool isMathematicalOrientationX() const;
+ inline bool isMathematicalOrientationY() const;
+ inline bool isMathematicalOrientationZ() const;
+
+ ::basegfx::B2DRectangle getScaledLogicClipDoubleRect() const;
+ ::com::sun::star::drawing::Direction3D getScaledLogicWidth() const;
+
+ inline bool isSwapXAndY() const;
+
+ bool isPercentY() const;
+
+ double getBaseValueY() const;
+
+ inline bool maySkipPointsInRegressionCalculation() const;
+
+protected: //member
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData > m_aScales;
+ ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
+
+ //this is calculated based on m_aScales and m_aMatrixScreenToScene
+ mutable ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTransformation > m_xTransformationLogicToScene;
+
+ bool m_bSwapXAndY;//e.g. true for bar chart and false for column chart
+
+ sal_Int32 m_nXResolution;
+ sal_Int32 m_nYResolution;
+ sal_Int32 m_nZResolution;
+
+ bool m_bMaySkipPointsInRegressionCalculation;
+};
+
+//describes wich axis of the drawinglayer scene or sreen axis are the normal axis
+enum NormalAxis
+{
+ NormalAxis_X
+ , NormalAxis_Y
+ , NormalAxis_Z
+};
+
+class PolarPlottingPositionHelper : public PlottingPositionHelper
+ /*
+ , public ::cppu::WeakImplHelper1<
+ ::com::sun::star::chart2::XTransformation >
+ */
+{
+public:
+ PolarPlottingPositionHelper( NormalAxis eNormalAxis=NormalAxis_Z );
+ PolarPlottingPositionHelper( const PolarPlottingPositionHelper& rSource );
+ virtual ~PolarPlottingPositionHelper();
+
+ virtual PlottingPositionHelper* clone() const;
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix);
+ virtual void setScales( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis );
+
+ ::basegfx::B3DHomMatrix getUnitCartesianToScene() const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >
+ getTransformationScaledLogicToScene() const;
+
+ //the resulting values should be used for input to the transformation
+ //received with 'getTransformationScaledLogicToScene'
+ double transformToRadius( double fLogicValueOnRadiusAxis, bool bDoScaling=true ) const;
+ double transformToAngleDegree( double fLogicValueOnAngleAxis, bool bDoScaling=true ) const;
+ double getWidthAngleDegree( double& fStartLogicValueOnAngleAxis, double& fEndLogicValueOnAngleAxis ) const;
+ //
+
+ virtual ::com::sun::star::drawing::Position3D
+ transformLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
+ virtual ::com::sun::star::drawing::Position3D
+ transformScaledLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
+ ::com::sun::star::drawing::Position3D
+ transformAngleRadiusToScene( double fLogicValueOnAngleAxis, double fLogicValueOnRadiusAxis, double fLogicZ, bool bDoScaling=true ) const;
+ ::com::sun::star::drawing::Position3D
+ transformUnitCircleToScene( double fUnitAngleDegree, double fUnitRadius, double fLogicZ, bool bDoScaling=true ) const;
+
+ using PlottingPositionHelper::transformScaledLogicToScene;
+
+#ifdef NOTYET
+ double getInnerLogicRadius() const;
+#endif
+ double getOuterLogicRadius() const;
+
+ inline bool isMathematicalOrientationAngle() const;
+ inline bool isMathematicalOrientationRadius() const;
+
+ /*
+ // ____ XTransformation ____
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL transform(
+ const ::com::sun::star::uno::Sequence< double >& rSourceValues )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getSourceDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getTargetDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+ */
+public:
+ //Offset for radius axis in absolute logic scaled values (1.0 == 1 category)
+ double m_fRadiusOffset;
+ //Offset for angle axis in real degree
+ double m_fAngleDegreeOffset;
+
+private:
+ ::basegfx::B3DHomMatrix m_aUnitCartesianToScene;
+ NormalAxis m_eNormalAxis;
+
+ ::basegfx::B3DHomMatrix impl_calculateMatrixUnitCartesianToScene( const ::basegfx::B3DHomMatrix& rMatrixScreenToScene ) const;
+};
+
+bool PolarPlottingPositionHelper::isMathematicalOrientationAngle() const
+{
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[2];
+ if( ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL==rScale.Orientation )
+ return true;
+ return false;
+}
+bool PolarPlottingPositionHelper::isMathematicalOrientationRadius() const
+{
+ const ::com::sun::star::chart2::ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
+ if( ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL==rScale.Orientation )
+ return true;
+ return false;
+}
+
+//better performance for big data
+void PlottingPositionHelper::setCoordinateSystemResolution( const ::com::sun::star::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution )
+{
+ m_nXResolution = 1000;
+ m_nYResolution = 1000;
+ m_nZResolution = 1000;
+ if( rCoordinateSystemResolution.getLength() > 0 )
+ m_nXResolution = rCoordinateSystemResolution[0];
+ if( rCoordinateSystemResolution.getLength() > 1 )
+ m_nYResolution = rCoordinateSystemResolution[1];
+ if( rCoordinateSystemResolution.getLength() > 2 )
+ m_nZResolution = rCoordinateSystemResolution[2];
+}
+
+bool PlottingPositionHelper::isSameForGivenResolution( double fX, double fY, double fZ
+ , double fX2, double fY2, double fZ2 /*these values are all expected tp be scaled already*/ )
+{
+ if( !::rtl::math::isFinite(fX) || !::rtl::math::isFinite(fY) || !::rtl::math::isFinite(fZ)
+ || !::rtl::math::isFinite(fX2) || !::rtl::math::isFinite(fY2) || !::rtl::math::isFinite(fZ2) )
+ return false;
+
+ double fScaledMinX = getLogicMinX();
+ double fScaledMinY = getLogicMinY();
+ double fScaledMinZ = getLogicMinZ();
+ double fScaledMaxX = getLogicMaxX();
+ double fScaledMaxY = getLogicMaxY();
+ double fScaledMaxZ = getLogicMaxZ();
+
+ doLogicScaling( &fScaledMinX, &fScaledMinY, &fScaledMinZ );
+ doLogicScaling( &fScaledMaxX, &fScaledMaxY, &fScaledMaxZ);
+
+ bool bSameX = ( static_cast<sal_Int32>(m_nXResolution*(fX - fScaledMinX)/(fScaledMaxX-fScaledMinX))
+ == static_cast<sal_Int32>(m_nXResolution*(fX2 - fScaledMinX)/(fScaledMaxX-fScaledMinX)) );
+
+ bool bSameY = ( static_cast<sal_Int32>(m_nYResolution*(fY - fScaledMinY)/(fScaledMaxY-fScaledMinY))
+ == static_cast<sal_Int32>(m_nYResolution*(fY2 - fScaledMinY)/(fScaledMaxY-fScaledMinY)) );
+
+ bool bSameZ = ( static_cast<sal_Int32>(m_nZResolution*(fZ - fScaledMinZ)/(fScaledMaxZ-fScaledMinZ))
+ == static_cast<sal_Int32>(m_nZResolution*(fZ2 - fScaledMinZ)/(fScaledMaxZ-fScaledMinZ)) );
+
+ return (bSameX && bSameY && bSameZ);
+}
+
+bool PlottingPositionHelper::isLogicVisible(
+ double fX, double fY, double fZ ) const
+{
+ return fX >= m_aScales[0].Minimum && fX <= m_aScales[0].Maximum
+ && fY >= m_aScales[1].Minimum && fY <= m_aScales[1].Maximum
+ && fZ >= m_aScales[2].Minimum && fZ <= m_aScales[2].Maximum;
+}
+
+void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ, bool bClip ) const
+{
+ if(bClip)
+ this->clipLogicValues( pX,pY,pZ );
+
+ if(pX && m_aScales[0].Scaling.is())
+ *pX = m_aScales[0].Scaling->doScaling(*pX);
+ if(pY && m_aScales[1].Scaling.is())
+ *pY = m_aScales[1].Scaling->doScaling(*pY);
+ if(pZ && m_aScales[2].Scaling.is())
+ *pZ = m_aScales[2].Scaling->doScaling(*pZ);
+}
+
+void PlottingPositionHelper::doLogicScaling( ::com::sun::star::drawing::Position3D& rPos, bool bClip ) const
+{
+ doLogicScaling( &rPos.PositionX, &rPos.PositionY, &rPos.PositionZ, bClip );
+}
+
+void PlottingPositionHelper::clipLogicValues( double* pX, double* pY, double* pZ ) const
+{
+ if(pX)
+ {
+ if( *pX < m_aScales[0].Minimum )
+ *pX = m_aScales[0].Minimum;
+ else if( *pX > m_aScales[0].Maximum )
+ *pX = m_aScales[0].Maximum;
+ }
+ if(pY)
+ {
+ if( *pY < m_aScales[1].Minimum )
+ *pY = m_aScales[1].Minimum;
+ else if( *pY > m_aScales[1].Maximum )
+ *pY = m_aScales[1].Maximum;
+ }
+ if(pZ)
+ {
+ if( *pZ < m_aScales[2].Minimum )
+ *pZ = m_aScales[2].Minimum;
+ else if( *pZ > m_aScales[2].Maximum )
+ *pZ = m_aScales[2].Maximum;
+ }
+}
+
+inline bool PlottingPositionHelper::clipYRange( double& rMin, double& rMax ) const
+{
+ //returns true if something remains
+ if( rMin > rMax )
+ {
+ double fHelp = rMin;
+ rMin = rMax;
+ rMax = fHelp;
+ }
+ if( rMin > getLogicMaxY() )
+ return false;
+ if( rMax < getLogicMinY() )
+ return false;
+ if( rMin < getLogicMinY() )
+ rMin = getLogicMinY();
+ if( rMax > getLogicMaxY() )
+ rMax = getLogicMaxY();
+ return true;
+}
+
+inline double PlottingPositionHelper::getLogicMinX() const
+{
+ return m_aScales[0].Minimum;
+}
+inline double PlottingPositionHelper::getLogicMinY() const
+{
+ return m_aScales[1].Minimum;
+}
+inline double PlottingPositionHelper::getLogicMinZ() const
+{
+ return m_aScales[2].Minimum;
+}
+
+inline double PlottingPositionHelper::getLogicMaxX() const
+{
+ return m_aScales[0].Maximum;
+}
+inline double PlottingPositionHelper::getLogicMaxY() const
+{
+ return m_aScales[1].Maximum;
+}
+inline double PlottingPositionHelper::getLogicMaxZ() const
+{
+ return m_aScales[2].Maximum;
+}
+inline bool PlottingPositionHelper::isMathematicalOrientationX() const
+{
+ return ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL == m_aScales[0].Orientation;
+}
+inline bool PlottingPositionHelper::isMathematicalOrientationY() const
+{
+ return ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL == m_aScales[1].Orientation;
+}
+inline bool PlottingPositionHelper::isMathematicalOrientationZ() const
+{
+ return ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL == m_aScales[2].Orientation;
+}
+inline bool PlottingPositionHelper::isSwapXAndY() const
+{
+ return m_bSwapXAndY;
+}
+inline bool PlottingPositionHelper::maySkipPointsInRegressionCalculation() const
+{
+ return m_bMaySkipPointsInRegressionCalculation;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/PolarLabelPositionHelper.hxx b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
new file mode 100644
index 000000000000..b4fd1fdc8483
--- /dev/null
+++ b/chart2/source/view/inc/PolarLabelPositionHelper.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_VIEW_POLARLABELPOSITIONHELPER_HXX
+#define _CHART2_VIEW_POLARLABELPOSITIONHELPER_HXX
+
+#include "LabelPositionHelper.hxx"
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class PolarPlottingPositionHelper;
+
+class PolarLabelPositionHelper : public LabelPositionHelper
+{
+public:
+ PolarLabelPositionHelper(
+ PolarPlottingPositionHelper* pPosHelper
+ , sal_Int32 nDimensionCount
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , ShapeFactory* pShapeFactory );
+ virtual ~PolarLabelPositionHelper();
+
+ ::com::sun::star::awt::Point getLabelScreenPositionAndAlignmentForLogicValues(
+ LabelAlignment& rAlignment
+ , double fLogicValueOnAngleAxis
+ , double fLogicValueOnRadiusAxis
+ , double fLogicZ
+ , sal_Int32 nScreenValueOffsetInRadiusDirection=0 ) const;
+
+ ::com::sun::star::awt::Point getLabelScreenPositionAndAlignmentForUnitCircleValues(
+ LabelAlignment& rAlignment, sal_Int32 nLabelPlacement /*see ::com::sun::star::chart::DataLabelPlacement*/
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , double fLogicZ
+ , sal_Int32 nScreenValueOffsetInRadiusDirection=0 ) const;
+
+private:
+ PolarPlottingPositionHelper* m_pPosHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/PropertyMapper.hxx b/chart2/source/view/inc/PropertyMapper.hxx
new file mode 100644
index 000000000000..c0871b94f835
--- /dev/null
+++ b/chart2/source/view/inc/PropertyMapper.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_PROPERTYMAPPER_HXX
+#define _CHART2_PROPERTYMAPPER_HXX
+
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+typedef ::std::map< ::rtl::OUString, ::rtl::OUString > tPropertyNameMap;
+typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakePropertyNameMap;
+
+typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > tPropertyNameValueMap;
+typedef ::comphelper::MakeMap< ::rtl::OUString, ::com::sun::star::uno::Any > tMakePropertyNameValueMap;
+
+typedef ::com::sun::star::uno::Sequence< rtl::OUString > tNameSequence;
+typedef ::comphelper::MakeSequence< rtl::OUString > tMakeNameSequence;
+
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > tAnySequence;
+typedef ::comphelper::MakeSequence< ::com::sun::star::uno::Any > tMakeAnySequence;
+
+class PropertyMapper
+{
+public:
+ static void setMappedProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap
+ , tPropertyNameValueMap* pOverwriteMap=0 );
+
+ static void getValueMap(
+ tPropertyNameValueMap& rValueMap
+ , const tPropertyNameMap& rNameMap
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ );
+
+ static void getMultiPropertyLists(
+ tNameSequence& rNames
+ , tAnySequence& rValues
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProp
+ , const tPropertyNameMap& rMap
+ );
+
+ static void getMultiPropertyListsFromValueMap(
+ tNameSequence& rNames
+ , tAnySequence& rValues
+ , const tPropertyNameValueMap& rValueMap
+ );
+
+ static ::com::sun::star::uno::Any*
+ getValuePointer( tAnySequence& rPropValues
+ , const tNameSequence& rPropNames
+ , const rtl::OUString& rPropName );
+
+ static ::com::sun::star::uno::Any*
+ getValuePointerForLimitedSpace( tAnySequence& rPropValues
+ , const tNameSequence& rPropNames
+ , bool bLimitedHeight );
+
+ static void setMultiProperties(
+ const tNameSequence& rNames
+ , const tAnySequence& rValues
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTarget );
+
+ static const tMakePropertyNameMap& getPropertyNameMapForCharacterProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForParagraphProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForFillProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForLineProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForFillAndLineProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForTextShapeProperties();
+
+ static const tMakePropertyNameMap& getPropertyNameMapForFilledSeriesProperties();
+ static const tMakePropertyNameMap& getPropertyNameMapForLineSeriesProperties();
+
+ static void getTextLabelMultiPropertyLists(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , tNameSequence& rPropNames, tAnySequence& rPropValues
+ , bool bName=true
+ , sal_Int32 nLimitedSpace=-1
+ , bool bLimitedHeight=false );
+
+ /** adds line-, fill- and character properties and sets some suitable
+ defaults for auto-grow properties
+ */
+ static void getPreparedTextShapePropertyLists(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , tNameSequence& rPropNames
+ , tAnySequence& rPropValues );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/ScaleAutomatism.hxx b/chart2/source/view/inc/ScaleAutomatism.hxx
new file mode 100644
index 000000000000..4440ad26ac5a
--- /dev/null
+++ b/chart2/source/view/inc/ScaleAutomatism.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_SCALEAUTOMATISM_HXX
+#define _CHART2_SCALEAUTOMATISM_HXX
+
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/ScaleData.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+
+/** This class implements the calculation of automatic axis limits.
+*/
+class ScaleAutomatism
+{
+public:
+ explicit ScaleAutomatism(
+ const ::com::sun::star::chart2::ScaleData& rSourceScale );
+ virtual ~ScaleAutomatism();
+
+ /** Expands own value range with the passed minimum and maximum. */
+ void expandValueRange( double fMinimum, double fMaximum );
+
+ /** Sets additional auto scaling options.
+ @param bExpandBorderToIncrementRhythm If true, expands automatic
+ borders to the fixed or calculated increment rhythm.
+ @param bExpandIfValuesCloseToBorder If true, expands automatic borders
+ if values are too close (closer than 1/21 of visible area).
+ @param bExpandWideValuesToZero If true, expands automatic border to
+ zero, if source values are positive only or negative only, and if
+ the absolute values are wide spread (at least one value is less
+ than 5/6 of absolute maximum), or if all values are equal.
+ @param bExpandNarrowValuesTowardZero If true, expands automatic border
+ toward zero (50% of the visible range), if source values are
+ positive only or negative only, and if the absolute values are
+ close to the absolute maximum (no value is less than 5/6 of
+ absolute maximum). */
+ void setAutoScalingOptions(
+ bool bExpandBorderToIncrementRhythm,
+ bool bExpandIfValuesCloseToBorder,
+ bool bExpandWideValuesToZero,
+ bool bExpandNarrowValuesTowardZero );
+
+ /** Sets the maximum allowed number of automatic main increments.
+ @descr The number of main increments may be limited e.g. by the length
+ of the axis and the font size of the axis caption text. */
+ void setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMainIncrementCount );
+
+ /** Fills the passed scale data and increment data according to the own settings. */
+ void calculateExplicitScaleAndIncrement(
+ ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement ) const;
+
+ ::com::sun::star::chart2::ScaleData getScale() const;
+
+private:
+ /** Fills the passed scale data and increment data for category scaling. */
+ void calculateExplicitIncrementAndScaleForCategory(
+ ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const;
+
+ /** Fills the passed scale data and increment data for logarithmic scaling. */
+ void calculateExplicitIncrementAndScaleForLogarithmic(
+ ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const;
+
+ /** Fills the passed scale data and increment data for linear scaling. */
+ void calculateExplicitIncrementAndScaleForLinear(
+ ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const;
+
+private:
+ ::com::sun::star::chart2::ScaleData m_aSourceScale;
+
+ double m_fValueMinimum; /// Minimum of all source values.
+ double m_fValueMaximum; /// Maximum of all source values.
+ sal_Int32 m_nMaximumAutoMainIncrementCount; /// Maximum number of automatic main increments.
+ bool m_bExpandBorderToIncrementRhythm; /// true = Expand to main increments.
+ bool m_bExpandIfValuesCloseToBorder; /// true = Expand if values are too close to the borders.
+ bool m_bExpandWideValuesToZero; /// true = Expand wide spread values to zero.
+ bool m_bExpandNarrowValuesTowardZero; /// true = Expand narrow range toward zero (add half of range).
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
new file mode 100644
index 000000000000..ef75f3a323af
--- /dev/null
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VIEW_SHAPEFACTORY_HXX
+#define _CHART2_VIEW_SHAPEFACTORY_HXX
+
+#include "PropertyMapper.hxx"
+#include "VLineProperties.hxx"
+#include "BaseGFXHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class Stripe;
+class ShapeFactory
+{
+public:
+ ShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory)
+ {m_xShapeFactory = xFactory;}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup2D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , ::rtl::OUString aName = ::rtl::OUString() );
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup3D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , ::rtl::OUString aName = ::rtl::OUString() );
+
+ //------
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCube( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , bool bRounded = false);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCylinder( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPyramid( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight
+ , bool bRotateZ
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCone( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
+ , double fDepth );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const Stripe& rStripe
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , sal_Bool bDoubleSided = true
+ , short nRotatedTexture = 0 //0 to 7 are the different possibilities
+ , bool bFlatNormals=true );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
+ , double fDepth);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon);
+
+ static sal_Int32 getSymbolCount();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nStandardSymbol
+ , sal_Int32 nBorderColor=0
+ , sal_Int32 nFillColor=0 );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , const VLineProperties* pLineProperties = NULL );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
+ , const VLineProperties& rLineProperties );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize );
+
+ //------------------- create 2D elements:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
+ , const ::rtl::OUString& rText
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ , const ::com::sun::star::uno::Any& rATransformation
+ );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createInvisibleRectangle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::awt::Size& rSize );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage );
+
+ //------
+ static void makeShapeInvisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ static void setShapeName( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape
+ , const rtl::OUString& rName );
+
+ static rtl::OUString getShapeName( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ static ::com::sun::star::uno::Any makeTransformation( const ::com::sun::star::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
+
+ static rtl::OUString getStackedString( const rtl::OUString& rString, bool bStacked=true );
+
+ static bool hasPolygonAnyLines( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+ static bool isPolygonEmptyOrSinglePoint( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+ static void closePolygon( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+
+ static ::com::sun::star::awt::Size calculateNewSizeRespectingAspectRatio(
+ const ::com::sun::star::awt::Size& rTargetSize
+ , const ::com::sun::star::awt::Size& rSourceSizeWithCorrectAspectRatio );
+
+ static ::com::sun::star::awt::Point calculateTopLeftPositionToCenterObject(
+ const ::com::sun::star::awt::Point& rTargetAreaPosition
+ , const ::com::sun::star::awt::Size& rTargetAreaSize
+ , const ::com::sun::star::awt::Size& rObjectSize );
+
+ static ::basegfx::B2IRectangle getRectangleOfShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
+
+ static ::com::sun::star::awt::Size getSizeAfterRotation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, double fRotationAngleDegree );
+
+ static void removeSubShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes );
+
+private:
+ ShapeFactory();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ impl_createCube( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize, sal_Int32 nRotateZAngleHundredthDegree
+ , bool bRounded );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ impl_createConeOrCylinder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
+ , bool bCylinder = false);
+
+ //member:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
+ m_xShapeFactory;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/Stripe.hxx b/chart2/source/view/inc/Stripe.hxx
new file mode 100644
index 000000000000..ca1aaf155d1e
--- /dev/null
+++ b/chart2/source/view/inc/Stripe.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_STRIPE_HXX
+#define _CHART_STRIPE_HXX
+
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/uno/Any.h>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/** A Stripe represents a 2 dimensional foursquare plane in a 3 dimaensional room.
+
+@todo could: it is not necessary to have 4 point members here; it would be sufficient to have one point and 2 directions
+*/
+
+class Stripe
+{
+public:
+ Stripe( const ::com::sun::star::drawing::Position3D& rPoint1
+ , const ::com::sun::star::drawing::Direction3D& rDirectionToPoint2
+ , const ::com::sun::star::drawing::Direction3D& rDirectionToPoint4 );
+
+ Stripe( const ::com::sun::star::drawing::Position3D& rPoint1
+ , const ::com::sun::star::drawing::Position3D& rPoint2
+ , double fDepth );
+
+ Stripe( const ::com::sun::star::drawing::Position3D& rPoint1
+ , const ::com::sun::star::drawing::Position3D& rPoint2
+ , const ::com::sun::star::drawing::Position3D& rPoint3
+ , const ::com::sun::star::drawing::Position3D& rPoint4 );
+
+ void SetManualNormal( const ::com::sun::star::drawing::Direction3D& rNormal );
+ ::com::sun::star::drawing::Direction3D getNormal() const;
+
+ void InvertNormal( bool bInvertNormal );
+
+ ::com::sun::star::uno::Any getPolyPolygonShape3D() const;
+ ::com::sun::star::uno::Any getNormalsPolygon() const;
+ ::com::sun::star::uno::Any getTexturePolygon( short nRotatedTexture ) const; //0 to 7 are the different possibilities
+
+ ::com::sun::star::drawing::Position3D GetPosition1() const { return m_aPoint1; }
+ ::com::sun::star::drawing::Position3D GetPosition2() const { return m_aPoint2; }
+ ::com::sun::star::drawing::Position3D GetPosition3() const { return m_aPoint3; }
+ ::com::sun::star::drawing::Position3D GetPosition4() const { return m_aPoint4; }
+
+private:
+ ::com::sun::star::drawing::Position3D m_aPoint1;
+ ::com::sun::star::drawing::Position3D m_aPoint2;
+ ::com::sun::star::drawing::Position3D m_aPoint3;
+ ::com::sun::star::drawing::Position3D m_aPoint4;
+
+ bool m_bInvertNormal;
+ bool m_bManualNormalSet;
+ ::com::sun::star::drawing::Direction3D m_aManualNormal;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx
new file mode 100644
index 000000000000..e884af865d6e
--- /dev/null
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCOORDINATESYSTEM_HXX
+#define _CHART2_VCOORDINATESYSTEM_HXX
+
+#include "MinimumAndMaximumSupplier.hxx"
+#include "ScaleAutomatism.hxx"
+#include "ThreeDHelper.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include "comphelper/implementationreference.hxx"
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include<map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VAxisBase;
+class VCoordinateSystem
+{
+public:
+ virtual ~VCoordinateSystem();
+
+ static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
+
+ virtual void SAL_CALL initPlottingTargets(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xFinalTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void setParticle( const rtl::OUString& rCooSysParticle );
+
+ virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
+ ::com::sun::star::drawing::HomogenMatrix getTransformationSceneToScreen();
+
+ //better performance for big data
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
+ , const ::com::sun::star::awt::Size& rPageResolution );
+
+ ::com::sun::star::chart2::ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ::com::sun::star::chart2::ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+
+ void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
+ ExplicitCategoriesProvider* getExplicitCategoriesProvider();
+
+ // returns a coplete scale set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ // returns a coplete increment set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+
+ void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
+ bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
+ void clearMinimumAndMaximumSupplierList();
+
+ void prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
+
+ void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
+ , const ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
+ , const ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement );
+
+ void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
+ getModel() const;
+
+ virtual void createVAxisList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier
+ , const ::com::sun::star::awt::Size& rFontReferenceSize
+ , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
+
+ virtual void initVAxisInList();
+ virtual void updateScalesAndIncrementsOnAxes();
+
+ virtual void createMaximumAxesLabels();
+ virtual void createAxesLabels();
+ virtual void updatePositions();
+ virtual void createAxesShapes();
+
+ virtual void createGridShapes();
+
+ virtual bool getPropertySwapXAndYAxis() const;
+
+ sal_Int32 getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const;
+
+ virtual bool needSeriesNamesForAxis() const;
+ void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence< rtl::OUString >& rSeriesNames );
+
+protected: //methods
+ VCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
+ getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > >
+ getGridListFromAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+
+ VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+ void prepareScaleAutomatism( ScaleAutomatism& rScaleAutomatism, double fMin, double fMax, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
+
+ rtl::OUString createCIDForAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+ rtl::OUString createCIDForGrid( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+ sal_Int32 getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+
+private: //methods
+ void impl_adjustDimension( sal_Int32& rDimensionIndex ) const;
+ void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
+
+protected: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
+
+ rtl::OUString m_aCooSysParticle;
+
+ typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates wether this is a main or secondary axis
+
+ //
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xLogicTargetForGrids;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xLogicTargetForAxes;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xFinalTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
+ ::com::sun::star::drawing::HomogenMatrix m_aMatrixSceneToScreen;
+
+ CuboidPlanePosition m_eLeftWallPos;
+ CuboidPlanePosition m_eBackWallPos;
+ CuboidPlanePosition m_eBottomPos;
+
+ //
+ MergedMinimumAndMaximumSupplier m_aMergedMinimumAndMaximumSupplier; //this is used only for autoscaling purpose
+
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aSeriesNamesForZAxis;
+
+ typedef std::map< tFullAxisIndex, ::boost::shared_ptr< VAxisBase > > tVAxisMap;
+
+ tVAxisMap m_aAxisMap;
+
+private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData > m_aExplicitScales;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitIncrementData > m_aExplicitIncrements;
+
+ typedef std::map< tFullAxisIndex, ::com::sun::star::chart2::ExplicitScaleData > tFullExplicitScaleMap;
+ typedef std::map< tFullAxisIndex, ::com::sun::star::chart2::ExplicitIncrementData > tFullExplicitIncrementMap;
+
+ tFullExplicitScaleMap m_aSecondaryExplicitScales;
+ tFullExplicitIncrementMap m_aSecondaryExplicitIncrements;
+
+ ::std::auto_ptr< ExplicitCategoriesProvider > m_apExplicitCategoriesProvider;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
new file mode 100644
index 000000000000..93aba58dbec4
--- /dev/null
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VIEW_DATASERIES_HXX
+#define _CHART2_VIEW_DATASERIES_HXX
+
+#include "PropertyMapper.hxx"
+
+#include <vector>
+//for auto_ptr
+#include <memory>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart2/StackingDirection.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <cppuhelper/weakref.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VDataSequence
+{
+public:
+ void init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >& xModel );
+ bool is() const;
+ void clear();
+ double getValue( sal_Int32 index ) const;
+ sal_Int32 detectNumberFormatKey( sal_Int32 index ) const;
+ sal_Int32 getLength() const;
+
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > Model;
+
+ mutable ::com::sun::star::uno::Sequence< double > Doubles;
+};
+
+class VDataSeries
+{
+public:
+ VDataSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xDataSeries );
+ virtual ~VDataSeries();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+ getModel() const;
+
+ void setCategoryXAxis();
+ void setParticle( const rtl::OUString& rSeriesParticle );
+ void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
+ void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
+
+ sal_Int32 getTotalPointCount() const;
+ double getXValue( sal_Int32 index ) const;
+ double getYValue( sal_Int32 index ) const;
+
+ double getY_Min( sal_Int32 index ) const;
+ double getY_Max( sal_Int32 index ) const;
+ double getY_First( sal_Int32 index ) const;
+ double getY_Last( sal_Int32 index ) const;
+
+ double getBubble_Size( sal_Int32 index ) const;
+
+ double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
+ double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
+
+ ::com::sun::star::uno::Sequence< double > getAllX() const;
+ ::com::sun::star::uno::Sequence< double > getAllY() const;
+
+ double getYMeanValue() const;
+
+ bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
+ sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
+ sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
+ bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
+
+ sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
+ , sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getPropertiesOfPoint( sal_Int32 index ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getPropertiesOfSeries() const;
+
+ ::com::sun::star::chart2::Symbol*
+ getSymbolProperties( sal_Int32 index ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getYErrorBarProperties( sal_Int32 index ) const;
+
+ bool hasPointOwnColor( sal_Int32 index ) const;
+
+ ::com::sun::star::chart2::StackingDirection getStackingDirection() const;
+ sal_Int32 getAttachedAxisIndex() const;
+ void setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex );
+
+ void doSortByXValues();
+
+ void setConnectBars( sal_Bool bConnectBars );
+ sal_Bool getConnectBars() const;
+
+ void setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis );
+ sal_Bool getGroupBarsPerAxis() const;
+
+ void setStartingAngle( sal_Int32 nStartingAngle );
+ sal_Int32 getStartingAngle() const;
+
+ void setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole );
+
+ //this is only temporarily here for area chart:
+ ::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
+ sal_Int32 m_nPolygonIndex;
+ double m_fLogicMinX;
+ double m_fLogicMaxX;
+ //
+ //this is here for deep stacking:
+ double m_fLogicZPos;//from 0 to series count -1
+ //
+
+ rtl::OUString getCID() const;
+ rtl::OUString getSeriesParticle() const;
+ rtl::OUString getPointCID_Stub() const;
+ rtl::OUString getErrorBarsCID() const;
+ rtl::OUString getLabelsCID() const;
+ rtl::OUString getLabelCID_Stub() const;
+ rtl::OUString getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const;
+
+ ::com::sun::star::chart2::DataPointLabel*
+ getDataPointLabelIfLabel( sal_Int32 index ) const;
+ bool getTextLabelMultiPropertyLists( sal_Int32 index, tNameSequence*& pPropNames, tAnySequence*& pPropValues ) const;
+
+ rtl::OUString getDataCurveEquationCID( sal_Int32 nCurveIndex ) const;
+ bool isAttributedDataPoint( sal_Int32 index ) const;
+
+ bool isVaryColorsByPoint() const;
+
+ void releaseShapes();
+
+ void setMissingValueTreatment( sal_Int32 nMissingValueTreatment );
+ sal_Int32 getMissingValueTreatment() const;
+
+private: //methods
+ ::com::sun::star::chart2::DataPointLabel*
+ getDataPointLabel( sal_Int32 index ) const;
+ void adaptPointCache( sal_Int32 nNewPointIndex ) const;
+
+public: //member
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xLabelsGroupShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xErrorBarsGroupShape;
+
+ //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)
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xFrontSubGroupShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xBackSubGroupShape;
+
+private: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > > m_aDataSequences;
+
+ //all points given by the model data (here are not only the visible points meant)
+ sal_Int32 m_nPointCount;
+
+ VDataSequence m_aValues_X;
+ VDataSequence m_aValues_Y;
+ VDataSequence m_aValues_Z;
+
+ VDataSequence m_aValues_Y_Min;
+ VDataSequence m_aValues_Y_Max;
+ VDataSequence m_aValues_Y_First;
+ VDataSequence m_aValues_Y_Last;
+
+ VDataSequence m_aValues_Bubble_Size;
+
+ VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
+
+ mutable double m_fYMeanValue;
+
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
+
+ ::com::sun::star::chart2::StackingDirection m_eStackingDirection;
+
+ sal_Int32 m_nAxisIndex;//indicates wether this is attached to a main or secondary axis
+
+ sal_Bool m_bConnectBars;
+
+ sal_Bool m_bGroupBarsPerAxis;
+
+ sal_Int32 m_nStartingAngle;
+
+ rtl::OUString m_aSeriesParticle;
+ rtl::OUString m_aCID;
+ rtl::OUString m_aPointCID_Stub;
+ rtl::OUString m_aLabelCID_Stub;
+
+ sal_Int32 m_nGlobalSeriesIndex;
+
+ //some cached values for data labels as they are very expensive
+ mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
+ m_apLabel_Series;
+ mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_Series;
+ mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_Series;
+ mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
+ m_apSymbolProperties_Series;
+
+ mutable ::std::auto_ptr< ::com::sun::star::chart2::DataPointLabel >
+ m_apLabel_AttributedPoint;
+ mutable ::std::auto_ptr< tNameSequence > m_apLabelPropNames_AttributedPoint;
+ mutable ::std::auto_ptr< tAnySequence > m_apLabelPropValues_AttributedPoint;
+ mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
+ m_apSymbolProperties_AttributedPoint;
+ mutable ::std::auto_ptr< ::com::sun::star::chart2::Symbol >
+ m_apSymbolProperties_InvisibleSymbolForSelection;
+ mutable sal_Int32 m_nCurrentAttributedPoint;
+ ::com::sun::star::awt::Size m_aReferenceSize;
+ //
+
+ sal_Int32 m_nMissingValueTreatment;
+ bool m_bAllowPercentValueInDataLabel;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx
new file mode 100644
index 000000000000..5df198c2f539
--- /dev/null
+++ b/chart2/source/view/inc/VDiagram.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VDIAGRAM_HXX
+#define _CHART2_VDIAGRAM_HXX
+
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include "ShapeFactory.hxx"
+#include <basegfx/range/b2irectangle.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class ShapeFactory;
+
+//-----------------------------------------------------------------------------
+/** The VDiagram is responsible to generate the visible parts of the Diagram
+that is wall, floor, axes and data series.
+The axes and data series are subobjects which are created and managed by the
+diagram.
+*/
+
+class VDiagram
+{
+public: //methods
+ VDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram
+ , const ::com::sun::star::drawing::Direction3D& rPreferredAspectRatio
+ , sal_Int32 nDimension=3, sal_Bool bPolar=sal_False );
+ virtual ~VDiagram();
+
+ void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xFinalTarget
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory);
+
+ void createShapes( const ::com::sun::star::awt::Point& rPos
+ , const ::com::sun::star::awt::Size& rSize );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getCoordinateRegion();
+
+ ::basegfx::B2IRectangle getCurrentRectangle();
+
+ void reduceToMimimumSize();
+
+ ::basegfx::B2IRectangle adjustPosAndSize( const ::com::sun::star::awt::Point& rPos
+ , const ::com::sun::star::awt::Size& rAvailableSize );
+
+ ::basegfx::B2IRectangle adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect );
+
+ // updateShapes(..);
+ // const awt::Point& rPos, const awt::Size& rSize );
+
+private: //methods
+ void createShapes_2d();
+ void createShapes_3d();
+
+ ::basegfx::B2IRectangle adjustPosAndSize_2d( const ::com::sun::star::awt::Point& rPos
+ , const ::com::sun::star::awt::Size& rAvailableSize );
+ ::basegfx::B2IRectangle adjustPosAndSize_3d( const ::com::sun::star::awt::Point& rPos
+ , const ::com::sun::star::awt::Size& rAvailableSize );
+
+ void adjustAspectRatio3d( const ::com::sun::star::awt::Size& rAvailableSize );
+
+private: //members
+ VDiagram(const VDiagram& rD);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xLogicTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xFinalTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
+ ShapeFactory* m_pShapeFactory;
+
+ // this is the surrounding shape which contains floor, wall and coordinate
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xOuterGroupShape;
+ // this is an additional inner shape that represents the coordinate region - that is - where to place data points
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xCoordinateRegionShape;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xWall2D;
+
+ sal_Int32 m_nDimensionCount;
+ sal_Bool m_bPolar;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > m_xDiagram;
+
+ ::com::sun::star::drawing::Direction3D m_aPreferredAspectRatio;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAspectRatio3D;
+
+ double m_fXAnglePi;
+ double m_fYAnglePi;
+ double m_fZAnglePi;
+ sal_Bool m_bRightAngledAxes;
+
+ ::com::sun::star::awt::Point m_aAvailablePosIncludingAxes;
+ ::com::sun::star::awt::Size m_aAvailableSizeIncludingAxes;
+
+ ::com::sun::star::awt::Point m_aCurrentPosWithoutAxes;
+ ::com::sun::star::awt::Size m_aCurrentSizeWithoutAxes;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
+
diff --git a/chart2/source/view/inc/VLegendSymbolFactory.hxx b/chart2/source/view/inc/VLegendSymbolFactory.hxx
new file mode 100644
index 000000000000..a568a9ef4a85
--- /dev/null
+++ b/chart2/source/view/inc/VLegendSymbolFactory.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_VLEGENDSYMBOLFACTORY_HXX
+#define CHART2_VLEGENDSYMBOLFACTORY_HXX
+
+#include <com/sun/star/chart2/LegendSymbolStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+namespace chart
+{
+
+class VLegendSymbolFactory
+{
+public:
+ enum tPropertyType
+ {
+ PROP_TYPE_FILLED_SERIES,
+ PROP_TYPE_LINE_SERIES,
+ PROP_TYPE_FILL,
+ PROP_TYPE_LINE,
+ PROP_TYPE_FILL_AND_LINE
+ };
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ createSymbol(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > xSymbolContainer,
+ ::com::sun::star::chart2::LegendSymbolStyle eStyle,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & xShapeFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xLegendEntryProperties,
+ tPropertyType ePropertyType,
+ const ::com::sun::star::uno::Any& rExplicitSymbol /*should contain a ::com::sun::star::chart2::Symbol without automatic symbol if the charttype does support symbols else empty*/);
+
+ enum tStockLineType
+ {
+ STOCK_LINE_TYPE_VERT,
+ STOCK_LINE_TYPE_OPEN,
+ STOCK_LINE_TYPE_CLOSE
+ };
+
+private:
+ VLegendSymbolFactory();
+};
+
+} // namespace chart
+
+// CHART2_VLEGENDSYMBOLFACTORY_HXX
+#endif
diff --git a/chart2/source/view/inc/VLineProperties.hxx b/chart2/source/view/inc/VLineProperties.hxx
new file mode 100644
index 000000000000..f6ec92d38cf8
--- /dev/null
+++ b/chart2/source/view/inc/VLineProperties.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHART2_VLINEPROPERTIES_HXX
+#define _CHART2_VLINEPROPERTIES_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct VLineProperties
+{
+ com::sun::star::uno::Any Color; //type sal_Int32 UNO_NAME_LINECOLOR
+ com::sun::star::uno::Any LineStyle; //type drawing::LineStyle for property UNO_NAME_LINESTYLE
+ com::sun::star::uno::Any Transparence;//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
+ com::sun::star::uno::Any Width;//type sal_Int32 for property UNO_NAME_LINEWIDTH
+ com::sun::star::uno::Any DashName;//type OUString for property "LineDashName"
+
+ VLineProperties();
+ void initFromPropertySet( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xProp
+ , bool bUseSeriesPropertyNames=false );
+
+ bool isLineVisible() const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/VPolarTransformation.hxx b/chart2/source/view/inc/VPolarTransformation.hxx
new file mode 100644
index 000000000000..f3da18ac92b6
--- /dev/null
+++ b/chart2/source/view/inc/VPolarTransformation.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_VPOLARTRANSFORMATION_HXX
+#define _CHART_VPOLARTRANSFORMATION_HXX
+
+#include "PlottingPositionHelper.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/chart2/XTransformation.hpp>
+
+namespace chart
+{
+
+class VPolarTransformation : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::chart2::XTransformation
+ >
+{
+public:
+ VPolarTransformation( const PolarPlottingPositionHelper& rPositionHelper );
+ virtual ~VPolarTransformation();
+
+ // ____ XTransformation ____
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL transform(
+ const ::com::sun::star::uno::Sequence< double >& rSourceValues )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getSourceDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+ /// @see ::com::sun::star::chart2::XTransformation
+ virtual sal_Int32 SAL_CALL getTargetDimension()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ PolarPlottingPositionHelper m_aPositionHelper;
+ ::basegfx::B3DHomMatrix m_aUnitCartesianToScene;
+};
+
+} // namespace chart
+
+// _CHART_VPOLARTRANSFORMATION_HXX
+#endif
+
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
new file mode 100644
index 000000000000..6b6b06437542
--- /dev/null
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VSERIESPLOTTER_HXX
+#define _CHART2_VSERIESPLOTTER_HXX
+
+#include "PlotterBase.hxx"
+#include "VDataSeries.hxx"
+#include "LabelAlignment.hxx"
+#include "MinimumAndMaximumSupplier.hxx"
+#include "LegendEntryProvider.hxx"
+#include "ExplicitCategoriesProvider.hxx"
+#include <com/sun/star/chart2/LegendSymbolStyle.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace util {
+ class XNumberFormatsSupplier;
+ }
+ namespace chart2 {
+ class XColorScheme;
+ class XRegressionCurveCalculator;
+ }
+}}}
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class NumberFormatterWrapper;
+
+class AxesNumberFormats
+{
+public:
+ AxesNumberFormats() {};
+
+ void setFormat( sal_Int32 nFormatKey, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
+ {
+ m_aNumberFormatMap[tFullAxisIndex(nDimIndex,nAxisIndex)] = nFormatKey;
+ }
+ sal_Int32 hasFormat( sal_Int32 nDimIndex, sal_Int32 nAxisIndex ) const
+ {
+ return (m_aNumberFormatMap.find(tFullAxisIndex(nDimIndex,nAxisIndex)) !=m_aNumberFormatMap.end());
+ }
+ sal_Int32 getFormat( sal_Int32 nDimIndex, sal_Int32 nAxisIndex ) const
+ {
+ tNumberFormatMap::const_iterator aIt = m_aNumberFormatMap.find(tFullAxisIndex(nDimIndex,nAxisIndex));
+ if( aIt !=m_aNumberFormatMap.end() )
+ return aIt->second;
+ return 0;
+ }
+
+private:
+ typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex;
+ typedef std::map< tFullAxisIndex, sal_Int32 > tNumberFormatMap;
+ tNumberFormatMap m_aNumberFormatMap;
+};
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+//enum StackType { STACK_NORMAL, STACK_NONE, STACK_BESIDES, STACK_ONTOP, STACK_BEHIND };
+
+class VDataSeriesGroup
+{
+ //a list of series that have the same CoordinateSystem
+ //they are used to be plotted maybe in a stacked manner by a plotter
+
+public:
+ VDataSeriesGroup();
+ VDataSeriesGroup( VDataSeries* pSeries );
+ virtual ~VDataSeriesGroup();
+
+ void addSeries( VDataSeries* pSeries );//takes ownership of pSeries
+ sal_Int32 getSeriesCount() const;
+ void deleteSeries();
+
+ 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 calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex
+ , bool bSeperateStackingForDifferentSigns
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex );
+ void calculateYMinAndMaxForCategoryRange( sal_Int32 nStartCategoryIndex, sal_Int32 nEndCategoryIndex
+ , bool bSeperateStackingForDifferentSigns
+ , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex );
+
+ ::std::vector< VDataSeries* > m_aSeriesVector;
+
+private:
+ //cached values
+ struct CachedYValues
+ {
+ CachedYValues();
+
+ bool m_bValuesDirty;
+ double m_fMinimumY;
+ double m_fMaximumY;
+ };
+
+ mutable bool m_bMaxPointCountDirty;
+ mutable sal_Int32 m_nMaxPointCount;
+ typedef std::map< sal_Int32, CachedYValues > tCachedYValuesPerAxisIndexMap;
+ mutable ::std::vector< tCachedYValuesPerAxisIndexMap > m_aListOfCachedYValues;
+};
+
+class VSeriesPlotter : public PlotterBase, public MinimumAndMaximumSupplier, public LegendEntryProvider
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ virtual ~VSeriesPlotter();
+
+ /*
+ * A new series can be positioned relative to other series in a chart.
+ * This positioning has two dimensions. First a series can be placed
+ * next to each other on the category axis. This position is indicated by xSlot.
+ * Second a series can be stacked on top of another. This position is indicated by ySlot.
+ * The positions are counted from 0 on.
+ * xSlot < 0 : append the series to already existing x series
+ * xSlot > occupied : append the series to already existing x series
+ *
+ * If the xSlot is already occupied the given ySlot decides what should happen:
+ * ySlot < -1 : move all existing series in the xSlot to next slot
+ * ySlot == -1 : stack on top at given x position
+ * ySlot == already occupied : insert at given y and x position
+ * ySlot > occupied : stack on top at given x position
+ */
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ /** a value <= 0 for a directions means that this direction can be stretched arbitrary
+ */
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+ virtual bool keepAspectRatio() const;
+
+ /** this enables you to handle series on the same x axis with different y axis
+ the property AttachedAxisIndex at a dataseries indicates which value scale is to use
+ (0==AttachedAxisIndex or a not set AttachedAxisIndex property indicates that this series should be scaled at the main y-axis;
+ 1==AttachedAxisIndex indicates that the series should be scaled at the first secondary axis if there is any otherwise at the main y axis
+ and so on.
+ The parameter nAxisIndex matches this DataSereis property 'AttachedAxisIndex'.
+ nAxisIndex must be greater than 0. nAxisIndex==1 referres to the first secondary axis.
+ )
+ */
+
+ virtual void SAL_CALL addSecondaryValueScale( const
+ ::com::sun::star::chart2::ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+
+ virtual double getMinimumX();
+ virtual double getMaximumX();
+
+ virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+ virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
+
+ virtual double getMinimumZ();
+ virtual double getMaximumZ();
+
+ virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex );
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex );
+ virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //------
+
+ void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const;
+ void getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, double& rfMaxY, double fMinX, double fMaxX, sal_Int32 nAxisIndex ) const;
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntries(
+ ::com::sun::star::chart2::LegendExpansion eLegendExpansion,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTextProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ )
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+ virtual ::com::sun::star::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex=-1/*-1 for series symbol*/ );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createLegendSymbolForSeries(
+ const VDataSeries& rSeries
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > createLegendSymbolForPoint(
+ const VDataSeries& rSeries
+ , sal_Int32 nPointIndex
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory );
+
+ virtual std::vector<
+ ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntriesForSeries(
+ const VDataSeries& rSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTextProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ );
+
+ virtual std::vector<
+ ::com::sun::star::chart2::ViewLegendEntry > SAL_CALL createLegendEntriesForChartType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTextProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xShapeFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext
+ );
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+
+ static VSeriesPlotter* createSeriesPlotter( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bExcludingPositioning = false /*for pie and donut charts labels and exploded segments are excluded from the given size*/);
+
+ sal_Int32 getPointCount() const;
+
+ void setNumberFormatsSupplier( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier > & xNumFmtSupplier );
+ void setAxesNumberFormats( const AxesNumberFormats& rAxesNumberFormats ) { m_aAxesNumberFormats = rAxesNumberFormats; };
+
+ void setColorScheme( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XColorScheme >& xColorScheme );
+
+ void setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider );
+
+ //get series names for the z axis labels
+ ::com::sun::star::uno::Sequence< rtl::OUString > getSeriesNames() const;
+
+ void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
+ //better performance for big data
+ void setCoordinateSystemResolution( const ::com::sun::star::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution );
+ bool PointsWereSkipped() const;
+
+ //return the depth for a logic 1
+ double getTransformedDepth() const;
+
+ void releaseShapes();
+
+ virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
+
+ bool WantToPlotInFrontOfAxisLine();
+ virtual bool shouldSnapRectToUsedArea();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ VSeriesPlotter();
+
+protected: //methods
+
+ VSeriesPlotter( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount
+ , bool bCategoryXAxis=true );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getSeriesGroupShape( VDataSeries* pDataSeries
+ , const::com::sun::star:: uno::Reference<
+ ::com::sun::star::drawing::XShapes >& 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
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getSeriesGroupShapeFrontChild( VDataSeries* pDataSeries
+ , const::com::sun::star:: uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getSeriesGroupShapeBackChild( VDataSeries* pDataSeries
+ , const::com::sun::star:: uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getLabelsGroupShape( VDataSeries& rDataSeries
+ , const::com::sun::star:: uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getErrorBarsGroupShape( VDataSeries& rDataSeries
+ , const::com::sun::star:: uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createDataLabel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , VDataSeries& rDataSeries
+ , sal_Int32 nPointIndex
+ , double fValue
+ , double fSumValue
+ , const ::com::sun::star::awt::Point& rScreenPosition2D
+ , LabelAlignment eAlignment=LABEL_ALIGN_CENTER
+ , sal_Int32 nOffset=0 );
+
+ ::rtl::OUString getLabelTextForValue( VDataSeries& 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)
+
+ @param rPos
+ logic coordinates
+
+ @param xErrorBarProperties
+ the XPropertySet returned by the DataPoint-property "ErrorBarX" or
+ "ErrorBarY".
+
+ @param nIndex
+ the index of the data point in rData for which the calculation is
+ done.
+
+ @param bVertical
+ for y-error bars this is true, for x-error-bars it is false.
+ */
+ virtual void createErrorBar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D & rPos
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xErrorBarProperties
+ , const VDataSeries& rVDataSeries
+ , sal_Int32 nIndex
+ , bool bVertical
+ );
+
+ virtual void createErrorBar_Y( const ::com::sun::star::drawing::Position3D& rUnscaledLogicPosition
+ , VDataSeries& rVDataSeries, sal_Int32 nPointIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget );
+
+ virtual void createRegressionCurvesShapes( VDataSeries& rVDataSeries
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xEquationTarget
+ , bool bMaySkipPointsInRegressionCalculation );
+
+ virtual void createRegressionCurveEquationShapes( const ::rtl::OUString & rEquationCID
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xEquationProperties
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xEquationTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveCalculator > & xRegressionCurveCalculator
+ , ::com::sun::star::awt::Point aDefaultPos );
+
+ virtual void setMappedProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xTarget
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap
+ , tPropertyNameValueMap* pOverwriteMap=0 );
+
+ virtual PlottingPositionHelper& getPlottingPositionHelper( sal_Int32 nAxisIndex ) const;//nAxisIndex indicates wether the position belongs to the main axis ( nAxisIndex==0 ) or secondary axis ( nAxisIndex==1 )
+
+ VDataSeries* getFirstSeries() const;
+
+protected: //member
+ PlottingPositionHelper* m_pMainPosHelper;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > m_xChartTypeModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > m_xChartTypeModelProps;
+
+ ::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)
+
+ ::std::auto_ptr< NumberFormatterWrapper > m_apNumberFormatterWrapper;
+ AxesNumberFormats m_aAxesNumberFormats;//direct numberformats on axes, if empty ask the data series instead
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XColorScheme > m_xColorScheme;
+
+ ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;
+
+ //better performance for big data
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_aCoordinateSystemResolution;
+ bool m_bPointsWereSkipped;
+
+private: //member
+ typedef std::map< sal_Int32 , ::com::sun::star::chart2::ExplicitScaleData > tSecondaryValueScales;
+ tSecondaryValueScales m_aSecondaryValueScales;
+
+ typedef std::map< sal_Int32 , PlottingPositionHelper* > tSecondaryPosHelperMap;
+ mutable tSecondaryPosHelperMap m_aSecondaryPosHelperMap;
+ ::com::sun::star::awt::Size m_aPageReferenceSize;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/ViewDefines.hxx b/chart2/source/view/inc/ViewDefines.hxx
new file mode 100644
index 000000000000..623e46e64fb7
--- /dev/null
+++ b/chart2/source/view/inc/ViewDefines.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_COMMONDEFINES_HXX
+#define _CHART_COMMONDEFINES_HXX
+
+namespace chart
+{
+
+//=========================================================================
+//
+//=========================================================================
+#define CHART_3DOBJECT_SEGMENTCOUNT ((sal_Int32)32)
+#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
+//There needs to be a little distance betweengrid 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
+
+
+}//end namespace chart
+#endif
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
new file mode 100644
index 000000000000..d8f997d36da9
--- /dev/null
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartItemPool.hxx"
+#include "macros.hxx"
+
+#include "chartview/ChartSfxItemIds.hxx"
+#include <svx/chrtitem.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/rectitem.hxx>
+#include <svl/ilstitem.hxx>
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+#include <editeng/editids.hrc>
+#include <svx/svxids.hrc>
+
+namespace chart
+{
+
+ChartItemPool::ChartItemPool():
+ SfxItemPool( String( RTL_CONSTASCII_USTRINGPARAM( "ChartItemPool" )), SCHATTR_START, SCHATTR_END, NULL, NULL )
+{
+// OSL_TRACE( "SCH: CTOR: ChartItemPool" );
+ /**************************************************************************
+ * PoolDefaults
+ **************************************************************************/
+ ppPoolDefaults = new SfxPoolItem*[SCHATTR_END - SCHATTR_START + 1];
+
+ ppPoolDefaults[SCHATTR_DATADESCR_SHOW_NUMBER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER);
+ ppPoolDefaults[SCHATTR_DATADESCR_SHOW_PERCENTAGE- SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE);
+ ppPoolDefaults[SCHATTR_DATADESCR_SHOW_CATEGORY - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY);
+ ppPoolDefaults[SCHATTR_DATADESCR_SHOW_SYMBOL - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL);
+ ppPoolDefaults[SCHATTR_DATADESCR_SEPARATOR - SCHATTR_START] = new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR,C2U(" "));
+ ppPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0);
+ SvULongs aTmp;
+ ppPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,aTmp);
+ ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
+
+ ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
+// ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem;
+ ppPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,FALSE);
+ ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE, SCHATTR_TEXT_ORDER);
+
+ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MIN);
+ ppPoolDefaults[SCHATTR_Y_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MIN);
+ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MAX);
+ ppPoolDefaults[SCHATTR_Y_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MAX);
+ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_Y_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_HELP);
+ ppPoolDefaults[SCHATTR_Y_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_HELP);
+ ppPoolDefaults[SCHATTR_Y_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_LOGARITHM);
+ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_ORIGIN);
+ ppPoolDefaults[SCHATTR_Y_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_ORIGIN);
+
+ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MIN);
+ ppPoolDefaults[SCHATTR_X_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MIN);
+ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MAX);
+ ppPoolDefaults[SCHATTR_X_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MAX);
+ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_X_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_HELP);
+ ppPoolDefaults[SCHATTR_X_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_HELP);
+ ppPoolDefaults[SCHATTR_X_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_LOGARITHM);
+ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_ORIGIN);
+ ppPoolDefaults[SCHATTR_X_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_ORIGIN);
+
+ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MIN);
+ ppPoolDefaults[SCHATTR_Z_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MIN);
+ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MAX);
+ ppPoolDefaults[SCHATTR_Z_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MAX);
+ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_Z_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_HELP);
+ ppPoolDefaults[SCHATTR_Z_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_HELP);
+ ppPoolDefaults[SCHATTR_Z_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_LOGARITHM);
+ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_ORIGIN);
+ ppPoolDefaults[SCHATTR_Z_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_ORIGIN);
+
+ ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_X);
+ ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0);
+ ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE);
+
+ ppPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START] = new SfxBoolItem (SCHATTR_STAT_AVERAGE);
+ ppPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START] = new SvxChartKindErrorItem (CHERROR_NONE, SCHATTR_STAT_KIND_ERROR);
+ ppPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT);
+ ppPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR);
+ ppPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS);
+ ppPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS);
+ ppPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START] = new SvxChartIndicateItem (CHINDICATE_NONE, SCHATTR_STAT_INDICATE);
+ ppPoolDefaults[SCHATTR_STAT_RANGE_POS - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_POS, String());
+ ppPoolDefaults[SCHATTR_STAT_RANGE_NEG - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_NEG, String());
+
+ ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0);
+ ppPoolDefaults[SCHATTR_TEXT_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_OVERLAP,FALSE);
+
+ ppPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_DEEP, 0);
+ ppPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_3D, 0);
+ ppPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL, 0);
+ ppPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0);
+ ppPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_LINES, 0);
+ ppPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_PERCENT, 0);
+ ppPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_STACKED, 0);
+ ppPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0); //Bug: war Bool! ->Fileformat testen (betrifft nur 5er)
+ ppPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0);
+ ppPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0);
+
+ ppPoolDefaults[SCHATTR_AXIS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS,2); //2 = Y-Achse!!!
+
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN);
+ ppPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX);
+ ppPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP);
+// ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_HELP);
+ // type changed from double to sal_Int32
+ ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0);
+ ppPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN);
+ ppPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN);
+
+ ppPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER);
+ ppPoolDefaults[SCHATTR_AXIS_NUMFMT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMT,0);
+ ppPoolDefaults[SCHATTR_AXIS_NUMFMTPERCENT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMTPERCENT,11);
+ ppPoolDefaults[SCHATTR_AXIS_SHOWAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,0);
+ ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,0);
+ ppPoolDefaults[SCHATTR_AXIS_SHOWMAINGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWMAINGRID,0);
+ ppPoolDefaults[SCHATTR_AXIS_SHOWHELPGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWHELPGRID,0);
+ ppPoolDefaults[SCHATTR_AXIS_TOPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_TOPDOWN,0);
+ ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0);
+ ppPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,0);
+
+ ppPoolDefaults[SCHATTR_AXIS_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_POSITION,0);
+ ppPoolDefaults[SCHATTR_AXIS_POSITION_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE);
+ ppPoolDefaults[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0);
+ ppPoolDefaults[SCHATTR_AXIS_LABEL_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0);
+ ppPoolDefaults[SCHATTR_AXIS_MARK_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0);
+
+ ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH);
+ ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,0);
+ ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,0);
+ ppPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START] = new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0));
+
+ // new for New Chart
+ ppPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_OVERLAP,0);
+ ppPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0);
+ ppPoolDefaults[SCHATTR_BAR_CONNECT - SCHATTR_START] = new SfxBoolItem(SCHATTR_BAR_CONNECT, FALSE);
+ ppPoolDefaults[SCHATTR_NUM_OF_LINES_FOR_BAR - SCHATTR_START] = new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 );
+ ppPoolDefaults[SCHATTR_SPLINE_ORDER - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 );
+ ppPoolDefaults[SCHATTR_SPLINE_RESOLUTION - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 );
+ ppPoolDefaults[SCHATTR_DIAGRAM_STYLE - SCHATTR_START] = new SvxChartStyleItem( CHSTYLE_2D_COLUMN, SCHATTR_DIAGRAM_STYLE );
+ ppPoolDefaults[SCHATTR_TEXTBREAK - SCHATTR_START] = new SfxBoolItem( SCHATTR_TEXTBREAK, FALSE );
+ ppPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, FALSE);
+ ppPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE);
+ ppPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SfxInt32Item( SCHATTR_STARTING_ANGLE, 90 );
+ ppPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, FALSE );
+
+ ppPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0);
+ ppPoolDefaults[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,aTmp);
+
+ ppPoolDefaults[SCHATTR_AXIS_FOR_ALL_SERIES - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0);
+ ppPoolDefaults[SCHATTR_REGRESSION_TYPE - SCHATTR_START] = new SvxChartRegressItem (CHREGRESS_NONE, SCHATTR_REGRESSION_TYPE);
+ ppPoolDefaults[SCHATTR_REGRESSION_SHOW_EQUATION - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, 0);
+ ppPoolDefaults[SCHATTR_REGRESSION_SHOW_COEFF - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, 0);
+
+ /**************************************************************************
+ * ItemInfos
+ **************************************************************************/
+ pItemInfos = new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1];
+
+ USHORT i;
+ for( i = SCHATTR_START; i <= SCHATTR_END; i++ )
+ {
+ pItemInfos[i - SCHATTR_START]._nSID = 0;
+ pItemInfos[i - SCHATTR_START]._nFlags = SFX_ITEM_POOLABLE;
+ }
+
+ // 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;
+
+ SetDefaults(ppPoolDefaults);
+ SetItemInfos(pItemInfos);
+}
+
+ChartItemPool::ChartItemPool(const ChartItemPool& rPool):
+ SfxItemPool(rPool)
+{
+// OSL_TRACE( "SCH: CTOR: ChartItemPool" );
+}
+
+ChartItemPool::~ChartItemPool()
+{
+// OSL_TRACE( "SCH: DTOR: ChartItemPool" );
+ Delete();
+
+ delete[] pItemInfos;
+
+ const USHORT nMax = SCHATTR_END - SCHATTR_START + 1;
+ for( USHORT i=0; i<nMax; ++i )
+ {
+ SetRefCount(*ppPoolDefaults[i], 0);
+ delete ppPoolDefaults[i];
+ }
+
+ delete[] ppPoolDefaults;
+}
+
+SfxItemPool* ChartItemPool::Clone() const
+{
+ return new ChartItemPool(*this);
+}
+
+SfxMapUnit ChartItemPool::GetMetric(USHORT /* nWhich */) const
+{
+ return SFX_MAPUNIT_100TH_MM;
+}
+
+// static
+SfxItemPool* ChartItemPool::CreateChartItemPool()
+{
+ return new ChartItemPool();
+}
+
+} // namespace chart
diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx
new file mode 100644
index 000000000000..b8ee9910ce2d
--- /dev/null
+++ b/chart2/source/view/main/ChartItemPool.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ITEMPOOL_HXX
+#define _CHART2_ITEMPOOL_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/itempool.hxx>
+
+namespace chart
+{
+class ChartItemPool : public SfxItemPool
+{
+private:
+ SfxPoolItem** ppPoolDefaults;
+ SfxItemInfo* pItemInfos;
+
+public:
+ ChartItemPool();
+ ChartItemPool(const ChartItemPool& rPool);
+protected:
+ virtual ~ChartItemPool();
+public:
+
+ virtual SfxItemPool* Clone() const;
+ SfxMapUnit GetMetric( USHORT nWhich ) const;
+
+ /// creates a pure chart item pool
+ static SfxItemPool* CreateChartItemPool();
+};
+
+} // namespace chart
+
+#endif
+// _CHART2_ITEMPOOL_HXX
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
new file mode 100644
index 000000000000..2347824664c5
--- /dev/null
+++ b/chart2/source/view/main/ChartView.cxx
@@ -0,0 +1,3187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ChartView.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "ViewDefines.hxx"
+#include "VDiagram.hxx"
+#include "VTitle.hxx"
+#include "ShapeFactory.hxx"
+#include "VCoordinateSystem.hxx"
+#include "VSeriesPlotter.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "TitleHelper.hxx"
+#include "LegendHelper.hxx"
+#include "VLegend.hxx"
+#include "PropertyMapper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ScaleAutomatism.hxx"
+#include "MinimumAndMaximumSupplier.hxx"
+#include "ObjectIdentifier.hxx"
+#include "DiagramHelper.hxx"
+#include "RelativePositionHelper.hxx"
+#include "servicenames.hxx"
+#include "AxisHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include "ControllerLockGuard.hxx"
+#include "BaseGFXHelper.hxx"
+#include "DataSeriesHelper.hxx"
+
+#include <comphelper/scopeguard.hxx>
+#include <boost/bind.hpp>
+#include <unotools/streamwrap.hxx>
+// header for class LocaleDataWrapper
+#include <unotools/localedatawrapper.hxx>
+// header for class SdrPage
+#include <svx/svdpage.hxx>
+// header for class SvxDrawPage
+#include <svx/unopage.hxx>
+// header for class SvxShape
+#include <svx/unoshape.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <svx/unofill.hxx>
+
+#include <time.h>
+
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart2/ExplicitSubIncrement.hpp>
+#include <com/sun/star/chart2/StackingDirection.hpp>
+#include <com/sun/star/chart2/XChartDocument.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/XTitled.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/XShapeGroup.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <svl/languageoptions.hxx>
+#include <sot/clsids.hxx>
+
+//.............................................................................
+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;
+using rtl::OUString;
+
+//static
+const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+//static
+ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider(
+ const Reference< uno::XInterface >& xChartView )
+{
+ ExplicitValueProvider* pExplicitValueProvider=0;
+
+ Reference< lang::XUnoTunnel > xTunnel( xChartView, uno::UNO_QUERY );
+ if( xTunnel.is() )
+ {
+ pExplicitValueProvider = reinterpret_cast<ExplicitValueProvider*>(xTunnel->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ }
+ return pExplicitValueProvider;
+}
+
+ChartView::ChartView(
+ uno::Reference<uno::XComponentContext> const & xContext)
+ : m_aMutex()
+ , m_xCC(xContext)
+ , m_xChartModel()
+ , m_xShapeFactory()
+ , m_xDrawPage()
+ , m_pDrawModelWrapper()
+ , m_aListenerContainer( m_aMutex )
+ , m_bViewDirty(true)
+ , m_bInViewUpdate(false)
+ , m_bViewUpdatePending(false)
+ , m_bRefreshAddIn(true)
+ , m_aPageResolution(1000,1000)
+ , m_bPointsWereSkipped(false)
+ , m_nScaleXNumerator(1)
+ , m_nScaleXDenominator(1)
+ , m_nScaleYNumerator(1)
+ , m_nScaleYDenominator(1)
+ , m_bSdrViewIsInEditMode(sal_False)
+ , m_aResultingDiagramRectangleExcludingAxes(0,0,0,0)
+{
+}
+
+void ChartView::impl_setChartModel( const uno::Reference< frame::XModel >& xChartModel )
+{
+ if( m_xChartModel != xChartModel )
+ {
+ m_xChartModel = xChartModel;
+ m_bViewDirty = true;
+ }
+}
+
+void SAL_CALL ChartView::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw ( uno::Exception, uno::RuntimeException)
+{
+ DBG_ASSERT(aArguments.getLength() >= 1,"need 1 argument to initialize the view: xModel");
+ if( !(aArguments.getLength() >= 1) )
+ return;
+
+ uno::Reference< frame::XModel > xNewChartModel;
+ if( !(aArguments[0] >>= xNewChartModel) )
+ {
+ DBG_ERROR( "need a Reference to frame::XModel as first parameter for view initialization" );
+ }
+ impl_setChartModel( xNewChartModel );
+
+ if( !m_pDrawModelWrapper.get() )
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ m_pDrawModelWrapper = ::boost::shared_ptr< DrawModelWrapper >( new DrawModelWrapper( m_xCC ) );
+ m_xShapeFactory = m_pDrawModelWrapper->getShapeFactory();
+ m_xDrawPage = m_pDrawModelWrapper->getMainDrawPage();
+ StartListening( m_pDrawModelWrapper->getSdrModel(), FALSE /*bPreventDups*/ );
+ // \--
+ }
+}
+
+ChartView::~ChartView()
+{
+ if( m_pDrawModelWrapper.get() )
+ {
+ EndListening( m_pDrawModelWrapper->getSdrModel(), FALSE /*bAllDups*/ );
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ m_pDrawModelWrapper.reset();
+ }
+ m_xDrawPage = NULL;
+ impl_deleteCoordinateSystems();
+}
+
+void ChartView::impl_deleteCoordinateSystems()
+{
+ //delete all coordinate systems
+ ::std::vector< VCoordinateSystem* > aVectorToDeleteObjects;
+ ::std::swap( aVectorToDeleteObjects, m_aVCooSysList );//#i109770#
+ ::std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin();
+ const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ delete *aIter;
+ }
+ aVectorToDeleteObjects.clear();
+}
+
+
+//-----------------------------------------------------------------
+// datatransfer::XTransferable
+namespace
+{
+const rtl::OUString lcl_aGDIMetaFileMIMEType(
+ RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""));
+const rtl::OUString lcl_aGDIMetaFileMIMETypeHighContrast(
+ RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""));
+} // anonymous namespace
+
+void ChartView::getMetaFile( const uno::Reference< io::XOutputStream >& xOutStream
+ , bool bUseHighContrast )
+{
+ if( !m_xDrawPage.is() )
+ return;
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory( m_xCC->getServiceManager(), uno::UNO_QUERY );
+ if( !xFactory.is() )
+ return;
+
+ // creating the graphic exporter
+ uno::Reference< document::XExporter > xExporter( xFactory->createInstance(
+ C2U("com.sun.star.drawing.GraphicExportFilter")), uno::UNO_QUERY);
+ uno::Reference< document::XFilter > xFilter( xExporter, uno::UNO_QUERY );
+
+ if( !xExporter.is() || !xFilter.is() )
+ return;
+
+ uno::Sequence< beans::PropertyValue > aProps(3);
+ aProps[0].Name = C2U("FilterName");
+ aProps[0].Value <<= C2U("SVM");
+
+ aProps[1].Name = C2U("OutputStream");
+ aProps[1].Value <<= xOutStream;
+
+ uno::Sequence< beans::PropertyValue > aFilterData(4);
+ aFilterData[0].Name = C2U("ExportOnlyBackground");
+ aFilterData[0].Value <<= sal_False;
+ aFilterData[1].Name = C2U("HighContrast");
+ aFilterData[1].Value <<= bUseHighContrast;
+
+ aFilterData[2].Name = C2U("Version");
+ const sal_Int32 nVersion = SOFFICE_FILEFORMAT_50;
+ aFilterData[2].Value <<= nVersion;
+
+ aFilterData[3].Name = C2U("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.realloc( aFilterData.getLength()+4 );
+ aFilterData[4].Name = C2U("ScaleXNumerator");
+ aFilterData[4].Value = uno::makeAny( m_nScaleXNumerator );
+ aFilterData[5].Name = C2U("ScaleXDenominator");
+ aFilterData[5].Value = uno::makeAny( m_nScaleXDenominator );
+ aFilterData[6].Name = C2U("ScaleYNumerator");
+ aFilterData[6].Value = uno::makeAny( m_nScaleYNumerator );
+ aFilterData[7].Name = C2U("ScaleYDenominator");
+ aFilterData[7].Value = uno::makeAny( m_nScaleYDenominator );
+ }
+
+ aProps[2].Name = C2U("FilterData");
+ aProps[2].Value <<= aFilterData;
+
+ xExporter->setSourceDocument( uno::Reference< lang::XComponent >( m_xDrawPage, uno::UNO_QUERY) );
+ if( xFilter->filter( aProps ) )
+ {
+ xOutStream->flush();
+ xOutStream->closeOutput();
+ uno::Reference< io::XSeekable > xSeekable( xOutStream, uno::UNO_QUERY );
+ if( xSeekable.is() )
+ xSeekable->seek(0);
+ }
+}
+
+uno::Any SAL_CALL ChartView::getTransferData( const datatransfer::DataFlavor& aFlavor )
+ throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException)
+{
+ bool bHighContrastMetaFile( aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMETypeHighContrast));
+ uno::Any aRet;
+ if( ! (bHighContrastMetaFile || aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMEType)) )
+ return aRet;
+
+ update();
+
+ SvMemoryStream aStream( 1024, 1024 );
+ 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 );
+
+ 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();
+ }
+ }
+
+ return aRet;
+}
+uno::Sequence< datatransfer::DataFlavor > SAL_CALL ChartView::getTransferDataFlavors()
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< datatransfer::DataFlavor > aRet(2);
+
+ aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMEType,
+ C2U( "GDIMetaFile" ),
+ ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
+ aRet[1] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
+ C2U( "GDIMetaFile" ),
+ ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
+
+ return aRet;
+}
+::sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
+ throw (uno::RuntimeException)
+{
+ return ( aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMEType) ||
+ aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMETypeHighContrast) );
+}
+
+//-----------------------------------------------------------------
+// ____ XUnoTunnel ___
+::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier )
+ throw( uno::RuntimeException)
+{
+ if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( ExplicitValueProvider::getUnoTunnelId().getConstArray(),
+ aIdentifier.getConstArray(), 16 ) )
+ {
+ ExplicitValueProvider* pProvider = this;
+ return reinterpret_cast<sal_Int64>(pProvider);
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------
+// lang::XServiceInfo
+
+APPHELPER_XSERVICEINFO_IMPL(ChartView,CHART_VIEW_SERVICE_IMPLEMENTATION_NAME)
+
+ uno::Sequence< rtl::OUString > ChartView
+::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = CHART_VIEW_SERVICE_NAME;
+ return aSNS;
+}
+
+//-----------------------------------------------------------------
+//-----------------------------------------------------------------
+
+::basegfx::B3DHomMatrix createTransformationSceneToScreen(
+ const ::basegfx::B2IRectangle& rDiagramRectangleWithoutAxes )
+{
+ ::basegfx::B3DHomMatrix aM;
+ aM.scale(double(rDiagramRectangleWithoutAxes.getWidth())/FIXED_SIZE_FOR_3D_CHART_VOLUME
+ , -double(rDiagramRectangleWithoutAxes.getHeight())/FIXED_SIZE_FOR_3D_CHART_VOLUME, 1.0 );
+ aM.translate(double(rDiagramRectangleWithoutAxes.getMinX())
+ , double(rDiagramRectangleWithoutAxes.getMinY()+rDiagramRectangleWithoutAxes.getHeight()-1), 0);
+ return aM;
+}
+
+VCoordinateSystem* findInCooSysList( const std::vector< VCoordinateSystem* >& rVCooSysList
+ , const uno::Reference< XCoordinateSystem >& xCooSys )
+{
+ for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+ if(pVCooSys->getModel()==xCooSys)
+ return pVCooSys;
+ }
+ return NULL;
+}
+
+VCoordinateSystem* addCooSysToList( std::vector< VCoordinateSystem* >& rVCooSysList
+ , const uno::Reference< XCoordinateSystem >& xCooSys
+ , const uno::Reference< frame::XModel >& xChartModel )
+{
+ VCoordinateSystem* pVCooSys = findInCooSysList( rVCooSysList, xCooSys );
+ if( !pVCooSys )
+ {
+ pVCooSys = VCoordinateSystem::createCoordinateSystem(xCooSys );
+ if(pVCooSys)
+ {
+ rtl::OUString aCooSysParticle( ObjectIdentifier::createParticleForCoordinateSystem( xCooSys, xChartModel ) );
+ pVCooSys->setParticle(aCooSysParticle);
+
+ pVCooSys->setExplicitCategoriesProvider( new ExplicitCategoriesProvider(xCooSys,xChartModel) );
+
+ rVCooSysList.push_back( pVCooSys );
+ }
+ }
+ return pVCooSys;
+}
+
+VCoordinateSystem* lcl_getCooSysForPlotter( const std::vector< VCoordinateSystem* >& rVCooSysList, MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
+{
+ if(!pMinimumAndMaximumSupplier)
+ return 0;
+ for( size_t nC=0; nC < rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+ if(pVCooSys->hasMinimumAndMaximumSupplier( pMinimumAndMaximumSupplier ))
+ return pVCooSys;
+ }
+ return 0;
+}
+
+typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates wether this is a main or secondary axis
+typedef std::pair< VCoordinateSystem* , tFullAxisIndex > tFullCoordinateSystem;
+typedef std::map< VCoordinateSystem*, tFullAxisIndex > tCoordinateSystemMap;
+
+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 );
+ //tFullAxisIndex getDimensionAndIndexForCooSys( VCoordinateSystem* pCooSys );
+
+ ScaleAutomatism aScaleAutomatism;
+
+private:
+ tCoordinateSystemMap aCoordinateSystems;
+ std::map< sal_Int32, sal_Int32 > aMaxIndexPerDimension;
+};
+
+AxisUsage::AxisUsage()
+ : aScaleAutomatism(AxisHelper::createDefaultScale())
+{
+}
+
+AxisUsage::~AxisUsage()
+{
+ aCoordinateSystems.clear();
+}
+
+/*
+tFullScaleIndex AxisUsage::getDimensionAndIndexForCooSys( VCoordinateSystem* pCooSys )
+{
+ tFullScaleIndex aRet(0,0);
+
+ tCoordinateSystemMap::const_iterator aFound( aCoordinateSystems.find(pCooSys) );
+ if(aFound!=aCoordinateSystems.end())
+ aRet = aFound->second;
+
+ return aRet;
+}
+*/
+
+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;
+
+ tCoordinateSystemMap::const_iterator aIter;
+ for( aIter = aCoordinateSystems.begin(); aIter!=aCoordinateSystems.end();++aIter )
+ {
+ if( aIter->second.first != nDimensionIndex )
+ continue;
+ if( aIter->second.second != nAxisIndex )
+ continue;
+ aRet.push_back( aIter->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;
+}
+
+//-----------------------------------------------------
+
+class SeriesPlotterContainer
+{
+public:
+ SeriesPlotterContainer( std::vector< VCoordinateSystem* >& rVCooSysList );
+ ~SeriesPlotterContainer();
+
+ void initializeCooSysAndSeriesPlotter( const uno::Reference< frame::XModel >& xChartModel );
+ void initAxisUsageList();
+ void doAutoScaling( const uno::Reference< frame::XModel >& xChartModel );
+ void updateScalesAndIncrementsOnAxes();
+ void setScalesFromCooSysToPlotter();
+ void setNumberFormatsFromAxes();
+ drawing::Direction3D getPreferredAspectRatio();
+
+ std::vector< VSeriesPlotter* >& getSeriesPlotterList() { return m_aSeriesPlotterList; }
+ std::vector< VCoordinateSystem* >& getCooSysList() { return m_rVCooSysList; }
+ std::vector< LegendEntryProvider* > getLegendEntryProviderList();
+
+ void AdaptScaleOfYAxisWithoutAttachedSeries( const uno::Reference< frame::XModel >& xChartModel );
+
+private:
+ std::vector< VSeriesPlotter* > m_aSeriesPlotterList;
+ std::vector< VCoordinateSystem* >& m_rVCooSysList;
+ ::std::map< uno::Reference< XAxis >, AxisUsage > m_aAxisUsageList;
+ sal_Int32 m_nMaxAxisIndex;
+ bool m_bChartTypeUsesShiftedXAxisTicksPerDefault;
+};
+
+SeriesPlotterContainer::SeriesPlotterContainer( std::vector< VCoordinateSystem* >& rVCooSysList )
+ : m_rVCooSysList( rVCooSysList )
+ , m_nMaxAxisIndex(0)
+ , m_bChartTypeUsesShiftedXAxisTicksPerDefault(false)
+{
+}
+
+SeriesPlotterContainer::~SeriesPlotterContainer()
+{
+ // - remove plotter from coordinatesystems
+ for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
+ m_rVCooSysList[nC]->clearMinimumAndMaximumSupplierList();
+ // - delete all plotter
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = m_aSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = m_aSeriesPlotterList.end();
+ for( aPlotterIter = m_aSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ delete *aPlotterIter;
+ m_aSeriesPlotterList.clear();
+}
+
+std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProviderList()
+{
+ std::vector< LegendEntryProvider* > aRet( m_aSeriesPlotterList.size() );
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = m_aSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = m_aSeriesPlotterList.end();
+ sal_Int32 nN = 0;
+ for( aPlotterIter = m_aSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; ++aPlotterIter, nN++ )
+ aRet[nN] = *aPlotterIter;
+ return aRet;
+}
+
+void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
+ const uno::Reference< frame::XModel >& xChartModel )
+{
+ //------------ get model series from model
+ sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ if( !xDiagram.is())
+ return;
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ if(!nDimensionCount)
+ {
+ //@todo handle mixed dimension
+ nDimensionCount = 2;
+ }
+
+ sal_Bool bSortByXValues = sal_False;
+ sal_Bool bConnectBars = sal_False;
+ sal_Bool bGroupBarsPerAxis = sal_True;
+ sal_Bool bIncludeHiddenCells = sal_True;
+ sal_Int32 nStartingAngle = 90;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
+ xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bSortByXValues;
+ xDiaProp->getPropertyValue( C2U( "ConnectBars" ) ) >>= bConnectBars;
+ xDiaProp->getPropertyValue( C2U( "GroupBarsPerAxis" ) ) >>= bGroupBarsPerAxis;
+ xDiaProp->getPropertyValue( C2U( "IncludeHiddenCells" ) ) >>= bIncludeHiddenCells;
+ xDiaProp->getPropertyValue( C2U( "StartingAngle" ) ) >>= nStartingAngle;
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ //---------------------------------------------------------------------
+ //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,xChartModel);
+
+ //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(nT==0)
+ m_bChartTypeUsesShiftedXAxisTicksPerDefault = ChartTypeHelper::shiftTicksAtXAxisPerDefault( xChartType );
+
+ bool bExcludingPositioning = DiagramPositioningMode_EXCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram );
+ VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount, bExcludingPositioning );
+ if( !pPlotter )
+ continue;
+ m_aSeriesPlotterList.push_back( pPlotter );
+ pPlotter->setNumberFormatsSupplier( xNumberFormatsSupplier );
+ pPlotter->setColorScheme( xColorScheme );
+ pPlotter->setExplicitCategoriesProvider( pVCooSys->getExplicitCategoriesProvider() );
+ sal_Int32 nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment( xDiagram, xChartType );
+
+ if(pVCooSys)
+ pVCooSys->addMinimumAndMaximumSupplier(pPlotter);
+
+ //------------ add series to plotter and thus prepare him for providing minimum and maximum values
+ 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 > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
+ if(!xDataSeries.is())
+ continue;
+ if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) )
+ continue;
+
+ 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 );
+
+ rtl::OUString aSeriesParticle( ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCS, nT, nS ) );
+ pSeries->setParticle(aSeriesParticle);
+
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+ pSeries->setRoleOfSequenceForDataLabelNumberFormatDetection(aRole);
+
+ //ignore secondary axis for charttypes that do not suppoert them
+ if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
+ !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 ) )
+ {
+ 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( pSeries, zSlot, xSlot, ySlot );
+ }
+ }
+ }
+
+ //transport seriesnames to the coordinatesystems if needed
+ if( m_aSeriesPlotterList.size() )
+ {
+ uno::Sequence< rtl::OUString > aSeriesNames;
+ bool bSeriesNamesInitialized = false;
+ for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = m_rVCooSysList[nC];
+ if(!pVCooSys)
+ continue;
+ if( pVCooSys->needSeriesNamesForAxis() )
+ {
+ if(!bSeriesNamesInitialized)
+ {
+ VSeriesPlotter* pSeriesPlotter = m_aSeriesPlotterList[0];
+ if( pSeriesPlotter )
+ aSeriesNames = pSeriesPlotter->getSeriesNames();
+ bSeriesNamesInitialized = true;
+ }
+ pVCooSys->setSeriesNamesForAxis( aSeriesNames );
+ }
+ }
+ }
+}
+
+void SeriesPlotterContainer::initAxisUsageList()
+{
+ m_aAxisUsageList.clear();
+ size_t nC;
+ for( nC=0; nC < m_rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = m_rVCooSysList[nC];
+ for(sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
+ {
+ uno::Reference< XCoordinateSystem > xCooSys = pVCooSys->getModel();
+ if( nDimensionIndex >= xCooSys->getDimension() )
+ continue;
+ const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
+ for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
+ {
+ uno::Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ if(m_aAxisUsageList.find(xAxis)==m_aAxisUsageList.end())
+ m_aAxisUsageList[xAxis].aScaleAutomatism = ScaleAutomatism(xAxis->getScaleData());
+ AxisUsage& rAxisUsage = m_aAxisUsageList[xAxis];
+ rAxisUsage.addCoordinateSystem(pVCooSys,nDimensionIndex,nAxisIndex);
+ }
+ }
+ }
+ }
+
+ ::std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
+ const ::std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
+
+ //init m_nMaxAxisIndex
+ m_nMaxAxisIndex = 0;
+ for(sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
+ {
+ for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ )
+ {
+ sal_Int32 nLocalMax = aAxisIter->second.getMaxAxisIndexForDimension( nDimensionIndex );
+ if( m_nMaxAxisIndex < nLocalMax )
+ m_nMaxAxisIndex = nLocalMax;
+ }
+ }
+}
+
+void SeriesPlotterContainer::setScalesFromCooSysToPlotter()
+{
+ //set scales to plotter to enable them to provide the preferred scene AspectRatio
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = m_aSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = m_aSeriesPlotterList.end();
+ for( aPlotterIter = m_aSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ 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 numberfarmats to plotter to enable them to display the data labels in the numberfromat of teh axis
+
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = m_aSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = m_aSeriesPlotterList.end();
+ for( aPlotterIter = m_aSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( m_rVCooSysList, pSeriesPlotter );
+ if(pVCooSys)
+ {
+ AxesNumberFormats aAxesNumberFormats;
+ 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( C2U( "NumberFormat" ) ) >>= nNumberFormatKey )
+ {
+ aAxesNumberFormats.setFormat( nNumberFormatKey, nDimensionIndex, nAxisIndex );
+ }
+ }
+ }
+ catch( lang::IndexOutOfBoundsException& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ pSeriesPlotter->setAxesNumberFormats( aAxesNumberFormats );
+ }
+ }
+}
+
+void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
+{
+ for( size_t nC=0; nC < m_rVCooSysList.size(); nC++)
+ m_rVCooSysList[nC]->updateScalesAndIncrementsOnAxes();
+}
+
+void SeriesPlotterContainer::doAutoScaling( const uno::Reference< frame::XModel >& xChartModel )
+{
+ //precondition: need a initialized m_aSeriesPlotterList
+ //precondition: need a initialized m_aAxisUsageList
+
+ ::std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
+ const ::std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
+
+ //iterate over the main scales first than secondary axis
+ size_t nC;
+ sal_Int32 nAxisIndex=0;
+ for( nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ )
+ {
+
+ // - first do autoscale for all x and z scales (because they are treated independent)
+ for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ )
+ {
+ AxisUsage& rAxisUsage = (*aAxisIter).second;
+ ::std::vector< VCoordinateSystem* > aVCooSysList_X = rAxisUsage.getCoordinateSystems(0,nAxisIndex);
+ ::std::vector< VCoordinateSystem* > aVCooSysList_Z = rAxisUsage.getCoordinateSystems(2,nAxisIndex);
+
+ for( nC=0; nC < aVCooSysList_X.size(); nC++)
+ aVCooSysList_X[nC]->prepareScaleAutomatismForDimensionAndIndex(rAxisUsage.aScaleAutomatism,0,nAxisIndex);
+ for( nC=0; nC < aVCooSysList_Z.size(); nC++)
+ aVCooSysList_Z[nC]->prepareScaleAutomatismForDimensionAndIndex(rAxisUsage.aScaleAutomatism,2,nAxisIndex);
+
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ rAxisUsage.aScaleAutomatism.calculateExplicitScaleAndIncrement( aExplicitScale, aExplicitIncrement );
+
+ for( nC=0; nC < aVCooSysList_X.size(); nC++)
+ {
+ ExplicitCategoriesProvider* pExplicitCategoriesProvider = aVCooSysList_X[nC]->getExplicitCategoriesProvider();
+
+ if( m_bChartTypeUsesShiftedXAxisTicksPerDefault || (aExplicitScale.AxisType==AxisType::CATEGORY && pExplicitCategoriesProvider && pExplicitCategoriesProvider->hasComplexCategories() ) )
+ aExplicitIncrement.ShiftedPosition = true;
+ aVCooSysList_X[nC]->setExplicitScaleAndIncrement( 0, nAxisIndex, aExplicitScale, aExplicitIncrement );
+ }
+ for( nC=0; nC < aVCooSysList_Z.size(); nC++)
+ aVCooSysList_Z[nC]->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( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ )
+ {
+ AxisUsage& rAxisUsage = (*aAxisIter).second;
+ ::std::vector< VCoordinateSystem* > aVCooSysList_X = rAxisUsage.getCoordinateSystems(0,nAxisIndex);
+ ::std::vector< VCoordinateSystem* > aVCooSysList_Y = rAxisUsage.getCoordinateSystems(1,nAxisIndex);
+ ::std::vector< VCoordinateSystem* > aVCooSysList_Z = rAxisUsage.getCoordinateSystems(2,nAxisIndex);
+
+ if(!aVCooSysList_Y.size())
+ continue;
+
+ for( nC=0; nC < aVCooSysList_Y.size(); nC++)
+ aVCooSysList_Y[nC]->prepareScaleAutomatismForDimensionAndIndex(rAxisUsage.aScaleAutomatism,1,nAxisIndex);
+
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
+ rAxisUsage.aScaleAutomatism.calculateExplicitScaleAndIncrement( aExplicitScale, aExplicitIncrement );
+
+ for( nC=0; nC < aVCooSysList_X.size(); nC++)
+ aVCooSysList_X[nC]->setExplicitScaleAndIncrement( 0, nAxisIndex, aExplicitScale, aExplicitIncrement );
+ for( nC=0; nC < aVCooSysList_Y.size(); nC++)
+ aVCooSysList_Y[nC]->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScale, aExplicitIncrement );
+ for( nC=0; nC < aVCooSysList_Z.size(); nC++)
+ aVCooSysList_Z[nC]->setExplicitScaleAndIncrement( 2, nAxisIndex, aExplicitScale, aExplicitIncrement );
+ }
+ }
+ AdaptScaleOfYAxisWithoutAttachedSeries( xChartModel );
+}
+
+void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno::Reference< frame::XModel >& xChartModel )
+{
+ //issue #i80518#
+
+ ::std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
+ const ::std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
+
+ for( sal_Int32 nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ )
+ {
+ for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ )
+ {
+ AxisUsage& rAxisUsage = (*aAxisIter).second;
+ ::std::vector< VCoordinateSystem* > aVCooSysList_Y = rAxisUsage.getCoordinateSystems( 1, nAxisIndex );
+ if( !aVCooSysList_Y.size() )
+ continue;
+
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ if( xDiagram.is() )
+ {
+ bool bSeriesAttachedToThisAxis = false;
+ sal_Int32 nAttachedAxisIndex = -1;
+ {
+ ::std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ ::std::vector< Reference< XDataSeries > >::const_iterator aIter = aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex( *aIter );
+ if( nAxisIndex == nCurrentIndex )
+ {
+ bSeriesAttachedToThisAxis = true;
+ break;
+ }
+ else if( nAttachedAxisIndex<0 || nAttachedAxisIndex>nCurrentIndex )
+ nAttachedAxisIndex=nCurrentIndex;
+ }
+ }
+
+ if( !bSeriesAttachedToThisAxis && nAttachedAxisIndex >= 0 )
+ {
+ for( size_t nC = 0; nC < aVCooSysList_Y.size(); ++nC )
+ {
+ aVCooSysList_Y[nC]->prepareScaleAutomatismForDimensionAndIndex( rAxisUsage.aScaleAutomatism, 1, nAttachedAxisIndex );
+
+ ExplicitScaleData aExplicitScaleSource = aVCooSysList_Y[nC]->getExplicitScale( 1,nAttachedAxisIndex );
+ ExplicitIncrementData aExplicitIncrementSource = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAttachedAxisIndex );
+
+ ExplicitScaleData aExplicitScaleDest = aVCooSysList_Y[nC]->getExplicitScale( 1,nAxisIndex );;
+ ExplicitIncrementData aExplicitIncrementDest = aVCooSysList_Y[nC]->getExplicitIncrement( 1,nAxisIndex );;
+
+ aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
+ aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
+ aExplicitScaleDest.Breaks = aExplicitScaleSource.Breaks;
+ aExplicitScaleDest.AxisType = aExplicitScaleSource.AxisType;
+
+ aExplicitIncrementDest.BaseValue = aExplicitIncrementSource.BaseValue;
+
+ ScaleData aScale( rAxisUsage.aScaleAutomatism.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.getLength() )
+ bAutoMinorInterval = !( aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() );
+ if( bAutoMinorInterval )
+ {
+ if( aExplicitIncrementDest.SubIncrements.getLength() && aExplicitIncrementSource.SubIncrements.getLength() )
+ aExplicitIncrementDest.SubIncrements[0].IntervalCount =
+ aExplicitIncrementSource.SubIncrements[0].IntervalCount;
+ }
+
+ aVCooSysList_Y[nC]->setExplicitScaleAndIncrement( 1, nAxisIndex, aExplicitScaleDest, aExplicitIncrementDest );
+ }
+ }
+ }
+ }
+ }
+
+ if( AxisHelper::isAxisPositioningEnabled() )
+ {
+ //correct origin for y main axis (the origin is where the other main axis crosses)
+ sal_Int32 nAxisIndex=0;
+ sal_Int32 nDimensionIndex=1;
+ for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ )
+ {
+ AxisUsage& rAxisUsage = (*aAxisIter).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 );
+
+ ::com::sun::star::chart::ChartAxisPosition eCrossingMainAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ if( xCrossingMainAxis.is() )
+ {
+ xCrossingMainAxis->getPropertyValue(C2U( "CrossoverPosition" )) >>= eCrossingMainAxisPos;
+ if( ::com::sun::star::chart::ChartAxisPosition_VALUE == eCrossingMainAxisPos )
+ {
+ double fValue = 0.0;
+ xCrossingMainAxis->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue;
+ aExplicitScale.Origin = fValue;
+ }
+ else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == eCrossingMainAxisPos )
+ aExplicitScale.Origin = 0.0;
+ else if( ::com::sun::star::chart::ChartAxisPosition_START == eCrossingMainAxisPos )
+ aExplicitScale.Origin = aExplicitScale.Minimum;
+ else if( ::com::sun::star::chart::ChartAxisPosition_END == eCrossingMainAxisPos )
+ aExplicitScale.Origin = aExplicitScale.Maximum;
+ }
+
+ aVCooSysList[nC]->setExplicitScaleAndIncrement( nDimensionIndex, nAxisIndex, aExplicitScale, aExplicitIncrement );
+ }
+ }
+ }
+}
+
+drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio()
+{
+ drawing::Direction3D aPreferredAspectRatio(1.0,1.0,1.0);
+
+ sal_Int32 nPlotterCount=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;
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = m_aSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = m_aSeriesPlotterList.end();
+ for( aPlotterIter = m_aSeriesPlotterList.begin(), nPlotterCount=0
+ ; aPlotterIter != aPlotterEnd; aPlotterIter++, nPlotterCount++ )
+ {
+ drawing::Direction3D aSingleRatio( (*aPlotterIter)->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;
+}
+
+//-----------------------------------------------------
+
+namespace
+{
+
+bool lcl_IsPieOrDonut( const uno::Reference< XDiagram >& 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 );
+}
+
+void lcl_setDefaultWritingMode( ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper, const Reference< frame::XModel >& xChartModel )
+{
+ //get writing mode from parent document:
+ if( SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ try
+ {
+ uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
+ sal_Int16 nWritingMode=-1;
+ if ( xChild.is() )
+ {
+ uno::Reference< beans::XPropertySet > xParentProps( xChild->getParent(), uno::UNO_QUERY );
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSupplier( xParentProps, uno::UNO_QUERY );
+ if( xStyleFamiliesSupplier.is() )
+ {
+ uno::Reference< container::XNameAccess > xStylesFamilies( xStyleFamiliesSupplier->getStyleFamilies() );
+ if( xStylesFamilies.is() )
+ {
+ if( !xStylesFamilies->hasByName( C2U("PageStyles") ) )
+ {
+ //draw/impress is parent document
+ uno::Reference< lang::XMultiServiceFactory > xFatcory( xParentProps, uno::UNO_QUERY );
+ if( xFatcory.is() )
+ {
+ uno::Reference< beans::XPropertySet > xDrawDefaults( xFatcory->createInstance( C2U( "com.sun.star.drawing.Defaults" ) ), uno::UNO_QUERY );
+ if( xDrawDefaults.is() )
+ xDrawDefaults->getPropertyValue( C2U("WritingMode") ) >>= nWritingMode;
+ }
+ }
+ else
+ {
+ uno::Reference< container::XNameAccess > xPageStyles( xStylesFamilies->getByName( C2U("PageStyles") ), uno::UNO_QUERY );
+ if( xPageStyles.is() )
+ {
+ rtl::OUString aPageStyle;
+
+ uno::Reference< text::XTextDocument > xTextDocument( xParentProps, uno::UNO_QUERY );
+ if( xTextDocument.is() )
+ {
+ //writer is parent document
+ //retrieve the current page style from the text cursor property PageStyleName
+
+ uno::Reference< text::XTextEmbeddedObjectsSupplier > xTextEmbeddedObjectsSupplier( xTextDocument, uno::UNO_QUERY );
+ if( xTextEmbeddedObjectsSupplier.is() )
+ {
+ uno::Reference< container::XNameAccess > xEmbeddedObjects( xTextEmbeddedObjectsSupplier->getEmbeddedObjects() );
+ if( xEmbeddedObjects.is() )
+ {
+ uno::Sequence< rtl::OUString > aNames( xEmbeddedObjects->getElementNames() );
+
+ sal_Int32 nCount = aNames.getLength();
+ for( sal_Int32 nN=0; nN<nCount; nN++ )
+ {
+ uno::Reference< beans::XPropertySet > xEmbeddedProps( xEmbeddedObjects->getByName( aNames[nN] ), uno::UNO_QUERY );
+ if( xEmbeddedProps.is() )
+ {
+ static rtl::OUString aChartCLSID = rtl::OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName());
+ rtl::OUString aCLSID;
+ xEmbeddedProps->getPropertyValue( C2U("CLSID") ) >>= aCLSID;
+ if( aCLSID.equals(aChartCLSID) )
+ {
+ uno::Reference< frame::XModel > xModel;
+ xEmbeddedProps->getPropertyValue( C2U("Model") ) >>= xModel;
+ if( xModel == xChartModel )
+ {
+ uno::Reference< text::XTextContent > xEmbeddedObject( xEmbeddedProps, uno::UNO_QUERY );
+ if( xEmbeddedObject.is() )
+ {
+ uno::Reference< text::XTextRange > xAnchor( xEmbeddedObject->getAnchor() );
+ if( xAnchor.is() )
+ {
+ uno::Reference< beans::XPropertySet > xAnchorProps( xAnchor, uno::UNO_QUERY );
+ if( xAnchorProps.is() )
+ {
+ xAnchorProps->getPropertyValue( C2U("WritingMode") ) >>= nWritingMode;
+ }
+ uno::Reference< text::XText > xText( xAnchor->getText() );
+ if( xText.is() )
+ {
+ uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
+ if( xTextCursorProps.is() )
+ xTextCursorProps->getPropertyValue( C2U("PageStyleName") ) >>= aPageStyle;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ if( !aPageStyle.getLength() )
+ {
+ uno::Reference< text::XText > xText( xTextDocument->getText() );
+ if( xText.is() )
+ {
+ uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
+ if( xTextCursorProps.is() )
+ xTextCursorProps->getPropertyValue( C2U("PageStyleName") ) >>= aPageStyle;
+ }
+ }
+ }
+ else
+ {
+ //Calc is parent document
+ xParentProps->getPropertyValue( C2U("PageStyle") ) >>= aPageStyle;
+ if(!aPageStyle.getLength())
+ aPageStyle = C2U("Default");
+ }
+ if( nWritingMode == -1 || nWritingMode == text::WritingMode2::PAGE )
+ {
+ uno::Reference< beans::XPropertySet > xPageStyle( xPageStyles->getByName( aPageStyle ), uno::UNO_QUERY );
+ if( xPageStyle.is() )
+ xPageStyle->getPropertyValue( C2U("WritingMode") ) >>= nWritingMode;
+ }
+ }
+ }
+ }
+ }
+ }
+ if( nWritingMode != -1 && nWritingMode != text::WritingMode2::PAGE )
+ {
+ if( pDrawModelWrapper.get() )
+ pDrawModelWrapper->GetItemPool().SetPoolDefaultItem(SfxInt32Item(EE_PARA_WRITINGDIR, nWritingMode) );
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+sal_Int16 lcl_getDefaultWritingModeFromPool( ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper )
+{
+ sal_Int16 nWritingMode = text::WritingMode2::LR_TB;
+ if( pDrawModelWrapper.get() )
+ {
+ const SfxPoolItem* pItem = &(pDrawModelWrapper->GetItemPool().GetDefaultItem( EE_PARA_WRITINGDIR ));
+ if( pItem )
+ nWritingMode = static_cast< sal_Int16 >((static_cast< const SfxInt32Item * >( pItem ))->GetValue());
+ }
+ return nWritingMode;
+}
+
+} //end anonymous namespace
+
+//------------ create complete diagram shape (inclusive axis and series)
+
+awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
+ , const uno::Reference< drawing::XShapes>& xDiagramPlusAxes_Shapes
+ , const awt::Point& rAvailablePos
+ , const awt::Size& rAvailableSize
+ , const awt::Size& rPageSize
+ , bool bUseFixedInnerSize
+ , const uno::Reference< drawing::XShape>& xDiagram_MarkHandles /*needs to be resized to fit the result*/
+ )
+{
+ //return the used rectangle
+ awt::Rectangle aUsedOuterRect( rAvailablePos.X, rAvailablePos.Y, 0, 0 );
+
+// sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ if( !xDiagram.is())
+ return aUsedOuterRect;
+
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ if(!nDimensionCount)
+ {
+ //@todo handle mixed dimension
+ nDimensionCount = 2;
+ }
+
+ ::basegfx::B2IRectangle aAvailableOuterRect( BaseGFXHelper::makeRectangle(rAvailablePos,rAvailableSize) );
+
+ const std::vector< VCoordinateSystem* >& rVCooSysList( rSeriesPlotterContainer.getCooSysList() );
+ const std::vector< VSeriesPlotter* >& rSeriesPlotterList( rSeriesPlotterContainer.getSeriesPlotterList() );
+
+ //create VAxis, so they can give necessary information for automatic scaling
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( m_xChartModel, uno::UNO_QUERY );
+ size_t nC = 0;
+ for( nC=0; nC < rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+ if(3==nDimensionCount)
+ {
+ 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 );
+ }
+ pVCooSys->createVAxisList( xNumberFormatsSupplier
+ , rPageSize //font reference size
+ , BaseGFXHelper::B2IRectangleToAWTRectangle( aAvailableOuterRect ) //maximum space for labels
+ );
+ }
+
+
+ // - prepare list of all axis and how they are used
+ rSeriesPlotterContainer.initAxisUsageList();
+ rSeriesPlotterContainer.doAutoScaling( m_xChartModel );
+ rSeriesPlotterContainer.setScalesFromCooSysToPlotter();
+ rSeriesPlotterContainer.setNumberFormatsFromAxes();
+
+ //---------------------------------------------------------------------
+ //create shapes
+
+ //------------ create diagram shapes
+ //aspect ratio
+ drawing::Direction3D aPreferredAspectRatio(
+ rSeriesPlotterContainer.getPreferredAspectRatio() );
+
+ uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(0);
+ uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(0);
+ VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
+ {//create diagram
+ aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory);
+ aVDiagram.createShapes(rAvailablePos,rAvailableSize);
+ xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
+ if( !bUseFixedInnerSize )
+ aVDiagram.reduceToMimimumSize();
+ }
+
+ uno::Reference< drawing::XShapes > xTextTargetShapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxes_Shapes) );
+
+ // - create axis and grids for all coordinate systems
+
+ //init all coordinate systems
+ for( nC=0; nC < rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+ pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis);
+
+ pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
+
+ pVCooSys->initVAxisInList();
+ }
+
+ //calculate resulting size respecting axis label layout and fontscaling
+
+ uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY );
+ ::basegfx::B2IRectangle aConsumedOuterRect;
+
+ //use first coosys only so far; todo: calculate for more than one coosys if we have more in future
+ //todo: this is just a workaround at the moment for pie and donut labels
+ bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram);
+ if( !bIsPieOrDonut && rVCooSysList.size() > 0 )
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[0];
+ pVCooSys->createMaximumAxesLabels();
+
+ aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) );
+ ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
+ if( !bUseFixedInnerSize )
+ aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
+
+ pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ createTransformationSceneToScreen( aNewInnerRect ) ));
+
+ //redo autoscaling to get size and text dependent automatic main increment count
+ rSeriesPlotterContainer.doAutoScaling( m_xChartModel );
+ rSeriesPlotterContainer.updateScalesAndIncrementsOnAxes();
+ rSeriesPlotterContainer.setScalesFromCooSysToPlotter();
+
+ pVCooSys->createAxesLabels();
+
+ bool bLessSpaceConsumedThanExpected = false;
+ {
+ ::basegfx::B2IRectangle aOldRect( aConsumedOuterRect );
+ 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 && !bUseFixedInnerSize )
+ {
+ 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 neccessary 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++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+
+ pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
+
+ pVCooSys->createAxesShapes();
+ pVCooSys->createGridShapes();
+ }
+
+ // - create data series for all charttypes
+ m_bPointsWereSkipped = false;
+ ::std::vector< VSeriesPlotter* >::const_iterator aPlotterIter = rSeriesPlotterList.begin();
+ const ::std::vector< VSeriesPlotter* >::const_iterator aPlotterEnd = rSeriesPlotterList.end();
+ for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ //------------ set transformation to plotter / create series
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ rtl::OUString aCID; //III
+ uno::Reference< drawing::XShapes > xSeriesTarget(0);
+ if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() )
+ xSeriesTarget = xSeriesTargetInFrontOfAxis;
+ else
+ {
+ xSeriesTarget = xSeriesTargetBehindAxis;
+ DBG_ASSERT( !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,aCID );
+ pSeriesPlotter->setPageReferenceSize( rPageSize );
+ VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
+ if(2==nDimensionCount)
+ pSeriesPlotter->setTransformationSceneToScreen( pVCooSys->getTransformationSceneToScreen() );
+ //better performance for big data
+ awt::Size aCoordinateRegionResolution(1000,1000);
+ {
+ //calculate resolution for coordinate system
+ Sequence<sal_Int32> aCoordinateSystemResolution = pVCooSys->getCoordinateSystemResolution( rPageSize, m_aPageResolution );
+ pSeriesPlotter->setCoordinateSystemResolution( aCoordinateSystemResolution );
+ }
+ //
+ pSeriesPlotter->createShapes();
+ m_bPointsWereSkipped = m_bPointsWereSkipped || pSeriesPlotter->PointsWereSkipped();
+ }
+
+ //recreate all with corrected sizes if requested
+ if( bIsPieOrDonut )
+ {
+ m_bPointsWereSkipped = false;
+
+ aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) );
+ ::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
+ if( !bUseFixedInnerSize )
+ aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
+
+ for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ pSeriesPlotter->releaseShapes();
+ }
+
+ //clear and recreate
+ ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here
+ xSeriesTargetBehindAxis.clear();
+ ShapeFactory::removeSubShapes( xTextTargetShapes );
+
+ //set new transformation
+ for( nC=0; nC < rVCooSysList.size(); nC++)
+ {
+ VCoordinateSystem* pVCooSys = rVCooSysList[nC];
+ pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
+ createTransformationSceneToScreen( aNewInnerRect ) ));
+ }
+
+ // - create data series for all charttypes
+ for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ //------------ set transformation to plotter / create series
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
+ if(2==nDimensionCount)
+ pSeriesPlotter->setTransformationSceneToScreen( pVCooSys->getTransformationSceneToScreen() );
+ pSeriesPlotter->createShapes();
+ m_bPointsWereSkipped = m_bPointsWereSkipped || pSeriesPlotter->PointsWereSkipped();
+ }
+
+ /*
+ uno::Reference< drawing::XShape > xDiagramPlusAxes_KeepRatio( xDiagramPlusAxes_Shapes, uno::UNO_QUERY );
+
+ awt::Size aNewSize( rAvailableSize );
+ awt::Point aNewPos( rAvailablePos );
+ if( bKeepAspectRatio )
+ {
+ awt::Size aCurrentSize( xDiagramPlusAxes_KeepRatio->getSize());
+
+ aNewSize = ShapeFactory::calculateNewSizeRespectingAspectRatio(
+ rAvailableSize, aCurrentSize );
+ aNewPos = ShapeFactory::calculateTopLeftPositionToCenterObject(
+ rAvailablePos, rAvailableSize, aNewSize );
+ }
+
+ xDiagramPlusAxes_KeepRatio->setPosition( aNewPos );
+ xDiagramPlusAxes_KeepRatio->setSize( aNewSize );
+ */
+ for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ pSeriesPlotter->rearrangeLabelToAvoidOverlapIfRequested( rPageSize );
+ }
+ }
+
+ if( bUseFixedInnerSize )
+ {
+ //if( !bIsPieOrDonut )
+ // aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) );
+ aUsedOuterRect = awt::Rectangle( aConsumedOuterRect.getMinX(), aConsumedOuterRect.getMinY(), aConsumedOuterRect.getWidth(), aConsumedOuterRect.getHeight() );
+ }
+ else
+ aUsedOuterRect = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height );
+
+ bool bSnapRectToUsedArea = false;
+ for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; aPlotterIter++ )
+ {
+ VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
+ bSnapRectToUsedArea = pSeriesPlotter->shouldSnapRectToUsedArea();
+ if(bSnapRectToUsedArea)
+ break;
+ }
+ if(bSnapRectToUsedArea)
+ {
+ if( bUseFixedInnerSize )
+ m_aResultingDiagramRectangleExcludingAxes = getRectangleOfObject( C2U("PlotAreaExcludingAxes") );
+ else
+ {
+ ::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle();
+ m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() );
+ }
+ }
+ else
+ {
+ if( bUseFixedInnerSize )
+ m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height );
+ else
+ {
+ ::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle();
+ m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( aConsumedInnerRect.getMinX(), aConsumedInnerRect.getMinY(), aConsumedInnerRect.getWidth(), aConsumedInnerRect.getHeight() );
+ }
+ }
+
+ if( xDiagram_MarkHandles.is() )
+ {
+ awt::Point aPos(rAvailablePos);
+ awt::Size aSize(rAvailableSize);
+ bool bPosSizeExcludeAxesProperty = true;
+ uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW );
+ if( xDiaProps.is() )
+ xDiaProps->getPropertyValue(C2U("PosSizeExcludeAxes")) >>= bPosSizeExcludeAxesProperty;
+ if( bUseFixedInnerSize || bPosSizeExcludeAxesProperty )
+ {
+ aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y );
+ aSize = awt::Size( m_aResultingDiagramRectangleExcludingAxes.Width, m_aResultingDiagramRectangleExcludingAxes.Height );
+ }
+ xDiagram_MarkHandles->setPosition( aPos );
+ xDiagram_MarkHandles->setSize( aSize );
+ }
+
+ return aUsedOuterRect;
+}
+
+//-------------------------------------------------------------
+//-------------------------------------------------------------
+//-------------------------------------------------------------
+
+sal_Bool ChartView::getExplicitValuesForAxis(
+ uno::Reference< XAxis > xAxis
+ , ExplicitScaleData& rExplicitScale
+ , ExplicitIncrementData& rExplicitIncrement )
+{
+ impl_updateView();
+
+ if(!xAxis.is())
+ return sal_False;
+
+ uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(xAxis,ChartModelHelper::findDiagram( m_xChartModel ) ) );
+ const VCoordinateSystem* pVCooSys = findInCooSysList(m_aVCooSysList,xCooSys);
+ if(!pVCooSys)
+ return sal_False;
+
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
+ {
+ rExplicitScale = pVCooSys->getExplicitScale(nDimensionIndex,nAxisIndex);
+ rExplicitIncrement = pVCooSys->getExplicitIncrement(nDimensionIndex,nAxisIndex);
+ return sal_True;
+ }
+ return sal_False;
+}
+
+SdrPage* ChartView::getSdrPage()
+{
+ SdrPage* pPage=0;
+ Reference< lang::XUnoTunnel> xUnoTunnel(m_xDrawPage,uno::UNO_QUERY);
+ if(xUnoTunnel.is())
+ {
+ SvxDrawPage* pSvxDrawPage = reinterpret_cast<SvxDrawPage*>(xUnoTunnel->getSomething(
+ SvxDrawPage::getUnoTunnelId() ));
+ if(pSvxDrawPage)
+ {
+ pPage = pSvxDrawPage->GetSdrPage();
+ }
+ }
+ return pPage;
+}
+
+uno::Reference< drawing::XShape > ChartView::getShapeForCID( const rtl::OUString& rObjectCID )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SdrObject* pObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, this->getSdrPage() );
+ if( pObj )
+ return uno::Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY);
+ return 0;
+}
+
+awt::Rectangle ChartView::getDiagramRectangleExcludingAxes()
+{
+ impl_updateView();
+ return m_aResultingDiagramRectangleExcludingAxes;
+}
+
+awt::Rectangle ChartView::getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect )
+{
+ impl_updateView();
+
+ awt::Rectangle aRet;
+ uno::Reference< drawing::XShape > xShape( getShapeForCID(rObjectCID) );
+ if(xShape.is())
+ {
+ //special handling for axis for old api:
+ //same special handling for diagram
+ ObjectType eObjectType( ObjectIdentifier::getObjectType( rObjectCID ) );
+ if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_DIAGRAM )
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ SvxShape* pRoot = SvxShape::getImplementation( xShape );
+ if( pRoot )
+ {
+ SdrObject* pRootSdrObject = pRoot->GetSdrObject();
+ if( pRootSdrObject )
+ {
+ SdrObjList* pRootList = pRootSdrObject->GetSubList();
+ if( pRootList )
+ {
+ OUString aShapeName = C2U("MarkHandles");
+ if( eObjectType == OBJECTTYPE_DIAGRAM )
+ aShapeName = C2U("PlotAreaIncludingAxes");
+ SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList );
+ if( pShape )
+ xShape = uno::Reference< drawing::XShape >( pShape->getUnoShape(), uno::UNO_QUERY);
+ }
+ }
+ }
+ }
+
+ awt::Size aSize( xShape->getSize() );
+ awt::Point aPoint( xShape->getPosition() );
+ aRet = awt::Rectangle( aPoint.X, aPoint.Y, aSize.Width, aSize.Height );
+ if( bSnapRect )
+ {
+ //for rotated objects the shape size and position differs from the visible rectangle
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if( pShape )
+ {
+ SdrObject* pSdrObject = pShape->GetSdrObject();
+ if( pSdrObject )
+ {
+ Rectangle aSnapRect( pSdrObject->GetSnapRect() );
+ aRet = awt::Rectangle(aSnapRect.Left(),aSnapRect.Top(),aSnapRect.GetWidth(),aSnapRect.GetHeight());
+ }
+ }
+ }
+ }
+ return aRet;
+}
+
+::boost::shared_ptr< DrawModelWrapper > ChartView::getDrawModelWrapper()
+{
+ return m_pDrawModelWrapper;
+}
+
+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.getLength() )
+ {
+ uno::Reference<beans::XPropertySet> xProp(aCooSysList[0], uno::UNO_QUERY );
+ if( xProp.is()) try
+ {
+ xProp->getPropertyValue( C2U( "SwapXAndYAxis" ) ) >>= bSwapXAndY;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ return bSwapXAndY;
+}
+
+}
+
+sal_Int32 lcl_getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , bool bSearchForParallelAxisIfNothingIsFound )
+{
+ sal_Int32 nNumberFormatKey(0);
+ Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is() && !( xProp->getPropertyValue( C2U( "NumberFormat" ) ) >>= nNumberFormatKey ) )
+ {
+ bool bPercentFormatSet = false;
+ //check wether we have a percent scale -> use percent format
+ if( xNumberFormatsSupplier.is() )
+ {
+ ScaleData aData = xAxis->getScaleData();
+ if( aData.AxisType==AxisType::PERCENT )
+ {
+ sal_Int32 nPercentFormat = ExplicitValueProvider::getPercentNumberFormat( xNumberFormatsSupplier );
+ if( nPercentFormat != -1 )
+ {
+ nNumberFormatKey = nPercentFormat;
+ bPercentFormatSet = true;
+ }
+ }
+ }
+
+ if( !bPercentFormatSet )
+ {
+ typedef ::std::map< sal_Int32, sal_Int32 > tNumberformatFrequency;
+ tNumberformatFrequency aKeyMap;
+
+ bool bNumberFormatKeyFoundViaAttachedData = false;
+ sal_Int32 nAxisIndex = 0;
+ sal_Int32 nDimensionIndex = 1;
+
+ try
+ {
+ Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW );
+ if( xCTCnt.is() )
+ {
+ AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
+ ::rtl::OUString aRoleToMatch;
+ if( nDimensionIndex == 0 )
+ aRoleToMatch = C2U("values-x");
+ Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ if( nDimensionIndex != 0 )
+ aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
+ Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
+ {
+ Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]);
+ Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
+
+ if( nDimensionIndex == 1 )
+ {
+ //only take those series into accoutn that are attached to this axis
+ sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ if( nAttachedAxisIndex != nAxisIndex )
+ continue;
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences());
+ for( sal_Int32 nLSeqIdx=0; nLSeqIdx<aLabeledSeq.getLength(); ++nLSeqIdx )
+ {
+ if(!aLabeledSeq[nLSeqIdx].is())
+ continue;
+ Reference< data::XDataSequence > xSeq( aLabeledSeq[nLSeqIdx]->getValues());
+ if(!xSeq.is())
+ continue;
+ Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
+ ::rtl::OUString aRole;
+ bool bTakeIntoAccount =
+ ( xSeqProp.is() && (aRoleToMatch.getLength() > 0) &&
+ (xSeqProp->getPropertyValue(C2U("Role")) >>= aRole ) &&
+ aRole.equals( aRoleToMatch ));
+
+ if( bTakeIntoAccount )
+ {
+ sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
+ // initialize the value
+ if( aKeyMap.find( nKey ) == aKeyMap.end())
+ aKeyMap[ nKey ] = 0;
+ // increase frequency
+ aKeyMap[ nKey ] = (aKeyMap[ nKey ] + 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( ! aKeyMap.empty())
+ {
+ sal_Int32 nMaxFreq = 0;
+ // find most frequent key
+ for( tNumberformatFrequency::const_iterator aIt = aKeyMap.begin();
+ aIt != aKeyMap.end(); ++aIt )
+ {
+ OSL_TRACE( "NumberFormatKey %d appears %d times", (*aIt).first, (*aIt).second );
+ // all values must at least be 1
+ if( (*aIt).second > nMaxFreq )
+ {
+ nNumberFormatKey = (*aIt).first;
+ bNumberFormatKeyFoundViaAttachedData = true;
+ nMaxFreq = (*aIt).second;
+ }
+ }
+ }
+
+ if( bSearchForParallelAxisIfNothingIsFound )
+ {
+ //no format is set to this axis and no data is set to this axis
+ //--> try to obtain the format from the parallel y-axis
+ if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
+ {
+ sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
+ Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) );
+ nNumberFormatKey = lcl_getExplicitNumberFormatKeyForAxis( xParallelAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier, false );
+ }
+ }
+ }
+ }
+ return nNumberFormatKey;
+}
+
+//static
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ return lcl_getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier
+ , true /*bSearchForParallelAxisIfNothingIsFound*/ );
+}
+
+//static
+sal_Int32 ExplicitValueProvider::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ sal_Int32 nRet=-1;
+ Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() );
+ if( xNumberFormats.is() )
+ {
+ sal_Bool bCreate = sal_True;
+ const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
+ Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT,
+ rLocaleDataWrapper.getLocale(), bCreate );
+ if( aKeySeq.getLength() )
+ {
+ nRet = aKeySeq[0];
+ }
+ }
+ return nRet;
+}
+
+
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
+ const uno::Reference< XDataSeries >& xSeries,
+ sal_Int32 nPointIndex /*-1 for whole series*/,
+ const uno::Reference< XDiagram >& xDiagram
+ )
+{
+ sal_Int32 nFormat=0;
+ if( !xSeriesOrPointProp.is() )
+ return nFormat;
+
+ rtl::OUString aPropName( C2U( "NumberFormat" ) );
+ if( !(xSeriesOrPointProp->getPropertyValue(aPropName) >>= nFormat) )
+ {
+ uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
+
+ bool bFormatFound = false;
+ if( ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( xChartType ) )
+ {
+ uno::Reference< beans::XPropertySet > xAttachedAxisProps( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY );
+ if( xAttachedAxisProps.is() && ( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
+ bFormatFound = true;
+ }
+ if( !bFormatFound )
+ {
+ Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY );
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+
+ Reference< data::XLabeledDataSequence > xLabeledSequence(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole, false ));
+ if( xLabeledSequence.is() )
+ {
+ Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex );
+ }
+ }
+ }
+ 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(C2U( "PercentageNumberFormat" )) >>= nFormat) )
+ {
+ nFormat = ExplicitValueProvider::getPercentNumberFormat( xNumberFormatsSupplier );
+ }
+ if(nFormat<0)
+ nFormat=0;
+ return nFormat;
+}
+
+//static
+awt::Rectangle ExplicitValueProvider::addAxisTitleSizes(
+ const Reference< frame::XModel >& xChartModel
+ , const Reference< uno::XInterface >& xChartView
+ , const awt::Rectangle& rExcludingPositionAndSize )
+{
+ awt::Rectangle aRet(rExcludingPositionAndSize);
+
+ //add axis title sizes to the diagram size
+ uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xChartModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xChartModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xChartModel ) );
+ if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() )
+ {
+ ExplicitValueProvider* pExplicitValueProvider = ExplicitValueProvider::getExplicitValueProvider(xChartView);
+ if( pExplicitValueProvider )
+ {
+ //detect wether x axis points into x direction or not
+ if( lcl_getPropertySwapXAndYAxis( ChartModelHelper::findDiagram( xChartModel ) ) )
+ {
+ 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() )
+ {
+ rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, xChartModel ) );
+ nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
+ if( nTitleSpaceHeight )
+ nTitleSpaceHeight+=lcl_getDiagramTitleSpace();
+ }
+ if( xTitle_Width.is() )
+ {
+ rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, xChartModel ) );
+ nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
+ if(nTitleSpaceWidth)
+ nTitleSpaceWidth+=lcl_getDiagramTitleSpace();
+ }
+ if( xSecondTitle_Height.is() )
+ {
+ rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, xChartModel ) );
+ nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
+ if( nSecondTitleSpaceHeight )
+ nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace();
+ }
+ if( xSecondTitle_Width.is() )
+ {
+ rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, xChartModel ) );
+ nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
+ if( nSecondTitleSpaceWidth )
+ nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace();
+ }
+
+ aRet.X -= nTitleSpaceWidth;
+ aRet.Y -= nSecondTitleSpaceHeight;
+ aRet.Width += nTitleSpaceWidth + nSecondTitleSpaceWidth;
+ aRet.Height += nTitleSpaceHeight + nSecondTitleSpaceHeight;
+ }
+ }
+ return aRet;
+}
+
+//static
+awt::Rectangle ExplicitValueProvider::substractAxisTitleSizes(
+ const Reference< frame::XModel >& xChartModel
+ , const Reference< uno::XInterface >& xChartView
+ , const awt::Rectangle& rPositionAndSizeIncludingTitles )
+{
+ awt::Rectangle aRet(rPositionAndSizeIncludingTitles);
+
+ //add axis title sizes to the diagram size
+ uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xChartModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xChartModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xChartModel ) );
+ if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() )
+ {
+ ExplicitValueProvider* pExplicitValueProvider = ExplicitValueProvider::getExplicitValueProvider(xChartView);
+ if( pExplicitValueProvider )
+ {
+ //detect wether x axis points into x direction or not
+ if( lcl_getPropertySwapXAndYAxis( ChartModelHelper::findDiagram( xChartModel ) ) )
+ {
+ 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() )
+ {
+ rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, xChartModel ) );
+ nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
+ if( nTitleSpaceHeight )
+ nTitleSpaceHeight+=lcl_getDiagramTitleSpace();
+ }
+ if( xTitle_Width.is() )
+ {
+ rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, xChartModel ) );
+ nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
+ if(nTitleSpaceWidth)
+ nTitleSpaceWidth+=lcl_getDiagramTitleSpace();
+ }
+ if( xSecondTitle_Height.is() )
+ {
+ rtl::OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, xChartModel ) );
+ nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
+ if( nSecondTitleSpaceHeight )
+ nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace();
+ }
+ if( xSecondTitle_Width.is() )
+ {
+ rtl::OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, xChartModel ) );
+ nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
+ if( nSecondTitleSpaceWidth )
+ nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace();
+ }
+
+ aRet.X += nTitleSpaceWidth;
+ aRet.Y += nSecondTitleSpaceHeight;
+ aRet.Width -= (nTitleSpaceWidth + nSecondTitleSpaceWidth);
+ aRet.Height -= (nTitleSpaceHeight + nSecondTitleSpaceHeight);
+ }
+ }
+ return aRet;
+}
+
+double lcl_getPageLayoutDistancePercentage()
+{
+ return 0.02;
+}
+
+bool getAvailablePosAndSizeForDiagram(
+ awt::Point& rOutPos, awt::Size& rOutAvailableDiagramSize
+ , const awt::Rectangle& rSpaceLeft
+ , const awt::Size & rPageSize
+ , const uno::Reference< XDiagram > & xDiagram
+ , bool& bUseFixedInnerSize )
+{
+ bUseFixedInnerSize = false;
+
+ //@todo: we need a size dependent on the axis labels
+ awt::Rectangle aRemainingSpace(rSpaceLeft);
+ {
+ sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
+ sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
+ aRemainingSpace.X+=nXDistance;
+ aRemainingSpace.Width-=2*nXDistance;
+ aRemainingSpace.Y+=nYDistance;
+ aRemainingSpace.Height-=2*nYDistance;
+ }
+ if(aRemainingSpace.Width <= 0 || aRemainingSpace.Height <= 0 )
+ return false;
+
+ uno::Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY);
+
+ bool bPosSizeExcludeAxes = false;
+ if( xProp.is() )
+ xProp->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes;
+
+ //size:
+ ::com::sun::star::chart2::RelativeSize aRelativeSize;
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "RelativeSize" ) )>>=aRelativeSize) )
+ {
+ rOutAvailableDiagramSize.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*rPageSize.Height);
+ rOutAvailableDiagramSize.Width = static_cast<sal_Int32>(aRelativeSize.Primary*rPageSize.Width);
+ bUseFixedInnerSize = bPosSizeExcludeAxes;
+ }
+ else
+ rOutAvailableDiagramSize = awt::Size(aRemainingSpace.Width,aRemainingSpace.Height);
+
+ //position:
+ chart2::RelativePosition aRelativePosition;
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "RelativePosition" ) )>>=aRelativePosition) )
+ {
+ //@todo decide wether x is primary or secondary
+
+ //the coordinates re relative to the page
+ double fX = aRelativePosition.Primary*rPageSize.Width;
+ double fY = aRelativePosition.Secondary*rPageSize.Height;
+
+ rOutPos = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY))
+ , rOutAvailableDiagramSize, aRelativePosition.Anchor );
+ bUseFixedInnerSize = bPosSizeExcludeAxes;
+ }
+ else
+ rOutPos = awt::Point(aRemainingSpace.X,aRemainingSpace.Y);
+
+ //ensure that the diagram does not lap out right side or out of bottom
+ {
+ if( rOutPos.Y + rOutAvailableDiagramSize.Height > rPageSize.Height )
+ rOutAvailableDiagramSize.Height = rPageSize.Height - rOutPos.Y;
+ if( rOutPos.X + rOutAvailableDiagramSize.Width > rPageSize.Width )
+ rOutAvailableDiagramSize.Width = rPageSize.Width - rOutPos.X;
+ }
+
+ return true;
+}
+
+enum TitleAlignment { ALIGN_LEFT, ALIGN_TOP, ALIGN_RIGHT, ALIGN_BOTTOM, ALIGN_Z };
+
+void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
+ , awt::Rectangle& rDiagramPlusAxesRect, const awt::Size & rPageSize )
+{
+ if(!pVTitle)
+ return;
+
+ 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 )
+ {
+ case ALIGN_TOP:
+ aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width/2
+ , rDiagramPlusAxesRect.Y - aTitleSize.Height/2 - nYDistance );
+ break;
+ case ALIGN_BOTTOM:
+ aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width/2
+ , rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height + aTitleSize.Height/2 + nYDistance );
+ break;
+ case ALIGN_LEFT:
+ aNewPosition = awt::Point( rDiagramPlusAxesRect.X - aTitleSize.Width/2 - nXDistance
+ , rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height/2 );
+ break;
+ case ALIGN_RIGHT:
+ aNewPosition = awt::Point( rDiagramPlusAxesRect.X + rDiagramPlusAxesRect.Width + aTitleSize.Width/2 + nXDistance
+ , rDiagramPlusAxesRect.Y + rDiagramPlusAxesRect.Height/2 );
+ break;
+ case 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;
+ sal_Int32 nMaxX = rPageSize.Width - aTitleSize.Width/2;
+ sal_Int32 nMinX = aTitleSize.Width/2;
+ sal_Int32 nMinY = aTitleSize.Height/2;
+ if( aNewPosition.Y > nMaxY )
+ aNewPosition.Y = nMaxY;
+ if( aNewPosition.X > nMaxX )
+ aNewPosition.X = nMaxX;
+ if( aNewPosition.Y < nMinY )
+ aNewPosition.Y = nMinY;
+ if( aNewPosition.X < nMinX )
+ aNewPosition.X = nMinX;
+
+ pVTitle->changePosition( aNewPosition );
+}
+
+std::auto_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
+ , const uno::Reference< drawing::XShapes>& xPageShapes
+ , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const uno::Reference< frame::XModel >& xChartModel
+ , awt::Rectangle& rRemainingSpace
+ , const awt::Size & rPageSize
+ , TitleAlignment eAlignment
+ , bool& rbAutoPosition )
+{
+ std::auto_ptr<VTitle> apVTitle;
+
+ // #i109336# Improve auto positioning in chart
+ double fPercentage = lcl_getPageLayoutDistancePercentage();
+ 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 )
+ {
+ sal_Int32 nYOffset = 135; // 1/100 mm
+ nYDistance += nYOffset;
+ }
+ else if ( eType == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION )
+ {
+ sal_Int32 nYOffset = 420; // 1/100 mm
+ nYDistance = nYOffset;
+ }
+ else if ( eType == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
+ {
+ sal_Int32 nXOffset = 450; // 1/100 mm
+ nXDistance = nXOffset;
+ }
+
+ uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, xChartModel ) );
+ if(xTitle.is())
+ {
+ rtl::OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) );
+ if ( aCompleteString.getLength() == 0 )
+ return apVTitle;//don't create empty titles as the resulting diagram position is wrong then
+
+ //create title
+ apVTitle = std::auto_ptr<VTitle>(new VTitle(xTitle));
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, xChartModel ) );
+ apVTitle->init(xPageShapes,xShapeFactory,aCID);
+ apVTitle->createShapes( awt::Point(0,0), rPageSize );
+ awt::Size aTitleUnrotatedSize = apVTitle->getUnrotatedSize();
+ awt::Size aTitleSize = apVTitle->getFinalSize();
+
+ //position
+ rbAutoPosition=true;
+ awt::Point aNewPosition(0,0);
+ chart2::RelativePosition aRelativePosition;
+ uno::Reference< beans::XPropertySet > xProp(xTitle, uno::UNO_QUERY);
+ if( xProp.is() && (xProp->getPropertyValue( C2U( "RelativePosition" ) )>>=aRelativePosition) )
+ {
+ rbAutoPosition = false;
+
+ //@todo decide wether x is primary or secondary
+ double fX = aRelativePosition.Primary*rPageSize.Width;
+ double fY = aRelativePosition.Secondary*rPageSize.Height;
+
+ double fAnglePi = apVTitle->getRotationAnglePi();
+ aNewPosition = RelativePositionHelper::getCenterOfAnchoredObject(
+ awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY))
+ , aTitleUnrotatedSize, aRelativePosition.Anchor, fAnglePi );
+ }
+ else //auto position
+ {
+ switch( eAlignment )
+ {
+ case ALIGN_TOP:
+ aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width/2
+ , rRemainingSpace.Y + aTitleSize.Height/2 + nYDistance );
+ break;
+ case ALIGN_BOTTOM:
+ aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width/2
+ , rRemainingSpace.Y + rRemainingSpace.Height - aTitleSize.Height/2 - nYDistance );
+ break;
+ case ALIGN_LEFT:
+ aNewPosition = awt::Point( rRemainingSpace.X + aTitleSize.Width/2 + nXDistance
+ , rRemainingSpace.Y + rRemainingSpace.Height/2 );
+ break;
+ case ALIGN_RIGHT:
+ aNewPosition = awt::Point( rRemainingSpace.X + rRemainingSpace.Width - aTitleSize.Width/2 - nXDistance
+ , rRemainingSpace.Y + rRemainingSpace.Height/2 );
+ break;
+ default:
+ break;
+
+ }
+ }
+ apVTitle->changePosition( aNewPosition );
+
+ //remaining space
+ switch( eAlignment )
+ {
+ case ALIGN_TOP:
+ rRemainingSpace.Y += ( aTitleSize.Height + nYDistance );
+ rRemainingSpace.Height -= ( aTitleSize.Height + nYDistance );
+ break;
+ case ALIGN_BOTTOM:
+ rRemainingSpace.Height -= ( aTitleSize.Height + nYDistance );
+ break;
+ case ALIGN_LEFT:
+ rRemainingSpace.X += ( aTitleSize.Width + nXDistance );
+ rRemainingSpace.Width -= ( aTitleSize.Width + nXDistance );
+ break;
+ case ALIGN_RIGHT:
+ rRemainingSpace.Width -= ( aTitleSize.Width + nXDistance );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // #i109336# Improve auto positioning in chart
+ switch ( eAlignment )
+ {
+ case ALIGN_TOP:
+ {
+ rRemainingSpace.Y += nYDistance;
+ rRemainingSpace.Height -= nYDistance;
+ }
+ break;
+ case ALIGN_BOTTOM:
+ {
+ rRemainingSpace.Height -= nYDistance;
+ }
+ break;
+ case ALIGN_LEFT:
+ {
+ rRemainingSpace.X += nXDistance;
+ rRemainingSpace.Width -= nXDistance;
+ }
+ break;
+ case ALIGN_RIGHT:
+ {
+ rRemainingSpace.Width -= nXDistance;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return apVTitle;
+}
+
+bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
+ , const uno::Reference< drawing::XShapes>& xPageShapes
+ , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const uno::Reference< uno::XComponentContext > & xContext
+ , awt::Rectangle & rRemainingSpace
+ , const awt::Size & rPageSize
+ , const uno::Reference< frame::XModel > & xModel
+ , const std::vector< LegendEntryProvider* >& rLegendEntryProviderList
+ , sal_Int16 nDefaultWritingMode )
+{
+ if( VLegend::isVisible( xLegend ))
+ {
+ VLegend aVLegend( xLegend, xContext, rLegendEntryProviderList );
+ aVLegend.init( xPageShapes, xShapeFactory, xModel );
+ aVLegend.setDefaultWritingMode( nDefaultWritingMode );
+ aVLegend.createShapes( awt::Size( rRemainingSpace.Width, rRemainingSpace.Height ),
+ rPageSize );
+ aVLegend.changePosition( rRemainingSpace, rPageSize );
+ return true;
+ }
+ return false;
+}
+
+void formatPage(
+ const uno::Reference< frame::XModel > & xModel
+ , const awt::Size rPageSize
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ )
+{
+ try
+ {
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ OSL_ASSERT( xChartDoc.is());
+ if( ! xChartDoc.is())
+ return;
+ uno::Reference< beans::XPropertySet > xModelPage( xChartDoc->getPageBackground());
+ if( ! xModelPage.is())
+ return;
+
+
+ if( !xShapeFactory.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xPageProp;
+ // create a shape for the background
+ {
+ uno::Reference< drawing::XShape > xShape(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY );
+ if( xTarget.is() &&
+ xShape.is())
+ {
+ xTarget->add( xShape );
+ xShape->setSize( rPageSize );
+ xPageProp.set( xShape, uno::UNO_QUERY );
+ if( xPageProp.is())
+ {
+ xPageProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ));
+ }
+ }
+ }
+
+ //format page
+ if( xPageProp.is())
+ {
+ tPropertyNameValueMap aNameValueMap;
+ PropertyMapper::getValueMap( aNameValueMap, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xModelPage );
+
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) );
+ aNameValueMap.insert( tPropertyNameValueMap::value_type( C2U("Name"), uno::makeAny( aCID ) ) ); //CID rtl::OUString
+
+ tNameSequence aNames;
+ tAnySequence aValues;
+ PropertyMapper::getMultiPropertyListsFromValueMap( aNames, aValues, aNameValueMap );
+ PropertyMapper::setMultiProperties( aNames, aValues, xPageProp );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void lcl_removeEmptyGroupShapes( const Reference< drawing::XShapes>& xParent )
+{
+ if(!xParent.is())
+ 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--; )
+ {
+ uno::Any aAny = xParent->getByIndex( nN );
+ Reference< drawing::XShapes> xShapes(0);
+ if( aAny >>= xShapes )
+ lcl_removeEmptyGroupShapes( xShapes );
+ if( xShapes.is() && xShapes->getCount()==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 );
+ }
+ }
+}
+
+bool ChartView::impl_AddInDrawsAllByItself()
+{
+ bool bRet = false;
+ /*
+ uno::Reference< beans::XPropertySet > xProp( m_xChartModel, uno::UNO_QUERY );
+ if( xProp.is()) try
+ {
+ uno::Reference< util::XRefreshable > xAddIn;
+ xProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn;
+ if( xAddIn.is() )
+ {
+ rtl::OUString aBaseDiagram;
+ xProp->getPropertyValue( C2U( "BaseDiagram" ) ) >>= aBaseDiagram;
+ if(aBaseDiagram.getLength())
+ bRet = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ */
+ return bRet;
+}
+
+void ChartView::impl_refreshAddIn()
+{
+ if( !m_bRefreshAddIn )
+ return;
+
+ uno::Reference< beans::XPropertySet > xProp( m_xChartModel, uno::UNO_QUERY );
+ if( xProp.is()) try
+ {
+ uno::Reference< util::XRefreshable > xAddIn;
+ xProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn;
+ if( xAddIn.is() )
+ {
+ sal_Bool bRefreshAddInAllowed = sal_True;
+ xProp->getPropertyValue( C2U( "RefreshAddInAllowed" ) ) >>= bRefreshAddInAllowed;
+ if( bRefreshAddInAllowed )
+ xAddIn->refresh();
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartView::createShapes()
+{
+#if OSL_DEBUG_LEVEL > 0
+ clock_t nStart = clock();
+ OSL_TRACE( "\nPPPPPPPPP>>>>>>>>>>>> chart view :: createShapes()" );
+#endif
+
+ //make sure add-in is refreshed after creating the shapes
+ const ::comphelper::ScopeGuard aGuard( boost::bind( &ChartView::impl_refreshAddIn, this ) );
+ if( impl_AddInDrawsAllByItself() )
+ return;
+
+ m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle(0,0,0,0);
+ impl_deleteCoordinateSystems();
+ if( m_pDrawModelWrapper )
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ // #i12587# support for shapes in chart
+ m_pDrawModelWrapper->getSdrModel().EnableUndo( FALSE );
+ m_pDrawModelWrapper->clearMainDrawPage();
+ // \--
+ }
+
+ lcl_setDefaultWritingMode( m_pDrawModelWrapper, m_xChartModel );
+
+ awt::Size aPageSize = ChartModelHelper::getPageSize( m_xChartModel );
+
+ uno::Reference<drawing::XShapes> xPageShapes( ShapeFactory(m_xShapeFactory)
+ .getOrCreateChartRootShape( m_xDrawPage ) );
+
+ SdrPage* pPage = ChartView::getSdrPage();
+ if(pPage) //it is neccessary to use the implementation here as the uno page does not provide a propertyset
+ pPage->SetSize(Size(aPageSize.Width,aPageSize.Height));
+ else
+ {
+ DBG_ERROR("could not set page size correctly");
+ }
+
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+
+ //------------ apply fill properties to page
+ // todo: it would be nicer to just pass the page m_xDrawPage and format it,
+ // but the draw page does not support XPropertySet
+ formatPage( m_xChartModel, aPageSize, xPageShapes, m_xShapeFactory );
+
+ //sal_Int32 nYDistance = static_cast<sal_Int32>(aPageSize.Height*lcl_getPageLayoutDistancePercentage());
+ awt::Rectangle aRemainingSpace( 0, 0, aPageSize.Width, aPageSize.Height );
+
+ //create the group shape for diagram and axes first to have title and legends on top of it
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ rtl::OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) ) );//todo: other index if more than one diagram is possible
+ uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xPageShapes,aDiagramCID) );
+
+ uno::Reference< drawing::XShape > xDiagram_MarkHandles( ShapeFactory(m_xShapeFactory).createInvisibleRectangle(
+ xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
+ ShapeFactory::setShapeName( xDiagram_MarkHandles, C2U("MarkHandles") );
+
+ uno::Reference< drawing::XShape > xDiagram_OuterRect( ShapeFactory(m_xShapeFactory).createInvisibleRectangle(
+ xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
+ ShapeFactory::setShapeName( xDiagram_OuterRect, C2U("PlotAreaIncludingAxes") );
+
+ uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( ShapeFactory(m_xShapeFactory).createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) );
+
+ //------------ create some titles
+ std::auto_ptr<VTitle> apVTitle(0);
+ bool bAutoPositionDummy = true;
+
+ //------------ create main title shape
+ lcl_createTitle( TitleHelper::MAIN_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ //------------ create sub title shape
+ lcl_createTitle( TitleHelper::SUB_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+
+ //------------ prepare series to give input to the legend (create categories and symbols etc.)
+ SeriesPlotterContainer aSeriesPlotterContainer( m_aVCooSysList );
+ aSeriesPlotterContainer.initializeCooSysAndSeriesPlotter( m_xChartModel );
+
+ //------------ create legend
+ lcl_createLegend( LegendHelper::getLegend( m_xChartModel ), xPageShapes, m_xShapeFactory, m_xCC
+ , aRemainingSpace, aPageSize, m_xChartModel, aSeriesPlotterContainer.getLegendEntryProviderList()
+ , lcl_getDefaultWritingModeFromPool( m_pDrawModelWrapper ) );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ sal_Int32 nDimension = DiagramHelper::getDimension( xDiagram );
+
+ //------------ create x axis title
+ bool bAutoPosition_XTitle = true;
+ std::auto_ptr<VTitle> apVTitle_X;
+ if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) )
+ apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, ALIGN_BOTTOM, bAutoPosition_XTitle );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ //------------ create y axis title
+ bool bAutoPosition_YTitle = true;
+ std::auto_ptr<VTitle> apVTitle_Y;
+ if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) )
+ apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, ALIGN_LEFT, bAutoPosition_YTitle );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ //------------ create z axis title
+ bool bAutoPosition_ZTitle = true;
+ std::auto_ptr<VTitle> apVTitle_Z;
+ if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) )
+ apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, ALIGN_RIGHT, bAutoPosition_ZTitle );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ bool bDummy = false;
+ bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy );
+
+ //------------ create secondary x axis title
+ bool bAutoPosition_SecondXTitle = true;
+ std::auto_ptr<VTitle> apVTitle_SecondX;
+ if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 0 ) )
+ apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, bIsVertical? ALIGN_RIGHT : ALIGN_TOP, bAutoPosition_SecondXTitle );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ //------------ create secondary y axis title
+ bool bAutoPosition_SecondYTitle = true;
+ std::auto_ptr<VTitle> apVTitle_SecondY;
+ if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 1 ) )
+ apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ , aRemainingSpace, aPageSize, bIsVertical? ALIGN_TOP : ALIGN_RIGHT, bAutoPosition_SecondYTitle );
+ if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
+ return;
+
+ //------------ create complete diagram shape (inclusive axis and series)
+ awt::Point aAvailablePosDia;
+ awt::Size aAvailableSizeForDiagram;
+ bool bUseFixedInnerSize = false;
+ if( getAvailablePosAndSizeForDiagram( aAvailablePosDia, aAvailableSizeForDiagram, aRemainingSpace, aPageSize
+ , ChartModelHelper::findDiagram( m_xChartModel ), bUseFixedInnerSize ) )
+ {
+ awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent( aSeriesPlotterContainer
+ , xDiagramPlusAxes_Shapes
+ , aAvailablePosDia ,aAvailableSizeForDiagram, aPageSize, bUseFixedInnerSize, xDiagram_MarkHandles );
+
+ if( xDiagram_OuterRect.is() )
+ {
+ xDiagram_OuterRect->setPosition( awt::Point( aUsedOuterRect.X, aUsedOuterRect.Y ) );
+ xDiagram_OuterRect->setSize( awt::Size( aUsedOuterRect.Width, aUsedOuterRect.Height ) );
+ }
+
+ //correct axis title position
+ awt::Rectangle aDiagramPlusAxesRect( aUsedOuterRect );
+ if(bAutoPosition_XTitle)
+ changePositionOfAxisTitle( apVTitle_X.get(), ALIGN_BOTTOM, aDiagramPlusAxesRect, aPageSize );
+ if(bAutoPosition_YTitle)
+ changePositionOfAxisTitle( apVTitle_Y.get(), ALIGN_LEFT, aDiagramPlusAxesRect, aPageSize );
+ if(bAutoPosition_ZTitle)
+ changePositionOfAxisTitle( apVTitle_Z.get(), ALIGN_Z, aDiagramPlusAxesRect, aPageSize );
+ if(bAutoPosition_SecondXTitle)
+ changePositionOfAxisTitle( apVTitle_SecondX.get(), bIsVertical? ALIGN_RIGHT : ALIGN_TOP, aDiagramPlusAxesRect, aPageSize );
+ if(bAutoPosition_SecondYTitle)
+ changePositionOfAxisTitle( apVTitle_SecondY.get(), bIsVertical? ALIGN_TOP : ALIGN_RIGHT, aDiagramPlusAxesRect, aPageSize );
+ }
+
+ //cleanup: remove all empty group shapes to avoid grey border lines:
+ lcl_removeEmptyGroupShapes( xPageShapes );
+ }
+
+ // #i12587# support for shapes in chart
+ if ( m_pDrawModelWrapper )
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ m_pDrawModelWrapper->getSdrModel().EnableUndo( TRUE );
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ clock_t nEnd = clock();
+ double fDuration =(double(nEnd-nStart)*1000.0)/double(CLOCKS_PER_SEC);
+
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< chart view :: createShapes():: needed %f msec", fDuration );
+#endif
+}
+
+//-----------------------------------------------------------------
+// util::XEventListener (base of XCloseListener)
+//-----------------------------------------------------------------
+void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ )
+ throw(uno::RuntimeException)
+{
+ impl_setChartModel( 0 );
+}
+
+void ChartView::impl_updateView()
+{
+ if( !m_xChartModel.is() || !m_pDrawModelWrapper )
+ return;
+
+ // #i12587# support for shapes in chart
+ if ( m_bSdrViewIsInEditMode )
+ {
+ return;
+ }
+
+ if( m_bViewDirty && !m_bInViewUpdate )
+ {
+ m_bInViewUpdate = true;
+ //bool bOldRefreshAddIn = m_bRefreshAddIn;
+ //m_bRefreshAddIn = false;
+ try
+ {
+ impl_notifyModeChangeListener(C2U("invalid"));
+
+ //prepare draw model
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ m_pDrawModelWrapper->lockControllers();
+ // \--
+ }
+
+ //create chart view
+ {
+ m_bViewDirty = false;
+ m_bViewUpdatePending = false;
+ createShapes();
+
+ if( m_bViewDirty )
+ {
+ //avoid recursions due to add-in
+ m_bRefreshAddIn = false;
+ m_bViewDirty = false;
+ m_bViewUpdatePending = false;
+ //delete old chart view
+ createShapes();
+ m_bRefreshAddIn = true;
+ }
+ }
+
+ m_bViewDirty = m_bViewUpdatePending;
+ m_bViewUpdatePending = false;
+ m_bInViewUpdate = false;
+ }
+ catch( uno::Exception& ex)
+ {
+ m_bViewDirty = m_bViewUpdatePending;
+ m_bViewUpdatePending = false;
+ m_bInViewUpdate = false;
+ ASSERT_EXCEPTION( ex );
+ }
+
+ {
+ // /--
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ m_pDrawModelWrapper->unlockControllers();
+ // \--
+ }
+
+ impl_notifyModeChangeListener(C2U("valid"));
+
+ //m_bRefreshAddIn = bOldRefreshAddIn;
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL ChartView::modified( const lang::EventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+ m_bViewDirty = sal_True;
+ if( m_bInViewUpdate )
+ m_bViewUpdatePending = true;
+
+ impl_notifyModeChangeListener(C2U("dirty"));
+}
+
+//SfxListener
+void ChartView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ //#i77362 change notification for changes on additional shapes are missing
+ if( m_bInViewUpdate )
+ return;
+
+ // #i12587# support for shapes in chart
+ if ( m_bSdrViewIsInEditMode && m_xChartModel.is() )
+ {
+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartModel->getCurrentController(), uno::UNO_QUERY );
+ if ( xSelectionSupplier.is() )
+ {
+ ::rtl::OUString aSelObjCID;
+ uno::Any aSelObj( xSelectionSupplier->getSelection() );
+ aSelObj >>= aSelObjCID;
+ if ( aSelObjCID.getLength() > 0 )
+ {
+ return;
+ }
+ }
+ }
+
+ const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >(&rHint);
+ if( !pSdrHint )
+ return;
+
+ bool bShapeChanged = false;
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJCHG:
+ bShapeChanged = true;
+ break;
+ case HINT_OBJINSERTED:
+ bShapeChanged = true;
+ break;
+ case HINT_OBJREMOVED:
+ bShapeChanged = true;
+ break;
+ case HINT_MODELCLEARED:
+ bShapeChanged = true;
+ break;
+ case HINT_ENDEDIT:
+ bShapeChanged = true;
+ break;
+ default:
+ break;
+ }
+
+ if(bShapeChanged)
+ {
+ //#i76053# do not send view modified notifications for changes on the hidden page which contains e.g. the symbols for the dialogs
+ if( ChartView::getSdrPage() != pSdrHint->GetPage() )
+ bShapeChanged=false;
+ }
+
+ if(!bShapeChanged)
+ return;
+
+ Reference< util::XModifiable > xModifiable( m_xChartModel, uno::UNO_QUERY );
+ if( xModifiable.is() )
+ xModifiable->setModified( sal_True );
+}
+
+void ChartView::impl_notifyModeChangeListener( const rtl::OUString& rNewMode )
+{
+ try
+ {
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer
+ .getContainer( ::getCppuType((const uno::Reference< util::XModeChangeListener >*)0) );
+ if( pIC )
+ {
+ 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 );
+ }
+ }
+ }
+ catch( uno::Exception& ex)
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModeChangeBroadcaster ____
+
+void SAL_CALL ChartView::addModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aListenerContainer.addInterface(
+ ::getCppuType((const uno::Reference< util::XModeChangeListener >*)0), xListener );
+}
+void SAL_CALL ChartView::removeModeChangeListener( const uno::Reference< util::XModeChangeListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aListenerContainer.removeInterface(
+ ::getCppuType((const uno::Reference< util::XModeChangeListener >*)0), xListener );
+}
+void SAL_CALL ChartView::addModeChangeApproveListener( const uno::Reference< util::XModeChangeApproveListener >& /* _rxListener */ )
+ throw (lang::NoSupportException, uno::RuntimeException)
+{
+
+}
+void SAL_CALL ChartView::removeModeChangeApproveListener( const uno::Reference< util::XModeChangeApproveListener >& /* _rxListener */ )
+ throw (lang::NoSupportException, uno::RuntimeException)
+{
+
+}
+
+// ____ XUpdatable ____
+void SAL_CALL ChartView::update() throw (uno::RuntimeException)
+{
+ impl_updateView();
+
+ //#i100778# migrate all imported or old documents to a plot area sizing exclusive axes (in case the save settings allow for this):
+ //Although in general it is a bad idea to change the model from within the view this is exceptionally the best place to do this special conversion.
+ //When a view update is requested (what happens for creating the metafile or displaying
+ //the chart in edit mode or printing) it is most likely that all necessary informations are available - like the underlying spreadsheet data for example.
+ //Those data is important for the correct axis lable sizes which are needed during conversion.
+ if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_xChartModel, true, false ) )
+ impl_updateView();
+}
+
+// ____ XPropertySet ____
+Reference< beans::XPropertySetInfo > SAL_CALL ChartView::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+ return 0;
+}
+
+void SAL_CALL ChartView::setPropertyValue( const ::rtl::OUString& rPropertyName
+ , const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException
+ , lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( rPropertyName.equals(C2U("Resolution")) )
+ {
+ awt::Size aNewResolution;
+ if( ! (rValue >>= aNewResolution) )
+ throw lang::IllegalArgumentException( C2U("Property 'Resolution' requires value of type awt::Size"), 0, 0 );
+
+ if( m_aPageResolution.Width!=aNewResolution.Width || m_aPageResolution.Height!=aNewResolution.Height )
+ {
+ //set modified only when the new resolution is higher and points were skipped before
+ bool bSetModified = m_bPointsWereSkipped && (m_aPageResolution.Width<aNewResolution.Width || m_aPageResolution.Height<aNewResolution.Height);
+
+ m_aPageResolution = aNewResolution;
+
+ if( bSetModified )
+ this->modified( lang::EventObject( static_cast< uno::XWeak* >( this ) ) );
+ }
+ }
+ else if( rPropertyName.equals(C2U("ZoomFactors")) )
+ {
+ //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
+ uno::Sequence< beans::PropertyValue > aZoomFactors;
+ if( ! (rValue >>= aZoomFactors) )
+ throw lang::IllegalArgumentException( C2U("Property 'ZoomFactors' requires value of type Sequence< PropertyValue >"), 0, 0 );
+
+ sal_Int32 nFilterArgs = aZoomFactors.getLength();
+ beans::PropertyValue* pDataValues = aZoomFactors.getArray();
+ while( nFilterArgs-- )
+ {
+ if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleXNumerator" ) ) )
+ pDataValues->Value >>= m_nScaleXNumerator;
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleXDenominator" ) ) )
+ pDataValues->Value >>= m_nScaleXDenominator;
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleYNumerator" ) ) )
+ pDataValues->Value >>= m_nScaleYNumerator;
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleYDenominator" ) ) )
+ pDataValues->Value >>= m_nScaleYDenominator;
+
+ pDataValues++;
+ }
+ }
+ else if( rPropertyName.equals(C2U("SdrViewIsInEditMode")) )
+ {
+ //#i77362 change notification for changes on additional shapes are missing
+ if( ! (rValue >>= m_bSdrViewIsInEditMode) )
+ throw lang::IllegalArgumentException( C2U("Property 'SdrViewIsInEditMode' requires value of type sal_Bool"), 0, 0 );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to set to chart wizard"), 0 );
+}
+
+Any SAL_CALL ChartView::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( rPropertyName.equals(C2U("Resolution")) )
+ {
+ aRet = uno::makeAny( m_aPageResolution );
+ }
+ else
+ throw beans::UnknownPropertyException( C2U("unknown property was tried to get from chart wizard"), 0 );
+ return aRet;
+}
+
+void SAL_CALL ChartView::addPropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const Reference< beans::XPropertyChangeListener >& /* xListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL ChartView::removePropertyChangeListener(
+ const ::rtl::OUString& /* aPropertyName */, const Reference< beans::XPropertyChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL ChartView::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+void SAL_CALL ChartView::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, const Reference< beans::XVetoableChangeListener >& /* aListener */ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+// ____ XMultiServiceFactory ____
+
+Reference< uno::XInterface > ChartView::createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ SdrModel* pModel = ( m_pDrawModelWrapper ? &m_pDrawModelWrapper->getSdrModel() : NULL );
+ if ( pModel )
+ {
+ if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DashTable" ) ) == 0 )
+ {
+ if ( !m_xDashTable.is() )
+ {
+ m_xDashTable = SvxUnoDashTable_createInstance( pModel );
+ }
+ return m_xDashTable;
+ }
+ else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.GradientTable" ) ) == 0 )
+ {
+ if ( !m_xGradientTable.is() )
+ {
+ m_xGradientTable = SvxUnoGradientTable_createInstance( pModel );
+ }
+ return m_xGradientTable;
+ }
+ else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.HatchTable" ) ) == 0 )
+ {
+ if ( !m_xHatchTable.is() )
+ {
+ m_xHatchTable = SvxUnoHatchTable_createInstance( pModel );
+ }
+ return m_xHatchTable;
+ }
+ else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.BitmapTable" ) ) == 0 )
+ {
+ if ( !m_xBitmapTable.is() )
+ {
+ m_xBitmapTable = SvxUnoBitmapTable_createInstance( pModel );
+ }
+ return m_xBitmapTable;
+ }
+ else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) ) == 0 )
+ {
+ if ( !m_xTransGradientTable.is() )
+ {
+ m_xTransGradientTable = SvxUnoTransGradientTable_createInstance( pModel );
+ }
+ return m_xTransGradientTable;
+ }
+ else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.MarkerTable" ) ) == 0 )
+ {
+ if ( !m_xMarkerTable.is() )
+ {
+ m_xMarkerTable = SvxUnoMarkerTable_createInstance( pModel );
+ }
+ return m_xMarkerTable;
+ }
+ }
+
+ return 0;
+}
+
+Reference< uno::XInterface > ChartView::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ OSL_ENSURE( Arguments.getLength(), "ChartView::createInstanceWithArguments: arguments are ignored" );
+ (void) Arguments; // avoid warning
+ return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< ::rtl::OUString > ChartView::getAvailableServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aServiceNames( 6 );
+
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) );
+ aServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) );
+ aServiceNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) );
+ aServiceNames[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) );
+ aServiceNames[4] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) );
+ aServiceNames[5] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MarkerTable" ) );
+
+ return aServiceNames;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/ChartView.hxx b/chart2/source/view/main/ChartView.hxx
new file mode 100644
index 000000000000..476adae03674
--- /dev/null
+++ b/chart2/source/view/main/ChartView.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHARTVIEWIMPL_HXX
+#define _CHARTVIEWIMPL_HXX
+
+#include "chartview/ExplicitValueProvider.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase9.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+// header for class SfxListener
+#include <svl/lstner.hxx>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class SdrPage;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class VCoordinateSystem;
+class DrawModelWrapper;
+class SeriesPlotterContainer;
+
+//-----------------------------------------------------------------------------
+/** The ChartView is responsible to manage the generation of Drawing Objects
+for visualization on a given OutputDevice. The ChartModel is responsible to notify changes to the view.
+The view than changes to state dirty. The view can be updated with call 'update'.
+
+The View is not responsible to handle single user events (that is instead done by the ChartWindow).
+*/
+
+class ChartView : public ::cppu::WeakImplHelper9<
+ ::com::sun::star::lang::XInitialization
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::datatransfer::XTransferable
+ ,::com::sun::star::lang::XUnoTunnel
+ //::com::sun::star::lang::XComponent ???
+ //::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ //::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ //::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ ,::com::sun::star::util::XModifyListener
+ ,::com::sun::star::util::XModeChangeBroadcaster
+ ,::com::sun::star::util::XUpdatable
+ ,::com::sun::star::beans::XPropertySet
+ ,::com::sun::star::lang::XMultiServiceFactory
+ >
+ , public ExplicitValueProvider
+ , private SfxListener
+{
+public:
+ ChartView(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext);
+ virtual ~ChartView();
+
+ // ___lang::XServiceInfo___
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ChartView)
+
+ // ___lang::XInitialization___
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // ___ExplicitValueProvider___
+ virtual sal_Bool getExplicitValuesForAxis(
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
+ , ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
+ , ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ getShapeForCID( const rtl::OUString& rObjectCID );
+
+ virtual ::com::sun::star::awt::Rectangle getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false );
+
+ virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes();
+
+ ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper();
+
+ // ___XTransferable___
+ virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::datatransfer::UnsupportedFlavorException
+ , ::com::sun::star::io::IOException
+ , ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-------------------------------------------------------------------------------------
+ // ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
+ //-------------------------------------------------------------------------------------
+ virtual void SAL_CALL
+ disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModifyListener
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL modified(
+ const ::com::sun::star::lang::EventObject& aEvent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XModeChangeBroadcaster
+ //-----------------------------------------------------------------
+
+ virtual void SAL_CALL addModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::util::XUpdatable
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::beans::XPropertySet
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
+ // ::com::sun::star::lang::XMultiServiceFactory
+ //-----------------------------------------------------------------
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
+ const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // for ExplicitValueProvider
+ // ____ XUnoTunnel ___
+ virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
+ throw (::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ ChartView();
+
+ void createShapes();
+ void getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream
+ , bool bUseHighContrast );
+ SdrPage* getSdrPage();
+
+ void impl_setChartModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ void impl_deleteCoordinateSystems();
+ void impl_notifyModeChangeListener( const rtl::OUString& rNewMode );
+
+ void impl_refreshAddIn();
+ bool impl_AddInDrawsAllByItself();
+
+ void impl_updateView();
+
+ ::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
+ , const ::com::sun::star::awt::Point& rAvailablePos
+ , const ::com::sun::star::awt::Size& rAvailableSize
+ , const ::com::sun::star::awt::Size& rPageSize
+ , bool bUseFixedInnerSize
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles );
+
+
+private: //member
+ ::osl::Mutex m_aMutex;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
+ m_xCC;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ m_xChartModel;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
+ m_xShapeFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>
+ m_xDrawPage;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDashTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xGradientTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xHatchTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xBitmapTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xTransGradientTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xMarkerTable;
+
+ ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
+
+ std::vector< VCoordinateSystem* > m_aVCooSysList;
+
+ ::cppu::OMultiTypeInterfaceContainerHelper
+ m_aListenerContainer;
+
+ bool volatile m_bViewDirty; //states wether the view needs to be rebuild
+ bool volatile m_bInViewUpdate;
+ bool volatile m_bViewUpdatePending;
+ bool volatile m_bRefreshAddIn;
+
+ //better performance for big data
+ ::com::sun::star::awt::Size m_aPageResolution;
+ bool m_bPointsWereSkipped;
+
+ //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
+ sal_Int32 m_nScaleXNumerator;
+ sal_Int32 m_nScaleXDenominator;
+ sal_Int32 m_nScaleYNumerator;
+ sal_Int32 m_nScaleYDenominator;
+
+ sal_Bool m_bSdrViewIsInEditMode;
+
+ ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/view/main/Clipping.cxx b/chart2/source/view/main/Clipping.cxx
new file mode 100644
index 000000000000..e61096e5a0ba
--- /dev/null
+++ b/chart2/source/view/main/Clipping.cxx
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "Clipping.hxx"
+#include "CommonConverters.hxx"
+#include "BaseGFXHelper.hxx"
+
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using ::basegfx::B2DRectangle;
+using ::basegfx::B2DTuple;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace{
+/** @descr This is a supporting function for lcl_clip2d. It computes a new parametric
+ value for an entering (dTE) or leaving (dTL) intersection point with one
+ of the edges bounding the clipping area.
+ For explanation of the parameters please refer to :
+
+ Liang-Biarsky parametric line-clipping algorithm as described in:
+ Computer Graphics: principles and practice, 2nd ed.,
+ James D. Foley et al.,
+ Section 3.12.4 on page 117.
+*/
+bool lcl_CLIPt(double fDenom,double fNum, double & fTE, double & fTL)
+{
+ double fT;
+
+ if (fDenom > 0) // Intersection enters: PE
+ {
+ fT = fNum / fDenom; // Parametric value at the intersection.
+ if (fT > fTL) // fTE and fTL crossover
+ return false; // therefore reject the line.
+ else if (fT > fTE) // A new fTE has been found.
+ fTE = fT;
+ }
+ else if (fDenom < 0) // Intersection leaves: PL
+ {
+ fT = fNum / fDenom; // Parametric Value at the intersection.
+ if (fT < fTE) // fTE and fTL crossover
+ return false; // therefore reject the line.
+ else if (fT < fTL) // A new fTL has been found.
+ fTL = fT;
+ }
+ else if (fNum > 0)
+ return false; // Line lies on the outside of the edge.
+
+ return true;
+}
+
+/** @descr The line given by it's two endpoints rP0 and rP1 is clipped at the rectangle
+ rRectangle. If there is at least a part of it visible then TRUE is returned and
+ the endpoints of that part are stored in rP0 and rP1. The points rP0 and rP1
+ may have the same coordinates.
+ @param rP0 Start point of the line to clip. Modified to contain a start point inside
+ the clipping area if possible.
+ @param rP1 End point of the line to clip. Modified to contain an end point inside
+ the clipping area if possible.
+ @param rRectangle Clipping area.
+ @return If the line lies completely or partly inside the clipping area then TRUE
+ is returned. If the line lies completely outside then FALSE is returned and rP0 and
+ rP1 are left unmodified.
+*/
+bool lcl_clip2d(B2DTuple& rPoint0, B2DTuple& rPoint1, const B2DRectangle& rRectangle)
+{
+ //Direction vector of the line.
+ B2DTuple aDirection = rPoint1 - rPoint0;
+
+ if( aDirection.getX()==0 && aDirection.getY()==0 && rRectangle.isInside(rPoint0) )
+ {
+ // Degenerate case of a zero length line.
+ return true;
+ }
+ else
+ {
+ // Values of the line parameter where the line enters resp. leaves the rectangle.
+ double fTE = 0,
+ fTL = 1;
+
+ // Test wether at least a part lies in the four half-planes with respect to
+ // the rectangles four edges.
+ if( lcl_CLIPt(aDirection.getX(), rRectangle.getMinX() - rPoint0.getX(), fTE, fTL) )
+ if( lcl_CLIPt(-aDirection.getX(), rPoint0.getX() - rRectangle.getMaxX(), fTE, fTL) )
+ if( lcl_CLIPt(aDirection.getY(), rRectangle.getMinY() - rPoint0.getY(), fTE, fTL) )
+ if( lcl_CLIPt(-aDirection.getY(), rPoint0.getY() - rRectangle.getMaxY(), fTE, fTL) )
+ {
+ // At least a part is visible.
+ if (fTL < 1)
+ {
+ // Compute the new end point.
+ rPoint1.setX( rPoint0.getX() + fTL * aDirection.getX() );
+ rPoint1.setY( rPoint0.getY() + fTL * aDirection.getY() );
+ }
+ if (fTE > 0)
+ {
+ // Compute the new starting point.
+ rPoint0.setX( rPoint0.getX() + fTE * aDirection.getX() );
+ rPoint0.setY( rPoint0.getY() + fTE * aDirection.getY() );
+ }
+ return true;
+ }
+
+ // Line is not visible.
+ return false;
+ }
+}
+
+bool lcl_clip2d_(drawing::Position3D& rPoint0, drawing::Position3D& rPoint1, const B2DRectangle& rRectangle)
+{
+ B2DTuple aP0(rPoint0.PositionX,rPoint0.PositionY);
+ B2DTuple aP1(rPoint1.PositionX,rPoint1.PositionY);
+ bool bRet = lcl_clip2d( aP0, aP1, rRectangle );
+
+ rPoint0.PositionX = aP0.getX();
+ rPoint0.PositionY = aP0.getY();
+ rPoint1.PositionX = aP1.getX();
+ rPoint1.PositionY = aP1.getY();
+
+ return bRet;
+}
+
+void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
+ , const drawing::Position3D& rPos
+ , sal_Int32 nPolygonIndex
+ , std::vector< sal_Int32 >& rResultPointCount
+ , sal_Int32 nReservePointCount )
+{
+ if(nPolygonIndex<0)
+ {
+ OSL_ENSURE( false, "The polygon index needs to be > 0");
+ nPolygonIndex=0;
+ }
+
+ //make sure that we have enough polygons
+ if(nPolygonIndex >= rPoly.SequenceX.getLength() )
+ {
+ rPoly.SequenceX.realloc(nPolygonIndex+1);
+ rPoly.SequenceY.realloc(nPolygonIndex+1);
+ rPoly.SequenceZ.realloc(nPolygonIndex+1);
+ rResultPointCount.resize(nPolygonIndex+1,0);
+ }
+
+ drawing::DoubleSequence* pOuterSequenceX = &rPoly.SequenceX.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceY = &rPoly.SequenceY.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceZ = &rPoly.SequenceZ.getArray()[nPolygonIndex];
+
+ sal_Int32 nNewResultPointCount = rResultPointCount[nPolygonIndex]+1;
+ sal_Int32 nSeqLength = pOuterSequenceX->getLength();
+
+ if( nSeqLength <= nNewResultPointCount )
+ {
+ sal_Int32 nReallocLength = nReservePointCount;
+ if( nNewResultPointCount > nReallocLength )
+ {
+ nReallocLength = nNewResultPointCount;
+ DBG_ERROR("this should not be the case to avoid performance problems");
+ }
+ pOuterSequenceX->realloc(nReallocLength);
+ pOuterSequenceY->realloc(nReallocLength);
+ pOuterSequenceZ->realloc(nReallocLength);
+ }
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ pInnerSequenceX[nNewResultPointCount-1] = rPos.PositionX;
+ pInnerSequenceY[nNewResultPointCount-1] = rPos.PositionY;
+ pInnerSequenceZ[nNewResultPointCount-1] = rPos.PositionZ;
+ rResultPointCount[nPolygonIndex]=nNewResultPointCount;
+}
+
+}//end anonymous namespace
+
+void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolygon
+ , const B2DRectangle& rRectangle
+ , drawing::PolyPolygonShape3D& aResult
+ , bool bSplitPiecesToDifferentPolygons )
+{
+ aResult.SequenceX.realloc(0);
+ aResult.SequenceY.realloc(0);
+ aResult.SequenceZ.realloc(0);
+
+ if(!rPolygon.SequenceX.getLength())
+ 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.SequenceX.getLength();
+ for(sal_Int32 nOldPolyIndex=0; nOldPolyIndex<nOldPolyCount; nOldPolyIndex++, nNewPolyIndex++ )
+ {
+ sal_Int32 nOldPointCount = rPolygon.SequenceX[nOldPolyIndex].getLength();
+
+ // 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 an 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 < aResult.SequenceX.getLength()
+ && 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--; )
+ {
+ drawing::DoubleSequence* pOuterSequenceX = &aResult.SequenceX.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceY = &aResult.SequenceY.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceZ = &aResult.SequenceZ.getArray()[nPolygonIndex];
+
+ sal_Int32 nUsedPointCount = aResultPointCount[nPolygonIndex];
+ pOuterSequenceX->realloc(nUsedPointCount);
+ pOuterSequenceY->realloc(nUsedPointCount);
+ pOuterSequenceZ->realloc(nUsedPointCount);
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/DataPointSymbolSupplier.cxx b/chart2/source/view/main/DataPointSymbolSupplier.cxx
new file mode 100644
index 000000000000..d59a011cd429
--- /dev/null
+++ b/chart2/source/view/main/DataPointSymbolSupplier.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "chartview/DataPointSymbolSupplier.hxx"
+#include "ShapeFactory.hxx"
+#include "macros.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+//using namespace ::com::sun::star::chart2;
+
+uno::Reference< drawing::XShapes > DataPointSymbolSupplier::create2DSymbolList(
+ uno::Reference< lang::XMultiServiceFactory > xShapeFactory
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Direction3D& rSize )
+{
+ uno::Reference< drawing::XShape > xGroup(
+ xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.GroupShape" ) ), uno::UNO_QUERY );
+ if(xTarget.is())
+ xTarget->add(xGroup);
+ uno::Reference< drawing::XShapes > xGroupShapes =
+ uno::Reference<drawing::XShapes>( xGroup, uno::UNO_QUERY );
+
+ ShapeFactory aShapeFactory(xShapeFactory);
+ drawing::Position3D aPos(0,0,0);
+ for(sal_Int32 nS=0;nS<ShapeFactory::getSymbolCount();nS++)
+ {
+ aShapeFactory.createSymbol2D( xGroupShapes, aPos, rSize, nS );
+ }
+ return xGroupShapes;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
new file mode 100644
index 000000000000..577f450172b5
--- /dev/null
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -0,0 +1,411 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "chartview/DrawModelWrapper.hxx"
+#include "macros.hxx"
+#include "ShapeFactory.hxx"
+#include "ChartItemPool.hxx"
+#include "ObjectIdentifier.hxx"
+#include <svx/unomodel.hxx>
+#include <svl/itempool.hxx>
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+// header for define EE_PARA_HYPHENATE
+#include <editeng/eeitem.hxx>
+// header for class Svx3DPercentDiagonalItem
+#include <svx/svx3ditems.hxx>
+// header for class SvtPathOptions
+#include <unotools/pathoptions.hxx>
+// header E3dObjFactory
+#include <svx/objfac3d.hxx>
+// header for class SdrObjList
+#include <svx/svdpage.hxx>
+// header for SvxUnoXDashTable_createInstance
+#include <svx/XPropertyTable.hxx>
+// header for class XDashList
+#include <svx/xtable.hxx>
+// header for class SdrOutliner
+#include <svx/svdoutl.hxx>
+// header for class LinguMgr
+#include <editeng/unolingu.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+// header for class VirtualDevice
+#include <vcl/virdev.hxx>
+
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <sfx2/objsh.hxx>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace
+{
+// this code is copied from sfx2/source/doc/objembed.cxx
+SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel )
+{
+ SfxObjectShell* pResult = NULL;
+
+ 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( uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) );
+ }
+ }
+ }
+ catch( 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) fromthe parent document
+OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel )
+{
+ SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel );
+ if ( pParent )
+ return pParent->GetDocumentRefDev();
+ return NULL;
+}
+
+} // anonymous namespace
+
+//.. ...........................................................................
+namespace chart
+{
+//.............................................................................
+
+DrawModelWrapper::DrawModelWrapper(
+ uno::Reference<uno::XComponentContext> const & xContext )
+ : SdrModel( SvtPathOptions().GetPalettePath() )
+ , m_xMCF(0)
+ , m_pChartItemPool(0)
+ , m_xMainDrawPage(0)
+ , m_xHiddenDrawPage(0)
+ , m_apRefDevice(0)
+{
+ m_pChartItemPool = ChartItemPool::CreateChartItemPool();
+
+ m_xMCF = xContext->getServiceManager();
+
+ SetScaleUnit(MAP_100TH_MM);
+ SetScaleFraction(Fraction(1, 1));
+ SetDefaultFontHeight(423); // 12pt
+
+ SfxItemPool* pMasterPool = &GetItemPool();
+ pMasterPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
+ pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, TRUE) );
+ pMasterPool->SetPoolDefaultItem(Svx3DPercentDiagonalItem (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();
+
+ //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
+ static bool b3dFactoryInitialized = false;
+ if(!b3dFactoryInitialized)
+ {
+ E3dObjFactory aObjFactory;
+ b3dFactoryInitialized = true;
+ }
+
+ //Hyphenyation and spellchecking
+ SdrOutliner& rOutliner = GetDrawOutliner();
+ try
+ {
+ uno::Reference< linguistic2::XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ rOutliner.SetHyphenator( xHyphenator );
+
+ uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ rOutliner.SetSpeller( xSpellChecker );
+ }
+ catch(...)
+ {
+ DBG_ERROR("Can't get Hyphenator or SpellChecker for chart");
+ }
+
+ //ref device for font rendering
+ OutputDevice* pDefaultDevice = rOutliner.GetRefDevice();
+ if( !pDefaultDevice )
+ pDefaultDevice = Application::GetDefaultDevice();
+ m_apRefDevice = std::auto_ptr< OutputDevice >( new VirtualDevice( *pDefaultDevice ) );
+ MapMode aMapMode = m_apRefDevice->GetMapMode();
+ aMapMode.SetMapUnit(MAP_100TH_MM);
+ m_apRefDevice->SetMapMode(aMapMode);
+ SetRefDevice(m_apRefDevice.get());
+ rOutliner.SetRefDevice(m_apRefDevice.get());
+}
+
+DrawModelWrapper::~DrawModelWrapper()
+{
+ //remove m_pChartItemPool from pool chain
+ if(m_pChartItemPool)
+ {
+ SfxItemPool* pPool = &GetItemPool();
+ for (;;)
+ {
+ SfxItemPool* pSecondary = pPool->GetSecondaryPool();
+ if(pSecondary == m_pChartItemPool)
+ {
+ pPool->SetSecondaryPool (NULL);
+ break;
+ }
+ pPool = pSecondary;
+ }
+ SfxItemPool::Free(m_pChartItemPool);
+ }
+}
+
+uno::Reference< uno::XInterface > 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 );
+}
+
+uno::Reference< frame::XModel > DrawModelWrapper::getUnoModel()
+{
+ uno::Reference< uno::XInterface > xI = this->SdrModel::getUnoModel();
+ return uno::Reference<frame::XModel>::query( xI );
+}
+
+SdrModel& DrawModelWrapper::getSdrModel()
+{
+ return *this;
+}
+
+uno::Reference< lang::XMultiServiceFactory > DrawModelWrapper::getShapeFactory()
+{
+ uno::Reference< lang::XMultiServiceFactory > xShapeFactory( this->getUnoModel(), uno::UNO_QUERY );
+ return xShapeFactory;
+}
+
+uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage()
+{
+ //create draw page:
+ if( !m_xMainDrawPage.is() )
+ {
+ uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY );
+ if( xDrawPagesSuplier.is() )
+ {
+ uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () );
+ if( xDrawPages->getCount()>1 )
+ {
+ uno::Any aPage = xDrawPages->getByIndex( 0 ) ;
+ aPage >>= m_xMainDrawPage;
+ }
+ if(!m_xMainDrawPage.is())
+ {
+ m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
+ }
+ }
+ }
+ //ensure that additional shapes are in front of the chart objects so create the chart root before
+ ShapeFactory(this->getShapeFactory()).getOrCreateChartRootShape( m_xMainDrawPage );
+ return m_xMainDrawPage;
+}
+uno::Reference< drawing::XDrawPage > DrawModelWrapper::getHiddenDrawPage()
+{
+ if( !m_xHiddenDrawPage.is() )
+ {
+ uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY );
+ if( xDrawPagesSuplier.is() )
+ {
+ uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () );
+ if( xDrawPages->getCount()>1 )
+ {
+ uno::Any aPage = xDrawPages->getByIndex( 1 ) ;
+ aPage >>= m_xHiddenDrawPage;
+ }
+
+ if(!m_xHiddenDrawPage.is())
+ {
+ if( xDrawPages->getCount()==0 )
+ m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
+ m_xHiddenDrawPage = xDrawPages->insertNewByIndex( 1 );
+ }
+ }
+ }
+ return m_xHiddenDrawPage;
+}
+void DrawModelWrapper::clearMainDrawPage()
+{
+ //uno::Reference<drawing::XShapes> xChartRoot( m_xMainDrawPage, uno::UNO_QUERY );
+ uno::Reference<drawing::XShapes> xChartRoot( ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
+ if( xChartRoot.is() )
+ {
+ sal_Int32 nSubCount = xChartRoot->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nS = nSubCount; nS--; )
+ {
+ if( xChartRoot->getByIndex( nS ) >>= xShape )
+ xChartRoot->remove( xShape );
+ }
+ }
+}
+
+uno::Reference< drawing::XShapes > DrawModelWrapper::getChartRootShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
+{
+ return ShapeFactory::getChartRootShape( xDrawPage );
+}
+
+void DrawModelWrapper::lockControllers()
+{
+ uno::Reference< frame::XModel > xDrawModel( this->getUnoModel() );
+ if( xDrawModel.is())
+ xDrawModel->lockControllers();
+}
+void DrawModelWrapper::unlockControllers()
+{
+ uno::Reference< frame::XModel > xDrawModel( this->getUnoModel() );
+ if( xDrawModel.is())
+ xDrawModel->unlockControllers();
+}
+
+void DrawModelWrapper::attachParentReferenceDevice( const uno::Reference< frame::XModel > & xChartModel )
+{
+ OutputDevice * pParentRefDev( lcl_GetParentRefDevice( xChartModel ));
+ if( pParentRefDev )
+ {
+ SetRefDevice( pParentRefDev );
+ }
+}
+
+OutputDevice* DrawModelWrapper::getReferenceDevice() const
+{
+ return SdrModel::GetRefDevice();
+}
+
+SfxItemPool& DrawModelWrapper::GetItemPool()
+{
+ return this->SdrModel::GetItemPool();
+}
+const SfxItemPool& DrawModelWrapper::GetItemPool() const
+{
+ return this->SdrModel::GetItemPool();
+}
+XColorTable* DrawModelWrapper::GetColorTable() const
+{
+ return this->SdrModel::GetColorTable();
+}
+XDashList* DrawModelWrapper::GetDashList() const
+{
+ return this->SdrModel::GetDashList();
+}
+XLineEndList* DrawModelWrapper::GetLineEndList() const
+{
+ return this->SdrModel::GetLineEndList();
+}
+XGradientList* DrawModelWrapper::GetGradientList() const
+{
+ return this->SdrModel::GetGradientList();
+}
+XHatchList* DrawModelWrapper::GetHatchList() const
+{
+ return this->SdrModel::GetHatchList();
+}
+XBitmapList* DrawModelWrapper::GetBitmapList() const
+{
+ return this->SdrModel::GetBitmapList();
+}
+
+SdrObject* DrawModelWrapper::getNamedSdrObject( const rtl::OUString& rName )
+{
+ if(rName.getLength()==0)
+ return 0;
+ return getNamedSdrObject( rName, GetPage(0) );
+}
+
+//static
+SdrObject* DrawModelWrapper::getNamedSdrObject( const String& rObjectCID, SdrObjList* pSearchList )
+{
+ if(!pSearchList || rObjectCID.Len()==0)
+ return 0;
+ ULONG nCount = pSearchList->GetObjCount();
+ for( ULONG nN=0; nN<nCount; nN++ )
+ {
+ 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 0;
+}
+
+//static
+bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ uno::Reference<drawing::XShapes> xShapes( xChild->getParent(), uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ xShapes->remove(xShape);
+ return true;
+ }
+ }
+ return false;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx
new file mode 100644
index 000000000000..24ec5a285468
--- /dev/null
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -0,0 +1,488 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "LabelPositionHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "CommonConverters.hxx"
+#include "PropertyMapper.hxx"
+#include "ShapeFactory.hxx"
+#include "macros.hxx"
+#include "RelativeSizeHelper.hxx"
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+LabelPositionHelper::LabelPositionHelper(
+ PlottingPositionHelper* pPosHelper
+ , sal_Int32 nDimensionCount
+ , const uno::Reference< drawing::XShapes >& xLogicTarget
+ , ShapeFactory* pShapeFactory )
+ : m_pPosHelper(pPosHelper)
+ , m_nDimensionCount(nDimensionCount)
+ , m_xLogicTarget(xLogicTarget)
+ , m_pShapeFactory(pShapeFactory)
+{
+}
+
+LabelPositionHelper::~LabelPositionHelper()
+{
+}
+
+awt::Point LabelPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D ) const
+{
+ return PlottingPositionHelper::transformSceneToScreenPosition(
+ rScenePosition3D, m_xLogicTarget, m_pShapeFactory, m_nDimensionCount );
+}
+
+//static
+void LabelPositionHelper::changeTextAdjustment( tAnySequence& rPropValues, const tNameSequence& rPropNames, LabelAlignment eAlignment)
+{
+ //HorizontalAdjustment
+ {
+ drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER;
+ if( LABEL_ALIGN_RIGHT==eAlignment || LABEL_ALIGN_RIGHT_TOP==eAlignment || LABEL_ALIGN_RIGHT_BOTTOM==eAlignment )
+ eHorizontalAdjust = drawing::TextHorizontalAdjust_LEFT;
+ else if( LABEL_ALIGN_LEFT==eAlignment || LABEL_ALIGN_LEFT_TOP==eAlignment || LABEL_ALIGN_LEFT_BOTTOM==eAlignment )
+ eHorizontalAdjust = drawing::TextHorizontalAdjust_RIGHT;
+ uno::Any* pHorizontalAdjustAny = PropertyMapper::getValuePointer(rPropValues,rPropNames,C2U("TextHorizontalAdjust"));
+ if(pHorizontalAdjustAny)
+ *pHorizontalAdjustAny = uno::makeAny(eHorizontalAdjust);
+ }
+
+ //VerticalAdjustment
+ {
+ drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
+ if( LABEL_ALIGN_TOP==eAlignment || LABEL_ALIGN_RIGHT_TOP==eAlignment || LABEL_ALIGN_LEFT_TOP==eAlignment )
+ eVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
+ else if( LABEL_ALIGN_BOTTOM==eAlignment || LABEL_ALIGN_RIGHT_BOTTOM==eAlignment || LABEL_ALIGN_LEFT_BOTTOM==eAlignment )
+ eVerticalAdjust = drawing::TextVerticalAdjust_TOP;
+ uno::Any* pVerticalAdjustAny = PropertyMapper::getValuePointer(rPropValues,rPropNames,C2U("TextVerticalAdjust"));
+ if(pVerticalAdjustAny)
+ *pVerticalAdjustAny = uno::makeAny(eVerticalAdjust);
+ }
+}
+
+void lcl_doDynamicFontResize( uno::Any* pAOldAndNewFontHeightAny
+ , const awt::Size& rOldReferenceSize
+ , const awt::Size& rNewReferenceSize )
+{
+ double fOldFontHeight = 0, fNewFontHeight;
+ if( pAOldAndNewFontHeightAny && ( *pAOldAndNewFontHeightAny >>= fOldFontHeight ) )
+ {
+ fNewFontHeight = RelativeSizeHelper::calculate( fOldFontHeight, rOldReferenceSize, rNewReferenceSize );
+ *pAOldAndNewFontHeightAny = uno::makeAny(fNewFontHeight);
+ }
+}
+
+//static
+void LabelPositionHelper::doDynamicFontResize( tAnySequence& rPropValues
+ , const tNameSequence& rPropNames
+ , const uno::Reference< beans::XPropertySet >& xAxisModelProps
+ , const awt::Size& rNewReferenceSize
+ )
+{
+ //-------------------------
+ //handle dynamic font resize:
+ awt::Size aOldReferenceSize;
+ if( xAxisModelProps->getPropertyValue( C2U("ReferencePageSize")) >>= aOldReferenceSize )
+ {
+ uno::Any* pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, C2U("CharHeight") );
+ lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
+ pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, C2U("CharHeightAsian") );
+ lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
+ pAOldAndNewFontHeightAny = PropertyMapper::getValuePointer( rPropValues, rPropNames, C2U("CharHeightComplex") );
+ lcl_doDynamicFontResize( pAOldAndNewFontHeightAny, aOldReferenceSize, rNewReferenceSize );
+ }
+}
+
+namespace
+{
+
+void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on a left side of something with a right centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width *rtl::math::sin( beta )
+ -aSize.Height *rtl::math::cos( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ else
+ rfYCorrection = -aSize.Width *rtl::math::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;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ else
+ rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ }
+}
+
+void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on a right side of something with a left centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree== 0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width*rtl::math::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;
+ if( bRotateAroundCenter )
+ rfYCorrection = aSize.Width *rtl::math::sin( beta )/2.0;
+ else
+ rfYCorrection = aSize.Width *rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Width *rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )/2.0;
+ else
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ if( bRotateAroundCenter )
+ rfYCorrection = -aSize.Width*rtl::math::sin( 2*F_PI - fAnglePi )/2.0;
+ }
+}
+
+void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels on top of something with a bottom centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree== 0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width*rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi - F_PI/2.0;
+ rfXCorrection = aSize.Height*rtl::math::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 );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = fAnglePi - F_PI;
+ rfXCorrection = -aSize.Height *rtl::math::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 );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width*rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+}
+
+void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
+{
+ //correct label positions for labels below something with a top centered alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection -= aSize.Width *rtl::math::cos( fAnglePi )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Height*rtl::math::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 );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::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;
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+ if( !bRotateAroundCenter )
+ rfXCorrection += aSize.Width*rtl::math::cos( beta )/2.0;
+ rfYCorrection = aSize.Width*rtl::math::sin( beta )/2.0;
+ }
+}
+
+void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the left top corner of something with a bottom right alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta )
+ -aSize.Width*rtl::math::cos( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::cos( beta )
+ -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the left bottom corner of something with a top right alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta )
+ -aSize.Height*rtl::math::cos( beta );;
+ rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Width*rtl::math::cos( beta )
+ +aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the right top corner of something with a bottom left alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta );
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = -aSize.Width*rtl::math::cos( beta )
+ -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ }
+}
+
+void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for labels at the right bottom corner of something with a top left alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfYCorrection = aSize.Width*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = fAnglePi-F_PI/2.0;
+ rfXCorrection = aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Height*rtl::math::sin( beta )
+ +aSize.Width*rtl::math::cos( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )
+ +aSize.Width*rtl::math::sin( beta );
+ rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ }
+}
+
+}//end anonymous namespace
+
+//static
+void LabelPositionHelper::correctPositionForRotation( const uno::Reference< drawing::XShape >& xShape2DText
+ , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter )
+{
+ if( !xShape2DText.is() )
+ return;
+
+ awt::Point aOldPos = xShape2DText->getPosition();
+ awt::Size aSize = xShape2DText->getSize();
+
+ double fYCorrection = 0.0;
+ double fXCorrection = 0.0;
+
+ double fAnglePositiveDegree = fRotationAngle;
+ while(fAnglePositiveDegree<0.0)
+ fAnglePositiveDegree+=360.0;
+
+ switch(eLabelAlignment)
+ {
+ case LABEL_ALIGN_LEFT:
+ lcl_correctRotation_Left( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_RIGHT:
+ lcl_correctRotation_Right( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_TOP:
+ lcl_correctRotation_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_BOTTOM:
+ lcl_correctRotation_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize, bRotateAroundCenter );
+ break;
+ case LABEL_ALIGN_LEFT_TOP:
+ lcl_correctRotation_Left_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_LEFT_BOTTOM:
+ lcl_correctRotation_Left_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_RIGHT_TOP:
+ lcl_correctRotation_Right_Top( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ case LABEL_ALIGN_RIGHT_BOTTOM:
+ lcl_correctRotation_Right_Bottom( fXCorrection, fYCorrection, fAnglePositiveDegree, aSize );
+ break;
+ default: //LABEL_ALIGN_CENTER
+ break;
+ }
+
+ xShape2DText->setPosition( awt::Point(
+ static_cast<sal_Int32>(aOldPos.X + fXCorrection )
+ , static_cast<sal_Int32>(aOldPos.Y + fYCorrection ) ) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/Linear3DTransformation.cxx b/chart2/source/view/main/Linear3DTransformation.cxx
new file mode 100644
index 000000000000..9292ee6eb757
--- /dev/null
+++ b/chart2/source/view/main/Linear3DTransformation.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Linear3DTransformation.hxx"
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+
+namespace chart
+{
+
+ Linear3DTransformation::Linear3DTransformation( const drawing::HomogenMatrix& rHomMatrix, bool bSwapXAndY )
+ : m_Matrix(rHomMatrix)
+ , m_bSwapXAndY(bSwapXAndY)
+{}
+
+Linear3DTransformation::~Linear3DTransformation()
+{}
+
+// ____ XTransformation ____
+Sequence< double > SAL_CALL Linear3DTransformation::transform(
+ const Sequence< double >& rSourceValues )
+ throw (RuntimeException,
+ lang::IllegalArgumentException)
+{
+ double fX = rSourceValues[0];
+ double fY = rSourceValues[1];
+ double fZ = rSourceValues[2];
+ if(m_bSwapXAndY)
+ std::swap(fX,fY);
+ Sequence< double > aNewVec(3);
+ 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;
+
+ fZwi = m_Matrix.Line2.Column1 * fX
+ + m_Matrix.Line2.Column2 * fY
+ + m_Matrix.Line2.Column3 * fZ
+ + m_Matrix.Line2.Column4;
+ aNewVec[1] = fZwi;
+
+ fZwi = m_Matrix.Line3.Column1 * fX
+ + m_Matrix.Line3.Column2 * fY
+ + m_Matrix.Line3.Column3 * fZ
+ + m_Matrix.Line3.Column4;
+ aNewVec[2] = 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[0] /= fZwi;
+ aNewVec[1] /= fZwi;
+ aNewVec[2] /= fZwi;
+ }
+ return aNewVec;
+}
+
+sal_Int32 SAL_CALL Linear3DTransformation::getSourceDimension()
+ throw (RuntimeException)
+{
+ return 3;
+}
+
+sal_Int32 SAL_CALL Linear3DTransformation::getTargetDimension()
+ throw (RuntimeException)
+{
+ return 3;
+}
+
+
+} // namespace chart
diff --git a/chart2/source/view/main/NumberFormatterWrapper.cxx b/chart2/source/view/main/NumberFormatterWrapper.cxx
new file mode 100644
index 000000000000..4e4cd342506c
--- /dev/null
+++ b/chart2/source/view/main/NumberFormatterWrapper.cxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "macros.hxx"
+#include <comphelper/processfactory.hxx>
+// header for class SvNumberFormatsSupplierObj
+#include <svl/numuno.hxx>
+// header for class SvNumberformat
+#include <svl/zformat.hxx>
+#include <tools/color.hxx>
+#include <i18npool/mslangid.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+FixedNumberFormatter::FixedNumberFormatter(
+ const uno::Reference< util::XNumberFormatsSupplier >& xSupplier
+ , sal_Int32 nNumberFormatKey )
+ : m_aNumberFormatterWrapper(xSupplier)
+ , m_nNumberFormatKey( nNumberFormatKey )
+{
+}
+
+FixedNumberFormatter::~FixedNumberFormatter()
+{
+}
+
+/*
+sal_Int32 FixedNumberFormatter::getTextAndColor( double fUnscaledValueForText, rtl::OUString& rLabel ) const
+{
+ sal_Int32 nLabelColor = Color(COL_BLUE).GetColor(); //@todo get this from somewheres
+ rLabel = getFormattedString( fUnscaledValueForText, nLabelColor );
+ return nLabelColor;
+}
+*/
+
+rtl::OUString FixedNumberFormatter::getFormattedString( double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const
+{
+ return m_aNumberFormatterWrapper.getFormattedString(
+ m_nNumberFormatKey, fValue, rLabelColor, rbColorChanged );
+}
+
+//-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+
+NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNumberFormatsSupplier >& xSupplier )
+ : m_xNumberFormatsSupplier(xSupplier)
+ , m_pNumberFormatter(NULL)
+
+{
+ uno::Reference<beans::XPropertySet> xProp(m_xNumberFormatsSupplier,uno::UNO_QUERY);
+ rtl::OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM("NullDate"));
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) )
+ m_aNullDate = xProp->getPropertyValue(sNullDate);
+ SvNumberFormatsSupplierObj* pSupplierObj = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
+ if( pSupplierObj )
+ m_pNumberFormatter = pSupplierObj->GetNumberFormatter();
+ DBG_ASSERT(m_pNumberFormatter,"need a numberformatter");
+}
+
+NumberFormatterWrapper::~NumberFormatterWrapper()
+{
+}
+
+SvNumberFormatter* NumberFormatterWrapper::getSvNumberFormatter() const
+{
+ return m_pNumberFormatter;
+}
+
+rtl::OUString NumberFormatterWrapper::getFormattedString(
+ sal_Int32 nNumberFormatKey, double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const
+{
+ String aText;
+ Color* pTextColor = NULL;
+ if( !m_pNumberFormatter )
+ {
+ DBG_ERROR("Need a NumberFormatter");
+ return aText;
+ }
+ // i99104 handle null date correctly
+ USHORT nYear = 1899,nDay = 30,nMonth = 12;
+ if ( m_aNullDate.hasValue() )
+ {
+ Date* pDate = m_pNumberFormatter->GetNullDate();
+ if ( pDate )
+ {
+ nYear = pDate->GetYear();
+ nMonth = pDate->GetMonth();
+ nDay = pDate->GetDay();
+ } // if ( pDate )
+ util::DateTime aNewNullDate;
+ m_aNullDate >>= aNewNullDate;
+ m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year);
+ }
+ m_pNumberFormatter->GetOutputString(
+ fValue, nNumberFormatKey, aText, &pTextColor);
+ if ( m_aNullDate.hasValue() )
+ {
+ m_pNumberFormatter->ChangeNullDate(nDay,nMonth,nYear);
+ }
+ rtl::OUString aRet( aText );
+
+ if(pTextColor)
+ {
+ rbColorChanged = true;
+ rLabelColor = pTextColor->GetColor();
+ }
+ else
+ rbColorChanged = false;
+
+ return aRet;
+}
+
+// to get the language type use MsLangId::convertLocaleToLanguage( rNumberFormat.aLocale )
+
+/*
+ uno::Reference< i18n::XNumberFormatCode > xNumberFormatCode(
+ m_xCC->getServiceManager()->createInstanceWithContext( C2U(
+ "com.sun.star.i18n.NumberFormatMapper" ), m_xCC ), uno::UNO_QUERY );
+
+ i18n::NumberFormatCode aNumberFormatCode = xNumberFormatCode->getDefault (
+ i18n::KNumberFormatType::MEDIUM,
+ i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER,
+ aLocale );
+
+ uno::Sequence< i18n::NumberFormatCode > aListOfNumberFormatCode = xNumberFormatCode->getAllFormatCode(
+ i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER,
+ aLocale );
+
+ i18n::NumberFormatCode aNumberFormatCode0 = aListOfNumberFormatCode[0];
+ i18n::NumberFormatCode aNumberFormatCode1 = aListOfNumberFormatCode[1];
+*/
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx
new file mode 100644
index 000000000000..08f43dc7064d
--- /dev/null
+++ b/chart2/source/view/main/PlotterBase.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PlotterBase.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include <rtl/math.hxx>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <tools/debug.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+PlotterBase::PlotterBase( sal_Int32 nDimensionCount )
+ : m_xLogicTarget(NULL)
+ , m_xFinalTarget(NULL)
+ , m_xShapeFactory(NULL)
+ , m_pShapeFactory(NULL)
+ , m_aCID()
+ , m_nDimension(nDimensionCount)
+ , m_pPosHelper(NULL)
+{
+}
+
+ void SAL_CALL PlotterBase
+::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
+ , const uno::Reference< drawing::XShapes >& xFinalTarget
+ , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const rtl::OUString& rCID )
+ throw (uno::RuntimeException)
+{
+ DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
+ //is only allowed to be called once
+ m_xLogicTarget = xLogicTarget;
+ m_xFinalTarget = xFinalTarget;
+ m_xShapeFactory = xShapeFactory;
+ m_pShapeFactory = new ShapeFactory(xShapeFactory);
+ m_aCID = rCID;
+}
+
+PlotterBase::~PlotterBase()
+{
+ delete m_pShapeFactory;
+}
+
+void SAL_CALL PlotterBase::setScales( const uno::Sequence< ExplicitScaleData >& rScales
+ , sal_Bool bSwapXAndYAxis )
+ throw (uno::RuntimeException)
+{
+ DBG_ASSERT(m_nDimension<=rScales.getLength(),"Dimension of Plotter does not fit two dimension of given scale sequence");
+ m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
+}
+
+
+void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
+{
+ DBG_ASSERT(m_nDimension==2,"Set this transformation only in case of 2D");
+ if(m_nDimension!=2)
+ return;
+ m_pPosHelper->setTransformationSceneToScreen( rMatrix );
+}
+
+uno::Reference< drawing::XShapes > PlotterBase::createGroupShape(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , ::rtl::OUString rName )
+{
+ if(!m_xShapeFactory.is())
+ return NULL;
+
+ if(m_nDimension==2)
+ {
+ //create and add to target
+ return m_pShapeFactory->createGroup2D( xTarget, rName );
+ }
+ else
+ {
+ //create and added to target
+ return m_pShapeFactory->createGroup3D( xTarget, rName );
+ }
+}
+
+bool PlotterBase::isValidPosition( const drawing::Position3D& rPos )
+{
+ if( ::rtl::math::isNan(rPos.PositionX) )
+ return false;
+ if( ::rtl::math::isNan(rPos.PositionY) )
+ return false;
+ if( ::rtl::math::isNan(rPos.PositionZ) )
+ return false;
+ if( ::rtl::math::isInf(rPos.PositionX) )
+ return false;
+ if( ::rtl::math::isInf(rPos.PositionY) )
+ return false;
+ if( ::rtl::math::isInf(rPos.PositionZ) )
+ return false;
+ return true;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
new file mode 100644
index 000000000000..deb390b70a79
--- /dev/null
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -0,0 +1,667 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ViewDefines.hxx"
+#include "Linear3DTransformation.hxx"
+#include "VPolarTransformation.hxx"
+
+#include "ShapeFactory.hxx"
+#include "PropertyMapper.hxx"
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+#include <rtl/math.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+PlottingPositionHelper::PlottingPositionHelper()
+ : m_aScales()
+ , m_aMatrixScreenToScene()
+ , m_xTransformationLogicToScene(NULL)
+ , m_bSwapXAndY( false )
+ , m_nXResolution( 1000 )
+ , m_nYResolution( 1000 )
+ , m_nZResolution( 1000 )
+ , m_bMaySkipPointsInRegressionCalculation( true )
+{
+}
+PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper& rSource )
+ : m_aScales( rSource.m_aScales )
+ , m_aMatrixScreenToScene( rSource.m_aMatrixScreenToScene )
+ , m_xTransformationLogicToScene( NULL ) //should be recalculated
+ , m_bSwapXAndY( rSource.m_bSwapXAndY )
+ , m_nXResolution( rSource.m_nXResolution )
+ , m_nYResolution( rSource.m_nYResolution )
+ , m_nZResolution( rSource.m_nZResolution )
+ , m_bMaySkipPointsInRegressionCalculation( rSource.m_bMaySkipPointsInRegressionCalculation )
+{
+}
+
+PlottingPositionHelper::~PlottingPositionHelper()
+{
+
+}
+
+PlottingPositionHelper* PlottingPositionHelper::clone() const
+{
+ PlottingPositionHelper* pRet = new PlottingPositionHelper(*this);
+ return pRet;
+}
+
+PlottingPositionHelper* PlottingPositionHelper::createSecondaryPosHelper( const ExplicitScaleData& rSecondaryScale )
+{
+ PlottingPositionHelper* pRet = this->clone();
+ pRet->m_aScales[1]=rSecondaryScale;
+ return pRet;
+}
+
+void PlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
+{
+ m_aMatrixScreenToScene = HomogenMatrixToB3DHomMatrix(rMatrix);
+ m_xTransformationLogicToScene = NULL;
+}
+
+void PlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleData >& rScales, sal_Bool bSwapXAndYAxis )
+{
+ m_aScales = rScales;
+ m_bSwapXAndY = bSwapXAndYAxis;
+ m_xTransformationLogicToScene = NULL;
+}
+const uno::Sequence< ExplicitScaleData >& PlottingPositionHelper::getScales() const
+{
+ return m_aScales;
+}
+
+uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScaledLogicToScene() const
+{
+ //this is a standard transformation for a cartesian coordinate system
+
+ //transformation from 2) to 4) //@todo 2) and 4) need a ink to a document
+
+ //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 an double )
+ if(!m_xTransformationLogicToScene.is())
+ {
+ ::basegfx::B3DHomMatrix aMatrix;
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MinZ = getLogicMinZ();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MaxZ = getLogicMaxZ();
+
+ AxisOrientation nXAxisOrientation = m_aScales[0].Orientation;
+ AxisOrientation nYAxisOrientation = m_aScales[1].Orientation;
+ AxisOrientation nZAxisOrientation = m_aScales[2].Orientation;
+
+ //apply scaling
+ doLogicScaling( &MinX, &MinY, &MinZ );
+ doLogicScaling( &MaxX, &MaxY, &MaxZ);
+
+ if(m_bSwapXAndY)
+ {
+ std::swap(MinX,MinY);
+ std::swap(MaxX,MaxY);
+ std::swap(nXAxisOrientation,nYAxisOrientation);
+ }
+
+ double fWidthX = MaxX - MinX;
+ double fWidthY = MaxY - MinY;
+ double fWidthZ = MaxZ - MinZ;
+
+ double fScaleDirectionX = AxisOrientation_MATHEMATICAL==nXAxisOrientation ? 1.0 : -1.0;
+ double fScaleDirectionY = AxisOrientation_MATHEMATICAL==nYAxisOrientation ? 1.0 : -1.0;
+ double fScaleDirectionZ = AxisOrientation_MATHEMATICAL==nZAxisOrientation ? -1.0 : 1.0;
+
+ double fScaleX = fScaleDirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthX;
+ double fScaleY = fScaleDirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthY;
+ double fScaleZ = fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ;
+
+ aMatrix.scale(fScaleX, fScaleY, fScaleZ);
+
+ if( AxisOrientation_MATHEMATICAL==nXAxisOrientation )
+ aMatrix.translate(-MinX*fScaleX, 0.0, 0.0);
+ else
+ aMatrix.translate(-MaxX*fScaleX, 0.0, 0.0);
+ if( AxisOrientation_MATHEMATICAL==nYAxisOrientation )
+ aMatrix.translate(0.0, -MinY*fScaleY, 0.0);
+ else
+ aMatrix.translate(0.0, -MaxY*fScaleY, 0.0);
+ if( AxisOrientation_MATHEMATICAL==nZAxisOrientation )
+ aMatrix.translate(0.0, 0.0, -MaxZ*fScaleZ);//z direction in draw is reverse mathematical direction
+ else
+ aMatrix.translate(0.0, 0.0, -MinZ*fScaleZ);
+
+ aMatrix = m_aMatrixScreenToScene*aMatrix;
+
+ m_xTransformationLogicToScene = new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix ),m_bSwapXAndY);
+ }
+ return m_xTransformationLogicToScene;
+}
+
+drawing::Position3D PlottingPositionHelper::transformLogicToScene(
+ double fX, double fY, double fZ, bool bClip ) const
+{
+ if(bClip)
+ this->clipLogicValues( &fX,&fY,&fZ );
+ this->doLogicScaling( &fX,&fY,&fZ );
+
+ return this->transformScaledLogicToScene( fX, fY, fZ, false );
+}
+
+drawing::Position3D PlottingPositionHelper::transformScaledLogicToScene(
+ double fX, double fY, double fZ, bool bClip ) const
+{
+ if( bClip )
+ this->clipScaledLogicValues( &fX,&fY,&fZ );
+
+ drawing::Position3D aPos( fX, fY, fZ);
+
+ uno::Reference< XTransformation > xTransformation =
+ this->getTransformationScaledLogicToScene();
+ uno::Sequence< double > aSeq =
+ xTransformation->transform( Position3DToSequence(aPos) );
+ return SequenceToPosition3D(aSeq);
+}
+
+//static
+awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D
+ , const uno::Reference< drawing::XShapes >& xSceneTarget
+ , ShapeFactory* pShapeFactory
+ , sal_Int32 nDimensionCount )
+{
+ //@todo would like to have a cheaper method to do this transformation
+ awt::Point aScreenPoint( static_cast<sal_Int32>(rScenePosition3D.PositionX), static_cast<sal_Int32>(rScenePosition3D.PositionY) );
+
+ //transformation from scene to screen (only neccessary for 3D):
+ if(3==nDimensionCount)
+ {
+ //create 3D anchor shape
+ tPropertyNameMap aDummyPropertyNameMap;
+ uno::Reference< drawing::XShape > xShape3DAnchor = pShapeFactory->createCube( xSceneTarget
+ , rScenePosition3D,drawing::Direction3D(1,1,1)
+ , 0, 0, aDummyPropertyNameMap);
+ //get 2D position from xShape3DAnchor
+ aScreenPoint = xShape3DAnchor->getPosition();
+ xSceneTarget->remove(xShape3DAnchor);
+ }
+ return aScreenPoint;
+}
+
+void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D& rPolygon ) const
+{
+ drawing::Position3D aScenePosition;
+ 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--; )
+ {
+ double& fX = xValues[nP];
+ double& fY = yValues[nP];
+ double& fZ = zValues[nP];
+ aScenePosition = this->transformScaledLogicToScene( fX,fY,fZ,true );
+ fX = aScenePosition.PositionX;
+ fY = aScenePosition.PositionY;
+ fZ = aScenePosition.PositionZ;
+ }
+ }
+}
+
+
+void PlottingPositionHelper::clipScaledLogicValues( double* pX, double* pY, double* pZ ) const
+{
+ //get logic clip values:
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MinZ = getLogicMinZ();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MaxZ = getLogicMaxZ();
+
+ //apply scaling
+ doLogicScaling( &MinX, &MinY, &MinZ );
+ doLogicScaling( &MaxX, &MaxY, &MaxZ);
+
+ if(pX)
+ {
+ if( *pX < MinX )
+ *pX = MinX;
+ else if( *pX > MaxX )
+ *pX = MaxX;
+ }
+ if(pY)
+ {
+ if( *pY < MinY )
+ *pY = MinY;
+ else if( *pY > MaxY )
+ *pY = MaxY;
+ }
+ if(pZ)
+ {
+ if( *pZ < MinZ )
+ *pZ = MinZ;
+ else if( *pZ > MaxZ )
+ *pZ = MaxZ;
+ }
+}
+
+basegfx::B2DRectangle PlottingPositionHelper::getScaledLogicClipDoubleRect() const
+{
+ //get logic clip values:
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MinZ = getLogicMinZ();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MaxZ = getLogicMaxZ();
+
+ //apply scaling
+ doLogicScaling( &MinX, &MinY, &MinZ );
+ doLogicScaling( &MaxX, &MaxY, &MaxZ);
+
+ basegfx::B2DRectangle aRet( MinX, MaxY, MaxX, MinY );
+ return aRet;
+}
+
+drawing::Direction3D PlottingPositionHelper::getScaledLogicWidth() const
+{
+ drawing::Direction3D aRet;
+
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MinZ = getLogicMinZ();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MaxZ = getLogicMaxZ();
+
+ doLogicScaling( &MinX, &MinY, &MinZ );
+ doLogicScaling( &MaxX, &MaxY, &MaxZ);
+
+ aRet.DirectionX = MaxX - MinX;
+ aRet.DirectionY = MaxY - MinY;
+ aRet.DirectionZ = MaxZ - MinZ;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+PolarPlottingPositionHelper::PolarPlottingPositionHelper( NormalAxis eNormalAxis )
+ : m_fRadiusOffset(0.0)
+ , m_fAngleDegreeOffset(90.0)
+ , m_aUnitCartesianToScene()
+ , m_eNormalAxis(eNormalAxis)
+{
+ m_bMaySkipPointsInRegressionCalculation = false;
+}
+
+PolarPlottingPositionHelper::PolarPlottingPositionHelper( const PolarPlottingPositionHelper& rSource )
+ : PlottingPositionHelper(rSource)
+ , m_fRadiusOffset( rSource.m_fRadiusOffset )
+ , m_fAngleDegreeOffset( rSource.m_fAngleDegreeOffset )
+ , m_aUnitCartesianToScene( rSource.m_aUnitCartesianToScene )
+ , m_eNormalAxis( rSource.m_eNormalAxis )
+{
+}
+
+PolarPlottingPositionHelper::~PolarPlottingPositionHelper()
+{
+}
+
+PlottingPositionHelper* PolarPlottingPositionHelper::clone() const
+{
+ PolarPlottingPositionHelper* pRet = new PolarPlottingPositionHelper(*this);
+ return pRet;
+}
+
+void PolarPlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
+{
+ PlottingPositionHelper::setTransformationSceneToScreen( rMatrix);
+ m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
+}
+void PolarPlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleData >& rScales, sal_Bool bSwapXAndYAxis )
+{
+ PlottingPositionHelper::setScales( rScales, bSwapXAndYAxis );
+ m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
+}
+
+::basegfx::B3DHomMatrix PolarPlottingPositionHelper::impl_calculateMatrixUnitCartesianToScene( const ::basegfx::B3DHomMatrix& rMatrixScreenToScene ) const
+{
+ ::basegfx::B3DHomMatrix aRet;
+
+ if( !m_aScales.getLength() )
+ return aRet;
+
+ double fTranslate =1.0;
+ double fScale =FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0;
+
+ double fTranslateLogicZ =fTranslate;
+ double fScaleLogicZ =fScale;
+ {
+ double fScaleDirectionZ = AxisOrientation_MATHEMATICAL==m_aScales[2].Orientation ? 1.0 : -1.0;
+ double MinZ = getLogicMinZ();
+ double MaxZ = getLogicMaxZ();
+ doLogicScaling( 0, 0, &MinZ );
+ doLogicScaling( 0, 0, &MaxZ );
+ double fWidthZ = MaxZ - MinZ;
+
+ if( AxisOrientation_MATHEMATICAL==m_aScales[2].Orientation )
+ fTranslateLogicZ=MinZ;
+ else
+ fTranslateLogicZ=MaxZ;
+ fScaleLogicZ = fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ;
+ }
+
+ double fTranslateX = fTranslate;
+ double fTranslateY = fTranslate;
+ double fTranslateZ = fTranslate;
+
+ double fScaleX = fScale;
+ double fScaleY = fScale;
+ double fScaleZ = fScale;
+
+ switch(m_eNormalAxis)
+ {
+ case NormalAxis_X:
+ {
+ fTranslateX = fTranslateLogicZ;
+ fScaleX = fScaleLogicZ;
+ }
+ break;
+ case NormalAxis_Y:
+ {
+ fTranslateY = fTranslateLogicZ;
+ fScaleY = fScaleLogicZ;
+ }
+ break;
+ default: //NormalAxis_Z:
+ {
+ fTranslateZ = fTranslateLogicZ;
+ fScaleZ = fScaleLogicZ;
+ }
+ break;
+ }
+
+ aRet.translate(fTranslateX, fTranslateY, fTranslateZ);//x first
+ aRet.scale(fScaleX, fScaleY, fScaleZ);//x first
+
+ aRet = rMatrixScreenToScene * aRet;
+ return aRet;
+}
+
+::basegfx::B3DHomMatrix PolarPlottingPositionHelper::getUnitCartesianToScene() const
+{
+ return m_aUnitCartesianToScene;
+}
+
+uno::Reference< XTransformation > PolarPlottingPositionHelper::getTransformationScaledLogicToScene() const
+{
+ if( !m_xTransformationLogicToScene.is() )
+ m_xTransformationLogicToScene = new VPolarTransformation(*this);
+ return m_xTransformationLogicToScene;
+}
+
+double PolarPlottingPositionHelper::getWidthAngleDegree( double& fStartLogicValueOnAngleAxis, double& fEndLogicValueOnAngleAxis ) const
+{
+ const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
+ if( AxisOrientation_MATHEMATICAL != rAngleScale.Orientation )
+ {
+ double fHelp = fEndLogicValueOnAngleAxis;
+ fEndLogicValueOnAngleAxis = fStartLogicValueOnAngleAxis;
+ fStartLogicValueOnAngleAxis = fHelp;
+ }
+
+ double fStartAngleDegree = this->transformToAngleDegree( fStartLogicValueOnAngleAxis );
+ double fEndAngleDegree = this->transformToAngleDegree( fEndLogicValueOnAngleAxis );
+ double fWidthAngleDegree = fEndAngleDegree - fStartAngleDegree;
+
+ if( ::rtl::math::approxEqual( fStartAngleDegree, fEndAngleDegree )
+ && !::rtl::math::approxEqual( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis ) )
+ fWidthAngleDegree = 360.0;
+
+ while(fWidthAngleDegree<0.0)
+ fWidthAngleDegree+=360.0;
+ while(fWidthAngleDegree>360.0)
+ fWidthAngleDegree-=360.0;
+
+ return fWidthAngleDegree;
+}
+
+double PolarPlottingPositionHelper::transformToAngleDegree( double fLogicValueOnAngleAxis, bool bDoScaling ) const
+{
+ double fRet=0.0;
+
+ double fAxisAngleScaleDirection = 1.0;
+ {
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
+ if(AxisOrientation_MATHEMATICAL != rScale.Orientation)
+ fAxisAngleScaleDirection *= -1.0;
+ }
+
+ double MinAngleValue = 0.0;
+ double MaxAngleValue = 0.0;
+ {
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ double MinZ = getLogicMinZ();
+ double MaxZ = getLogicMaxZ();
+
+ doLogicScaling( &MinX, &MinY, &MinZ );
+ doLogicScaling( &MaxX, &MaxY, &MaxZ);
+
+ MinAngleValue = m_bSwapXAndY ? MinY : MinX;
+ MaxAngleValue = m_bSwapXAndY ? MaxY : MaxX;
+ }
+
+ double fScaledLogicAngleValue = 0.0;
+ if(bDoScaling)
+ {
+ double fX = m_bSwapXAndY ? getLogicMaxX() : fLogicValueOnAngleAxis;
+ double fY = m_bSwapXAndY ? fLogicValueOnAngleAxis : getLogicMaxY();
+ double fZ = getLogicMaxZ();
+ clipLogicValues( &fX, &fY, &fZ );
+ doLogicScaling( &fX, &fY, &fZ );
+ fScaledLogicAngleValue = m_bSwapXAndY ? fY : fX;
+ }
+ else
+ fScaledLogicAngleValue = fLogicValueOnAngleAxis;
+
+ fRet = m_fAngleDegreeOffset
+ + fAxisAngleScaleDirection*(fScaledLogicAngleValue-MinAngleValue)*360.0
+ /fabs(MaxAngleValue-MinAngleValue);
+ while(fRet>360.0)
+ fRet-=360.0;
+ while(fRet<0)
+ fRet+=360.0;
+ return fRet;
+}
+
+double PolarPlottingPositionHelper::transformToRadius( double fLogicValueOnRadiusAxis, bool bDoScaling ) const
+{
+ double fNormalRadius = 0.0;
+ {
+ double fScaledLogicRadiusValue = 0.0;
+ double fX = m_bSwapXAndY ? fLogicValueOnRadiusAxis: getLogicMaxX();
+ double fY = m_bSwapXAndY ? getLogicMaxY() : fLogicValueOnRadiusAxis;
+ if(bDoScaling)
+ doLogicScaling( &fX, &fY, 0 );
+
+ fScaledLogicRadiusValue = m_bSwapXAndY ? fX : fY;
+
+ bool bMinIsInnerRadius = true;
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
+ if(AxisOrientation_MATHEMATICAL != rScale.Orientation)
+ bMinIsInnerRadius = false;
+
+ double fInnerScaledLogicRadius=0.0;
+ double fOuterScaledLogicRadius=0.0;
+ {
+ double MinX = getLogicMinX();
+ double MinY = getLogicMinY();
+ doLogicScaling( &MinX, &MinY, 0 );
+ double MaxX = getLogicMaxX();
+ double MaxY = getLogicMaxY();
+ doLogicScaling( &MaxX, &MaxY, 0 );
+
+ double fMin = m_bSwapXAndY ? MinX : MinY;
+ double fMax = m_bSwapXAndY ? MaxX : MaxY;
+
+ fInnerScaledLogicRadius = bMinIsInnerRadius ? fMin : fMax;
+ fOuterScaledLogicRadius = bMinIsInnerRadius ? fMax : fMin;
+ }
+
+ if( bMinIsInnerRadius )
+ fInnerScaledLogicRadius -= fabs(m_fRadiusOffset);
+ else
+ fInnerScaledLogicRadius += fabs(m_fRadiusOffset);
+ fNormalRadius = (fScaledLogicRadiusValue-fInnerScaledLogicRadius)/(fOuterScaledLogicRadius-fInnerScaledLogicRadius);
+ }
+ return fNormalRadius;
+}
+
+drawing::Position3D PolarPlottingPositionHelper::transformLogicToScene( double fX, double fY, double fZ, bool bClip ) const
+{
+ if(bClip)
+ this->clipLogicValues( &fX,&fY,&fZ );
+ double fLogicValueOnAngleAxis = m_bSwapXAndY ? fY : fX;
+ double fLogicValueOnRadiusAxis = m_bSwapXAndY ? fX : fY;
+ return this->transformAngleRadiusToScene( fLogicValueOnAngleAxis, fLogicValueOnRadiusAxis, fZ, true );
+}
+
+drawing::Position3D PolarPlottingPositionHelper::transformScaledLogicToScene( double fX, double fY, double fZ, bool bClip ) const
+{
+ if(bClip)
+ this->clipScaledLogicValues( &fX,&fY,&fZ );
+ double fLogicValueOnAngleAxis = m_bSwapXAndY ? fY : fX;
+ double fLogicValueOnRadiusAxis = m_bSwapXAndY ? fX : fY;
+ return this->transformAngleRadiusToScene( fLogicValueOnAngleAxis, fLogicValueOnRadiusAxis, fZ, false );
+}
+drawing::Position3D PolarPlottingPositionHelper::transformUnitCircleToScene( double fUnitAngleDegree, double fUnitRadius
+ , double fLogicZ, bool /* bDoScaling */ ) const
+{
+ double fAnglePi = fUnitAngleDegree*F_PI/180.0;
+
+ double fX=fUnitRadius*rtl::math::cos(fAnglePi);
+ double fY=fUnitRadius*rtl::math::sin(fAnglePi);
+ double fZ=fLogicZ;
+
+ switch(m_eNormalAxis)
+ {
+ case NormalAxis_X:
+ std::swap(fX,fZ);
+ break;
+ case NormalAxis_Y:
+ std::swap(fY,fZ);
+ fZ*=-1;
+ break;
+ default: //NormalAxis_Z
+ break;
+ }
+
+ //!! 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 B3DPointToPosition3D(aRet);
+}
+
+drawing::Position3D PolarPlottingPositionHelper::transformAngleRadiusToScene( double fLogicValueOnAngleAxis, double fLogicValueOnRadiusAxis, double fLogicZ, bool bDoScaling ) const
+{
+ double fUnitAngleDegree = this->transformToAngleDegree(fLogicValueOnAngleAxis,bDoScaling);
+ double fUnitRadius = this->transformToRadius(fLogicValueOnRadiusAxis,bDoScaling);
+
+ return transformUnitCircleToScene( fUnitAngleDegree, fUnitRadius, fLogicZ, bDoScaling );
+}
+
+#ifdef NOTYET
+double PolarPlottingPositionHelper::getInnerLogicRadius() const
+{
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
+ if( AxisOrientation_MATHEMATICAL==rScale.Orientation )
+ return rScale.Minimum;
+ else
+ return rScale.Maximum;
+}
+#endif
+
+double PolarPlottingPositionHelper::getOuterLogicRadius() const
+{
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
+ if( AxisOrientation_MATHEMATICAL==rScale.Orientation )
+ return rScale.Maximum;
+ else
+ return rScale.Minimum;
+}
+
+bool PlottingPositionHelper::isPercentY() const
+{
+ return m_aScales[1].AxisType==AxisType::PERCENT;
+}
+
+double PlottingPositionHelper::getBaseValueY() const
+{
+ return m_aScales[1].Origin;
+}
+
+/*
+// ____ XTransformation ____
+uno::Sequence< double > SAL_CALL PolarPlottingPositionHelper::transform(
+ const uno::Sequence< double >& rSourceValues )
+ throw (uno::RuntimeException, lang::IllegalArgumentException)
+{
+ uno::Sequence< double > aSourceValues(3);
+ return aSourceValues;
+}
+
+sal_Int32 SAL_CALL PolarPlottingPositionHelper::getSourceDimension() throw (uno::RuntimeException)
+{
+ return 3;
+}
+
+sal_Int32 SAL_CALL PolarPlottingPositionHelper::getTargetDimension() throw (uno::RuntimeException)
+{
+ return 3;
+}
+*/
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx
new file mode 100644
index 000000000000..8e5402b48d63
--- /dev/null
+++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "PolarLabelPositionHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "CommonConverters.hxx"
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+
+//.............................................................................
+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( pPosHelper, nDimensionCount, xLogicTarget, pShapeFactory )
+ , m_pPosHelper(pPosHelper)
+{
+}
+
+PolarLabelPositionHelper::~PolarLabelPositionHelper()
+{
+}
+
+awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForLogicValues(
+ LabelAlignment& rAlignment
+ , double fLogicValueOnAngleAxis
+ , double fLogicValueOnRadiusAxis
+ , double fLogicZ
+ , sal_Int32 nScreenValueOffsetInRadiusDirection ) const
+{
+ double fUnitCircleAngleDegree = m_pPosHelper->transformToAngleDegree( fLogicValueOnAngleAxis );
+ double fUnitCircleRadius = m_pPosHelper->transformToRadius( fLogicValueOnRadiusAxis );
+
+ return getLabelScreenPositionAndAlignmentForUnitCircleValues(
+ rAlignment, ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
+ , fUnitCircleAngleDegree, 0.0
+ , fUnitCircleRadius, fUnitCircleRadius, fLogicZ, nScreenValueOffsetInRadiusDirection );
+}
+
+awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCircleValues(
+ LabelAlignment& rAlignment, sal_Int32 nLabelPlacement
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , double fLogicZ
+ , sal_Int32 nScreenValueOffsetInRadiusDirection ) const
+{
+ bool bCenter = (nLabelPlacement != ::com::sun::star::chart::DataLabelPlacement::OUTSIDE)
+ && (nLabelPlacement != ::com::sun::star::chart::DataLabelPlacement::INSIDE);
+
+ double fAngleDegree = fUnitCircleStartAngleDegree + fUnitCircleWidthAngleDegree/2.0;
+ double fRadius = 0.0;
+ if( !bCenter ) //e.g. for pure pie chart(one ring only) or for angle axis of polyar coordinate system
+ fRadius = fUnitCircleOuterRadius;
+ else
+ fRadius = fUnitCircleInnerRadius + (fUnitCircleOuterRadius-fUnitCircleInnerRadius)/2.0 ;
+
+ awt::Point aRet( this->transformSceneToScreenPosition(
+ m_pPosHelper->transformUnitCircleToScene( fAngleDegree, fRadius, fLogicZ+0.5 ) ) );
+
+ if(3==m_nDimensionCount && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE)
+ {
+ //check wether the upper or the downer edge is more distant from the center
+ //take the farest point to put the label to
+
+ awt::Point aP0( this->transformSceneToScreenPosition(
+ m_pPosHelper->transformUnitCircleToScene( 0, 0, fLogicZ ) ) );
+ awt::Point aP1(aRet);
+ awt::Point aP2( this->transformSceneToScreenPosition(
+ m_pPosHelper->transformUnitCircleToScene( fAngleDegree, fRadius, fLogicZ-0.5 ) ) );
+
+ ::basegfx::B2DVector aV0( aP0.X, aP0.Y );
+ ::basegfx::B2DVector aV1( aP1.X, aP1.Y );
+ ::basegfx::B2DVector aV2( aP2.X, aP2.Y );
+
+ double fL1 = ::basegfx::B2DVector(aV1-aV0).getLength();
+ double fL2 = ::basegfx::B2DVector(aV2-aV0).getLength();
+
+ if(fL2>fL1)
+ aRet = aP2;
+
+ //calculate new angle for alignment
+ 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 = atan(fDY/fDX)*180.0/F_PI;
+ if(fDX<0.0)
+ fAngleDegree+=180.0;
+ }
+ else
+ {
+ if(fDY>0.0)
+ fAngleDegree = 90.0;
+ else
+ fAngleDegree = 270.0;
+ }
+ }
+ //------------------------------
+ //set LabelAlignment
+ if( !bCenter )
+ {
+ while(fAngleDegree>360.0)
+ fAngleDegree-=360.0;
+ while(fAngleDegree<0.0)
+ fAngleDegree+=360.0;
+
+ bool bOutside = nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+
+ if(fAngleDegree==0.0)
+ rAlignment = LABEL_ALIGN_CENTER;
+ else if(fAngleDegree<=22.5)
+ rAlignment = bOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
+ else if(fAngleDegree<67.5)
+ rAlignment = bOutside ? LABEL_ALIGN_RIGHT_TOP : LABEL_ALIGN_LEFT_BOTTOM;
+ else if(fAngleDegree<112.5)
+ rAlignment = bOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
+ else if(fAngleDegree<=157.5)
+ rAlignment = bOutside ? LABEL_ALIGN_LEFT_TOP : LABEL_ALIGN_RIGHT_BOTTOM;
+ else if(fAngleDegree<=202.5)
+ rAlignment = bOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+ else if(fAngleDegree<247.5)
+ rAlignment = bOutside ? LABEL_ALIGN_LEFT_BOTTOM : LABEL_ALIGN_RIGHT_TOP;
+ else if(fAngleDegree<292.5)
+ 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;
+ }
+ else
+ {
+ rAlignment = LABEL_ALIGN_CENTER;
+ }
+
+ //add a scaling independent Offset if requested
+ if( nScreenValueOffsetInRadiusDirection != 0)
+ {
+ awt::Point aOrigin( this->transformSceneToScreenPosition(
+ m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, fLogicZ+0.5 ) ) );
+ basegfx::B2IVector aDirection( aRet.X- aOrigin.X, aRet.Y- aOrigin.Y );
+ aDirection.setLength(nScreenValueOffsetInRadiusDirection);
+ aRet.X += aDirection.getX();
+ aRet.Y += aDirection.getY();
+ }
+
+ return aRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
new file mode 100644
index 000000000000..1979582763fa
--- /dev/null
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -0,0 +1,539 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "PropertyMapper.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+namespace
+{
+
+void lcl_overwriteOrAppendValues(
+ tPropertyNameValueMap &rMap, const tPropertyNameValueMap& rOverwriteMap )
+{
+ tPropertyNameValueMap::const_iterator aIt( rOverwriteMap.begin() );
+ tPropertyNameValueMap::const_iterator aEnd( rOverwriteMap.end() );
+
+ for( ; aIt != aEnd; ++aIt )
+ rMap[ aIt->first ] = aIt->second;
+}
+
+} // anonymous namespace
+
+//static
+void PropertyMapper::setMappedProperties(
+ const uno::Reference< beans::XPropertySet >& xTarget
+ , const uno::Reference< beans::XPropertySet >& xSource
+ , const tPropertyNameMap& rMap
+ , tPropertyNameValueMap* pOverwriteMap )
+{
+ if( !xTarget.is() || !xSource.is() )
+ return;
+
+ tNameSequence aNames;
+ tAnySequence aValues;
+ getMultiPropertyLists(aNames, aValues, xSource, rMap );
+ if(pOverwriteMap && (aNames.getLength() == aValues.getLength()))
+ {
+ tPropertyNameValueMap aNewMap;
+ for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI )
+ aNewMap[ aNames[nI] ] = aValues[nI];
+ lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap );
+ aNames = ContainerHelper::MapKeysToSequence( aNewMap );
+ aValues = ContainerHelper::MapValuesToSequence( aNewMap );
+ }
+
+ PropertyMapper::setMultiProperties( aNames, aValues, xTarget );
+}
+
+void PropertyMapper::getValueMap(
+ tPropertyNameValueMap& rValueMap
+ , const tPropertyNameMap& rNameMap
+ , const uno::Reference< beans::XPropertySet >& xSourceProp
+ )
+{
+ tPropertyNameMap::const_iterator aIt( rNameMap.begin() );
+ tPropertyNameMap::const_iterator aEnd( rNameMap.end() );
+
+ for( ; aIt != aEnd; ++aIt )
+ {
+ rtl::OUString aTarget = aIt->first;
+ rtl::OUString aSource = aIt->second;
+ try
+ {
+ uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
+ if( aAny.hasValue() )
+ rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+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
+ , const tPropertyNameValueMap& rValueMap
+ )
+{
+ sal_Int32 nPropertyCount = rValueMap.size();
+ rNames.realloc(nPropertyCount);
+ rValues.realloc(nPropertyCount);
+
+ //fill sequences
+ tPropertyNameValueMap::const_iterator aValueIt( rValueMap.begin() );
+ tPropertyNameValueMap::const_iterator aValueEnd( rValueMap.end() );
+ sal_Int32 nN=0;
+ for( ; aValueIt != aValueEnd; ++aValueIt )
+ {
+ const uno::Any& rAny = aValueIt->second;
+ if( rAny.hasValue() )
+ {
+ //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
+ rNames[nN] = aValueIt->first;
+ rValues[nN] = rAny;
+ ++nN;
+ }
+ }
+ //reduce to real property count
+ rNames.realloc(nN);
+ rValues.realloc(nN);
+}
+
+uno::Any* PropertyMapper::getValuePointer( tAnySequence& rPropValues
+ , const tNameSequence& rPropNames
+ , const rtl::OUString& rPropName )
+{
+ sal_Int32 nCount = rPropNames.getLength();
+ for( sal_Int32 nN = 0; nN < nCount; nN++ )
+ {
+ if(rPropNames[nN].equals(rPropName))
+ return &rPropValues[nN];
+ }
+ return NULL;
+}
+
+uno::Any* PropertyMapper::getValuePointerForLimitedSpace( tAnySequence& rPropValues
+ , const tNameSequence& rPropNames
+ , bool bLimitedHeight)
+{
+ return PropertyMapper::getValuePointer( rPropValues, rPropNames
+ , bLimitedHeight ? C2U("TextMaximumFrameHeight") : C2U("TextMaximumFrameWidth") );
+}
+
+/*
+//set some properties from service style::CharacterProperties:
+//-------- tabpage: Zeichen -----------
+//Schriftart z.B. Albany UNO_NAME_EDIT_CHAR_FONTNAME == UNO_NAME_EDIT_CHAR_FONTSTYLENAME //UNO_NAME_CHAR_FONT
+//Schriftschnitt z.B. kursiv UNO_NAME_EDIT_CHAR_POSTURE UNO_NAME_CHAR_POSTURE awt::FontSlant NONE OBLIQUE ITALIC DONTKNOW REVERSE_OBLIQUE REVERSE_ITALIC
+//Schriftgrad (Punktgrösse z.B. 12) UNO_NAME_EDIT_CHAR_HEIGHT == UNO_NAME_CHAR_HEIGHT
+ //? UNO_NAME_EDIT_CHAR_WEIGHT == UNO_NAME_CHAR_WEIGHT
+//Sprache UNO_NAME_EDIT_CHAR_LOCALE lang::Locale
+
+//-------- tabpage: Schrifteffekt -----------
+//Unterstreichung UNO_NAME_CHAR_UNDERLINE sal_Int16 awt::FontUnderline_NONE _SINGLE _DOUBLE _DOTTED _DONTKNOW _DASH ...
+//Unterstreichung-farbe ??? 'CharUnderlineColor' + CharUnderlineHasColor
+//Durchstreichung z.B. doppelt "CharStrikeout" sal_Int16 awt::FontStrikeout_NONE _SINGLE _DOUBLE ...
+//wortweise-Durchstreichung ja/nein "CharWordMode" bool
+//Schriftfarbe UNO_NAME_EDIT_CHAR_COLOR sal_Int32 UNO_NAME_CHAR_COLOR
+//ReliefArt ohne/erhaben/tief "CharRelief" sal_Int16 text::FontRelief_NONE FontRelief_EMBOSSED FontRelief_ENGRAVED
+//Kontur "CharContoured" bool
+//Schatten UNO_NAME_CHAR_SHADOWED bool
+*/
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForCharacterProperties =
+ tMakePropertyNameMap
+// ( C2U( "CharBackColor" ), C2U("TextBackgroundColor") )
+// ( C2U( "CharCaseMap" ), C2U("CaseMapping") )
+ ( C2U( "CharColor" ), C2U("CharColor") )
+ ( C2U( "CharContoured" ), C2U("CharContoured") )
+/////// ( C2U( "CharCrossedOut" ), C2U("CharCrossedOut") ) //setting this explicitly somehow conflicts with CharStrikeout
+ ( C2U( "CharEmphasis" ), C2U("CharEmphasis") )//the service style::CharacterProperties describes a property called 'CharEmphasize' wich is nowhere implemented
+// ( C2U( "CharEscapement" ), C2U("CharEscapement") ) //#i98344# @future: add these to properties again, if the user interface offers the possibility to change them; then make sure that older wrong files are corrected on import
+// ( C2U( "CharEscapementHeight" ), C2U("CharEscapementHeight") ) //#i98344# @future: add these to properties again, if the user interface offers the possibility to change them; then make sure that older wrong files are corrected on import
+// ( C2U( "CharFlash" ), C2U("Flashing") )
+
+ ( C2U( "CharFontFamily" ), C2U("CharFontFamily") )
+ ( C2U( "CharFontFamilyAsian" ), C2U("CharFontFamilyAsian") )
+ ( C2U( "CharFontFamilyComplex" ), C2U("CharFontFamilyComplex") )
+ ( C2U( "CharFontCharSet" ), C2U("CharFontCharSet") )
+ ( C2U( "CharFontCharSetAsian" ), C2U("CharFontCharSetAsian") )
+ ( C2U( "CharFontCharSetComplex" ), C2U("CharFontCharSetComplex") )
+ ( C2U( "CharFontName" ), C2U("CharFontName") )
+ ( C2U( "CharFontNameAsian" ), C2U("CharFontNameAsian") )
+ ( C2U( "CharFontNameComplex" ), C2U("CharFontNameComplex") )
+ ( C2U( "CharFontPitch" ), C2U("CharFontPitch") )
+ ( C2U( "CharFontPitchAsian" ), C2U("CharFontPitchAsian") )
+ ( C2U( "CharFontPitchComplex" ), C2U("CharFontPitchComplex") )
+ ( C2U( "CharFontStyleName" ), C2U("CharFontStyleName") )
+ ( C2U( "CharFontStyleNameAsian" ), C2U("CharFontStyleNameAsian") )
+ ( C2U( "CharFontStyleNameComplex" ),C2U("CharFontStyleNameComplex") )
+
+ ( C2U( "CharHeight" ), C2U("CharHeight") )
+ ( C2U( "CharHeightAsian" ), C2U("CharHeightAsian") )
+ ( C2U( "CharHeightComplex" ), C2U("CharHeightComplex") )
+ ( C2U( "CharKerning" ), C2U("CharKerning") )
+ ( C2U( "CharLocale" ), C2U("CharLocale") )
+ ( C2U( "CharLocaleAsian" ), C2U("CharLocaleAsian") )
+ ( C2U( "CharLocaleComplex" ), C2U("CharLocaleComplex") )
+// ( C2U( "CharNoHyphenation" ), C2U("InhibitHyphenation") )
+ ( C2U( "CharPosture" ), C2U("CharPosture") )
+ ( C2U( "CharPostureAsian" ), C2U("CharPostureAsian") )
+ ( C2U( "CharPostureComplex" ), C2U("CharPostureComplex") )
+ ( C2U( "CharRelief" ), C2U("CharRelief") )
+// ( C2U( "CharRotation" ), C2U("Rotation") ) --> additional feature ...
+// ( C2U( "CharScaleWidth" ), C2U("CharScaleWidth") )
+ ( C2U( "CharShadowed" ), C2U("CharShadowed") )
+ ( C2U( "CharStrikeout" ), C2U("CharStrikeout") )
+ ( C2U( "CharUnderline" ), C2U("CharUnderline") )
+ ( C2U( "CharUnderlineColor" ), C2U("CharUnderlineColor") )
+ ( C2U( "CharUnderlineHasColor" ), C2U("CharUnderlineHasColor") )
+ ( C2U( "CharWeight" ), C2U("CharWeight") )
+ ( C2U( "CharWeightAsian" ), C2U("CharWeightAsian") )
+ ( C2U( "CharWeightComplex" ), C2U("CharWeightComplex") )
+ ( C2U( "CharWordMode" ), C2U("CharWordMode") )
+
+ ( C2U( "WritingMode" ), C2U("WritingMode") )
+
+// ( C2U( "RubyText" ), C2U("RubyText") )
+// ( C2U( "RubyAdjust" ), C2U("RubyAdjust") )
+// ( C2U( "RubyCharStyleName" ), C2U("RubyStyleName") )
+// ( C2U( "RubyIsAbove" ), C2U("RubyIsAbove") )
+ ( C2U( "ParaIsCharacterDistance" ), C2U("ParaIsCharacterDistance") )
+ ;
+ return m_aShapePropertyMapForCharacterProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForParagraphProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForParagraphProperties =
+ tMakePropertyNameMap
+ ( C2U( "ParaAdjust" ), C2U("ParaAdjust") )
+ ( C2U( "ParaBottomMargin" ), C2U("ParaBottomMargin") )
+ ( C2U( "ParaIsHyphenation" ), C2U("ParaIsHyphenation") )
+ ( C2U( "ParaLastLineAdjust" ), C2U("ParaLastLineAdjust") )
+ ( C2U( "ParaLeftMargin" ), C2U("ParaLeftMargin") )
+ ( C2U( "ParaRightMargin" ), C2U("ParaRightMargin") )
+ ( C2U( "ParaTopMargin" ), C2U("ParaTopMargin") )
+ ;
+ return m_aShapePropertyMapForParagraphProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForFillProperties =
+ tMakePropertyNameMap
+ ( C2U( "FillBackground" ), C2U( "FillBackground" ) )
+ ( C2U( "FillBitmapName" ), C2U( "FillBitmapName" ) )
+ ( C2U( "FillColor" ), C2U( "FillColor" ) )
+ ( C2U( "FillGradientName" ), C2U( "FillGradientName" ) )
+ ( C2U( "FillGradientStepCount" ), C2U( "FillGradientStepCount" ) )
+ ( C2U( "FillHatchName" ), C2U( "FillHatchName" ) )
+ ( C2U( "FillStyle" ), C2U( "FillStyle" ) )
+ ( C2U( "FillTransparence" ), C2U( "FillTransparence" ) )
+ ( C2U( "FillTransparenceGradientName" ), C2U("FillTransparenceGradientName") )
+ //bitmap properties
+ ( C2U( "FillBitmapMode" ), C2U( "FillBitmapMode" ) )
+ ( C2U( "FillBitmapSizeX" ), C2U( "FillBitmapSizeX" ) )
+ ( C2U( "FillBitmapSizeY" ), C2U( "FillBitmapSizeY" ) )
+ ( C2U( "FillBitmapLogicalSize" ), C2U( "FillBitmapLogicalSize" ) )
+ ( C2U( "FillBitmapOffsetX" ), C2U( "FillBitmapOffsetX" ) )
+ ( C2U( "FillBitmapOffsetY" ), C2U( "FillBitmapOffsetY" ) )
+ ( C2U( "FillBitmapRectanglePoint" ),C2U( "FillBitmapRectanglePoint" ) )
+ ( C2U( "FillBitmapPositionOffsetX" ),C2U( "FillBitmapPositionOffsetX" ) )
+ ( C2U( "FillBitmapPositionOffsetY" ),C2U( "FillBitmapPositionOffsetY" ) )
+ ;
+ return m_aShapePropertyMapForFillProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForLineProperties =
+ tMakePropertyNameMap
+ ( C2U( "LineColor" ), C2U( "LineColor" ) )
+ ( C2U( "LineDashName" ), C2U( "LineDashName" ) )
+ ( C2U( "LineJoint" ), C2U( "LineJoint" ) )
+ ( C2U( "LineStyle" ), C2U( "LineStyle" ) )
+ ( C2U( "LineTransparence" ), C2U( "LineTransparence" ) )
+ ( C2U( "LineWidth" ), C2U( "LineWidth" ) )
+ ;
+ return m_aShapePropertyMapForLineProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillAndLineProperties()
+{
+ static tMakePropertyNameMap m_aShapePropertyMapForFillAndLineProperties =
+ tMakePropertyNameMap
+ ( PropertyMapper::getPropertyNameMapForFillProperties() )
+ ( PropertyMapper::getPropertyNameMapForLineProperties() )
+ ;
+
+ return m_aShapePropertyMapForFillAndLineProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForTextShapeProperties()
+{
+ static tMakePropertyNameMap m_aShapePropertyMapForTextShapeProperties =
+ tMakePropertyNameMap
+ ( PropertyMapper::getPropertyNameMapForCharacterProperties() )
+ ( PropertyMapper::getPropertyNameMapForFillProperties() )
+ ( PropertyMapper::getPropertyNameMapForLineProperties() )
+// ( PropertyMapper::getPropertyNameMapForParagraphProperties() )
+ // some text properties
+// ( C2U( "TextHorizontalAdjust" ), C2U( "TextHorizontalAdjust" ) )
+// ( C2U( "TextVerticalAdjust" ), C2U( "TextVerticalAdjust" ) )
+// ( C2U( "TextAutoGrowHeight" ), C2U( "TextAutoGrowHeight" ) )
+// ( C2U( "TextAutoGrowWidth" ), C2U( "TextAutoGrowWidth" ) )
+// ( C2U( "TextLeftDistance" ), C2U( "TextLeftDistance" ) )
+// ( C2U( "TextRightDistance" ), C2U( "TextRightDistance" ) )
+// ( C2U( "TextUpperDistance" ), C2U( "TextUpperDistance" ) )
+// ( C2U( "TextLowerDistance" ), C2U( "TextLowerDistance" ) )
+ ;
+
+ return m_aShapePropertyMapForTextShapeProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForLineSeriesProperties =
+ tMakePropertyNameMap
+ ( C2U( "LineColor" ), C2U("Color") )
+ ( C2U( "LineDashName" ), C2U("LineDashName") )
+// ( C2U( "LineJoint" ), C2U("LineJoint") )
+ ( C2U( "LineStyle" ), C2U("LineStyle") )
+ ( C2U( "LineTransparence" ), C2U("Transparency") )
+ ( C2U( "LineWidth" ), C2U("LineWidth") )
+
+ ;
+ return m_aShapePropertyMapForLineSeriesProperties;
+}
+
+//static
+const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesProperties()
+{
+ //shape property -- chart model object property
+ static tMakePropertyNameMap m_aShapePropertyMapForFilledSeriesProperties =
+ tMakePropertyNameMap
+ ( C2U( "FillBackground"), C2U("FillBackground") )
+ ( C2U( "FillBitmapName" ), C2U("FillBitmapName") )
+ ( C2U( "FillColor" ), C2U("Color") )
+ ( C2U( "FillGradientName" ), C2U("GradientName") )
+ ( C2U( "FillGradientStepCount" ), C2U( "GradientStepCount" ) )
+ ( C2U( "FillHatchName" ), C2U("HatchName") )
+ ( C2U( "FillStyle" ), C2U("FillStyle") )
+ ( C2U( "FillTransparence" ), C2U("Transparency") )
+ ( C2U( "FillTransparenceGradientName" ), C2U("TransparencyGradientName") )
+ //bitmap properties
+ ( C2U( "FillBitmapMode" ), C2U( "FillBitmapMode" ) )
+ ( C2U( "FillBitmapSizeX" ), C2U( "FillBitmapSizeX" ) )
+ ( C2U( "FillBitmapSizeY" ), C2U( "FillBitmapSizeY" ) )
+ ( C2U( "FillBitmapLogicalSize" ), C2U( "FillBitmapLogicalSize" ) )
+ ( C2U( "FillBitmapOffsetX" ), C2U( "FillBitmapOffsetX" ) )
+ ( C2U( "FillBitmapOffsetY" ), C2U( "FillBitmapOffsetY" ) )
+ ( C2U( "FillBitmapRectanglePoint" ),C2U( "FillBitmapRectanglePoint" ) )
+ ( C2U( "FillBitmapPositionOffsetX" ),C2U( "FillBitmapPositionOffsetX" ) )
+ ( C2U( "FillBitmapPositionOffsetY" ),C2U( "FillBitmapPositionOffsetY" ) )
+ //line properties
+ ( C2U( "LineColor" ), C2U("BorderColor") )
+ ( C2U( "LineDashName" ), C2U("BorderDashName") )
+// ( C2U( "LineJoint" ), C2U("LineJoint") )
+ ( C2U( "LineStyle" ), C2U("BorderStyle") )
+ ( C2U( "LineTransparence" ), C2U("BorderTransparency") )
+ ( C2U( "LineWidth" ), C2U("BorderWidth") )
+ ;
+ return m_aShapePropertyMapForFilledSeriesProperties;
+}
+
+// static
+void PropertyMapper::setMultiProperties(
+ const tNameSequence& rNames
+ , const tAnySequence& rValues
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xTarget )
+{
+ bool bSuccess = false;
+ try
+ {
+ uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
+ if( xShapeMultiProp.is() )
+ {
+ xShapeMultiProp->setPropertyValues( rNames, rValues );
+ bSuccess = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e ); //if this occurs more often think of removing the XMultiPropertySet completly for better performance
+ }
+
+ if(!bSuccess)
+ try
+ {
+ sal_Int32 nCount = std::max( rNames.getLength(), rValues.getLength() );
+ rtl::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( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void PropertyMapper::getTextLabelMultiPropertyLists(
+ const uno::Reference< beans::XPropertySet >& xSourceProp
+ , tNameSequence& rPropNames, tAnySequence& rPropValues
+ , bool bName
+ , sal_Int32 nLimitedSpace
+ , bool bLimitedHeight )
+{
+ //fill character properties into the ValueMap
+ tPropertyNameValueMap aValueMap;
+ PropertyMapper::getValueMap( aValueMap
+ , PropertyMapper::getPropertyNameMapForCharacterProperties()
+ , xSourceProp );
+
+ //some more shape properties apart from character properties, position-matrix and label string
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("LineStyle"), uno::makeAny(drawing::LineStyle_NONE) ) ); // drawing::LineStyle
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextHorizontalAdjust"), uno::makeAny(drawing::TextHorizontalAdjust_CENTER) ) ); // drawing::TextHorizontalAdjust - needs to be overwritten
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextVerticalAdjust"), uno::makeAny(drawing::TextVerticalAdjust_CENTER) ) ); //drawing::TextVerticalAdjust - needs to be overwritten
+ //aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextWritingMode"), uno::makeAny(eWritingMode) ) ); //text::WritingMode
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowHeight"), uno::makeAny(sal_True) ) ); // sal_Bool
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowWidth"), uno::makeAny(sal_True) ) ); // sal_Bool
+ if( bName )
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("Name"), uno::makeAny( rtl::OUString() ) ) ); //CID rtl::OUString - needs to be overwritten for each point
+
+ if( nLimitedSpace > 0 )
+ {
+ if(bLimitedHeight)
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameHeight"), uno::makeAny(nLimitedSpace) ) ); //sal_Int32
+ else
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameWidth"), uno::makeAny(nLimitedSpace) ) ); //sal_Int32
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("ParaIsHyphenation"), uno::makeAny(sal_True) ) );
+ }
+
+ /*
+ //@todo ?: add paragraph properties:
+ //(uno::makeAny(eParaAdjust)) //ParaAdjust - style::ParagraphAdjust
+ //(uno::makeAny( (sal_Bool)rAxisLabelProperties.bLineBreakAllowed )) //ParaIsHyphenation - sal_Bool
+ style::ParagraphAdjust eParaAdjust( style::ParagraphAdjust_LEFT );
+ if( eHorizontalAdjust == drawing::TextHorizontalAdjust_RIGHT )
+ eParaAdjust = style::ParagraphAdjust_RIGHT;
+ */
+
+ PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
+}
+
+void PropertyMapper::getPreparedTextShapePropertyLists(
+ const uno::Reference< beans::XPropertySet >& xSourceProp
+ , tNameSequence& rPropNames, tAnySequence& rPropValues )
+{
+ //fill character, line and fill properties into the ValueMap
+ tPropertyNameValueMap aValueMap;
+ PropertyMapper::getValueMap( aValueMap
+ , PropertyMapper::getPropertyNameMapForTextShapeProperties()
+ , xSourceProp );
+
+ // auto-grow makes sure the shape has the correct size after setting text
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextHorizontalAdjust"), uno::makeAny( drawing::TextHorizontalAdjust_CENTER )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextVerticalAdjust"), uno::makeAny( drawing::TextVerticalAdjust_CENTER )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowHeight"), uno::makeAny( true )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowWidth"), uno::makeAny( true )));
+
+ // set some distance to the border, in case it is shown
+ const sal_Int32 nWidthDist = 250;
+ const sal_Int32 nHeightDist = 125;
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextLeftDistance"), uno::makeAny( nWidthDist )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextRightDistance"), uno::makeAny( nWidthDist )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextUpperDistance"), uno::makeAny( nHeightDist )));
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextLowerDistance"), uno::makeAny( nHeightDist )));
+
+ // use a line-joint showing the border of thick lines like two rectangles
+ // filled in between.
+ aValueMap[C2U("LineJoint")] <<= drawing::LineJoint_ROUND;
+
+ PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
new file mode 100644
index 000000000000..721cabd15d83
--- /dev/null
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -0,0 +1,2111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ShapeFactory.hxx"
+#include "ViewDefines.hxx"
+#include "Stripe.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "PropertyMapper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+
+#include <editeng/unoprnms.hxx>
+#include <tools/color.hxx>
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+
+#ifndef _BGFX_VECTOR_B2DPOINT_HXX
+#include <basegfx/point/b2dpoint.hxx>
+#endif
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// set a name/CID at a shape (is used for selection handling)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape
+ , const rtl::OUString& rName )
+{
+ if(!xShape.is())
+ return;
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->setPropertyValue( C2U( UNO_NAME_MISC_OBJ_NAME )
+ , uno::makeAny( rName ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+//static
+rtl::OUString ShapeFactory::getShapeName( const uno::Reference< drawing::XShape >& xShape )
+{
+ rtl::OUString aRet;
+
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U( UNO_NAME_MISC_OBJ_NAME ) ) >>= aRet;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------
+
+uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
+{
+ uno::Reference< drawing::XShapes > xRet;
+ uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nN = nCount; nN--; )
+ {
+ if( xShapes->getByIndex( nN ) >>= xShape )
+ {
+ if( ShapeFactory::getShapeName( xShape ).equals(C2U("com.sun.star.chart2.shapes")) )
+ {
+ xRet = uno::Reference< drawing::XShapes >( xShape, uno::UNO_QUERY );
+ break;
+ }
+ }
+ }
+ }
+ return xRet;
+}
+
+//-----------------------------------------------------------------------------
+
+uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
+{
+ uno::Reference< drawing::XShapes > xRet( ShapeFactory::getChartRootShape( xDrawPage ) );
+ if( !xRet.is() )
+ {
+ //create the root shape
+ xRet = this->createGroup2D(
+ uno::Reference<drawing::XShapes>( xDrawPage, uno::UNO_QUERY )
+ , C2U("com.sun.star.chart2.shapes") );
+ }
+ return xRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// diverse PolyPolygon create methods
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+uno::Any createPolyPolygon_Cube(
+ const drawing::Direction3D& rSize, double fRoundedEdge, bool bRounded = true )
+{
+ DBG_ASSERT(fRoundedEdge>=0, "fRoundedEdge needs to be >= 0");
+
+ // always use extra points, so set percent diagonal to 0.4 which is 0% in the UI (old Chart comment)
+ if( fRoundedEdge == 0.0 && bRounded)
+ fRoundedEdge = 0.4 / 200.0;
+ else if(!bRounded)
+ fRoundedEdge = 0.0;
+
+ //fWidthH stands for Half Width
+ const double fWidthH = rSize.DirectionX >=0.0? rSize.DirectionX/2.0 : -rSize.DirectionX/2.0;
+ const double fHeight = rSize.DirectionY;
+// const double fDepth = rSize.DirectionZ >=0.0? rSize.DirectionZ : -rSize.DirectionZ ;
+
+ const double fHeightSign = fHeight >= 0.0 ? 1.0 : -1.0;
+
+ const double fOffset = (fWidthH * fRoundedEdge) * 1.05; // increase by 5% for safety
+ const bool bRoundEdges = fRoundedEdge && fOffset < fWidthH && 2.0 * fOffset < fHeightSign*fHeight;
+ const sal_Int32 nPointCount = bRoundEdges ? 13 : 5;
+
+ //--------------------------------------
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for(sal_Int32 nN = nPointCount; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+ //*pInnerSequenceZ++ = -fDepth/2.0;
+
+ if(nPointCount == 5)
+ {
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = 0.0;
+
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = -fWidthH;
+ }
+ else
+ {
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = fHeightSign*fOffset;
+ *pInnerSequenceY++ = fHeight - fHeightSign*fOffset;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceY++ = fHeight - fHeightSign*fOffset;
+ *pInnerSequenceY++ = fHeightSign*fOffset;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+
+ *pInnerSequenceX++ = -fWidthH + fOffset;
+ *pInnerSequenceX++ = fWidthH - fOffset;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = fWidthH;
+ *pInnerSequenceX++ = fWidthH - fOffset;
+ *pInnerSequenceX++ = -fWidthH + fOffset;
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = -fWidthH;
+ *pInnerSequenceX++ = -fWidthH + fOffset;
+ }
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+uno::Any createPolyPolygon_Cylinder(
+ double fHeight
+ , double fRadius
+ , sal_Int32& nVerticalSegmentCount )
+{
+ //fHeight may be negative
+ DBG_ASSERT(fRadius>0, "The radius of a cylinder needs to be > 0");
+
+ //--------------------------------------
+ drawing::PolyPolygonShape3D aPP;
+
+ nVerticalSegmentCount=1;
+
+ aPP.SequenceX.realloc(3);
+ aPP.SequenceY.realloc(3);
+ aPP.SequenceZ.realloc(3);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ double fY1 = 0.0;
+ double fY2 = fHeight;
+
+ if( fHeight<0.0 )
+ ::std::swap(fY1,fY2);
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = fY1;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY1;
+ //----------------------------
+
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY1;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY2;
+ //----------------------------
+
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY2;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = fY2;
+ //----------------------------
+
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+uno::Any createPolyPolygon_Cone( double fHeight, double fRadius, double fTopHeight
+ , sal_Int32& nVerticalSegmentCount )
+{
+ DBG_ASSERT(fRadius>0, "The radius of a cone needs to be > 0");
+
+ //for stacked charts we need cones without top -> fTopHeight != 0 resp. bTopless == true
+ //fTopHeight indicates the high of the cutted top only (not the full height)
+ bool bTopless = !::rtl::math::approxEqual( fHeight, fHeight + fTopHeight );
+
+ double r1= 0.0, r2 = fRadius;
+ if(bTopless)
+ // #i63212# fHeight may be negative, fTopHeight is always positive -> use fabs(fHeight)
+ r1 = fRadius * (fTopHeight)/(fabs(fHeight)+fTopHeight);
+
+ nVerticalSegmentCount=1;
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(2);
+ aPP.SequenceY.realloc(2);
+ aPP.SequenceZ.realloc(2);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ double fX1 = 0.0;
+ double fX2 = r2;
+ double fX3 = r1;
+
+ double fY1 = 0.0;
+ double fY2 = 0.0;
+ double fY3 = fHeight;
+
+ if( fHeight<0.0 )
+ {
+ ::std::swap(fX1,fX3);
+ ::std::swap(fY1,fY3);
+ }
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceY++ = fY1;
+ *pInnerSequenceX++ = fX1;
+
+ *pInnerSequenceY++ = fY2;
+ *pInnerSequenceX++ = fX2;
+ //----------------------------
+
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceY++ = fY2;
+ *pInnerSequenceX++ = fX2;
+
+ *pInnerSequenceY++ = fY3;
+ *pInnerSequenceX++ = fX3;
+ //----------------------------
+
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// methods for 3D shape creation
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::createCube(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree
+ , const uno::Reference< beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , bool bRounded )
+{
+ if( !xTarget.is() )
+ return 0;
+ if( bRounded )
+ {
+ try
+ {
+ if( xSourceProp.is() )
+ {
+ drawing::LineStyle aLineStyle;
+ xSourceProp->getPropertyValue( C2U( "BorderStyle" ) ) >>= aLineStyle;
+ if( aLineStyle == drawing::LineStyle_SOLID )
+ bRounded = false;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ uno::Reference<drawing::XShape> xShape = impl_createCube( xTarget, rPosition, rSize, nRotateZAngleHundredthDegree, bRounded );
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ if( xSourceProp.is())
+ PropertyMapper::setMappedProperties( xProp, xSourceProp, rPropertyNameMap );
+ return xShape;
+}
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::impl_createCube(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree
+ , bool bRounded )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DExtrudeObject") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //depth
+ double fDepth = rSize.DirectionZ;
+ if(fDepth<0)
+ fDepth*=-1.0;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_EXTRUDE_DEPTH )
+ , uno::makeAny((sal_Int32)fDepth) );
+
+ //PercentDiagonal
+ sal_Int16 nPercentDiagonal = bRounded ? 3 : 0;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL )
+ , uno::makeAny( nPercentDiagonal ) );
+
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D )
+ , createPolyPolygon_Cube( rSize, double(nPercentDiagonal)/200.0,bRounded) );
+
+ //Matrix for position
+ {
+ ::basegfx::B3DHomMatrix aM;
+ if(nRotateZAngleHundredthDegree!=0)
+ aM.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
+ aM.translate(rPosition.PositionX
+ , rPosition.PositionY
+ , rPosition.PositionZ - (fDepth/2.0));
+ drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(aHM) );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::createCylinder(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree )
+{
+ return impl_createConeOrCylinder(
+ xTarget, rPosition, rSize, 0.0, nRotateZAngleHundredthDegree, true );
+}
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::createPyramid(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , double fTopHeight, bool bRotateZ
+ , const uno::Reference< beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ Reference< drawing::XShapes > xGroup( ShapeFactory::createGroup3D( xTarget, rtl::OUString() ) );
+
+ sal_Bool bDoubleSided = false;
+ short nRotatedTexture = 0;
+
+ const double fWidth = rSize.DirectionX;
+ const double fDepth = rSize.DirectionZ;
+ const double fHeight = rSize.DirectionY;
+
+ drawing::Position3D aBottomP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth/2.0 );
+ if(bRotateZ)
+ aBottomP1.PositionY -= fWidth/2.0;
+ else
+ aBottomP1.PositionX -= fWidth/2.0;
+ drawing::Position3D aBottomP2( aBottomP1 );
+ if(bRotateZ)
+ aBottomP2.PositionY += fWidth;
+ else
+ aBottomP2.PositionX += fWidth;
+ drawing::Position3D aBottomP3( aBottomP2 );
+ drawing::Position3D aBottomP4( aBottomP1 );
+ aBottomP3.PositionZ += fDepth;
+ aBottomP4.PositionZ += fDepth;
+
+ const double fTopFactor = (fTopHeight)/(fabs(fHeight)+fTopHeight);
+ drawing::Position3D aTopP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth*fTopFactor/2.0 );
+ if(bRotateZ)
+ {
+ aTopP1.PositionY -= fWidth*fTopFactor/2.0;
+ aTopP1.PositionX += fHeight;
+ }
+ else
+ {
+ aTopP1.PositionX -= fWidth*fTopFactor/2.0;
+ aTopP1.PositionY += fHeight;
+ }
+ drawing::Position3D aTopP2( aTopP1 );
+ if(bRotateZ)
+ aTopP2.PositionY += fWidth*fTopFactor;
+ else
+ aTopP2.PositionX += fWidth*fTopFactor;
+ drawing::Position3D aTopP3( aTopP2 );
+ drawing::Position3D aTopP4( aTopP1 );
+ aTopP3.PositionZ += fDepth*fTopFactor;
+ aTopP4.PositionZ += fDepth*fTopFactor;
+
+ Stripe aStripeBottom( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
+
+ drawing::Position3D aNormalsBottomP1( aBottomP1 );
+ drawing::Position3D aNormalsBottomP2( aBottomP2 );
+ drawing::Position3D aNormalsBottomP3( aBottomP3 );
+ drawing::Position3D aNormalsBottomP4( aBottomP4 );
+ drawing::Position3D aNormalsTopP1( aBottomP1 );
+ drawing::Position3D aNormalsTopP2( aBottomP2 );
+ drawing::Position3D aNormalsTopP3( aBottomP3 );
+ drawing::Position3D aNormalsTopP4( aBottomP4 );
+ if( bRotateZ )
+ {
+ aNormalsTopP1.PositionX += fHeight;
+ aNormalsTopP2.PositionX += fHeight;
+ aNormalsTopP3.PositionX += fHeight;
+ aNormalsTopP4.PositionX += fHeight;
+ }
+ else
+ {
+ aNormalsTopP1.PositionY += fHeight;
+ aNormalsTopP2.PositionY += fHeight;
+ aNormalsTopP3.PositionY += fHeight;
+ aNormalsTopP4.PositionY += fHeight;
+ }
+
+ bool bInvertPolygon = false;
+ bool bInvertNormals = false;
+
+ if(bRotateZ)
+ {
+ //bars
+ if(fHeight>=0.0)
+ {
+ nRotatedTexture = 2;
+ bInvertNormals = true;
+ aStripeBottom = Stripe( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
+ }
+ else
+ {
+ bInvertPolygon = true;
+ nRotatedTexture = 1;
+ aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
+ }
+ }
+ else
+ {
+ //columns
+ if(fHeight>=0.0)
+ {
+ bInvertPolygon = true;
+ nRotatedTexture = 2;
+ aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
+ }
+ else
+ {
+ nRotatedTexture = 3;
+ bInvertNormals = true;
+ aStripeBottom = Stripe( aBottomP4, aBottomP3, aBottomP2, aBottomP1 );
+ }
+ }
+ aStripeBottom.InvertNormal(true);
+
+ Stripe aStripe1( aTopP2, aTopP1, aBottomP1, aBottomP2 );
+ Stripe aStripe2( aTopP3, aTopP2, aBottomP2, aBottomP3 );
+ Stripe aStripe3( aTopP4, aTopP3, aBottomP3, aBottomP4 );
+ Stripe aStripe4( aTopP1, aTopP4, aBottomP4, aBottomP1 );
+
+ if( bInvertPolygon )
+ {
+ aStripe1 = Stripe( aBottomP1, aTopP1, aTopP2, aBottomP2 );
+ aStripe2 = Stripe( aBottomP2, aTopP2, aTopP3, aBottomP3 );
+ aStripe3 = Stripe( aBottomP3, aTopP3, aTopP4, aBottomP4 );
+ aStripe4 = Stripe( aBottomP4, aTopP4, aTopP1, aBottomP1 );
+ }
+
+ Stripe aNormalsStripe1( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP2, aNormalsTopP2 );
+ Stripe aNormalsStripe2( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP3, aNormalsTopP3 );
+ Stripe aNormalsStripe3( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP4, aNormalsTopP4 );
+ Stripe aNormalsStripe4( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP1, aNormalsTopP1 );
+
+ if( bInvertNormals )
+ {
+ aNormalsStripe1 = Stripe( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP1, aNormalsTopP1 );
+ aNormalsStripe2 = Stripe( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP2, aNormalsTopP2 );
+ aNormalsStripe3 = Stripe( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP3, aNormalsTopP3 );
+ aNormalsStripe4 = Stripe( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP4, aNormalsTopP4 );
+ }
+
+ aStripe1.SetManualNormal( aNormalsStripe1.getNormal() );
+ aStripe2.SetManualNormal( aNormalsStripe2.getNormal() );
+ aStripe3.SetManualNormal( aNormalsStripe3.getNormal() );
+ aStripe4.SetManualNormal( aNormalsStripe4.getNormal() );
+
+ const bool bFlatNormals = false;
+ ShapeFactory::createStripe( xGroup, aStripe1, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripe2, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripe3, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ 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 );
+}
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::createCone(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree )
+{
+ return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
+}
+
+uno::Reference<drawing::XShape>
+ ShapeFactory::impl_createConeOrCylinder(
+ const uno::Reference<drawing::XShapes>& xTarget
+ , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
+ , bool bCylinder )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DLatheObject") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ double fWidth = rSize.DirectionX/2.0; //The depth will be corrrected 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::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //PercentDiagonal
+ sal_Int16 nPercentDiagonal = 5;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL )
+ , uno::makeAny( nPercentDiagonal ) );
+
+ //Polygon
+ sal_Int32 nVerticalSegmentCount = 0;
+ uno::Any aPPolygon = bCylinder ? createPolyPolygon_Cylinder(
+ fHeight, fRadius, nVerticalSegmentCount)
+ : createPolyPolygon_Cone(
+ fHeight, fRadius, fTopHeight, nVerticalSegmentCount);
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D ), aPPolygon );
+
+ //Matrix for position
+ {
+ ::basegfx::B3DHomMatrix aM;
+ if(nRotateZAngleHundredthDegree!=0)
+ aM.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
+ //stretch the symmetric objects to given depth
+ aM.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX);
+ aM.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ);
+ drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(aHM) );
+ }
+
+ //Segments
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_HORZ_SEGS )
+ , uno::makeAny(CHART_3DOBJECT_SEGMENTCOUNT) );
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_VERT_SEGS )
+ , uno::makeAny((sal_Int32)nVerticalSegmentCount) );//depends on point count of the used polygon
+
+ //Reduced lines
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_REDUCED_LINE_GEOMETRY )
+ , uno::makeAny((sal_Bool)sal_True) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+void appendAndCloseBezierCoords( drawing::PolyPolygonBezierCoords& rReturn, const drawing::PolyPolygonBezierCoords& rAdd, sal_Bool bAppendInverse )
+{
+ if(!rAdd.Coordinates.getLength())
+ return;
+ sal_Int32 nAddCount = rAdd.Coordinates[0].getLength();
+ if(!nAddCount)
+ return;
+
+ sal_Int32 nOldCount = rReturn.Coordinates[0].getLength();
+
+ rReturn.Coordinates[0].realloc(nOldCount+nAddCount+1);
+ rReturn.Flags[0].realloc(nOldCount+nAddCount+1);
+
+ 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];
+ }
+
+ //close
+ rReturn.Coordinates[0][nOldCount+nAddCount] = rReturn.Coordinates[0][0];
+ rReturn.Flags[0][nOldCount+nAddCount] = rReturn.Flags[0][0];
+}
+
+//------------------------------------------------------------------------------------------------------------
+
+drawing::PolyPolygonBezierCoords getCircularArcBezierCoords(
+ double fStartAngleRadian, double fWidthAngleRadian, double fUnitRadius
+ , const ::basegfx::B2DHomMatrix& rTransformationFromUnitCircle
+ , const double fAngleSubdivisionRadian )
+{
+ //at least one polygon is created using two normal and two control points
+ //if the angle is larger it is separated into multiple sub angles
+
+ drawing::PolyPolygonBezierCoords aReturn = drawing::PolyPolygonBezierCoords();
+ sal_Int32 nSegmentCount = static_cast< sal_Int32 >( fWidthAngleRadian/fAngleSubdivisionRadian );
+ if( fWidthAngleRadian > fAngleSubdivisionRadian*nSegmentCount )
+ nSegmentCount++;
+
+ double fFirstSegmentAngle = fAngleSubdivisionRadian;
+ double fLastSegmentAngle = fAngleSubdivisionRadian;
+ if(nSegmentCount==1)
+ {
+ fFirstSegmentAngle = fWidthAngleRadian;
+ fLastSegmentAngle = 0.0;
+ }
+ else
+ {
+ double fFirstAngleOnSubDevision = (static_cast<sal_Int32>(fStartAngleRadian/fAngleSubdivisionRadian)+1)*fAngleSubdivisionRadian;
+ if( !::rtl::math::approxEqual( fStartAngleRadian, fFirstAngleOnSubDevision ) )
+ fFirstSegmentAngle = fFirstAngleOnSubDevision-fStartAngleRadian;
+
+ if(nSegmentCount>1)
+ {
+ fLastSegmentAngle = fWidthAngleRadian-fFirstSegmentAngle-fAngleSubdivisionRadian*(nSegmentCount-2);
+ if( fLastSegmentAngle<0 )
+ nSegmentCount--;
+ if( fLastSegmentAngle>fAngleSubdivisionRadian )
+ {
+ fLastSegmentAngle-=fAngleSubdivisionRadian;
+ nSegmentCount++;
+ }
+ }
+ }
+
+ 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);
+ drawing::FlagSequence aFlags(nPointCount);
+
+ //
+
+ //!! 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;
+ ::basegfx::B2DPoint POrigin = rTransformationFromUnitCircle * ::basegfx::B2DPoint(0.0, 0.0);
+
+ sal_Int32 nPoint=0;
+ double fCurrentRotateAngle = fStartAngleRadian;
+ 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
+ fCurrentSegmentAngle = fFirstSegmentAngle;
+ else if(nSegment==(nSegmentCount-1)) //the last segment gets the rest angle that does not fit into equal pieces
+ fCurrentSegmentAngle = fLastSegmentAngle;
+
+ //first create untransformed points for a unit circle arc:
+ const double fCos = cos(fCurrentSegmentAngle/2.0);
+ const double fSin = sin(fCurrentSegmentAngle/2.0);
+ P0.setX(fCos);
+ P3.setX(fCos);
+ P0.setY(-fSin);
+ P3.setY(-P0.getY());
+
+ P1.setX((4.0-fCos)/3.0);
+ P2.setX(P1.getX());
+ P1.setY((1.0-fCos)*(fCos-3.0)/(3.0*fSin));
+ P2.setY(-P1.getY());
+ //transform thus startangle equals NULL
+ ::basegfx::B2DHomMatrix aStart;
+ aStart.rotate(fCurrentSegmentAngle/2.0 + fCurrentRotateAngle );
+ fCurrentRotateAngle+=fCurrentSegmentAngle;
+
+ aStart.scale( fUnitRadius, fUnitRadius );
+
+ //apply given transformation to get final points
+ P0 = rTransformationFromUnitCircle*(aStart*P0);
+ P1 = rTransformationFromUnitCircle*(aStart*P1);
+ 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;
+
+ aPoints[nPoint].X = static_cast< sal_Int32 >( P1.getX());
+ aPoints[nPoint].Y = static_cast< sal_Int32 >( P1.getY());
+ aFlags[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;
+
+ 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;
+ }
+ }
+
+ aReturn.Coordinates[0] = aPoints;
+ aReturn.Flags[0] = aFlags;
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------------------------------------------------
+
+drawing::PolyPolygonBezierCoords getRingBezierCoords(
+ double fUnitCircleInnerRadius
+ , double fUnitCircleOuterRadius
+ , double fStartAngleRadian, double fWidthAngleRadian
+ , ::basegfx::B2DHomMatrix aTransformationFromUnitCircle
+ , const double fAngleSubdivisionRadian )
+{
+ drawing::PolyPolygonBezierCoords aReturn = drawing::PolyPolygonBezierCoords();
+
+ 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];
+
+ drawing::PolyPolygonBezierCoords aInnerArc = getCircularArcBezierCoords(
+ fStartAngleRadian, fWidthAngleRadian, fUnitCircleInnerRadius, aTransformationFromUnitCircle, fAngleSubdivisionRadian );
+ appendAndCloseBezierCoords( aReturn, aInnerArc, sal_True );
+
+ //fill rMarkHandlePoints
+ /*
+ {
+ rMarkHandlePoints.realloc(1);
+ rMarkHandlePoints[0].realloc(6);
+ sal_Int32 nHandleCount=0;
+ sal_Int32 nOuterArcCount = aOuterArc.Coordinates[0].getLength();
+ if(nOuterArcCount>0)
+ rMarkHandlePoints[0][nHandleCount++]=aOuterArc.Coordinates[0][0];
+ if(nOuterArcCount>1)
+ rMarkHandlePoints[0][nHandleCount++]=aOuterArc.Coordinates[0][nOuterArcCount-1];
+ sal_Int32 nInnerArcCount = aInnerArc.Coordinates[0].getLength();
+ if(nInnerArcCount>0)
+ rMarkHandlePoints[0][nHandleCount++]=aInnerArc.Coordinates[0][0];
+ if(nInnerArcCount>1)
+ rMarkHandlePoints[0][nHandleCount++]=aInnerArc.Coordinates[0][nInnerArcCount-1];
+ rMarkHandlePoints[0].realloc(nHandleCount);
+ }
+ */
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------------------------------------------------
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createPieSegment2D(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const drawing::Direction3D& rOffset
+ , const drawing::HomogenMatrix& rUnitCircleToScene )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ while(fUnitCircleWidthAngleDegree>360)
+ fUnitCircleWidthAngleDegree -= 360.0;
+ while(fUnitCircleWidthAngleDegree<0)
+ fUnitCircleWidthAngleDegree += 360.0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance(
+ C2U("com.sun.star.drawing.ClosedBezierShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape); //need to add the shape before setting of properties
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) );
+ aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY);
+
+ const double fAngleSubdivisionRadian = F_PI/10.0;
+
+ drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(
+ fUnitCircleInnerRadius, fUnitCircleOuterRadius
+ , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
+ , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
+
+ xProp->setPropertyValue( C2U( "PolyPolygonBezier" ), uno::makeAny( aCoords ) );
+
+ //add shape for markhandles
+ /*
+ drawing::PointSequenceSequence aMarkHandlePoints(1); to be filled within getRingBezierCoords
+ if( xGroup.is() )
+ {
+ VLineProperties aHandleLineProperties;
+ aHandleLineProperties.LineStyle = uno::makeAny( drawing::LineStyle_NONE );
+ uno::Reference< drawing::XShape > xHandleShape =
+ this->createLine2D( xGroup, aMarkHandlePoints, &aHandleLineProperties );
+ this->setShapeName( xHandleShape, C2U("HandlesOnly") );
+ }
+ */
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ return xShape;
+}
+
+//------------------------------------------------------------------------------------------------------------
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createPieSegment(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const drawing::Direction3D& rOffset
+ , const drawing::HomogenMatrix& rUnitCircleToScene
+ , double fDepth )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ while(fUnitCircleWidthAngleDegree>360)
+ fUnitCircleWidthAngleDegree -= 360.0;
+ while(fUnitCircleWidthAngleDegree<0)
+ fUnitCircleWidthAngleDegree += 360.0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DExtrudeObject") ), uno::UNO_QUERY );
+ xTarget->add(xShape); //need to add the shape before setting of properties
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ 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
+ , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
+ , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
+
+ //depth
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_EXTRUDE_DEPTH )
+ , uno::makeAny((sal_Int32)fDepth) );
+
+ //PercentDiagonal
+ sal_Int16 nPercentDiagonal = 0;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL )
+ , uno::makeAny( nPercentDiagonal ) );
+
+ //Polygon
+ drawing::PolyPolygonShape3D aPoly( BezierToPoly(aCoords) );
+ ShapeFactory::closePolygon( aPoly );
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D )
+ , uno::makeAny( aPoly ) );
+
+ //DoubleSided
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_DOUBLE_SIDED )
+ , uno::makeAny( (sal_Bool)true) );
+
+ //Reduced lines
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_REDUCED_LINE_GEOMETRY )
+ , uno::makeAny((sal_Bool)sal_True) );
+
+ //TextureProjectionMode
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTURE_PROJ_Y )
+ , uno::makeAny( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+
+ //TextureProjectionMode
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTURE_PROJ_X )
+ , uno::makeAny( drawing::TextureProjectionMode_PARALLEL ) );
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTURE_PROJ_Y )
+ , uno::makeAny( drawing::TextureProjectionMode_OBJECTSPECIFIC ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------------------------------------------
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget
+ , const Stripe& rStripe
+ , const uno::Reference< beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , sal_Bool bDoubleSided
+ , short nRotatedTexture
+ , bool bFlatNormals )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DPolygonObject" ) ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D )
+ , rStripe.getPolyPolygonShape3D() );
+
+ //TexturePolygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTUREPOLYGON3D )
+ , rStripe.getTexturePolygon( nRotatedTexture ) );
+
+ //Normals Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_NORMALSPOLYGON3D )
+ , rStripe.getNormalsPolygon() );
+ //NormalsKind
+ if(bFlatNormals)
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_NORMALS_KIND )
+ , uno::makeAny( drawing::NormalsKind_FLAT ) );
+
+ //LineOnly
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_LINEONLY )
+ , uno::makeAny( (sal_Bool)false) );
+
+ //DoubleSided
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_DOUBLE_SIDED )
+ , uno::makeAny(bDoubleSided) );
+
+ if( xSourceProp.is())
+ PropertyMapper::setMappedProperties( xProp, xSourceProp, rPropertyNameMap );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::PolyPolygonShape3D& rPolyPolygon
+ , double fDepth )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ if( !rPolyPolygon.SequenceX.getLength())
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DExtrudeObject") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //depth
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_EXTRUDE_DEPTH )
+ , uno::makeAny((sal_Int32)fDepth) );
+
+ //PercentDiagonal
+ sal_Int16 nPercentDiagonal = 0;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL )
+ , uno::makeAny( nPercentDiagonal ) );
+
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D )
+ , uno::makeAny( rPolyPolygon ) );
+
+ //DoubleSided
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_DOUBLE_SIDED )
+ , uno::makeAny( (sal_Bool)true) );
+
+ //the z component of the polygon is now ignored by the drawing layer,
+ //so we nned to translate the object via transformation matrix
+
+ //Matrix for position
+ if( rPolyPolygon.SequenceZ.getLength()&& rPolyPolygon.SequenceZ[0].getLength() )
+ {
+ ::basegfx::B3DHomMatrix aM;
+ aM.translate( 0
+ , 0
+ , rPolyPolygon.SequenceZ[0][0] );
+ drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(aHM) );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::PolyPolygonShape3D& rPolyPolygon )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.PolyPolygonShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //UNO_NAME_POLYGON "Polygon" drawing::PointSequence*
+ drawing::PointSequenceSequence aPoints( PolyToPointSequence(rPolyPolygon) );
+
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_POLYPOLYGON )
+ , uno::makeAny( aPoints ) );
+
+ //ZOrder
+ //an area should always be behind other shapes
+ xProp->setPropertyValue( C2U( UNO_NAME_MISC_OBJ_ZORDER )
+ , uno::makeAny( sal_Int32(0) ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+enum SymbolType { SYMBOL_SQUARE=0
+ , SYMBOL_DIAMOND
+ , SYMBOL_ARROW_DOWN
+ , SYMBOL_ARROW_UP
+ , SYMBOL_ARROW_RIGHT
+ , SYMBOL_ARROW_LEFT
+ , SYMBOL_BOWTIE
+ , SYMBOL_SANDGLASS
+ , SYMBOL_COUNT
+ };
+
+sal_Int32 ShapeFactory::getSymbolCount()
+{
+ return SYMBOL_COUNT;
+}
+
+drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D& rPos
+ , const drawing::Direction3D& rSize
+ , sal_Int32 nStandardSymbol )
+{
+ if(nStandardSymbol<0)
+ nStandardSymbol*=-1;
+ nStandardSymbol = nStandardSymbol%ShapeFactory::getSymbolCount();
+ SymbolType eSymbolType=static_cast<SymbolType>(nStandardSymbol);
+
+ const double& fX = rPos.PositionX;
+ const double& fY = rPos.PositionY;
+
+ const double fWidthH = rSize.DirectionX/2.0; //fWidthH stands for Half Width
+ const double fHeightH = rSize.DirectionY/2.0; //fHeightH stands for Half Height
+
+ sal_Int32 nPointCount = 4; //all arrow symbols only need 4 points
+ switch( eSymbolType )
+ {
+ case SYMBOL_SQUARE:
+ case SYMBOL_DIAMOND:
+ case SYMBOL_BOWTIE:
+ case SYMBOL_SANDGLASS:
+ nPointCount = 5;
+ break;
+ default:
+ break;
+ }
+
+ //--------------------------------------
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for(sal_Int32 nN = nPointCount; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ switch(eSymbolType)
+ {
+ case SYMBOL_ARROW_UP:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+ break;
+ }
+ case SYMBOL_ARROW_DOWN:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
+ case SYMBOL_ARROW_RIGHT:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
+ case SYMBOL_ARROW_LEFT:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY;
+ break;
+ }
+ case SYMBOL_BOWTIE:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
+ case SYMBOL_SANDGLASS:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+ break;
+ }
+ case SYMBOL_DIAMOND:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY;
+
+ *pInnerSequenceX++ = fX;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY;
+ break;
+ }
+ default: //case SYMBOL_SQUARE:
+ {
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY+fHeightH;
+
+ *pInnerSequenceX++ = fX+fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+
+ *pInnerSequenceX++ = fX-fWidthH;
+ *pInnerSequenceY++ = fY-fHeightH;
+ break;
+ }
+ }
+ //return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+ return aPP;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createSymbol2D(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition
+ , const drawing::Direction3D& rSize
+ , sal_Int32 nStandardSymbol
+ , sal_Int32 nBorderColor
+ , sal_Int32 nFillColor )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.PolyPolygonShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ drawing::PointSequenceSequence aPoints( PolyToPointSequence(
+ createPolyPolygon_Symbol( rPosition, rSize, nStandardSymbol ) ));
+
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_POLYPOLYGON )
+ , uno::makeAny( aPoints ) );
+
+ //LineColor
+ xProp->setPropertyValue( C2U( UNO_NAME_LINECOLOR )
+ , uno::makeAny( nBorderColor ) );
+
+ //FillColor
+ xProp->setPropertyValue( C2U( UNO_NAME_FILLCOLOR )
+ , uno::makeAny( nFillColor ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createGraphic2D(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition
+ , const drawing::Direction3D& rSize
+ , const uno::Reference< graphic::XGraphic >& xGraphic )
+{
+ if( !xTarget.is() || !xGraphic.is() )
+ return 0;
+
+ // @todo: change this to a rectangle shape with a fill bitmap for
+ // performance reasons (ask AW, said CL)
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.GraphicObjectShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ try
+ {
+ // assume position is upper left corner. Transform to center.
+ drawing::Position3D aCenterPosition(
+ rPosition.PositionX - (rSize.DirectionX / 2.0),
+ rPosition.PositionY - (rSize.DirectionY / 2.0),
+ rPosition.PositionZ );
+ xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
+ xShape->setSize( Direction3DToAWTSize( rSize ));
+ }
+ catch( const uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->setPropertyValue( C2U("Graphic"), uno::makeAny( xGraphic ));
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShapes >
+ ShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >& xTarget
+ , ::rtl::OUString aName )
+{
+ if( !xTarget.is() )
+ return 0;
+ try
+ {
+ //create and add to target
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.GroupShape" ) ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set name
+ if(aName.getLength())
+ setShapeName( xShape , aName );
+
+ {//workaround
+ //need this null size as otherwise empty group shapes where painted with a gray border
+ xShape->setSize(awt::Size(0,0));
+ }
+
+ //return
+ uno::Reference< drawing::XShapes > xShapes =
+ uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
+ return xShapes;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return 0;
+}
+
+uno::Reference< drawing::XShapes >
+ ShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >& xTarget
+ , ::rtl::OUString aName )
+{
+ if( !xTarget.is() )
+ return 0;
+ try
+ {
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DSceneObject" ) ), uno::UNO_QUERY );
+
+ xTarget->add(xShape);
+
+ //it is necessary to set the transform matrix to initialize the scene properly (bug #106316#)
+ //otherwise all objects which are placed into this Group will not be visible
+ //the following should be unnecessary after a the bug is fixed
+ {
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ ::basegfx::B3DHomMatrix aM;
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
+ , uno::makeAny(B3DHomMatrixToHomogenMatrix(aM)) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ //set name
+ if(aName.getLength())
+ setShapeName( xShape , aName );
+
+ //return
+ uno::Reference< drawing::XShapes > xShapes =
+ uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
+ return xShapes;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return 0;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition
+ , const drawing::Direction3D& rSize )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.EllipseShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ try
+ {
+ drawing::Position3D aCenterPosition(
+ rPosition.PositionX - (rSize.DirectionX / 2.0),
+ rPosition.PositionY - (rSize.DirectionY / 2.0),
+ rPosition.PositionZ );
+ xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
+ xShape->setSize( Direction3DToAWTSize( rSize ));
+ }
+ catch( const uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xProp->setPropertyValue( C2U( UNO_NAME_CIRCKIND )
+ , uno::makeAny( eKind ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::PolyPolygonShape3D& rPoints
+ , const VLineProperties& rLineProperties )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ if(!rPoints.SequenceX.getLength())
+ return NULL;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.Shape3DPolygonObject") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D )
+ , uno::makeAny( rPoints ) );
+
+ //LineOnly
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_LINEONLY )
+ , uno::makeAny( (sal_Bool)true ) );
+
+ //Transparency
+ if(rLineProperties.Transparence.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINETRANSPARENCE )
+ , rLineProperties.Transparence );
+
+ //LineStyle
+ if(rLineProperties.LineStyle.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINESTYLE )
+ , rLineProperties.LineStyle );
+
+ //LineWidth
+ if(rLineProperties.Width.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINEWIDTH )
+ , rLineProperties.Width );
+
+ //LineColor
+ if(rLineProperties.Color.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINECOLOR )
+ , rLineProperties.Color );
+ //, uno::makeAny( sal_Int32( Color(COL_RED).GetColor()) ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::PointSequenceSequence& rPoints
+ , const VLineProperties* pLineProperties )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ if(!rPoints.getLength())
+ return NULL;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ //"com.sun.star.drawing.LineShape") ), uno::UNO_QUERY );
+ "com.sun.star.drawing.PolyLineShape") ), uno::UNO_QUERY );
+ //"com.sun.star.drawing.PolyLinePathShape") ), uno::UNO_QUERY );
+ //"com.sun.star.drawing.PolyPolygonPathShape") ), uno::UNO_QUERY );
+ //"com.sun.star.drawing.PolyPolygonShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ //Polygon
+ xProp->setPropertyValue( C2U( UNO_NAME_POLYPOLYGON )
+ , uno::makeAny( rPoints ) );
+
+ if(pLineProperties)
+ {
+ //Transparency
+ if(pLineProperties->Transparence.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINETRANSPARENCE )
+ , pLineProperties->Transparence );
+
+ //LineStyle
+ if(pLineProperties->LineStyle.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINESTYLE )
+ , pLineProperties->LineStyle );
+
+ //LineWidth
+ if(pLineProperties->Width.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINEWIDTH )
+ , pLineProperties->Width );
+
+ //LineColor
+ if(pLineProperties->Color.hasValue())
+ xProp->setPropertyValue( C2U( UNO_NAME_LINECOLOR )
+ , pLineProperties->Color );
+
+ //LineDashName
+ if(pLineProperties->DashName.hasValue())
+ xProp->setPropertyValue( C2U( "LineDashName" )
+ , pLineProperties->DashName );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Any ShapeFactory::makeTransformation( const awt::Point& rScreenPosition2D, double fRotationAnglePi )
+{
+ ::basegfx::B2DHomMatrix aM;
+ //As autogrow is active the rectangle is automatically expanded to that side
+ //to which the text is not adjusted.
+ // aM.scale( 1, 1 ); Oops? A scale with this parameters is neutral, line commented out
+ aM.rotate( fRotationAnglePi );
+ aM.translate( rScreenPosition2D.X, rScreenPosition2D.Y );
+ uno::Any aATransformation = uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) );
+ return aATransformation;
+}
+
+void ShapeFactory::makeShapeInvisible( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xShapeProp.is(), "created shape offers no XPropertySet");
+ if( xShapeProp.is())
+ {
+ try
+ {
+ xShapeProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ));
+ xShapeProp->setPropertyValue( C2U("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ));
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
+ const uno::Reference< drawing::XShapes >& xTarget
+ , const awt::Size& rSize )
+{
+ try
+ {
+ if(!xTarget.is())
+ return 0;
+
+ uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY );
+ if( xTarget.is() && xShape.is())
+ {
+ xTarget->add( xShape );
+ ShapeFactory::makeShapeInvisible( xShape );
+ xShape->setSize( rSize );
+ }
+ return xShape;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return 0;
+}
+
+uno::Reference< drawing::XShape >
+ ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
+ , const ::rtl::OUString& rText
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ , const uno::Any& rATransformation )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ if(!rText.getLength())
+ return 0;
+
+ //create shape and add to page
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.TextShape" ) ), uno::UNO_QUERY );
+ xTarget->add(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
+ {
+ xProp->setPropertyValue( C2U( "Transformation" ), rATransformation );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+//static
+rtl::OUString ShapeFactory::getStackedString( const rtl::OUString& rString, bool bStacked )
+{
+ sal_Int32 nLen = rString.getLength();
+ if(!bStacked || !nLen)
+ return rString;
+
+ rtl::OUStringBuffer aStackStr;
+ rtl::OUStringBuffer aSource(rString);
+
+ //add a newline after each letter
+ //as we do not no letters here add a newline after each char
+ for( sal_Int32 nPosSrc=0; nPosSrc < nLen; nPosSrc++ )
+ {
+ if( nPosSrc )
+ aStackStr.append( sal_Unicode('\r') );
+ aStackStr.append( aSource.charAt( nPosSrc ) );
+ }
+ return aStackStr.makeStringAndClear();
+}
+
+//static
+bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly)
+{
+ // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true
+ for( sal_Int32 nIdx = 0, nCount = rPoly.SequenceX.getLength(); nIdx < nCount; ++nIdx )
+ if( rPoly.SequenceX[ nIdx ].getLength() > 1 )
+ return true;
+ return false;
+}
+
+//static
+bool ShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPoly)
+{
+ // true, if empty polypolygon or one polygon with one point
+ return (rPoly.SequenceX.getLength() == 0) ||
+ ((rPoly.SequenceX.getLength() == 1) && (rPoly.SequenceX[0].getLength() <= 1));
+}
+
+//static
+void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly)
+{
+ DBG_ASSERT( rPoly.SequenceX.getLength() <= 1, "ShapeFactory::closePolygon - single polygon expected" );
+ //add a last point == first point
+ if(isPolygonEmptyOrSinglePoint(rPoly))
+ return;
+ drawing::Position3D aFirst(rPoly.SequenceX[0][0],rPoly.SequenceY[0][0],rPoly.SequenceZ[0][0]);
+ AddPointToPoly( rPoly, aFirst );
+}
+
+//static
+awt::Size ShapeFactory::calculateNewSizeRespectingAspectRatio(
+ const awt::Size& rTargetSize
+ , const awt::Size& rSourceSizeWithCorrectAspectRatio )
+{
+ awt::Size aNewSize;
+
+ double fFactorWidth = double(rTargetSize.Width)/double(rSourceSizeWithCorrectAspectRatio.Width);
+ double fFactorHeight = double(rTargetSize.Height)/double(rSourceSizeWithCorrectAspectRatio.Height);
+ double fFactor = std::min(fFactorWidth,fFactorHeight);
+ aNewSize.Width=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Width);
+ aNewSize.Height=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Height);
+
+ return aNewSize;
+}
+
+//static
+awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject(
+ const awt::Point& rTargetAreaPosition
+ , const awt::Size& rTargetAreaSize
+ , const awt::Size& rObjectSize )
+{
+ awt::Point aNewPosition(rTargetAreaPosition);
+ aNewPosition.X += static_cast<sal_Int32>(double(rTargetAreaSize.Width-rObjectSize.Width)/2.0);
+ aNewPosition.Y += static_cast<sal_Int32>(double(rTargetAreaSize.Height-rObjectSize.Height)/2.0);
+ return aNewPosition;
+}
+
+//static
+::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape(
+ const uno::Reference< drawing::XShape >& xShape )
+{
+ ::basegfx::B2IRectangle aRet;
+
+ if( xShape.is() )
+ {
+ awt::Point aPos = xShape->getPosition();
+ awt::Size aSize = xShape->getSize();
+ aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
+ }
+ return aRet;
+
+}
+
+//static
+awt::Size ShapeFactory::getSizeAfterRotation(
+ const uno::Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
+{
+ awt::Size aRet(0,0);
+ if(xShape.is())
+ {
+ const awt::Size aSize( xShape->getSize() );
+
+ if( ::rtl::math::approxEqual( fRotationAngleDegree, 0.0 ) )
+ aRet = aSize;
+ else
+ {
+ while(fRotationAngleDegree>=360.0)
+ fRotationAngleDegree-=360.0;
+ while(fRotationAngleDegree<0.0)
+ fRotationAngleDegree+=360.0;
+ 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 = fRotationAngleDegree*F_PI/180.0;
+
+ 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 ));
+ }
+ }
+ return aRet;
+}
+
+void ShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xShapes )
+{
+ if( xShapes.is() )
+ {
+ sal_Int32 nSubCount = xShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nS = nSubCount; nS--; )
+ {
+ if( xShapes->getByIndex( nS ) >>= xShape )
+ xShapes->remove( xShape );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/Stripe.cxx b/chart2/source/view/main/Stripe.cxx
new file mode 100644
index 000000000000..2df78e2a8e91
--- /dev/null
+++ b/chart2/source/view/main/Stripe.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Stripe.hxx"
+#include "CommonConverters.hxx"
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+Stripe::Stripe( const drawing::Position3D& rPoint1
+ , const drawing::Direction3D& rDirectionToPoint2
+ , const drawing::Direction3D& rDirectionToPoint4 )
+ : m_aPoint1(rPoint1)
+ , m_aPoint2(rPoint1+rDirectionToPoint2)
+ , m_aPoint3(m_aPoint2+rDirectionToPoint4)
+ , m_aPoint4(rPoint1+rDirectionToPoint4)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
+{
+}
+
+Stripe::Stripe( const drawing::Position3D& rPoint1
+ , const drawing::Position3D& rPoint2
+ , double fDepth )
+ : m_aPoint1(rPoint1)
+ , m_aPoint2(rPoint2)
+ , m_aPoint3(rPoint2)
+ , m_aPoint4(rPoint1)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
+{
+ m_aPoint3.PositionZ += fDepth;
+ m_aPoint4.PositionZ += fDepth;
+}
+
+Stripe::Stripe( const drawing::Position3D& rPoint1
+ , const drawing::Position3D& rPoint2
+ , const drawing::Position3D& rPoint3
+ , const drawing::Position3D& rPoint4 )
+ : m_aPoint1(rPoint1)
+ , m_aPoint2(rPoint2)
+ , m_aPoint3(rPoint3)
+ , m_aPoint4(rPoint4)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
+{
+}
+
+void Stripe::SetManualNormal( const drawing::Direction3D& rNormal )
+{
+ m_aManualNormal = rNormal;
+ m_bManualNormalSet = true;
+}
+
+void Stripe::InvertNormal( bool bInvertNormal )
+{
+ m_bInvertNormal = bInvertNormal;
+}
+
+uno::Any Stripe::getPolyPolygonShape3D() const
+{
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(4);
+ pOuterSequenceY->realloc(4);
+ pOuterSequenceZ->realloc(4);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ *pInnerSequenceX++ = m_aPoint1.PositionX;
+ *pInnerSequenceY++ = m_aPoint1.PositionY;
+ *pInnerSequenceZ++ = m_aPoint1.PositionZ;
+
+ *pInnerSequenceX++ = m_aPoint2.PositionX;
+ *pInnerSequenceY++ = m_aPoint2.PositionY;
+ *pInnerSequenceZ++ = m_aPoint2.PositionZ;
+
+ *pInnerSequenceX++ = m_aPoint3.PositionX;
+ *pInnerSequenceY++ = m_aPoint3.PositionY;
+ *pInnerSequenceZ++ = m_aPoint3.PositionZ;
+
+ *pInnerSequenceX++ = m_aPoint4.PositionX;
+ *pInnerSequenceY++ = m_aPoint4.PositionY;
+ *pInnerSequenceZ++ = m_aPoint4.PositionZ;
+
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+drawing::Direction3D Stripe::getNormal() const
+{
+ drawing::Direction3D aRet(1.0,0.0,0.0);
+
+ if( m_bManualNormalSet )
+ aRet = m_aManualNormal;
+ else
+ {
+ ::basegfx::B3DPolygon aPolygon3D;
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint1 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint2 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint3 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint4 ));
+ ::basegfx::B3DVector aNormal(::basegfx::tools::getNormal(aPolygon3D));
+ aRet = B3DVectorToDirection3D(aNormal);
+ }
+
+ if( m_bInvertNormal )
+ {
+ aRet.DirectionX *= -1.0;
+ aRet.DirectionY *= -1.0;
+ aRet.DirectionZ *= -1.0;
+ }
+ return aRet;
+}
+
+uno::Any Stripe::getNormalsPolygon() const
+{
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(4);
+ pOuterSequenceY->realloc(4);
+ pOuterSequenceZ->realloc(4);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ drawing::Direction3D aNormal( getNormal() );
+
+ for(sal_Int32 nN=4; --nN; )
+ {
+ *pInnerSequenceX++ = aNormal.DirectionX;
+ *pInnerSequenceY++ = aNormal.DirectionY;
+ *pInnerSequenceZ++ = aNormal.DirectionZ;
+ }
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+uno::Any Stripe::getTexturePolygon( short nRotatedTexture ) const
+{
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(4);
+ pOuterSequenceY->realloc(4);
+ pOuterSequenceZ->realloc(4);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ if( nRotatedTexture==0 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==1 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==2 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==3 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==4 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==5 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==6 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==7 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+
+ return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
new file mode 100644
index 000000000000..8bb6a11b4baf
--- /dev/null
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -0,0 +1,986 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VDataSeries.hxx"
+#include "ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "LabelPositionHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "RegressionCurveHelper.hxx"
+
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+
+//#include "CommonConverters.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/text/WritingMode.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;
+
+void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
+{
+ Model = xModel;
+ Doubles = DataSequenceToDoubleSequence( xModel );
+}
+
+bool VDataSequence::is() const
+{
+ return Model.is();
+}
+void VDataSequence::clear()
+{
+ Model = NULL;
+ Doubles.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;
+ }
+}
+
+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())
+ {
+ nNumberFormatKey = Model->getNumberFormatKeyByIndex( index );
+ }
+
+ return nNumberFormatKey;
+}
+
+sal_Int32 VDataSequence::getLength() const
+{
+ return Doubles.getLength();
+}
+
+namespace
+{
+struct lcl_LessXOfPoint
+{
+ inline bool operator() ( const std::vector< double >& first,
+ const std::vector< double >& second )
+ {
+ if( first.size() > 0 && second.size() > 0 )
+ {
+ return first[0]<second[0];
+ }
+ return false;
+ }
+};
+
+void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence )
+{
+ //#i71686#, #i101968#, #i102428#
+ sal_Int32 nCount = rData.Doubles.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( !::rtl::math::isNan( rData.Doubles[i] ) )
+ return;
+ }
+ //no double value is countained
+ //is there any text?
+ uno::Sequence< rtl::OUString > aStrings( DataSequenceToStringSequence( xDataSequence ) );
+ sal_Int32 nTextCount = aStrings.getLength();
+ for( sal_Int32 j = 0; j < nTextCount; ++j )
+ {
+ if( aStrings[j].getLength() )
+ {
+ rData.clear();
+ return;
+ }
+ }
+ //no content at all
+}
+
+void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment )
+{
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
+ && (::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue)) )
+ rfValue = 0.0;
+}
+
+}
+
+VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
+ : m_nPolygonIndex(0)
+ , m_fLogicMinX(0.0)
+ , m_fLogicMaxX(0.0)
+ , m_fLogicZPos(0.0)
+ , m_xGroupShape(NULL)
+ , m_xLabelsGroupShape(NULL)
+ , m_xErrorBarsGroupShape(NULL)
+ , m_xFrontSubGroupShape(NULL)
+ , m_xBackSubGroupShape(NULL)
+ , m_xDataSeries(xDataSeries)
+ , m_aDataSequences()
+ , m_nPointCount(0)
+
+ , m_aValues_X()
+ , m_aValues_Y()
+ , m_aValues_Z()
+ , m_aValues_Y_Min()
+ , m_aValues_Y_Max()
+ , m_aValues_Y_First()
+ , m_aValues_Y_Last()
+ , m_aValues_Bubble_Size()
+ , m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
+
+ , m_fYMeanValue(1.0)
+
+ , m_aAttributedDataPointIndexList()
+
+ , m_eStackingDirection(StackingDirection_NO_STACKING)
+ , m_nAxisIndex(0)
+ , m_bConnectBars(sal_False)
+ , m_bGroupBarsPerAxis(sal_True)
+ , m_nStartingAngle(90)
+
+ , m_aSeriesParticle()
+ , m_aCID()
+ , m_aPointCID_Stub()
+ , m_aLabelCID_Stub()
+
+ , m_nGlobalSeriesIndex(0)
+
+ , m_apLabel_Series(NULL)
+ , m_apLabelPropNames_Series(NULL)
+ , m_apLabelPropValues_Series(NULL)
+ , m_apSymbolProperties_Series(NULL)
+
+ , m_apLabel_AttributedPoint(NULL)
+ , m_apLabelPropNames_AttributedPoint(NULL)
+ , m_apLabelPropValues_AttributedPoint(NULL)
+ , m_apSymbolProperties_AttributedPoint(NULL)
+ , m_apSymbolProperties_InvisibleSymbolForSelection(NULL)
+ , m_nCurrentAttributedPoint(-1)
+ , m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ , m_bAllowPercentValueInDataLabel(false)
+{
+ ::rtl::math::setNan( & m_fYMeanValue );
+
+ uno::Reference<data::XDataSource> xDataSource =
+ uno::Reference<data::XDataSource>( xDataSeries, uno::UNO_QUERY );
+
+ m_aDataSequences = xDataSource->getDataSequences();
+
+ for(sal_Int32 nN = m_aDataSequences.getLength();nN--;)
+ {
+ if(!m_aDataSequences[nN].is())
+ continue;
+ uno::Reference<data::XDataSequence> xDataSequence( m_aDataSequences[nN]->getValues());
+ uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ uno::Any aARole = xProp->getPropertyValue( C2U( "Role" ) );
+ rtl::OUString aRole;
+ aARole >>= aRole;
+
+ if( aRole.equals(C2U("values-x")) )
+ {
+ m_aValues_X.init( xDataSequence );
+ lcl_clearIfNoValuesButTextIsContained( m_aValues_X, xDataSequence );
+ }
+ else if( aRole.equals(C2U("values-y")) )
+ m_aValues_Y.init( xDataSequence );
+ else if( aRole.equals(C2U("values-min")) )
+ m_aValues_Y_Min.init( xDataSequence );
+ else if( aRole.equals(C2U("values-max")) )
+ m_aValues_Y_Max.init( xDataSequence );
+ else if( aRole.equals(C2U("values-first")) )
+ m_aValues_Y_First.init( xDataSequence );
+ else if( aRole.equals(C2U("values-last")) )
+ m_aValues_Y_Last.init( xDataSequence );
+ else if( aRole.equals(C2U("values-size")) )
+ m_aValues_Bubble_Size.init( xDataSequence );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ }
+
+ //determine the point count
+ m_nPointCount = m_aValues_Y.getLength();
+ {
+ if( m_nPointCount < m_aValues_Bubble_Size.getLength() )
+ m_nPointCount = m_aValues_Bubble_Size.getLength();
+ if( m_nPointCount < m_aValues_Y_Min.getLength() )
+ m_nPointCount = m_aValues_Y_Min.getLength();
+ if( m_nPointCount < m_aValues_Y_Max.getLength() )
+ m_nPointCount = m_aValues_Y_Max.getLength();
+ if( m_nPointCount < m_aValues_Y_First.getLength() )
+ m_nPointCount = m_aValues_Y_First.getLength();
+ if( m_nPointCount < m_aValues_Y_Last.getLength() )
+ m_nPointCount = m_aValues_Y_Last.getLength();
+ }
+
+ uno::Reference<beans::XPropertySet> xProp(xDataSeries, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ //get AttributedDataPoints
+ xProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= m_aAttributedDataPointIndexList;
+
+ xProp->getPropertyValue( C2U( "StackingDirection" ) ) >>= m_eStackingDirection;
+
+ xProp->getPropertyValue( C2U( "AttachedAxisIndex" ) ) >>= m_nAxisIndex;
+ if(m_nAxisIndex<0)
+ m_nAxisIndex=0;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+VDataSeries::~VDataSeries()
+{
+}
+
+void VDataSeries::doSortByXValues()
+{
+ if( m_aValues_X.is() && m_aValues_X.Doubles.getLength() )
+ {
+ //prepare a vector vor sorting
+ std::vector< ::std::vector< double > > aTmp;//outer vector are points, inner vector are the different values of athe 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 );
+ }
+
+ //do sort
+ std::sort( aTmp.begin(), aTmp.end(), lcl_LessXOfPoint() );
+
+ //fill the sorted points back to the mambers
+ m_aValues_X.Doubles.realloc( m_nPointCount );
+ m_aValues_Y.Doubles.realloc( m_nPointCount );
+
+ for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ )
+ {
+ m_aValues_X.Doubles[nPointIndex]=aTmp[nPointIndex][0];
+ m_aValues_Y.Doubles[nPointIndex]=aTmp[nPointIndex][1];
+ }
+ }
+}
+
+uno::Reference< XDataSeries > VDataSeries::getModel() const
+{
+ return m_xDataSeries;
+}
+
+void VDataSeries::releaseShapes()
+{
+ m_xGroupShape.set(0);
+ m_xLabelsGroupShape.set(0);
+ m_xErrorBarsGroupShape.set(0);
+ m_xFrontSubGroupShape.set(0);
+ m_xBackSubGroupShape.set(0);
+
+ m_aPolyPolygonShape3D.SequenceX.realloc(0);
+ m_aPolyPolygonShape3D.SequenceY.realloc(0);
+ m_aPolyPolygonShape3D.SequenceZ.realloc(0);
+ m_nPolygonIndex = 0;
+}
+
+void VDataSeries::setCategoryXAxis()
+{
+ m_aValues_X.clear();
+ m_bAllowPercentValueInDataLabel = true;
+}
+
+void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
+{
+ m_nGlobalSeriesIndex = nGlobalSeriesIndex;
+}
+
+void VDataSeries::setParticle( const rtl::OUString& rSeriesParticle )
+{
+ m_aSeriesParticle = rSeriesParticle;
+
+ //get CID
+ m_aCID = ObjectIdentifier::createClassifiedIdentifierForParticle( m_aSeriesParticle );
+ m_aPointCID_Stub = ObjectIdentifier::createSeriesSubObjectStub( OBJECTTYPE_DATA_POINT, m_aSeriesParticle );
+
+ m_aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_LABEL, ::rtl::OUString(), getLabelsCID() );
+}
+rtl::OUString VDataSeries::getSeriesParticle() const
+{
+ return m_aSeriesParticle;
+}
+rtl::OUString VDataSeries::getCID() const
+{
+ return m_aCID;
+}
+rtl::OUString VDataSeries::getPointCID_Stub() const
+{
+ return m_aPointCID_Stub;
+}
+rtl::OUString VDataSeries::getErrorBarsCID() const
+{
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_ERRORS ) );
+ aChildParticle+=(C2U("="));
+
+ return ObjectIdentifier::createClassifiedIdentifierForParticles(
+ m_aSeriesParticle, aChildParticle );
+}
+rtl::OUString VDataSeries::getLabelsCID() const
+{
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+
+ return ObjectIdentifier::createClassifiedIdentifierForParticles(
+ m_aSeriesParticle, aChildParticle );
+}
+rtl::OUString VDataSeries::getLabelCID_Stub() const
+{
+ return m_aLabelCID_Stub;
+}
+rtl::OUString VDataSeries::getDataCurveCID( sal_Int32 nCurveIndex, bool bAverageLine ) const
+{
+ rtl::OUString aRet;
+ aRet = ObjectIdentifier::createDataCurveCID( m_aSeriesParticle, nCurveIndex, bAverageLine );
+ return aRet;
+}
+
+rtl::OUString VDataSeries::getDataCurveEquationCID( sal_Int32 nCurveIndex ) const
+{
+ rtl::OUString aRet;
+ aRet = ObjectIdentifier::createDataCurveEquationCID( m_aSeriesParticle, nCurveIndex );
+ return aRet;
+}
+void VDataSeries::setPageReferenceSize( const awt::Size & rPageRefSize )
+{
+ m_aReferenceSize = rPageRefSize;
+}
+
+StackingDirection VDataSeries::getStackingDirection() const
+{
+ return m_eStackingDirection;
+}
+sal_Int32 VDataSeries::getAttachedAxisIndex() const
+{
+ return m_nAxisIndex;
+}
+void VDataSeries::setConnectBars( sal_Bool bConnectBars )
+{
+ m_bConnectBars = bConnectBars;
+}
+sal_Bool VDataSeries::getConnectBars() const
+{
+ return m_bConnectBars;
+}
+void VDataSeries::setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis )
+{
+ m_bGroupBarsPerAxis = bGroupBarsPerAxis;
+}
+sal_Bool VDataSeries::getGroupBarsPerAxis() const
+{
+ return m_bGroupBarsPerAxis;
+}
+
+void VDataSeries::setStartingAngle( sal_Int32 nStartingAngle )
+{
+ m_nStartingAngle = nStartingAngle;
+}
+sal_Int32 VDataSeries::getStartingAngle() const
+{
+ return m_nStartingAngle;
+}
+
+void VDataSeries::setAttachedAxisIndex( sal_Int32 nAttachedAxisIndex )
+{
+ if( nAttachedAxisIndex < 0 )
+ nAttachedAxisIndex = 0;
+ m_nAxisIndex = nAttachedAxisIndex;
+}
+
+sal_Int32 VDataSeries::getTotalPointCount() const
+{
+ return m_nPointCount;
+}
+
+double VDataSeries::getXValue( sal_Int32 index ) const
+{
+ double fRet = 0.0;
+ if(m_aValues_X.is())
+ {
+ if( 0<=index && index<m_aValues_X.getLength() )
+ fRet = m_aValues_X.Doubles[index];
+ 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;
+}
+
+double VDataSeries::getYValue( sal_Int32 index ) const
+{
+ double fRet = 0.0;
+ if(m_aValues_Y.is())
+ {
+ if( 0<=index && index<m_aValues_Y.getLength() )
+ fRet = m_aValues_Y.Doubles[index];
+ 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;
+}
+
+double VDataSeries::getY_Min( sal_Int32 index ) const
+{
+ return m_aValues_Y_Min.getValue( index );
+}
+double VDataSeries::getY_Max( sal_Int32 index ) const
+{
+ return m_aValues_Y_Max.getValue( index );
+}
+double VDataSeries::getY_First( sal_Int32 index ) const
+{
+ return m_aValues_Y_First.getValue( index );
+}
+double VDataSeries::getY_Last( sal_Int32 index ) const
+{
+ return m_aValues_Y_Last.getValue( index );
+}
+double VDataSeries::getBubble_Size( sal_Int32 index ) const
+{
+ return m_aValues_Bubble_Size.getValue( index );
+}
+
+bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
+{
+ rtl::OUString aPropName( bForPercentage ? C2U( "PercentageNumberFormat" ) : C2U( "NumberFormat" ) );
+ bool bHasNumberFormat = false;
+ uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( nPointIndex ));
+ sal_Int32 nNumberFormat = -1;
+ if( xPointProp.is() && (xPointProp->getPropertyValue(aPropName) >>= nNumberFormat) )
+ bHasNumberFormat = true;
+ return bHasNumberFormat;
+}
+sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
+{
+ rtl::OUString aPropName( bForPercentage ? C2U( "PercentageNumberFormat" ) : C2U( "NumberFormat" ) );
+ sal_Int32 nNumberFormat = -1;
+ uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( nPointIndex ));
+ if( xPointProp.is() )
+ xPointProp->getPropertyValue(aPropName) >>= nNumberFormat;
+ return nNumberFormat;
+}
+void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole )
+{
+ if( rRole.equals(C2U("values-y")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y;
+ else if( rRole.equals(C2U("values-size")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Bubble_Size;
+ else if( rRole.equals(C2U("values-min")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Min;
+ else if( rRole.equals(C2U("values-max")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Max;
+ else if( rRole.equals(C2U("values-first")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_First;
+ else if( rRole.equals(C2U("values-last")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Last;
+ else if( rRole.equals(C2U("values-x")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X;
+}
+bool VDataSeries::shouldLabelNumberFormatKeyBeDetectedFromYAxis() const
+{
+ if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_Bubble_Size )
+ return false;
+ else if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_X )
+ return false;
+ return true;
+}
+sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
+{
+ sal_Int32 nRet = 0;
+ if( m_pValueSequenceForDataLabelNumberFormatDetection )
+ nRet = m_pValueSequenceForDataLabelNumberFormatDetection->detectNumberFormatKey( index );
+ return nRet;
+}
+
+sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const
+{
+ sal_Int32 nLabelPlacement=0;
+ try
+ {
+ uno::Reference< beans::XPropertySet > xPointProps( this->getPropertiesOfPoint( nPointIndex ) );
+ if( xPointProps.is() )
+ xPointProps->getPropertyValue( C2U( "LabelPlacement" ) ) >>= nLabelPlacement;
+
+ //ensure that the set label placement is supported by this charttype
+
+ uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
+ xChartType, nDimensionCount, bSwapXAndY, m_xDataSeries ) );
+
+ for( sal_Int32 nN = 0; nN < aAvailablePlacements.getLength(); nN++ )
+ if( aAvailablePlacements[nN] == nLabelPlacement )
+ return nLabelPlacement; //ok
+
+ //otherwise use the first supported one
+ if( aAvailablePlacements.getLength() )
+ {
+ nLabelPlacement = aAvailablePlacements[0];
+ return nLabelPlacement;
+ }
+
+ DBG_ERROR("no label placement supported");
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return nLabelPlacement;
+}
+
+double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
+{
+ double fMin=0.0;
+ ::rtl::math::setInf(&fMin, false);
+
+ if( !m_aValues_Y.is() &&
+ (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
+ || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
+ {
+ double fY_Min = getY_Min( index );
+ double fY_Max = getY_Max( index );
+ double fY_First = getY_First( index );
+ double fY_Last = getY_Last( index );
+
+ if(fMin>fY_First)
+ fMin=fY_First;
+ if(fMin>fY_Last)
+ fMin=fY_Last;
+ if(fMin>fY_Min)
+ fMin=fY_Min;
+ if(fMin>fY_Max)
+ fMin=fY_Max;
+ }
+ else
+ {
+ double fY = getYValue( index );
+ if(fMin>fY)
+ fMin=fY;
+ }
+
+ if( ::rtl::math::isInf(fMin) )
+ ::rtl::math::setNan(&fMin);
+
+ return fMin;
+}
+
+double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
+{
+ double fMax=0.0;
+ ::rtl::math::setInf(&fMax, true);
+
+ if( !m_aValues_Y.is() &&
+ (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
+ || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
+ {
+ double fY_Min = getY_Min( index );
+ double fY_Max = getY_Max( index );
+ double fY_First = getY_First( index );
+ double fY_Last = getY_Last( index );
+
+ if(fMax<fY_First)
+ fMax=fY_First;
+ if(fMax<fY_Last)
+ fMax=fY_Last;
+ if(fMax<fY_Min)
+ fMax=fY_Min;
+ if(fMax<fY_Max)
+ fMax=fY_Max;
+ }
+ else
+ {
+ double fY = getYValue( index );
+ if(fMax<fY)
+ fMax=fY;
+ }
+
+ if( ::rtl::math::isInf(fMax) )
+ ::rtl::math::setNan(&fMax);
+
+ return fMax;
+}
+
+uno::Sequence< double > VDataSeries::getAllX() const
+{
+ if(!m_aValues_X.is() && !m_aValues_X.getLength() && m_nPointCount)
+ {
+ //init x values from category indexes
+ //first category (index 0) matches with real number 1.0
+ m_aValues_X.Doubles.realloc( m_nPointCount );
+ for(sal_Int32 nN=m_aValues_X.getLength();nN--;)
+ m_aValues_X.Doubles[nN] = nN+1;
+ }
+ return m_aValues_X.Doubles;
+}
+
+uno::Sequence< double > VDataSeries::getAllY() const
+{
+ if(!m_aValues_Y.is() && !m_aValues_Y.getLength() && m_nPointCount)
+ {
+ //init y values from indexes
+ //first y-value (index 0) matches with real number 1.0
+ m_aValues_Y.Doubles.realloc( m_nPointCount );
+ for(sal_Int32 nN=m_aValues_Y.getLength();nN--;)
+ m_aValues_Y.Doubles[nN] = nN+1;
+ }
+ return m_aValues_Y.Doubles;
+}
+
+double VDataSeries::getYMeanValue() const
+{
+ if( ::rtl::math::isNan( m_fYMeanValue ) )
+ {
+ uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( C2U("com.sun.star.chart2.MeanValueRegressionCurve") ) );
+ uno::Sequence< double > aXValuesDummy;
+ xCalculator->recalculateRegression( aXValuesDummy, getAllY() );
+ double fXDummy = 1.0;
+ m_fYMeanValue = xCalculator->getCurveValue( fXDummy );
+ }
+ return m_fYMeanValue;
+}
+
+::std::auto_ptr< Symbol > getSymbolPropertiesFromPropertySet(
+ const uno::Reference< beans::XPropertySet >& xProp )
+{
+ ::std::auto_ptr< Symbol > apSymbolProps( new Symbol() );
+ try
+ {
+ if( xProp->getPropertyValue( C2U( "Symbol" ) ) >>= *apSymbolProps )
+ {
+ //use main color to fill symbols
+ xProp->getPropertyValue( C2U( "Color" ) ) >>= apSymbolProps->FillColor;
+ // border of symbols always same as fill color
+ apSymbolProps->BorderColor = apSymbolProps->FillColor;
+ }
+ else
+ apSymbolProps.reset();
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return apSymbolProps;
+}
+
+Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const
+{
+ Symbol* pRet=NULL;
+ if( isAttributedDataPoint( index ) )
+ {
+ adaptPointCache( index );
+ if(!m_apSymbolProperties_AttributedPoint.get())
+ m_apSymbolProperties_AttributedPoint = getSymbolPropertiesFromPropertySet( this->getPropertiesOfPoint( index ) );
+ pRet = m_apSymbolProperties_AttributedPoint.get();
+ //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.get())
+ m_apSymbolProperties_Series = getSymbolPropertiesFromPropertySet( this->getPropertiesOfSeries() );
+ if( m_apSymbolProperties_Series.get() && m_apSymbolProperties_Series->Style != SymbolStyle_NONE )
+ {
+ if(!m_apSymbolProperties_InvisibleSymbolForSelection.get())
+ {
+ m_apSymbolProperties_InvisibleSymbolForSelection = ::std::auto_ptr< Symbol >( new Symbol() );
+ m_apSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD;
+ m_apSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square
+ m_apSymbolProperties_InvisibleSymbolForSelection->Size = m_apSymbolProperties_Series->Size;
+ m_apSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible
+ m_apSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible
+ }
+ pRet = m_apSymbolProperties_InvisibleSymbolForSelection.get();
+ }
+ }
+ }
+ else
+ {
+ if(!m_apSymbolProperties_Series.get())
+ m_apSymbolProperties_Series = getSymbolPropertiesFromPropertySet( this->getPropertiesOfSeries() );
+ pRet = m_apSymbolProperties_Series.get();
+ }
+
+ if( pRet && pRet->Style == SymbolStyle_AUTO )
+ {
+ pRet->Style = SymbolStyle_STANDARD;
+
+ sal_Int32 nIndex = m_nGlobalSeriesIndex;
+ if(m_aValues_X.is())
+ nIndex++;
+ pRet->StandardSymbol = nIndex;
+ }
+
+ return pRet;
+}
+
+uno::Reference< beans::XPropertySet > VDataSeries::getYErrorBarProperties( sal_Int32 index ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProp;
+
+ uno::Reference< beans::XPropertySet > xPointProp( this->getPropertiesOfPoint( index ));
+ if( xPointProp.is() )
+ xPointProp->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProp;
+ return xErrorBarProp;
+}
+
+bool VDataSeries::hasPointOwnColor( sal_Int32 index ) const
+{
+ if( !isAttributedDataPoint(index) )
+ return false;
+
+ try
+ {
+ uno::Reference< beans::XPropertyState > xPointState( this->getPropertiesOfPoint(index), uno::UNO_QUERY_THROW );
+ return (xPointState->getPropertyState( C2U("Color")) != beans::PropertyState_DEFAULT_VALUE );
+ }
+ catch( uno::Exception& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return false;
+}
+
+bool VDataSeries::isAttributedDataPoint( sal_Int32 index ) const
+{
+ //returns true if the data point assigned by the given index has set it's own properties
+ if( index>=m_nPointCount || m_nPointCount==0)
+ return false;
+ for(sal_Int32 nN=m_aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ if(index==m_aAttributedDataPointIndexList[nN])
+ return true;
+ }
+ return false;
+}
+
+bool VDataSeries::isVaryColorsByPoint() const
+{
+ bool bVaryColorsByPoint = false;
+ Reference< beans::XPropertySet > xSeriesProp( this->getPropertiesOfSeries() );
+ if( xSeriesProp.is() )
+ xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint;
+ return bVaryColorsByPoint;
+}
+
+uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfPoint( sal_Int32 index ) const
+{
+ if( isAttributedDataPoint( index ) )
+ return m_xDataSeries->getDataPointByIndex(index);
+ return this->getPropertiesOfSeries();
+}
+
+uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfSeries() const
+{
+ return uno::Reference<beans::XPropertySet>(m_xDataSeries, uno::UNO_QUERY );
+}
+
+::std::auto_ptr< DataPointLabel > getDataPointLabelFromPropertySet(
+ const uno::Reference< beans::XPropertySet >& xProp )
+{
+ ::std::auto_ptr< DataPointLabel > apLabel( new DataPointLabel() );
+ try
+ {
+ if( !(xProp->getPropertyValue( C2U( "Label" ) ) >>= *apLabel) )
+ apLabel.reset();
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return apLabel;
+}
+
+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_nCurrentAttributedPoint = nNewPointIndex;
+ }
+}
+
+DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const
+{
+ DataPointLabel* pRet = NULL;
+ if( isAttributedDataPoint( index ) )
+ {
+ adaptPointCache( index );
+ if( !m_apLabel_AttributedPoint.get() )
+ m_apLabel_AttributedPoint = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
+ pRet = m_apLabel_AttributedPoint.get();
+ }
+ else
+ {
+ if(!m_apLabel_Series.get())
+ m_apLabel_Series = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
+ pRet = m_apLabel_Series.get();
+ }
+ if( !m_bAllowPercentValueInDataLabel )
+ {
+ if( pRet )
+ pRet->ShowNumberInPercent = false;
+ }
+ return pRet;
+}
+
+DataPointLabel* VDataSeries::getDataPointLabelIfLabel( sal_Int32 index ) const
+{
+ DataPointLabel* pLabel = this->getDataPointLabel( index );
+ if( !pLabel || (!pLabel->ShowNumber && !pLabel->ShowNumberInPercent
+ && !pLabel->ShowCategoryName ) )
+ return 0;
+ return pLabel;
+}
+
+bool VDataSeries::getTextLabelMultiPropertyLists( sal_Int32 index
+ , tNameSequence*& pPropNames
+ , tAnySequence*& pPropValues ) const
+{
+ pPropNames = NULL; pPropValues = NULL;
+ uno::Reference< beans::XPropertySet > xTextProp;
+ bool bDoDynamicFontResize = false;
+ if( isAttributedDataPoint( index ) )
+ {
+ adaptPointCache( index );
+ if(!m_apLabelPropValues_AttributedPoint.get())
+ {
+ pPropNames = new tNameSequence();
+ pPropValues = new tAnySequence();
+ xTextProp.set( this->getPropertiesOfPoint( index ));
+ PropertyMapper::getTextLabelMultiPropertyLists( xTextProp, *pPropNames, *pPropValues );
+ m_apLabelPropNames_AttributedPoint = ::std::auto_ptr< tNameSequence >(pPropNames);
+ m_apLabelPropValues_AttributedPoint = ::std::auto_ptr< tAnySequence >(pPropValues);
+ bDoDynamicFontResize = true;
+ }
+ pPropNames = m_apLabelPropNames_AttributedPoint.get();
+ pPropValues = m_apLabelPropValues_AttributedPoint.get();
+ }
+ else
+ {
+ if(!m_apLabelPropValues_Series.get())
+ {
+ pPropNames = new tNameSequence();
+ pPropValues = new tAnySequence();
+ xTextProp.set( this->getPropertiesOfPoint( index ));
+ PropertyMapper::getTextLabelMultiPropertyLists( xTextProp, *pPropNames, *pPropValues );
+ m_apLabelPropNames_Series = ::std::auto_ptr< tNameSequence >(pPropNames);
+ m_apLabelPropValues_Series = ::std::auto_ptr< tAnySequence >(pPropValues);
+ bDoDynamicFontResize = true;
+ }
+ pPropNames = m_apLabelPropNames_Series.get();
+ pPropValues = m_apLabelPropValues_Series.get();
+ }
+
+ if( bDoDynamicFontResize &&
+ pPropNames && pPropValues &&
+ xTextProp.is())
+ {
+ LabelPositionHelper::doDynamicFontResize( *pPropValues, *pPropNames, xTextProp, m_aReferenceSize );
+ }
+ if(pPropNames&&pPropValues)
+ return true;
+ return false;
+}
+
+void VDataSeries::setMissingValueTreatment( sal_Int32 nMissingValueTreatment )
+{
+ m_nMissingValueTreatment = nMissingValueTreatment;
+}
+
+sal_Int32 VDataSeries::getMissingValueTreatment() const
+{
+ return m_nMissingValueTreatment;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
new file mode 100644
index 000000000000..7101a984ee24
--- /dev/null
+++ b/chart2/source/view/main/VLegend.cxx
@@ -0,0 +1,834 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VLegend.hxx"
+#include "macros.hxx"
+#include "PropertyMapper.hxx"
+#include "CommonConverters.hxx"
+#include "ObjectIdentifier.hxx"
+#include "RelativePositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "RelativeSizeHelper.hxx"
+#include "LegendEntryProvider.hxx"
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+namespace
+{
+
+typedef ::std::pair< ::chart::tNameSequence, ::chart::tAnySequence > tPropertyValues;
+
+typedef ::std::vector< ViewLegendEntry > tViewLegendEntryContainer;
+
+double lcl_CalcViewFontSize(
+ const Reference< beans::XPropertySet > & xProp,
+ const awt::Size & rReferenceSize )
+{
+ double fResult = 10.0;
+
+ awt::Size aPropRefSize;
+ float fFontHeight( 0.0 );
+ if( xProp.is() && ( xProp->getPropertyValue( C2U( "CharHeight" )) >>= fFontHeight ))
+ {
+ fResult = fFontHeight;
+ try
+ {
+ if( (xProp->getPropertyValue( C2U( "ReferencePageSize" )) >>= aPropRefSize) &&
+ (aPropRefSize.Height > 0))
+ {
+ // todo: find out if asian text is really used
+// Reference< beans::XPropertySetInfo >xInfo( xProp, uno::UNO_QUERY );
+// float fFontHeight2 = fFontHeight;
+// if( xInfo.is() &&
+// xInfo->hasPropertyByName(C2U("CharHeightAsian")) &&
+// (xProp->getPropertyValue(C2U("CharHeightAsian")) >>= fFontHeight2) &&
+// fFontHeight2 > fFontHeight )
+// {
+// fFontHeight = fFontHeight2;
+// }
+
+// if( xInfo.is() &&
+// xInfo->hasPropertyByName(C2U("CharHeightComplex")) &&
+// (xProp->getPropertyValue(C2U("CharHeightComplex")) >>= fFontHeight2) &&
+// fFontHeight2 > fFontHeight )
+// {
+// fFontHeight = fFontHeight2;
+// }
+
+ fResult = ::chart::RelativeSizeHelper::calculate( fFontHeight, aPropRefSize, rReferenceSize );
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // pt -> 1/100th mm
+ return (fResult * (2540.0 / 72.0));
+}
+
+void lcl_getProperties(
+ const Reference< beans::XPropertySet > & xLegendProp,
+ tPropertyValues & rOutLineFillProperties,
+ tPropertyValues & rOutTextProperties,
+ sal_Int32 nMaxLabelWidth,
+ const awt::Size & rReferenceSize )
+{
+ // Get Line- and FillProperties from model legend
+ if( xLegendProp.is())
+ {
+ // set rOutLineFillProperties
+ ::chart::tPropertyNameValueMap aLineFillValueMap;
+ ::chart::PropertyMapper::getValueMap( aLineFillValueMap, ::chart::PropertyMapper::getPropertyNameMapForFillAndLineProperties(), xLegendProp );
+
+ aLineFillValueMap[ C2U("LineJoint") ] = uno::makeAny( drawing::LineJoint_ROUND );
+
+ ::chart::PropertyMapper::getMultiPropertyListsFromValueMap(
+ rOutLineFillProperties.first, rOutLineFillProperties.second, aLineFillValueMap );
+
+ // set rOutTextProperties
+ ::chart::tPropertyNameValueMap aTextValueMap;
+ ::chart::PropertyMapper::getValueMap( aTextValueMap, ::chart::PropertyMapper::getPropertyNameMapForCharacterProperties(), xLegendProp );
+
+ drawing::TextHorizontalAdjust eHorizAdjust( drawing::TextHorizontalAdjust_LEFT );
+ aTextValueMap[ C2U("TextAutoGrowHeight") ] = uno::makeAny( sal_True );
+ aTextValueMap[ C2U("TextAutoGrowWidth") ] = uno::makeAny( sal_True );
+ aTextValueMap[ C2U("TextHorizontalAdjust") ] = uno::makeAny( eHorizAdjust );
+ aTextValueMap[ C2U("TextMaximumFrameWidth") ] = uno::makeAny( nMaxLabelWidth );
+
+ // recalculate font size
+ awt::Size aPropRefSize;
+ float fFontHeight( 0.0 );
+ if( (xLegendProp->getPropertyValue( C2U( "ReferencePageSize" )) >>= aPropRefSize) &&
+ (aPropRefSize.Height > 0) &&
+ (aTextValueMap[ C2U("CharHeight") ] >>= fFontHeight) )
+ {
+ aTextValueMap[ C2U("CharHeight") ] = uno::makeAny(
+ static_cast< float >(
+ ::chart::RelativeSizeHelper::calculate( fFontHeight, aPropRefSize, rReferenceSize )));
+
+ if( aTextValueMap[ C2U("CharHeightAsian") ] >>= fFontHeight )
+ {
+ aTextValueMap[ C2U("CharHeightAsian") ] = uno::makeAny(
+ static_cast< float >(
+ ::chart::RelativeSizeHelper::calculate( fFontHeight, aPropRefSize, rReferenceSize )));
+ }
+ if( aTextValueMap[ C2U("CharHeightComplex") ] >>= fFontHeight )
+ {
+ aTextValueMap[ C2U("CharHeightComplex") ] = uno::makeAny(
+ static_cast< float >(
+ ::chart::RelativeSizeHelper::calculate( fFontHeight, aPropRefSize, rReferenceSize )));
+ }
+ }
+
+ ::chart::PropertyMapper::getMultiPropertyListsFromValueMap(
+ rOutTextProperties.first, rOutTextProperties.second, aTextValueMap );
+ }
+}
+
+awt::Size lcl_createTextShapes(
+ const tViewLegendEntryContainer & rEntries,
+ const Reference< lang::XMultiServiceFactory > & xShapeFactory,
+ const Reference< drawing::XShapes > & xTarget,
+ ::std::vector< Reference< drawing::XShape > > & rOutTextShapes,
+ const tPropertyValues & rTextProperties )
+{
+ awt::Size aResult;
+
+ for( tViewLegendEntryContainer::const_iterator aIt( rEntries.begin());
+ aIt != rEntries.end(); ++aIt )
+ {
+ try
+ {
+ // create label shape
+ Reference< drawing::XShape > xGroupShapeForSingleEntry(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.GroupShape" )), uno::UNO_QUERY_THROW );
+ Reference< drawing::XShape >xEntry(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.TextShape" )), uno::UNO_QUERY_THROW );
+ xTarget->add( xGroupShapeForSingleEntry );
+
+ Reference< drawing::XShapes > xGroup( xGroupShapeForSingleEntry, uno::UNO_QUERY_THROW );
+ xGroup->add( xEntry );
+
+ // set label text
+ Sequence< Reference< XFormattedString > > aLabelSeq = (*aIt).aLabel;
+ for( sal_Int32 i = 0; i < aLabelSeq.getLength(); ++i )
+ {
+ // todo: support more than one text range
+ if( i == 1 )
+ break;
+
+ Reference< text::XTextRange > xRange( xEntry, uno::UNO_QUERY );
+ OUString aLabelString( aLabelSeq[i]->getString());
+ // workaround for Issue #i67540#
+ if( !aLabelString.getLength())
+ aLabelString = C2U(" ");
+ if( xRange.is())
+ xRange->setString( aLabelString );
+
+ PropertyMapper::setMultiProperties(
+ rTextProperties.first, rTextProperties.second,
+ Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY ));
+
+ // adapt max-extent
+ awt::Size aCurrSize( xEntry->getSize());
+ aResult.Width = ::std::max( aResult.Width, aCurrSize.Width );
+ aResult.Height = ::std::max( aResult.Height, aCurrSize.Height );
+ }
+
+ rOutTextShapes.push_back( xGroupShapeForSingleEntry );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+
+void lcl_placeLegendEntries(
+ const tViewLegendEntryContainer & rEntries,
+ LegendExpansion eExpansion,
+ bool bSymbolsLeftSide,
+ const Reference< beans::XPropertySet > & xProperties,
+ tPropertyValues & rTextProperties,
+ const Reference< drawing::XShapes > & xTarget,
+ const Reference< lang::XMultiServiceFactory > & xShapeFactory,
+ const Reference< uno::XComponentContext > & /* xContext */,
+ const awt::Size & rAvailableSpace,
+ const awt::Size & rPageSize,
+ awt::Size & rOutLegendSize )
+{
+ double fViewFontSize = lcl_CalcViewFontSize( xProperties, rPageSize );
+
+ // padding as percentage of the font height
+ // #i109336# Improve auto positioning in chart
+ double fXPadding = 0.1;
+ double fYPadding = 0.2;
+ double fXOffset = 0.15;
+ double fYOffset = 0.15;
+
+ const sal_Int32 nXPadding = static_cast< sal_Int32 >( fViewFontSize * fXPadding );
+ const sal_Int32 nYPadding = static_cast< sal_Int32 >( fViewFontSize * fYPadding );
+ const sal_Int32 nXOffset = static_cast< sal_Int32 >( fViewFontSize * fXOffset );
+ const sal_Int32 nYOffset = static_cast< sal_Int32 >( fViewFontSize * fYOffset );
+
+ ::std::vector< Reference< drawing::XShape > > aTextShapes;
+ awt::Size aMaxEntryExtent = lcl_createTextShapes(
+ rEntries, xShapeFactory, xTarget, aTextShapes, rTextProperties );
+ OSL_ASSERT( aTextShapes.size() == rEntries.size());
+
+ // #i109336# Improve auto positioning in chart
+ double fSymbolSizeFraction = 0.8;
+ awt::Size aMaxSymbolExtent( static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction * 3.0 / 2.0 ),
+ static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction ) );
+
+ sal_Int32 nCurrentXPos = nXPadding;
+ sal_Int32 nCurrentYPos = nYPadding;
+ sal_Int32 nMaxEntryWidth = 2 * nXOffset + aMaxSymbolExtent.Width + aMaxEntryExtent.Width;
+ sal_Int32 nMaxEntryHeight = nYOffset + aMaxEntryExtent.Height;
+ sal_Int32 nNumberOfEntries = rEntries.size();
+
+ if( !bSymbolsLeftSide )
+ nCurrentXPos = -nXPadding;
+
+ sal_Int32 nNumberOfColumns = 0, nNumberOfRows = 0;
+
+ // determine layout depending on LegendExpansion
+ if( eExpansion == LegendExpansion_HIGH )
+ {
+ sal_Int32 nMaxNumberOfRows = nMaxEntryHeight
+ ? (rAvailableSpace.Height - 2*nYPadding ) / nMaxEntryHeight
+ : 0;
+
+ nNumberOfColumns = nMaxNumberOfRows
+ ? static_cast< sal_Int32 >(
+ ceil( static_cast< double >( nNumberOfEntries ) /
+ static_cast< double >( nMaxNumberOfRows ) ))
+ : 0;
+ nNumberOfRows = nNumberOfColumns
+ ? static_cast< sal_Int32 >(
+ ceil( static_cast< double >( nNumberOfEntries ) /
+ static_cast< double >( nNumberOfColumns ) ))
+ : 0;
+ }
+ else if( eExpansion == LegendExpansion_WIDE )
+ {
+ sal_Int32 nMaxNumberOfColumns = nMaxEntryWidth
+ ? (rAvailableSpace.Width - 2*nXPadding ) / nMaxEntryWidth
+ : 0;
+
+ nNumberOfRows = nMaxNumberOfColumns
+ ? static_cast< sal_Int32 >(
+ ceil( static_cast< double >( nNumberOfEntries ) /
+ static_cast< double >( nMaxNumberOfColumns ) ))
+ : 0;
+ nNumberOfColumns = nNumberOfRows
+ ? static_cast< sal_Int32 >(
+ ceil( static_cast< double >( nNumberOfEntries ) /
+ static_cast< double >( nNumberOfRows ) ))
+ : 0;
+ }
+ else // LegendExpansion_BALANCED
+ {
+ double fAspect = nMaxEntryHeight
+ ? static_cast< double >( nMaxEntryWidth ) / static_cast< double >( nMaxEntryHeight )
+ : 0.0;
+
+ nNumberOfRows = static_cast< sal_Int32 >(
+ ceil( sqrt( static_cast< double >( nNumberOfEntries ) * fAspect )));
+ nNumberOfColumns = nNumberOfRows
+ ? static_cast< sal_Int32 >(
+ ceil( static_cast< double >( nNumberOfEntries ) /
+ static_cast< double >( nNumberOfRows ) ))
+ : 0;
+ }
+
+ if(nNumberOfRows<=0)
+ return;
+
+ // calculate maximum height for current row
+ std::vector< sal_Int32 > nMaxHeights( nNumberOfRows );
+ sal_Int32 nRow = 0;
+ sal_Int32 nColumn = 0;
+ for( ; nRow < nNumberOfRows; ++nRow )
+ {
+ sal_Int32 nMaxHeight = 0;
+ for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn )
+ {
+ sal_Int32 nEntry = ( eExpansion == LegendExpansion_WIDE )
+ ? (nColumn + nRow * nNumberOfColumns)
+ // HIGH or BALANCED
+ : (nRow + nColumn * nNumberOfRows);
+ if( nEntry < nNumberOfEntries )
+ nMaxHeight = ::std::max(
+ nMaxHeight, nYOffset + aTextShapes[ nEntry ]->getSize().Height );
+ }
+ nMaxHeights[ nRow ] = nMaxHeight;
+ }
+
+ // place entries ordered in optimal-width columns
+ sal_Int32 nMaxYPos = 0;
+ for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn )
+ {
+ sal_Int32 nMaxWidth = 0;
+ nCurrentYPos = nYPadding;
+
+ for( nRow = 0; nRow < nNumberOfRows; ++nRow )
+ {
+ sal_Int32 nEntry = ( eExpansion == LegendExpansion_WIDE )
+ ? (nColumn + nRow * nNumberOfColumns)
+ // HIGH or BALANCED
+ : (nRow + nColumn * nNumberOfRows);
+
+ if( nEntry >= nNumberOfEntries )
+ break;
+
+ // symbol
+ Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+
+ if( xSymbol.is() )
+ {
+ // Note: aspect ratio should always be 3:2
+
+ // set symbol size to 75% of maximum space
+ awt::Size aSymbolSize(
+ aMaxSymbolExtent.Width * 75 / 100,
+ aMaxSymbolExtent.Height * 75 / 100 );
+ xSymbol->setSize( aSymbolSize );
+ sal_Int32 nSymbolXPos = nCurrentXPos + ((aMaxSymbolExtent.Width - aSymbolSize.Width) / 2);
+ if( !bSymbolsLeftSide )
+ nSymbolXPos = nSymbolXPos - aMaxSymbolExtent.Width;
+
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nTextHeight = nMaxHeights[ nRow ] - nYOffset;
+ sal_Int32 nFontSize = static_cast< sal_Int32 >( fViewFontSize );
+ sal_Int32 nMaxRowHeight = ( ( ( nTextHeight / nFontSize ) <= 1 ) ? nTextHeight : nFontSize );
+ sal_Int32 nSymbolYPos = nCurrentYPos + ( ( nMaxRowHeight - aSymbolSize.Height ) / 2 );
+ xSymbol->setPosition( awt::Point( nSymbolXPos, nSymbolYPos ) );
+ }
+
+ // position text shape
+ awt::Size aTextSize( aTextShapes[ nEntry ]->getSize());
+ nMaxWidth = ::std::max( nMaxWidth, 2 * nXOffset + aMaxSymbolExtent.Width + aTextSize.Width );
+ sal_Int32 nTextXPos = nCurrentXPos + aMaxSymbolExtent.Width;
+ if( !bSymbolsLeftSide )
+ nTextXPos = nCurrentXPos - aMaxSymbolExtent.Width - aTextSize.Width;
+ aTextShapes[ nEntry ]->setPosition( awt::Point( nTextXPos, nCurrentYPos ));
+
+ nCurrentYPos += nMaxHeights[ nRow ];
+ nMaxYPos = ::std::max( nMaxYPos, nCurrentYPos );
+ }
+ if( bSymbolsLeftSide )
+ nCurrentXPos += nMaxWidth;
+ else
+ nCurrentXPos -= nMaxWidth;
+ }
+
+ if( bSymbolsLeftSide )
+ rOutLegendSize.Width = nCurrentXPos + nXPadding;
+ else
+ {
+ sal_Int32 nLegendWidth = -(nCurrentXPos-nXPadding);
+ rOutLegendSize.Width = nLegendWidth;
+
+ awt::Point aPos(0,0);
+ for( sal_Int32 nEntry=0; nEntry<nNumberOfEntries; nEntry++ )
+ {
+ Reference< drawing::XShape > xSymbol( rEntries[ nEntry ].aSymbol );
+ aPos = xSymbol->getPosition();
+ aPos.X += nLegendWidth;
+ xSymbol->setPosition( aPos );
+ Reference< drawing::XShape > xText( aTextShapes[ nEntry ] );
+ aPos = xText->getPosition();
+ aPos.X += nLegendWidth;
+ xText->setPosition( aPos );
+ }
+ }
+ rOutLegendSize.Height = nMaxYPos + nYPadding;
+}
+
+// #i109336# Improve auto positioning in chart
+sal_Int32 lcl_getLegendLeftRightMargin()
+{
+ return 210; // 1/100 mm
+}
+
+// #i109336# Improve auto positioning in chart
+sal_Int32 lcl_getLegendTopBottomMargin()
+{
+ return 185; // 1/100 mm
+}
+
+chart2::RelativePosition lcl_getDefaultPosition( LegendPosition ePos, const awt::Rectangle& rOutAvailableSpace, const awt::Size & rPageSize )
+{
+ chart2::RelativePosition aResult;
+
+ switch( ePos )
+ {
+ case LegendPosition_LINE_START:
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendLeftRightMargin() ) /
+ static_cast< double >( rPageSize.Width ) );
+ aResult = chart2::RelativePosition(
+ fDefaultDistance, 0.5, drawing::Alignment_LEFT );
+ }
+ break;
+ case LegendPosition_LINE_END:
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendLeftRightMargin() ) /
+ static_cast< double >( rPageSize.Width ) );
+ aResult = chart2::RelativePosition(
+ 1.0 - fDefaultDistance, 0.5, drawing::Alignment_RIGHT );
+ }
+ break;
+ case LegendPosition_PAGE_START:
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendTopBottomMargin() ) /
+ static_cast< double >( rPageSize.Height ) );
+ double fDistance = (static_cast<double>(rOutAvailableSpace.Y)/static_cast<double>(rPageSize.Height)) + fDefaultDistance;
+ aResult = chart2::RelativePosition(
+ 0.5, fDistance, drawing::Alignment_TOP );
+ }
+ break;
+ case LegendPosition_PAGE_END:
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendTopBottomMargin() ) /
+ static_cast< double >( rPageSize.Height ) );
+ aResult = chart2::RelativePosition(
+ 0.5, 1.0 - fDefaultDistance, drawing::Alignment_BOTTOM );
+ }
+ break;
+
+ case LegendPosition_CUSTOM:
+ // to avoid warning
+ case LegendPosition_MAKE_FIXED_SIZE:
+ // nothing to be set
+ break;
+ }
+
+ return aResult;
+}
+
+/** @return
+ a point relative to the upper left corner that can be used for
+ XShape::setPosition()
+*/
+awt::Point lcl_calculatePositionAndRemainingSpace(
+ awt::Rectangle & rRemainingSpace,
+ const awt::Size & rPageSize,
+ chart2::RelativePosition aRelPos,
+ LegendPosition ePos,
+ const awt::Size& aLegendSize )
+{
+ // calculate position
+ awt::Point aResult(
+ static_cast< sal_Int32 >( aRelPos.Primary * rPageSize.Width ),
+ static_cast< sal_Int32 >( aRelPos.Secondary * rPageSize.Height ));
+
+ aResult = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ aResult, aLegendSize, aRelPos.Anchor );
+
+ // adapt rRemainingSpace if LegendPosition is not CUSTOM
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nXDistance = lcl_getLegendLeftRightMargin();
+ sal_Int32 nYDistance = lcl_getLegendTopBottomMargin();
+ switch( ePos )
+ {
+ case LegendPosition_LINE_START:
+ {
+ sal_Int32 nExtent = aLegendSize.Width;
+ rRemainingSpace.Width -= ( nExtent + nXDistance );
+ rRemainingSpace.X += ( nExtent + nXDistance );
+ }
+ break;
+ case LegendPosition_LINE_END:
+ {
+ rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance );
+ }
+ break;
+ case LegendPosition_PAGE_START:
+ {
+ sal_Int32 nExtent = aLegendSize.Height;
+ rRemainingSpace.Height -= ( nExtent + nYDistance );
+ rRemainingSpace.Y += ( nExtent + nYDistance );
+ }
+ break;
+ case LegendPosition_PAGE_END:
+ {
+ rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance );
+ }
+ break;
+
+ default:
+ // nothing
+ break;
+ }
+
+ // adjust the legend position. Esp. for old files that had slightly smaller legends
+ const sal_Int32 nEdgeDistance( 30 );
+ if( aResult.X + aLegendSize.Width > rPageSize.Width )
+ {
+ sal_Int32 nNewX( (rPageSize.Width - aLegendSize.Width) - nEdgeDistance );
+ if( nNewX > rPageSize.Width / 4 )
+ aResult.X = nNewX;
+ }
+ if( aResult.Y + aLegendSize.Height > rPageSize.Height )
+ {
+ sal_Int32 nNewY( (rPageSize.Height - aLegendSize.Height) - nEdgeDistance );
+ if( nNewY > rPageSize.Height / 4 )
+ aResult.Y = nNewY;
+ }
+
+ return aResult;
+}
+
+template< class T >
+void lcl_appendSeqToVector( const Sequence< T > & rSource, ::std::vector< T > & rDest )
+{
+ const sal_Int32 nCount = rSource.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ rDest.push_back( rSource[ i ] );
+}
+
+bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySet >& xLegendProp, sal_Int16 nDefaultWritingMode )
+{
+ bool bSymbolsLeftSide = true;
+ try
+ {
+ if( SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ if(xLegendProp.is())
+ {
+ sal_Int16 nWritingMode=-1;
+ if( (xLegendProp->getPropertyValue( C2U("WritingMode") ) >>= nWritingMode) )
+ {
+ if( nWritingMode == text::WritingMode2::PAGE )
+ nWritingMode = nDefaultWritingMode;
+ if( nWritingMode == text::WritingMode2::RL_TB )
+ bSymbolsLeftSide=false;
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return bSymbolsLeftSide;
+}
+
+} // anonymous namespace
+
+VLegend::VLegend(
+ const Reference< XLegend > & xLegend,
+ const Reference< uno::XComponentContext > & xContext,
+ const std::vector< LegendEntryProvider* >& rLegendEntryProviderList ) :
+ m_xLegend( xLegend ),
+ m_xContext( xContext ),
+ m_aLegendEntryProviderList( rLegendEntryProviderList )
+{
+}
+
+// ----------------------------------------
+
+void SAL_CALL VLegend::init(
+ const Reference< drawing::XShapes >& xTargetPage,
+ const Reference< lang::XMultiServiceFactory >& xFactory,
+ const Reference< frame::XModel >& xModel )
+{
+ m_xTarget = xTargetPage;
+ m_xShapeFactory = xFactory;
+ m_xModel = xModel;
+}
+
+// ----------------------------------------
+
+void VLegend::setDefaultWritingMode( sal_Int16 nDefaultWritingMode )
+{
+ m_nDefaultWritingMode = nDefaultWritingMode;
+}
+
+// ----------------------------------------
+
+// static
+bool VLegend::isVisible( const Reference< XLegend > & xLegend )
+{
+ if( ! xLegend.is())
+ return sal_False;
+
+ sal_Bool bShow = sal_False;
+ try
+ {
+ Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
+ xLegendProp->getPropertyValue( C2U( "Show" )) >>= bShow;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return bShow;
+}
+
+// ----------------------------------------
+
+void VLegend::createShapes(
+ const awt::Size & rAvailableSpace,
+ const awt::Size & rPageSize )
+{
+ if(! (m_xLegend.is() &&
+ m_xShapeFactory.is() &&
+ m_xTarget.is()))
+ return;
+
+ try
+ {
+ //create shape and add to page
+ m_xShape.set( m_xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.GroupShape" )), uno::UNO_QUERY );
+ m_xTarget->add( m_xShape );
+
+ // set name to enable selection
+ {
+ OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( m_xLegend, m_xModel ) );
+ ShapeFactory::setShapeName( m_xShape, ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle ) );
+ }
+
+ // create and insert sub-shapes
+ Reference< drawing::XShapes > xLegendContainer( m_xShape, uno::UNO_QUERY );
+ if( xLegendContainer.is())
+ {
+ Reference< drawing::XShape > xBorder(
+ m_xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY );
+
+ // for quickly setting properties
+ tPropertyValues aLineFillProperties;
+ tPropertyValues aTextProperties;
+
+ // limit the width of texts to 30% of the total available width
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nMaxLabelWidth = rAvailableSpace.Width * 3 / 10;
+ Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY );
+ LegendExpansion eExpansion = LegendExpansion_HIGH;
+ if( xLegendProp.is())
+ {
+ // get Expansion property
+ xLegendProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion;
+ if( eExpansion == LegendExpansion_WIDE )
+ {
+ //#i80377#
+ nMaxLabelWidth = (rAvailableSpace.Width * 5) / 6;//completely correct would be available width minus symbol size minus distances to page ...
+ }
+
+ lcl_getProperties( xLegendProp, aLineFillProperties, aTextProperties, nMaxLabelWidth,
+ rPageSize );
+ }
+
+ if( xBorder.is())
+ {
+ xLegendContainer->add( xBorder );
+
+ // apply legend properties
+ PropertyMapper::setMultiProperties(
+ aLineFillProperties.first, aLineFillProperties.second,
+ Reference< beans::XPropertySet >( xBorder, uno::UNO_QUERY ));
+
+ //because of this name this border will be used for marking the legend
+ ShapeFactory(m_xShapeFactory).setShapeName( xBorder, C2U("MarkHandles") );
+ }
+
+ // create entries
+ tViewLegendEntryContainer aViewEntries;
+ {
+ ::std::vector< LegendEntryProvider* >::const_iterator aIter = m_aLegendEntryProviderList.begin();
+ const ::std::vector< LegendEntryProvider* >::const_iterator aEnd = m_aLegendEntryProviderList.end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ LegendEntryProvider* pLegendEntryProvider( *aIter );
+ if( pLegendEntryProvider )
+ {
+ lcl_appendSeqToVector< ViewLegendEntry >(
+ pLegendEntryProvider->createLegendEntries( eExpansion, xLegendProp, xLegendContainer, m_xShapeFactory, m_xContext )
+ , aViewEntries );
+ }
+ }
+ }
+
+ bool bSymbolsLeftSide = lcl_shouldSymbolsBePlacedOnTheLeftSide( xLegendProp, m_nDefaultWritingMode );
+
+ // place entries
+ awt::Size aLegendSize;
+ lcl_placeLegendEntries( aViewEntries, eExpansion, bSymbolsLeftSide
+ , xLegendProp, aTextProperties
+ , xLegendContainer, m_xShapeFactory, m_xContext
+ , rAvailableSpace, rPageSize, aLegendSize );
+
+ if( xBorder.is())
+ xBorder->setSize( aLegendSize );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ----------------------------------------
+
+void VLegend::changePosition(
+ awt::Rectangle & rOutAvailableSpace,
+ const awt::Size & rPageSize )
+{
+ if(! m_xShape.is())
+ return;
+
+ try
+ {
+ // 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 bAutoPosition =
+ ! (xLegendProp->getPropertyValue( C2U( "RelativePosition" )) >>= aRelativePosition);
+
+ LegendPosition ePos = LegendPosition_CUSTOM;
+ xLegendProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos;
+
+ //calculate position
+ if( bAutoPosition )
+ {
+ // auto position: relative to remaining space
+ aRelativePosition = lcl_getDefaultPosition( ePos, rOutAvailableSpace, rPageSize );
+ awt::Point aPos = lcl_calculatePositionAndRemainingSpace(
+ rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize );
+ m_xShape->setPosition( aPos );
+ }
+ else
+ {
+ // manual position: relative to whole page
+ awt::Rectangle aAvailableSpace( 0, 0, rPageSize.Width, rPageSize.Height );
+ awt::Point aPos = lcl_calculatePositionAndRemainingSpace(
+ aAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize );
+ m_xShape->setPosition( aPos );
+
+ if( ePos != LegendPosition_CUSTOM )
+ {
+ // calculate remaining space as if having autoposition:
+ aRelativePosition = lcl_getDefaultPosition( ePos, rOutAvailableSpace, rPageSize );
+ lcl_calculatePositionAndRemainingSpace(
+ rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize );
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/VLegend.hxx b/chart2/source/view/main/VLegend.hxx
new file mode 100644
index 000000000000..9587b50f71e7
--- /dev/null
+++ b/chart2/source/view/main/VLegend.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VLEGEND_HXX
+#define _VLEGEND_HXX
+
+#include <com/sun/star/chart2/XLegend.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class LegendEntryProvider;
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VLegend
+{
+public:
+ VLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend > & xLegend,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const std::vector< LegendEntryProvider* >& rLegendEntryProviderList );
+
+ void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTargetPage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > & xModel );
+
+ void setDefaultWritingMode( sal_Int16 nDefaultWritingMode );
+
+ void createShapes( const ::com::sun::star::awt::Size & rAvailableSpace,
+ const ::com::sun::star::awt::Size & rPageSize );
+
+ /** Sets the position according to its internal anchor.
+
+ @param rOutAvailableSpace
+ is modified by the method, if the legend is in a standard position,
+ such that the space allocated by the legend is removed from it.
+
+ @param rReferenceSize
+ is used to calculate the offset (default 2%) from the edge.
+ */
+ void changePosition(
+ ::com::sun::star::awt::Rectangle & rOutAvailableSpace,
+ const ::com::sun::star::awt::Size & rReferenceSize );
+
+ static bool isVisible(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend > & xLegend );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend > m_xLegend;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > m_xShape;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > m_xModel;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ std::vector< LegendEntryProvider* > m_aLegendEntryProviderList;
+
+ sal_Int16 m_nDefaultWritingMode;//to be used when writing mode is set to page
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
new file mode 100644
index 000000000000..958a8defe0b6
--- /dev/null
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -0,0 +1,374 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VLegendSymbolFactory.hxx"
+#include "macros.hxx"
+#include "PropertyMapper.hxx"
+#include "ShapeFactory.hxx"
+#include "ObjectIdentifier.hxx"
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+// uncomment to disable line dashes at the border of boxes
+// #define DISABLE_DASHES_AT_BORDER
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+void lcl_setPropetiesToShape(
+ const Reference< beans::XPropertySet > & xProp,
+ const Reference< drawing::XShape > & xShape,
+ ::chart::VLegendSymbolFactory::tPropertyType ePropertyType )
+{
+ const ::chart::tPropertyNameMap & aFilledSeriesNameMap( ::chart::PropertyMapper::getPropertyNameMapForFilledSeriesProperties());
+ const ::chart::tPropertyNameMap & aLineSeriesNameMap( ::chart::PropertyMapper::getPropertyNameMapForLineSeriesProperties());
+ const ::chart::tPropertyNameMap & aLineNameMap( ::chart::PropertyMapper::getPropertyNameMapForLineProperties());
+ const ::chart::tPropertyNameMap & aFillNameMap( ::chart::PropertyMapper::getPropertyNameMapForFillProperties());
+ const ::chart::tPropertyNameMap & aFillLineNameMap( ::chart::PropertyMapper::getPropertyNameMapForFillAndLineProperties());
+
+ Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
+ if( xProp.is() && xShapeProp.is() )
+ {
+ ::chart::tPropertyNameValueMap aValueMap;
+ switch( ePropertyType )
+ {
+ case ::chart::VLegendSymbolFactory::PROP_TYPE_FILLED_SERIES:
+ ::chart::PropertyMapper::getValueMap( aValueMap, aFilledSeriesNameMap, xProp );
+ break;
+ case ::chart::VLegendSymbolFactory::PROP_TYPE_LINE_SERIES:
+ ::chart::PropertyMapper::getValueMap( aValueMap, aLineSeriesNameMap, xProp );
+ break;
+ case ::chart::VLegendSymbolFactory::PROP_TYPE_LINE:
+ ::chart::PropertyMapper::getValueMap( aValueMap, aLineNameMap, xProp );
+ break;
+ case ::chart::VLegendSymbolFactory::PROP_TYPE_FILL:
+ ::chart::PropertyMapper::getValueMap( aValueMap, aFillNameMap, xProp );
+ break;
+ case ::chart::VLegendSymbolFactory::PROP_TYPE_FILL_AND_LINE:
+ ::chart::PropertyMapper::getValueMap( aValueMap, aFillLineNameMap, xProp );
+ break;
+ }
+
+ ::chart::tNameSequence aPropNames;
+ ::chart::tAnySequence aPropValues;
+ ::chart::PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
+
+ uno::Any* pLineWidthAny = ::chart::PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("LineWidth"));
+ sal_Int32 nLineWidth = 0;
+ if( pLineWidthAny && (*pLineWidthAny>>=nLineWidth) )
+ {
+ const sal_Int32 nMaxLineWidthForLegend = 50;/*1/100 mm*///todo: make this dependent from legend entry height
+ if( nLineWidth>nMaxLineWidthForLegend )
+ *pLineWidthAny = uno::makeAny( nMaxLineWidthForLegend );
+ }
+
+ ::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
+ }
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+// static
+Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
+ const Reference< drawing::XShapes > xSymbolContainer,
+ chart2::LegendSymbolStyle eStyle,
+ const Reference< lang::XMultiServiceFactory > & xShapeFactory,
+ const Reference< beans::XPropertySet > & xLegendEntryProperties,
+ tPropertyType ePropertyType, const uno::Any& rExplicitSymbol )
+{
+ Reference< drawing::XShape > xResult;
+
+ if( ! (xSymbolContainer.is() &&
+ xShapeFactory.is()))
+ return xResult;
+
+ xResult.set( xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.GroupShape" )), uno::UNO_QUERY );
+ xSymbolContainer->add( xResult );
+ Reference< drawing::XShapes > xResultGroup( xResult, uno::UNO_QUERY );
+ if( ! xResultGroup.is())
+ return xResult;
+
+ // aspect ratio of symbols is always 3:2
+ awt::Size aBoundSize( 3000, 2000 );
+ bool bUseBox = false;
+
+ // add an invisible square box to maintain aspect ratio
+ switch( eStyle )
+ {
+ case chart2::LegendSymbolStyle_BOX:
+ case chart2::LegendSymbolStyle_HORIZONTAL_LINE:
+ case chart2::LegendSymbolStyle_VERTICAL_LINE:
+ case chart2::LegendSymbolStyle_DIAGONAL_LINE:
+ case chart2::LegendSymbolStyle_LINE_WITH_BOX:
+ case chart2::LegendSymbolStyle_LINE_WITH_SYMBOL:
+ case chart2::LegendSymbolStyle_CIRCLE:
+ {
+ Reference< drawing::XShape > xBound( ShapeFactory(xShapeFactory).createInvisibleRectangle(
+ xResultGroup, aBoundSize ));
+ break;
+ }
+
+ case chart2::LegendSymbolStyle_BAR:
+ case chart2::LegendSymbolStyle_RECTANGLE:
+ case chart2::LegendSymbolStyle_STRETCHED_RECTANGLE:
+ case chart2::LegendSymbolStyle_USER_DEFINED:
+ default:
+ break;
+ }
+
+ // create symbol
+ switch( eStyle )
+ {
+ case chart2::LegendSymbolStyle_BOX:
+ case chart2::LegendSymbolStyle_BAR:
+ case chart2::LegendSymbolStyle_RECTANGLE:
+ case chart2::LegendSymbolStyle_STRETCHED_RECTANGLE:
+ case chart2::LegendSymbolStyle_CIRCLE:
+ {
+ try
+ {
+ Reference< drawing::XShape > xShape;
+
+ if( eStyle == chart2::LegendSymbolStyle_CIRCLE )
+ xShape.set( xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.EllipseShape" )), uno::UNO_QUERY );
+ else
+ xShape.set( xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY );
+
+ if( xShape.is())
+ {
+ xResultGroup->add( xShape );
+ if( eStyle == chart2::LegendSymbolStyle_BOX ||
+ eStyle == chart2::LegendSymbolStyle_CIRCLE )
+ {
+ xShape->setSize( awt::Size( 2000, 2000 ));
+ xShape->setPosition( awt::Point( 500, 0 ));
+ }
+ else
+ {
+ xShape->setSize( aBoundSize );
+ }
+ }
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xShape, ePropertyType ); // PROP_TYPE_FILLED_SERIES );
+
+#ifdef DISABLE_DASHES_AT_BORDER
+ // don't allow dashed border style
+ Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
+ if( xShapeProp.is())
+ {
+ drawing::LineStyle aLineStyle;
+ if( ( xShapeProp->getPropertyValue( C2U("LineStyle")) >>= aLineStyle ) &&
+ aLineStyle == drawing::LineStyle_DASH )
+ {
+ aLineStyle = drawing::LineStyle_SOLID;
+ xShapeProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( aLineStyle ));
+ }
+ }
+#endif
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+ }
+
+ case chart2::LegendSymbolStyle_HORIZONTAL_LINE:
+ {
+ try
+ {
+ Reference< drawing::XShape > xLine(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.LineShape" )), uno::UNO_QUERY );
+ if( xLine.is())
+ {
+ xResultGroup->add( xLine );
+ xLine->setSize( awt::Size( 3000, 0 ));
+ xLine->setPosition( awt::Point( 0, 1000 ));
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType ); // PROP_TYPE_LINE_SERIES );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+ }
+
+ case chart2::LegendSymbolStyle_VERTICAL_LINE:
+ {
+ try
+ {
+ Reference< drawing::XShape > xLine(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.LineShape" )), uno::UNO_QUERY );
+ if( xLine.is())
+ {
+ xResultGroup->add( xLine );
+ xLine->setSize( awt::Size( 0, 2000 ));
+ xLine->setPosition( awt::Point( 1500, 0 ));
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType ); // PROP_TYPE_LINE_SERIES );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+ }
+
+ case chart2::LegendSymbolStyle_DIAGONAL_LINE:
+ {
+ try
+ {
+ Reference< drawing::XShape > xLine(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.LineShape" )), uno::UNO_QUERY );
+ if( xLine.is())
+ {
+ xResultGroup->add( xLine );
+ xLine->setSize( awt::Size( 2000, 2000 ));
+ xLine->setPosition( awt::Point( 500, 0 ));
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType ); // PROP_TYPE_LINE_SERIES );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+ }
+
+ case chart2::LegendSymbolStyle_LINE_WITH_BOX:
+ bUseBox = true;
+ // fall-through intended
+ case chart2::LegendSymbolStyle_LINE_WITH_SYMBOL:
+ try
+ {
+ Reference< drawing::XShape > xLine(
+ xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.LineShape" )), uno::UNO_QUERY );
+ if( xLine.is())
+ {
+ xResultGroup->add( xLine );
+ xLine->setSize( awt::Size( 3000, 0 ));
+ xLine->setPosition( awt::Point( 0, 1000 ));
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xLine, ePropertyType );
+ }
+
+ Reference< drawing::XShape > xSymbol;
+ const sal_Int32 nSize = 1500;
+ if( bUseBox )
+ {
+ xSymbol.set( xShapeFactory->createInstance(
+ C2U( "com.sun.star.drawing.RectangleShape" )), uno::UNO_QUERY );
+ xResultGroup->add( xSymbol );
+
+ if( xSymbol.is())
+ {
+ xSymbol->setSize( awt::Size( nSize, nSize ));
+ xSymbol->setPosition( awt::Point( 1500 - nSize/2, 1000 - nSize/2 ));
+
+ lcl_setPropetiesToShape( xLegendEntryProperties, xSymbol, ePropertyType );
+ }
+ }
+ else
+ {
+ chart2::Symbol aSymbol;
+
+ if( rExplicitSymbol >>= aSymbol )
+ {
+ drawing::Direction3D aSymbolSize( nSize, nSize, 0 );
+ drawing::Position3D aPos( 1500, 1000, 0 );
+ ShapeFactory aFactory( xShapeFactory );
+ if( aSymbol.Style == chart2::SymbolStyle_STANDARD )
+ {
+ // take series color as fill color
+ xLegendEntryProperties->getPropertyValue( C2U("Color")) >>= aSymbol.FillColor;
+ // border of symbols always same as fill color
+ aSymbol.BorderColor = aSymbol.FillColor;
+
+ xSymbol.set( aFactory.createSymbol2D(
+ xResultGroup,
+ aPos,
+ aSymbolSize,
+ aSymbol.StandardSymbol,
+ aSymbol.BorderColor,
+ aSymbol.FillColor ));
+ }
+ else if( aSymbol.Style == chart2::SymbolStyle_GRAPHIC )
+ {
+ xSymbol.set( aFactory.createGraphic2D(
+ xResultGroup,
+ aPos,
+ aSymbolSize,
+ aSymbol.Graphic ));
+ }
+ else if( aSymbol.Style == chart2::SymbolStyle_AUTO )
+ {
+ DBG_ERROR("the given parameter is not allowed to contain an automatic symbol style");
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+
+ case chart2::LegendSymbolStyle_USER_DEFINED:
+ break;
+
+ default:
+ // just to remove warning (there is an auto-generated extra label)
+ break;
+ }
+
+ return xResult;
+}
+
+} // namespace chart
diff --git a/chart2/source/view/main/VLineProperties.cxx b/chart2/source/view/main/VLineProperties.cxx
new file mode 100644
index 000000000000..dc8409a6891d
--- /dev/null
+++ b/chart2/source/view/main/VLineProperties.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VLineProperties.hxx"
+#include "macros.hxx"
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// get line properties from a propertyset
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+VLineProperties::VLineProperties()
+{
+ this->Color = uno::makeAny( sal_Int32(0x000000) ); //type sal_Int32 UNO_NAME_LINECOLOR
+ this->LineStyle = uno::makeAny( drawing::LineStyle_SOLID ); //type drawing::LineStyle for property UNO_NAME_LINESTYLE
+ this->Transparence = uno::makeAny( sal_Int16(0) );//type sal_Int16 for property UNO_NAME_LINETRANSPARENCE
+ this->Width = uno::makeAny( sal_Int32(0) );//type sal_Int32 for property UNO_NAME_LINEWIDTH
+}
+
+void VLineProperties::initFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp, bool bUseSeriesPropertyNames )
+{
+ if(xProp.is())
+ {
+ if( bUseSeriesPropertyNames ) try
+ {
+ this->Color = xProp->getPropertyValue( C2U( "BorderColor" ) );
+ this->LineStyle = xProp->getPropertyValue( C2U( "BorderStyle" ) );
+ this->Transparence = xProp->getPropertyValue( C2U( "BorderTransparency" ) );
+ this->Width = xProp->getPropertyValue( C2U( "BorderWidth" ) );
+ this->DashName = xProp->getPropertyValue( C2U( "BorderDashName" ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ else try
+ {
+ this->Color = xProp->getPropertyValue( C2U( "LineColor" ) );
+ this->LineStyle = xProp->getPropertyValue( C2U( "LineStyle" ) );
+ this->Transparence = xProp->getPropertyValue( C2U( "LineTransparence" ) );
+ this->Width = xProp->getPropertyValue( C2U( "LineWidth" ) );
+ this->DashName = xProp->getPropertyValue( C2U( "LineDashName" ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ else
+ this->LineStyle = uno::makeAny( drawing::LineStyle_NONE );
+}
+
+bool VLineProperties::isLineVisible() const
+{
+ bool bRet = false;
+
+ drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID);
+ this->LineStyle >>= aLineStyle;
+ if( aLineStyle != drawing::LineStyle_NONE )
+ {
+ sal_Int16 nLineTransparence=0;
+ this->Transparence >>= nLineTransparence;
+ if(100!=nLineTransparence)
+ {
+ bRet = true;
+ }
+ }
+
+ return bRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/VPolarTransformation.cxx b/chart2/source/view/main/VPolarTransformation.cxx
new file mode 100644
index 000000000000..fd3037316cc6
--- /dev/null
+++ b/chart2/source/view/main/VPolarTransformation.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "VPolarTransformation.hxx"
+#include "ViewDefines.hxx"
+#include "CommonConverters.hxx"
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+
+namespace chart
+{
+
+
+VPolarTransformation::VPolarTransformation( const PolarPlottingPositionHelper& rPositionHelper )
+ : m_aPositionHelper(rPositionHelper)
+ , m_aUnitCartesianToScene( rPositionHelper.getUnitCartesianToScene() )
+{
+}
+
+VPolarTransformation::~VPolarTransformation()
+{
+}
+
+// ____ XTransformation ____
+Sequence< double > SAL_CALL VPolarTransformation::transform(
+ const Sequence< double >& rSourceValues )
+ throw (RuntimeException,
+ lang::IllegalArgumentException)
+{
+ double fScaledLogicAngle = rSourceValues[0];
+ double fScaledLogicRadius = rSourceValues[1];
+
+ if( m_aPositionHelper.isSwapXAndY() )
+ std::swap(fScaledLogicAngle,fScaledLogicRadius);
+
+ double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
+ double fAnglePi = fAngleDegree*F_PI/180.0;
+ double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
+
+ double fX=fRadius*cos(fAnglePi);
+ double fY=fRadius*sin(fAnglePi);
+ double fZ=rSourceValues[2];
+
+ //!! 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);
+}
+
+sal_Int32 SAL_CALL VPolarTransformation::getSourceDimension()
+ throw (RuntimeException)
+{
+ return 3;
+}
+
+sal_Int32 SAL_CALL VPolarTransformation::getTargetDimension()
+ throw (RuntimeException)
+{
+ return 3;
+}
+
+
+} // namespace chart
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
new file mode 100644
index 000000000000..f62142735b7c
--- /dev/null
+++ b/chart2/source/view/main/VTitle.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "VTitle.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "PropertyMapper.hxx"
+#include "ShapeFactory.hxx"
+#include "RelativeSizeHelper.hxx"
+#include <com/sun/star/chart2/XFormattedString.hpp>
+#include <rtl/math.hxx>
+#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/text/ControlCharacter.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+VTitle::VTitle( const uno::Reference< XTitle > & xTitle )
+ : m_xTarget(NULL)
+ , m_xShapeFactory(NULL)
+ , m_xTitle(xTitle)
+ , m_xShape(NULL)
+ , m_aCID()
+ , m_fRotationAngleDegree(0.0)
+ , m_nXPos(0)
+ , m_nYPos(0)
+{
+}
+
+VTitle::~VTitle()
+{
+}
+
+void SAL_CALL VTitle::init(
+ const uno::Reference< drawing::XShapes >& xTargetPage
+ , const uno::Reference< lang::XMultiServiceFactory >& xFactory
+ , const rtl::OUString& rCID )
+{
+ m_xTarget = xTargetPage;
+ m_xShapeFactory = xFactory;
+ m_aCID = rCID;
+}
+
+double VTitle::getRotationAnglePi() const
+{
+ return m_fRotationAngleDegree*F_PI/180.0;
+}
+
+awt::Size VTitle::getUnrotatedSize() const //size before rotation
+{
+ awt::Size aRet;
+ if(m_xShape.is())
+ aRet = m_xShape->getSize();
+ return aRet;
+}
+
+awt::Size VTitle::getFinalSize() const //size after rotation
+{
+ return ShapeFactory::getSizeAfterRotation(
+ 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;
+ m_nYPos = rPos.Y;
+
+ //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.translate( m_nXPos, m_nYPos);
+ xShapeProp->setPropertyValue( C2U( "Transformation" ), uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void VTitle::createShapes(
+ const awt::Point& rPos
+ , const awt::Size& rReferenceSize )
+{
+ try
+ {
+ if(!m_xTitle.is())
+ return;
+
+ uno::Sequence< uno::Reference< XFormattedString > > aStringList = m_xTitle->getText();
+ if(aStringList.getLength()<=0)
+ return;
+
+ //create shape and add to page
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.TextShape" ) ), uno::UNO_QUERY );
+ m_xTarget->add(xShape);
+ m_xShape = xShape;
+
+ //set text and text properties
+ uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
+ uno::Reference< text::XTextCursor > xTextCursor( xText->createTextCursor() );
+ uno::Reference< text::XTextRange > xTextRange( xTextCursor, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTitleProperties( m_xTitle, uno::UNO_QUERY );
+ if( !xText.is() || !xTextRange.is() || !xTextCursor.is() || !xShapeProp.is() || !xTitleProperties.is() )
+ return;
+
+ tPropertyNameValueMap aValueMap;
+ //fill line-, fill- and paragraph-properties into the ValueMap
+ {
+ tMakePropertyNameMap aNameMap = PropertyMapper::getPropertyNameMapForParagraphProperties();
+ aNameMap( PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
+
+ PropertyMapper::getValueMap( aValueMap, aNameMap, xTitleProperties );
+ }
+
+ //fill some more shape properties into the ValueMap
+ {
+ drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER;
+ drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER;
+ //text::WritingMode eWritingMode = text::WritingMode_LR_TB;//@todo get correct one
+
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextHorizontalAdjust"), uno::makeAny(eHorizontalAdjust) ) ); // drawing::TextHorizontalAdjust
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextVerticalAdjust"), uno::makeAny(eVerticalAdjust) ) ); //drawing::TextVerticalAdjust
+ //aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextWritingMode"), uno::makeAny(eWritingMode) ) ); //text::WritingMode
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowHeight"), uno::makeAny(sal_True) ) ); // sal_Bool
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowWidth"), uno::makeAny(sal_True) ) ); // sal_Bool
+
+ ////aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameWidth"), uno::makeAny(rSize.Width) ) ); //sal_Int32
+ ////aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameHeight"), uno::makeAny(rSize.Height) ) ); //sal_Int32
+
+ //set name/classified ObjectID (CID)
+ if( m_aCID.getLength() )
+ aValueMap.insert( tPropertyNameValueMap::value_type( C2U("Name"), uno::makeAny( m_aCID ) ) ); //CID rtl::OUString
+ }
+
+ //set global title properties
+ {
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
+ PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
+ PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
+ }
+
+ sal_Bool bStackCharacters(sal_False);
+ try
+ {
+ xTitleProperties->getPropertyValue( C2U( "StackCharacters" ) ) >>= bStackCharacters;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ if(bStackCharacters)
+ {
+ //if the characters should be stacked we use only the first character properties for code simplicity
+ if( aStringList.getLength()>0 )
+ {
+ rtl::OUString aLabel;
+ for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ )
+ aLabel += aStringList[nN]->getString();
+ aLabel = ShapeFactory::getStackedString( aLabel, bStackCharacters );
+
+ xTextCursor->gotoEnd(false);
+ xText->insertString( xTextRange, aLabel, false );
+ xTextCursor->gotoEnd(true);
+ uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xSourceProps( aStringList[0], uno::UNO_QUERY );
+
+ PropertyMapper::setMappedProperties( xTargetProps, xSourceProps
+ , PropertyMapper::getPropertyNameMapForCharacterProperties() );
+
+ // adapt font size according to page size
+ awt::Size aOldRefSize;
+ if( xTitleProperties->getPropertyValue( C2U("ReferencePageSize")) >>= aOldRefSize )
+ {
+ RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rReferenceSize );
+ }
+ }
+ }
+ else
+ {
+ uno::Sequence< uno::Reference< text::XTextCursor > > aCursorList( aStringList.getLength() );
+ sal_Int32 nN = 0;
+ for( nN=0; nN<aStringList.getLength();nN++ )
+ {
+ xTextCursor->gotoEnd(false);
+ xText->insertString( xTextRange, aStringList[nN]->getString(), false );
+ xTextCursor->gotoEnd(true);
+ aCursorList[nN] = xText->createTextCursorByRange( uno::Reference< text::XTextRange >(xTextCursor,uno::UNO_QUERY) );
+ }
+ awt::Size aOldRefSize;
+ bool bHasRefPageSize =
+ ( xTitleProperties->getPropertyValue( C2U("ReferencePageSize")) >>= aOldRefSize );
+
+ //for( nN=0; nN<aStringList.getLength();nN++ ) //portion wise fromatting does not work still
+ if( aStringList.getLength()>0 )
+ {
+ //uno::Reference< beans::XPropertySet > xTargetProps( aCursorList[nN], uno::UNO_QUERY );
+ //uno::Reference< beans::XPropertySet > xSourceProps( aStringList[nN], uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTargetProps( xShape, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xSourceProps( aStringList[0], uno::UNO_QUERY );
+ PropertyMapper::setMappedProperties( xTargetProps, xSourceProps, PropertyMapper::getPropertyNameMapForCharacterProperties() );
+
+ // adapt font size according to page size
+ if( bHasRefPageSize )
+ {
+ RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rReferenceSize );
+ }
+ }
+ }
+
+ // #i109336# Improve auto positioning in chart
+ float fFontHeight = 0.0;
+ if ( xShapeProp.is() && ( xShapeProp->getPropertyValue( C2U( "CharHeight" ) ) >>= fFontHeight ) )
+ {
+ fFontHeight *= ( 2540. / 72. ); // pt -> 1/100 mm
+ float fXFraction = 0.18;
+ sal_Int32 nXDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fXFraction ) );
+ float fYFraction = 0.30;
+ sal_Int32 nYDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fYFraction ) );
+ xShapeProp->setPropertyValue( C2U( "TextLeftDistance" ), uno::makeAny( nXDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextRightDistance" ), uno::makeAny( nXDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextUpperDistance" ), uno::makeAny( nYDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextLowerDistance" ), uno::makeAny( nYDistance ) );
+ }
+
+ try
+ {
+ double fAngleDegree = 0;
+ xTitleProperties->getPropertyValue( C2U( "TextRotation" ) ) >>= fAngleDegree;
+ m_fRotationAngleDegree += fAngleDegree;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ m_nXPos = rPos.X;
+ m_nYPos = rPos.Y;
+
+ //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.translate( m_nXPos, m_nYPos );
+ xShapeProp->setPropertyValue( C2U( "Transformation" ), uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx
new file mode 100644
index 000000000000..8a6e7d6e4f16
--- /dev/null
+++ b/chart2/source/view/main/VTitle.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_VTITLE_HXX
+#define _CHART2_VTITLE_HXX
+
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VTitle
+{
+public:
+ VTitle( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle );
+ virtual ~VTitle();
+
+ void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTargetPage
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , const rtl::OUString& rCID );
+
+ void createShapes( const ::com::sun::star::awt::Point& rPos
+ , const ::com::sun::star::awt::Size& rReferenceSize );
+
+ double getRotationAnglePi() const;
+ ::com::sun::star::awt::Size getUnrotatedSize() const;
+ ::com::sun::star::awt::Size getFinalSize() const;
+ void changePosition( const ::com::sun::star::awt::Point& rPos );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > m_xTarget;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > m_xTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > m_xShape;
+ rtl::OUString m_aCID;
+
+ double m_fRotationAngleDegree;
+ sal_Int32 m_nXPos;
+ sal_Int32 m_nYPos;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
diff --git a/chart2/source/view/main/_serviceregistration_view.cxx b/chart2/source/view/main/_serviceregistration_view.cxx
new file mode 100644
index 000000000000..2f7e3db441e1
--- /dev/null
+++ b/chart2/source/view/main/_serviceregistration_view.cxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include <cppuhelper/implementationentry.hxx>
+
+#include "ChartView.hxx"
+
+static struct ::cppu::ImplementationEntry g_entries_chart2_view[] =
+{
+ {
+ ::chart::ChartView::create
+ , ::chart::ChartView::getImplementationName_Static
+ , ::chart::ChartView::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey , g_entries_chart2_view );
+}
+}
+//=========================================================================
diff --git a/chart2/source/view/main/makefile.mk b/chart2/source/view/main/makefile.mk
new file mode 100644
index 000000000000..ec9c99f2a898
--- /dev/null
+++ b/chart2/source/view/main/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chview
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+.INCLUDE: $(PRJ)$/chartview.pmk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES = \
+ $(SLO)$/ChartItemPool.obj \
+ $(SLO)$/DrawModelWrapper.obj \
+ $(SLO)$/NumberFormatterWrapper.obj \
+ $(SLO)$/PropertyMapper.obj \
+ $(SLO)$/Stripe.obj \
+ $(SLO)$/VLineProperties.obj \
+ $(SLO)$/ShapeFactory.obj \
+ $(SLO)$/VLegendSymbolFactory.obj \
+ $(SLO)$/DataPointSymbolSupplier.obj \
+ $(SLO)$/Linear3DTransformation.obj \
+ $(SLO)$/VPolarTransformation.obj \
+ $(SLO)$/Clipping.obj \
+ $(SLO)$/PlottingPositionHelper.obj \
+ $(SLO)$/LabelPositionHelper.obj \
+ $(SLO)$/PolarLabelPositionHelper.obj \
+ $(SLO)$/PlotterBase.obj \
+ $(SLO)$/VDataSeries.obj \
+ $(SLO)$/VLegend.obj \
+ $(SLO)$/VTitle.obj \
+ $(SLO)$/ChartView.obj \
+ $(SLO)$/_serviceregistration_view.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
diff --git a/chart2/source/view/makefile.mk b/chart2/source/view/makefile.mk
new file mode 100644
index 000000000000..0b54ac976ad2
--- /dev/null
+++ b/chart2/source/view/makefile.mk
@@ -0,0 +1,128 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..
+PRJNAME= chart2
+TARGET= chartview
+
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+.INCLUDE: $(PRJ)$/chartview.pmk
+
+# --- export library -------------------------------------------------
+
+#You can use several library macros of this form to build libraries that
+#do not consist of all object files in a directory or to merge different libraries.
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+LIB1FILES= \
+ $(SLB)$/chvaxes.lib \
+ $(SLB)$/chvtypes.lib \
+ $(SLB)$/chvdiagram.lib \
+ $(SLB)$/chview.lib
+
+#--------
+
+#Indicates the filename of the shared library.
+SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+
+#indicates dependencies:
+.IF "$(COM)" == "MSC"
+SHL1DEPN = \
+ $(LB)$/icharttools.lib
+.ELSE
+SHL1DEPN =
+.ENDIF
+
+#Specifies an import library to create. For Win32 only.
+SHL1IMPLIB= i$(TARGET)
+
+#Specifies libraries from the same module to put into the shared library.
+#was created above
+SHL1LIBS= $(LIB1TARGET)
+
+#Links import libraries.
+
+SHL1STDLIBS= $(CHARTTOOLS) \
+ $(CPPULIB) \
+ $(EDITENGLIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(SALLIB) \
+ $(SVLLIB) \
+ $(SVTOOLLIB) \
+ $(SVXCORELIB) \
+ $(TOOLSLIB) \
+ $(UNOTOOLSLIB) \
+ $(BASEGFXLIB) \
+ $(VCLLIB) \
+ $(SFXLIB) \
+ $(BASEGFXLIB)
+
+#--------exports
+
+#specifies the exported symbols for Windows only:
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+#Specifies the library name to parse for symbols. For Win32 only.
+DEFLIB1NAME= $(TARGET)
+
+#A file of symbols to export.
+#DEF1EXPORTFILE= $(PRJ)$/source$/inc$/exports.dxp
+
+#--------definition file
+
+#name of the definition file:
+DEF1NAME= $(SHL1TARGET)
+
+# indicates definition file dependencies
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+
+#A comment on the definition file.
+DEF1DES= Viewable Component Chart View
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk \
+ exports.flt
+ $(TYPE) exports.flt > $@
+
+ALLTAR : $(MISC)/chartview.component
+
+$(MISC)/chartview.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ chartview.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt chartview.component
diff --git a/chart2/uiconfig/accelerator/en-US/default.xml b/chart2/uiconfig/accelerator/en-US/default.xml
new file mode 100644
index 000000000000..e71843e4316a
--- /dev/null
+++ b/chart2/uiconfig/accelerator/en-US/default.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <accel:item accel:code="KEY_Q" accel:mod1="true" xlink:href=".uno:Quit"/>
+ <accel:item accel:code="KEY_F4" accel:mod2="true" xlink:href=".uno:Quit"/>
+ <accel:item accel:code="KEY_N" accel:mod1="true" xlink:href=".uno:NewDoc"/>
+ <accel:item accel:code="KEY_O" accel:mod1="true" xlink:href=".uno:Open"/>
+ <accel:item accel:code="KEY_OPEN" xlink:href=".uno:Open"/>
+ <accel:item accel:code="KEY_P" accel:mod1="true" xlink:href=".uno:Print"/>
+ <accel:item accel:code="KEY_S" accel:mod1="true" xlink:href=".uno:Save"/>
+ <accel:item accel:code="KEY_W" accel:mod1="true" xlink:href=".uno:CloseWin"/>
+ <accel:item accel:code="KEY_F4" accel:mod1="true" xlink:href=".uno:CloseWin"/>
+ <accel:item accel:code="KEY_J" accel:shift="true" accel:mod1="true" xlink:href=".uno:FullScreen"/>
+ <accel:item accel:code="KEY_Z" accel:mod1="true" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_BACKSPACE" accel:mod2="true" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_UNDO" xlink:href=".uno:Undo"/>
+ <accel:item accel:code="KEY_Y" accel:mod1="true" xlink:href=".uno:Redo"/>
+ <accel:item accel:code="KEY_REPEAT" xlink:href=".uno:Repeat"/>
+ <accel:item accel:code="KEY_X" accel:mod1="true" xlink:href=".uno:Cut"/>
+ <accel:item accel:code="KEY_DELETE" accel:shift="true" xlink:href=".uno:Cut"/>
+ <accel:item accel:code="KEY_CUT" xlink:href=".uno:Cut"/>
+ <accel:item accel:code="KEY_C" accel:mod1="true" xlink:href=".uno:Copy"/>
+ <accel:item accel:code="KEY_INSERT" accel:mod1="true" xlink:href=".uno:Copy"/>
+ <accel:item accel:code="KEY_COPY" xlink:href=".uno:Copy"/>
+ <accel:item accel:code="KEY_V" accel:mod1="true" xlink:href=".uno:Paste"/>
+ <accel:item accel:code="KEY_INSERT" accel:shift="true" xlink:href=".uno:Paste"/>
+ <accel:item accel:code="KEY_PASTE" xlink:href=".uno:Paste"/>
+ <accel:item accel:code="KEY_DELETE" xlink:href=".uno:Delete"/>
+ <accel:item accel:code="KEY_9" accel:shift="true" accel:mod1="true" accel:mod2="true" xlink:href=".uno:ShowItemBrowser"/>
+ <accel:item accel:code="KEY_F4" xlink:href=".uno:TransformDialog"/>
+</accel:acceleratorlist>
diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml
new file mode 100644
index 000000000000..788dac2fc90b
--- /dev/null
+++ b/chart2/uiconfig/menubar/menubar.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<menu:menubar xmlns:menu="http://openoffice.org/2001/menu" menu:id="menubar">
+ <menu:menu menu:id=".uno:PickList" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:AddDirect" menu:helpid="5537" menu:label="" />
+ <menu:menuitem menu:id=".uno:Open" menu:helpid="5501" menu:label="" />
+ <menu:menuitem menu:id=".uno:AutoPilotMenu" menu:helpid="6381" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:CloseDoc" menu:helpid="5503" menu:label="" />
+ <menu:menuitem menu:id=".uno:Save" menu:helpid="5505" menu:label="" />
+ <menu:menuitem menu:id=".uno:SaveAs" menu:helpid="5502" menu:label="" />
+ <menu:menuitem menu:id=".uno:SaveAll" menu:helpid="5309" menu:label="" />
+ <menu:menuitem menu:id=".uno:Reload" menu:helpid="5508" menu:label="" />
+ <menu:menuitem menu:id=".uno:VersionDialog" menu:helpid="6583" menu:label="" />
+ <menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:SetDocumentProperties" menu:helpid="5535" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Print" menu:helpid="5504" menu:label="" />
+ <menu:menuitem menu:id=".uno:PrinterSetup" menu:helpid="5302" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Quit" menu:helpid="5300" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:EditMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Undo" menu:helpid="5701" menu:label="" />
+ <menu:menuitem menu:id=".uno:Redo" menu:helpid="5700" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Cut" menu:helpid="5710" menu:label="" />
+ <menu:menuitem menu:id=".uno:Copy" menu:helpid="5711" menu:label="" />
+ <menu:menuitem menu:id=".uno:Paste" menu:helpid="5712" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ViewMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:AvailableToolbars" menu:label="" />
+ <menu:menuitem menu:id=".uno:StatusBarVisible" menu:helpid="5920" menu:label="" />
+ <menu:menuitem menu:id=".uno:ShowImeStatusWindow" menu:helpid="6680" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramData" menu:helpid="30514" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:InsertMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:InsertMenuTitles" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuLegend" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuAxes" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuGrids" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertMenuDataLabels" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuTrendlines" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuMeanValues" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuYErrorBars" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:InsertSymbol" menu:helpid="10503" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:FormatMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:FormatSelection" menu:label="" />
+ <menu:menuitem menu:id=".uno:TransformDialog" menu:helpid="10087" menu:label="" />
+ <menu:menu menu:id=".uno:ArrangeRow" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:Forward" menu:helpid="30594" menu:label="" />
+ <menu:menuitem menu:id=".uno:Backward" menu:helpid="30595" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menu menu:id=".uno:ChartTitleMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:MainTitle" menu:helpid="30557" menu:label="" />
+ <menu:menuitem menu:id=".uno:SubTitle" menu:helpid="30558" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:XTitle" menu:helpid="30559" menu:label="" />
+ <menu:menuitem menu:id=".uno:YTitle" menu:helpid="30560" menu:label="" />
+ <menu:menuitem menu:id=".uno:ZTitle" menu:helpid="30561" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:SecondaryXTitle" menu:label="" />
+ <menu:menuitem menu:id=".uno:SecondaryYTitle" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:AllTitles" menu:helpid="30562" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id=".uno:Legend" menu:helpid="30521" menu:label="" />
+ <menu:menu menu:id=".uno:DiagramAxisMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:DiagramAxisX" menu:helpid="30552" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramAxisY" menu:helpid="30553" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramAxisZ" menu:helpid="30554" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramAxisA" menu:helpid="30616" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramAxisB" menu:helpid="30617" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramAxisAll" menu:helpid="30555" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:DiagramGridMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:DiagramGridYMain" menu:helpid="30564" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramGridXMain" menu:helpid="30563" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramGridZMain" menu:helpid="30565" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramGridYHelp" menu:helpid="30579" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramGridXHelp" menu:helpid="30578" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramGridZHelp" menu:helpid="30580" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramGridAll" menu:helpid="30566" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramWall" menu:helpid="30524" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramFloor" menu:helpid="30525" menu:label="" />
+ <menu:menuitem menu:id=".uno:DiagramArea" menu:helpid="30526" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:DiagramType" menu:helpid="30528" menu:label="" />
+ <menu:menuitem menu:id=".uno:DataRanges" menu:helpid="30514" menu:label="" />
+ <menu:menuitem menu:id=".uno:View3D" menu:helpid="30527" menu:label="" />
+
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:ToolsMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menu menu:id=".uno:MacrosMenu" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:MacroRecorder" menu:helpid="6669" menu:label="" />
+ <menu:menuitem menu:id=".uno:RunMacro" menu:helpid="40011" menu:label="" />
+ <menu:menu menu:id=".uno:ScriptOrganizer" menu:label="" />
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1" menu:helpid="40013" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menuitem menu:id="service:com.sun.star.deployment.ui.PackageManagerDialog" menu:helpid="42772" />
+ <menu:menuitem menu:id=".uno:ConfigureDialog" menu:helpid="5904" menu:label="" />
+ <menu:menuitem menu:id=".uno:OptionsTreeDialog" menu:helpid="31630" menu:label="" />
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:WindowList" menu:label="" >
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:NewWindow" menu:helpid="5620" menu:label="" />
+ <menu:menuitem menu:id=".uno:CloseWin" menu:helpid="5621" menu:label="" />
+ <menu:menuseparator/>
+ </menu:menupopup>
+ </menu:menu>
+ <menu:menu menu:id=".uno:HelpMenu">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:HelpIndex"/>
+ <menu:menuitem menu:id=".uno:ExtendedHelp"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:HelpSupport"/>
+ <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:About"/>
+ </menu:menupopup>
+ </menu:menu>
+</menu:menubar>
diff --git a/chart2/uiconfig/statusbar/statusbar.xml b/chart2/uiconfig/statusbar/statusbar.xml
new file mode 100644
index 000000000000..27af64165411
--- /dev/null
+++ b/chart2/uiconfig/statusbar/statusbar.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE statusbar:statusbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "statusbar.dtd">
+<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="208" statusbar:helpid="helpid:5310"/>
+ <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="14" statusbar:helpid="helpid:5584"/>
+</statusbar:statusbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/arrowshapes.xml b/chart2/uiconfig/toolbar/arrowshapes.xml
new file mode 100644
index 000000000000..4a53519494ea
--- /dev/null
+++ b/chart2/uiconfig/toolbar/arrowshapes.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-down-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.corner-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.striped-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.notched-right-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.pentagon-right" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.chevron" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.left-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-down-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.up-right-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.quad-arrow-callout" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.circular-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.split-round-arrow" toolbar:helpid="helpid:11004" />
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes.s-sharped-arrow" toolbar:helpid="helpid:11004" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/basicshapes.xml b/chart2/uiconfig/toolbar/basicshapes.xml
new file mode 100644
index 000000000000..e65778305788
--- /dev/null
+++ b/chart2/uiconfig/toolbar/basicshapes.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-rectangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.round-quadrat" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ellipse" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.circle-pie" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.isosceles-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.right-triangle" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.trapezoid" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.diamond" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.parallelogram" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.pentagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.hexagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.octagon" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.block-arc" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.can" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.cube" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.paper" toolbar:helpid="helpid:11002" />
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame" toolbar:helpid="helpid:11002" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/calloutshapes.xml b/chart2/uiconfig/toolbar/calloutshapes.xml
new file mode 100644
index 000000000000..91b957fa697a
--- /dev/null
+++ b/chart2/uiconfig/toolbar/calloutshapes.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-rectangular-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.round-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.cloud-callout" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-1" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-2" toolbar:helpid="helpid:11006" />
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes.line-callout-3" toolbar:helpid="helpid:11006" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/drawbar.xml b/chart2/uiconfig/toolbar/drawbar.xml
new file mode 100644
index 000000000000..f4017835635c
--- /dev/null
+++ b/chart2/uiconfig/toolbar/drawbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <toolbar:toolbaritem xlink:href=".uno:SelectObject" toolbar:helpid="10128"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Line" toolbar:helpid="10102"/>
+ <toolbar:toolbaritem xlink:href=".uno:LineArrowEnd" toolbar:helpid="27173"/>
+ <toolbar:toolbaritem xlink:href=".uno:Rect" toolbar:helpid="10104"/>
+ <toolbar:toolbaritem xlink:href=".uno:Ellipse" toolbar:helpid="10110"/>
+ <toolbar:toolbaritem xlink:href=".uno:Freeline_Unfilled" toolbar:helpid="10464"/>
+ <toolbar:toolbaritem xlink:href=".uno:DrawText" toolbar:helpid="10253"/>
+ <toolbar:toolbaritem xlink:href=".uno:DrawCaption" toolbar:helpid="10254"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:BasicShapes" toolbar:style="dropdown" toolbar:helpid="11002"/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes" toolbar:style="dropdown" toolbar:helpid="11003"/>
+ <toolbar:toolbaritem xlink:href=".uno:ArrowShapes" toolbar:style="dropdown" toolbar:helpid="11004"/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes" toolbar:style="dropdown" toolbar:helpid="11005"/>
+ <toolbar:toolbaritem xlink:href=".uno:CalloutShapes" toolbar:style="dropdown" toolbar:helpid="11006"/>
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes" toolbar:style="dropdown" toolbar:helpid="11007"/>
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/flowchartshapes.xml b/chart2/uiconfig/toolbar/flowchartshapes.xml
new file mode 100644
index 000000000000..bb1d1099dbd4
--- /dev/null
+++ b/chart2/uiconfig/toolbar/flowchartshapes.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-alternate-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-decision" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-predefined-process" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-internal-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-document" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-multidocument" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-terminator" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-preparation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-input" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-manual-operation" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-off-page-connector" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-card" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-punched-tape" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-summing-junction" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-or" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-collate" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sort" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-extract" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-merge" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-stored-data" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-delay" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-sequential-access" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-magnetic-disk" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-direct-access-storage" toolbar:helpid="helpid:11005" />
+ <toolbar:toolbaritem xlink:href=".uno:FlowChartShapes.flowchart-display" toolbar:helpid="helpid:11005" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/standardbar.xml b/chart2/uiconfig/toolbar/standardbar.xml
new file mode 100644
index 000000000000..28b7f131af6a
--- /dev/null
+++ b/chart2/uiconfig/toolbar/standardbar.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:helpid="helpid:5537" toolbar:text="" toolbar:style="dropdown" />
+ <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:helpid="helpid:5500" toolbar:text="" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:helpid="helpid:5501" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="helpid:5505" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="helpid:5502" toolbar:text="" toolbar:visible="false" />
+ <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:helpid="helpid:5331" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="helpid:6312" toolbar:text="" toolbar:visible="false" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ExportDirectToPDF" toolbar:helpid="helpid:6674" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:PrintDefault" toolbar:helpid="helpid:5509" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Cut" toolbar:helpid="helpid:5710" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Copy" toolbar:helpid="helpid:5711" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Paste" toolbar:helpid="helpid:5712" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:Undo" toolbar:helpid="helpid:5701" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:Redo" toolbar:helpid="helpid:5700" toolbar:text="" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/starshapes.xml b/chart2/uiconfig/toolbar/starshapes.xml
new file mode 100644
index 000000000000..a2ff874d2fe7
--- /dev/null
+++ b/chart2/uiconfig/toolbar/starshapes.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.bang" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star4" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star5" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star8" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star12" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.star24" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.concave-star6" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.vertical-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.horizontal-scroll" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.signet" toolbar:helpid="helpid:11007" />
+ <toolbar:toolbaritem xlink:href=".uno:StarShapes.doorplate" toolbar:helpid="helpid:11007" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/symbolshapes.xml b/chart2/uiconfig/toolbar/symbolshapes.xml
new file mode 100644
index 000000000000..0fa6aee313db
--- /dev/null
+++ b/chart2/uiconfig/toolbar/symbolshapes.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.smiley" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.sun" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.moon" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.lightning" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.heart" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.flower" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.cloud" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.forbidden" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.puzzle" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.bracket-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-bracket" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbarbreak/>
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.brace-pair" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.left-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.right-brace" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.quad-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.octagon-bevel" toolbar:helpid="helpid:11003" />
+ <toolbar:toolbaritem xlink:href=".uno:SymbolShapes.diamond-bevel" toolbar:helpid="helpid:11003" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/uiconfig/toolbar/toolbar.xml b/chart2/uiconfig/toolbar/toolbar.xml
new file mode 100644
index 000000000000..41d5bd41ab63
--- /dev/null
+++ b/chart2/uiconfig/toolbar/toolbar.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ChartElementSelector" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatSelection" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DiagramType" toolbar:helpid="helpid:30528" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:DiagramData" toolbar:helpid="helpid:30514" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ToggleGridHorizontal" toolbar:helpid="helpid:30533" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:ToggleLegend" toolbar:helpid="helpid:30530" toolbar:text="" />
+ <toolbar:toolbaritem xlink:href=".uno:ScaleText" toolbar:helpid="helpid:30586" toolbar:text="" />
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:NewArrangement" toolbar:helpid="helpid:30539" toolbar:text="" />
+</toolbar:toolbar> \ No newline at end of file
diff --git a/chart2/util/makefile.mk b/chart2/util/makefile.mk
new file mode 100644
index 000000000000..dff14676a5b1
--- /dev/null
+++ b/chart2/util/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+PRJPCH=
+
+PRJNAME=chart2
+TARGET=chart_db
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : makefile.pmk
+
+#-------------------------------------------------------------------
+
+# UNOIDLDBFILES= \
+# $(UCR)$/csschart2.db
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(L10N_framewor)"==""
+ALLTAR : \
+ $(BIN)$/$(PRJNAME).rdb \
+ $(MISC)$/$(TARGET).don
+
+$(BIN)$/$(PRJNAME).rdb : $(UCR)$/$(PRJNAME).db
+ $(GNUCOPY) -f $(UCR)$/$(PRJNAME).db $@
+
+$(MISC)$/$(TARGET).don : $(UCR)$/$(PRJNAME).db
+ $(CPPUMAKER) -O$(OUT)$/inc -BUCR $(UCR)$/$(PRJNAME).db -X$(SOLARBINDIR)$/types.rdb && echo > $@
+ echo $@
+
+.ENDIF # "$(L10N_framewor)"==""
+
diff --git a/chart2/util/makefile.pmk b/chart2/util/makefile.pmk
new file mode 100644
index 000000000000..3819e6175504
--- /dev/null
+++ b/chart2/util/makefile.pmk
@@ -0,0 +1,46 @@
+# -*- makefile -*-
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : settings.mk
+
+# define macro for (chart-specific) tools library
+.IF "$(COM)" == "MSC" || "$(GUI)" == "OS2"
+ CHARTTOOLS= icharttools.lib
+.ELSE
+ CHARTTOOLS= -lcharttools$(DLLPOSTFIX)
+.ENDIF
+
+.IF "$(COM)" == "MSC" || "$(GUI)" == "OS2"
+ CHARTVIEW= ichartview.lib
+.ELSE
+ CHARTVIEW= -lchartview$(DLLPOSTFIX)
+.ENDIF
+
diff --git a/chart2/util/target.pmk b/chart2/util/target.pmk
new file mode 100644
index 000000000000..79f6dc2f2410
--- /dev/null
+++ b/chart2/util/target.pmk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+$(OUT)$/misc$/$(TARGET).idls: makefile.mk
+ -$(RM) $@
+ $(TYPE) $(mktmp $(foreach,i,$(IDLFILES) $(PACKAGE)$/$i)) >>$@
+
+ALLTAR: $(OUT)$/misc$/$(TARGET).idls
diff --git a/chart2/workbench/addin/exports.dxp b/chart2/workbench/addin/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/chart2/workbench/addin/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/chart2/workbench/addin/makefile.mk b/chart2/workbench/addin/makefile.mk
new file mode 100644
index 000000000000..2a7ebd1c80d9
--- /dev/null
+++ b/chart2/workbench/addin/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=chartaddin
+
+TARGET=chartsampleaddin
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+LIBTARGET=NO
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+# comprehensive type info, so rdb needn't be installed
+# CPPUMAKERFLAGS*=-C
+
+# UNOTYPES=\
+# com.sun.star.lang.XInitialization \
+# com.sun.star.lang.XServiceName \
+# com.sun.star.lang.XServiceInfo \
+# com.sun.star.util.XRefreshable \
+# com.sun.star.lang.XLocalizable \
+# com.sun.star.chart.XDiagram \
+# com.sun.star.chart.XChartDocument \
+# com.sun.star.chart.XAxisXSupplier \
+# com.sun.star.chart.XAxisYSupplier \
+# com.sun.star.chart.XStatisticDisplay \
+# com.sun.star.lang.XMultiServiceFactory
+
+# --- Files -------------------------------------
+
+SLOFILES=\
+ $(SLO)$/sampleaddin.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+SHL1DEPN=makefile.mk
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/chart2/workbench/addin/sampleaddin.cxx b/chart2/workbench/addin/sampleaddin.cxx
new file mode 100644
index 000000000000..a986dd9557c7
--- /dev/null
+++ b/chart2/workbench/addin/sampleaddin.cxx
@@ -0,0 +1,716 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "sampleaddin.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <osl/diagnose.h>
+
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/chart/X3DDisplay.hpp>
+
+using namespace com::sun::star;
+using namespace rtl;
+
+// code for creating instances of SampleAddIn
+
+extern "C" {
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo(
+ void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
+{
+ if( pRegistryKey )
+ {
+ try
+ {
+ OUString aImpl = OUString::createFromAscii( "/" );
+ aImpl += SampleAddIn::getImplementationName_Static();
+ aImpl += OUString::createFromAscii( "/UNO/SERVICES" );
+
+ uno::Reference< registry::XRegistryKey> xNewKey(
+ reinterpret_cast<registry::XRegistryKey*>( pRegistryKey )->createKey( aImpl ) );
+
+ uno::Sequence< OUString > aSequ = SampleAddIn::getSupportedServiceNames_Static();
+ const OUString * pArray = aSequ.getConstArray();
+ for( sal_Int32 i = 0; i < aSequ.getLength(); i++ )
+ xNewKey->createKey( pArray[i] );
+
+ return sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void* pRet = 0;
+
+ if ( pServiceManager &&
+ OUString::createFromAscii( pImplName ) == SampleAddIn::getImplementationName_Static() )
+ {
+ uno::Reference< lang::XSingleServiceFactory> xFactory( cppu::createSingleFactory(
+ reinterpret_cast<lang::XMultiServiceFactory*>( pServiceManager ),
+ SampleAddIn::getImplementationName_Static(),
+ SampleAddIn_CreateInstance,
+ SampleAddIn::getSupportedServiceNames_Static() ) );
+
+ if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+} // extern C
+
+
+// --------------------
+// class SampleAddIn
+// --------------------
+
+SampleAddIn::SampleAddIn()
+{
+
+}
+
+SampleAddIn::~SampleAddIn()
+{}
+
+
+// this functionality should be provided by the chart API some day
+sal_Bool SampleAddIn::getLogicalPosition( uno::Reference< drawing::XShape >& xAxis,
+ double fValue,
+ sal_Bool bVertical,
+ awt::Point& aOutPosition )
+{
+ sal_Bool bRet = sal_False;
+
+ if( xAxis.is())
+ {
+ awt::Size aSize = xAxis->getSize();
+ sal_Int32 nLength = bVertical? aSize.Height: aSize.Width;
+
+ uno::Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ try
+ {
+ double fMin(0.0), fMax(0.0);
+ uno::Any aAny = xProp->getPropertyValue( OUString::createFromAscii( "Min" ));
+ aAny >>= fMin;
+ aAny = xProp->getPropertyValue( OUString::createFromAscii( "Max" ));
+ aAny >>= fMax;
+
+ double fRange = fMax - fMin;
+ if( fMin <= fValue && fValue <= fMax &&
+ fRange != 0.0 )
+ {
+ double fPercentage = (fValue - fMin) / fRange;
+ awt::Point aPos = xAxis->getPosition();
+
+ if( bVertical )
+ {
+ aOutPosition.X = aPos.X;
+ aOutPosition.Y = static_cast<sal_Int32>(aPos.Y + nLength * (1.0 - fPercentage)); // y scale goes from top to bottom
+ }
+ else
+ {
+ aOutPosition.X = static_cast<sal_Int32>(aPos.X + nLength * fPercentage);
+ aOutPosition.Y = aPos.Y;
+ }
+ bRet = sal_True;
+ }
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ // the shape xAxis was no chart axis
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SampleAddIn::getImplementationName_Static()
+{
+ return OUString::createFromAscii( "SampleAddIn" );
+}
+
+uno::Sequence< ::rtl::OUString > SampleAddIn::getSupportedServiceNames_Static()
+{
+ uno::Sequence< OUString > aSeq( 4 );
+
+ aSeq[ 0 ] = OUString::createFromAscii( "com.sun.star.chart.ChartAxisXSupplier" );
+ aSeq[ 1 ] = OUString::createFromAscii( "com.sun.star.chart.ChartAxisYSupplier" );
+ aSeq[ 2 ] = OUString::createFromAscii( "com.sun.star.chart.Diagram" );
+ aSeq[ 3 ] = OUString::createFromAscii( "com.sun.star.chart.SampleAddIn" );
+
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SampleAddIn_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& )
+{
+ uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*)new SampleAddIn();
+
+ return xInst;
+}
+
+// implementation of interface methods
+
+// XInitialization
+void SAL_CALL SampleAddIn::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ // first argument should be the XChartDocument
+ OSL_ENSURE( aArguments.getLength() > 0, "Please initialize Chart AddIn with ChartDocument!" );
+
+ if( aArguments.getLength())
+ {
+ aArguments[ 0 ] >>= mxChartDoc;
+ OSL_ENSURE( mxChartDoc.is(), "First argument in initialization is not an XChartDocument!" );
+
+ // set XY chart as base type to be drawn
+ uno::Reference< beans::XPropertySet > xDocProp( mxChartDoc, uno::UNO_QUERY );
+ if( xDocProp.is())
+ {
+ uno::Any aBaseType;
+ aBaseType <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.XYDiagram" ));
+ try
+ {
+ xDocProp->setPropertyValue( rtl::OUString::createFromAscii( "BaseDiagram" ), aBaseType );
+ }
+ catch( ... )
+ {}
+ }
+
+ // change background of plot area to light blue
+ uno::Reference< chart::X3DDisplay > xWallSupplier( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xWallSupplier.is())
+ {
+ uno::Reference< beans::XPropertySet > xDiaProp( xWallSupplier->getWall(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xLegendProp( mxChartDoc->getLegend(), uno::UNO_QUERY );
+ if( xDiaProp.is() &&
+ xLegendProp.is())
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Int32)( 0xe0e0f0 );
+ xDiaProp->setPropertyValue( OUString::createFromAscii( "FillColor" ), aAny );
+ xLegendProp->setPropertyValue( OUString::createFromAscii( "FillColor" ), aAny );
+ }
+ }
+ }
+}
+
+// XRefreshable
+/********************************************************************************
+ *
+ * The method refresh is the most important method - here all objects that
+ * are necessary for the chart are created
+ *
+ * in the first implementation you will have to insert everything in this
+ * routine - all old objects are deleted beforehand
+ *
+ ********************************************************************************/
+void SAL_CALL SampleAddIn::refresh() throw( uno::RuntimeException )
+{
+ if( ! mxChartDoc.is())
+ return;
+
+ // first of all get the draw page
+ uno::Reference< drawing::XDrawPageSupplier > xPageSupp( mxChartDoc, uno::UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xFactory( mxChartDoc, uno::UNO_QUERY );
+ if( xPageSupp.is() &&
+ xFactory.is() )
+ {
+ uno::Reference< drawing::XDrawPage > xPage = xPageSupp->getDrawPage();
+ if( xPage.is())
+ {
+ // now we have the page to insert objects
+
+ // add a horizontal line at the middle value of the first series
+ // -------------------------------------------------------------
+
+
+ // get the logical position from the coordinate
+ // get x- and y-axis
+ uno::Reference< drawing::XShape > xYAxisShape( getYAxis(), uno::UNO_QUERY );
+ uno::Reference< drawing::XShape > xXAxisShape( getXAxis(), uno::UNO_QUERY );
+
+ if( xXAxisShape.is() &&
+ xYAxisShape.is() )
+ {
+ // create line first time
+ if( ! mxMyRedLine.is())
+ {
+ mxMyRedLine = uno::Reference< drawing::XShape >(
+ xFactory->createInstance( OUString::createFromAscii( "com.sun.star.drawing.LineShape" )),
+ uno::UNO_QUERY );
+ xPage->add( mxMyRedLine );
+
+ // make line red and thick
+ uno::Reference< beans::XPropertySet > xShapeProp( mxMyRedLine, uno::UNO_QUERY );
+ if( xShapeProp.is())
+ {
+ uno::Any aColor, aWidth;
+ aColor <<= (sal_Int32)(0xe01010);
+ aWidth <<= (sal_Int32)(50); // 0.5 mm
+ try
+ {
+ xShapeProp->setPropertyValue( OUString::createFromAscii( "LineColor" ), aColor );
+ xShapeProp->setPropertyValue( OUString::createFromAscii( "LineWidth" ), aWidth );
+ }
+ catch( ... )
+ {}
+ }
+ }
+ // create text object first time
+ if( ! mxMyText.is())
+ {
+ mxMyText = uno::Reference< drawing::XShape >(
+ xFactory->createInstance( OUString::createFromAscii( "com.sun.star.drawing.TextShape" )),
+ uno::UNO_QUERY );
+ xPage->add( mxMyText );
+
+ // change text
+ OUString aText;
+// if( maLocale.Language.equalsIgnoreCase( OUString::createFromAscii("DE")))
+// aText = OUString::createFromAscii( "Kleines Beispiel" );
+// else
+ aText = OUString::createFromAscii( "Little Example" );
+
+ uno::Reference< beans::XPropertySet > xTextProp( mxMyText, uno::UNO_QUERY );
+ if( xTextProp.is())
+ {
+ uno::Any aTrueAny;
+ aTrueAny <<= (sal_Bool)(sal_True);
+ try
+ {
+ xTextProp->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowWidth" ), aTrueAny );
+ }
+ catch( ... )
+ {}
+ }
+
+ uno::Reference< text::XTextRange > xTextRange( mxMyText, uno::UNO_QUERY );
+ if( xTextRange.is())
+ {
+ xTextRange->setString( aText );
+ }
+ }
+
+
+ // position line and text
+
+ // get the array. Note: the first dimension is the length
+ // of each series and the second one is the number of series
+ // this should be changed in the future
+ uno::Sequence< uno::Sequence< double > > aData;
+ uno::Reference< chart::XChartData > xData = mxChartDoc->getData();
+ uno::Reference< chart::XChartDataArray > xDataArray( xData, uno::UNO_QUERY );
+ if( xDataArray.is())
+ aData = xDataArray->getData();
+
+ // get row count == length of each series
+ sal_Int32 nSize = aData.getLength();
+ sal_Int32 nMiddle = nSize / 2;
+ // get value for first series
+ double fMiddleVal = xData->getNotANumber(); // set to NaN
+ if( aData[ nMiddle ].getLength()) // we have at least one series
+ fMiddleVal = aData[ nMiddle ][ 0 ];
+
+ awt::Point aPos;
+ getLogicalPosition( xYAxisShape, fMiddleVal, sal_True, aPos );
+ awt::Size aSize = xXAxisShape->getSize();
+
+ if( mxMyRedLine.is())
+ {
+ awt::Point aEnd = aPos;
+ aEnd.X += aSize.Width;
+
+ uno::Sequence< uno::Sequence< awt::Point > > aPtSeq( 1 );
+ aPtSeq[ 0 ].realloc( 2 );
+ aPtSeq[ 0 ][ 0 ] = aPos;
+ aPtSeq[ 0 ][ 1 ] = aEnd;
+
+ uno::Reference< beans::XPropertySet > xShapeProp( mxMyRedLine, uno::UNO_QUERY );
+ if( xShapeProp.is())
+ {
+ uno::Any aAny;
+ aAny <<= aPtSeq;
+ xShapeProp->setPropertyValue( rtl::OUString::createFromAscii( "PolyPolygon" ), aAny );
+ }
+ }
+ if( mxMyText.is())
+ {
+ // put the text centered below the red line
+ aPos.X += ( aSize.Width - mxMyRedLine->getPosition().X ) / 2;
+ aPos.Y += 1000;
+ aPos.Y += static_cast<sal_Int32>(0.1 * xYAxisShape->getSize().Height);
+ mxMyText->setPosition( aPos );
+ }
+ }
+ }
+ }
+
+ // set axis scale to 200
+// uno::Reference< beans::XPropertySet > xXAxis( getXAxis(), uno::UNO_QUERY );
+// if( xXAxis.is())
+// {
+// uno::Any aAny;
+// aAny <<= (sal_Bool)(sal_False);
+// xXAxis->setPropertyValue( rtl::OUString::createFromAscii( "AutoStepMain" ),
+// aAny );
+// aAny <<= (double)(200.0);
+// xXAxis->setPropertyValue( rtl::OUString::createFromAscii( "StepMain" ),
+// aAny );
+// }
+
+// try setting symbols
+// uno::Reference< beans::XPropertySet > xProp = getDataRowProperties( 0 );
+// if( xProp.is())
+// {
+// uno::Any aAny;
+// aAny <<= (sal_Int32)(-1);
+// xProp->setPropertyValue( OUString::createFromAscii( "SymbolType" ), aAny );
+// aAny <<= rtl::OUString::createFromAscii( "http://mib-1168/www/images/go.gif" );
+// xProp->setPropertyValue( OUString::createFromAscii( "SymbolBitmapURL" ), aAny );
+// }
+}
+
+void SAL_CALL SampleAddIn::addRefreshListener( const uno::Reference< util::XRefreshListener >& )
+ throw( uno::RuntimeException )
+{
+ // not implemented - this is not necessary
+ // (this method exists just because the interface requires it)
+}
+
+void SAL_CALL SampleAddIn::removeRefreshListener( const uno::Reference< util::XRefreshListener >& )
+ throw( uno::RuntimeException )
+{
+ // not implemented - this is not necessary
+ // (this method exists just because the interface requires it)
+}
+
+// XDiagram
+OUString SAL_CALL SampleAddIn::getDiagramType() throw( uno::RuntimeException )
+{
+ return OUString::createFromAscii( "com.sun.star.chart.SampleDiagram" );
+}
+
+// the following methods just delegate to the "parent diagram" (which in the future might no longer exist)
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getDataRowProperties( sal_Int32 nRow )
+ throw( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XDiagram > xDia = mxChartDoc->getDiagram();
+ if( xDia.is())
+ return xDia->getDataRowProperties( nRow );
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw( lang::IndexOutOfBoundsException,
+ uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XDiagram > xDia = mxChartDoc->getDiagram();
+ if( xDia.is())
+ return xDia->getDataPointProperties( nCol, nRow );
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+// XShape ( ::XDiagram )
+awt::Size SAL_CALL SampleAddIn::getSize()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< drawing::XShape > xShape( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xShape.is())
+ return xShape->getSize();
+ }
+
+ return awt::Size();
+}
+
+void SAL_CALL SampleAddIn::setSize( const awt::Size& aSize )
+ throw( beans::PropertyVetoException, uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< drawing::XShape > xShape( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xShape.is())
+ xShape->setSize( aSize );
+ }
+}
+
+awt::Point SAL_CALL SampleAddIn::getPosition()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< drawing::XShape > xShape( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xShape.is())
+ return xShape->getPosition();
+ }
+
+ return awt::Point();
+}
+
+void SAL_CALL SampleAddIn::setPosition( const awt::Point& aPos )
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< drawing::XShape > xShape( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xShape.is())
+ xShape->setPosition( aPos );
+ }
+}
+
+// XShapeDescriptor ( ::XShape ::XDiagram )
+rtl::OUString SAL_CALL SampleAddIn::getShapeType() throw( com::sun::star::uno::RuntimeException )
+{
+ return OUString::createFromAscii( "com.sun.star.chart.SampleAddinShape" );
+}
+
+// XAxisXSupplier
+uno::Reference< drawing::XShape > SAL_CALL SampleAddIn::getXAxisTitle()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisXSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getXAxisTitle();
+ }
+
+ return uno::Reference< drawing::XShape >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getXAxis()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisXSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getXAxis();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getXMainGrid()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisXSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getXMainGrid();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getXHelpGrid()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisXSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getXHelpGrid();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+// XAxisYSupplier
+uno::Reference< drawing::XShape > SAL_CALL SampleAddIn::getYAxisTitle()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisYSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getYAxisTitle();
+ }
+
+ return uno::Reference< drawing::XShape >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getYAxis()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisYSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getYAxis();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getYMainGrid()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisYSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getYMainGrid();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getYHelpGrid()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XAxisYSupplier > xAxisSupp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xAxisSupp.is())
+ return xAxisSupp->getYHelpGrid();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+// XStatisticDisplay
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getUpBar()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XStatisticDisplay > xStatDisp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xStatDisp.is())
+ return xStatDisp->getUpBar();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getDownBar()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XStatisticDisplay > xStatDisp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xStatDisp.is())
+ return xStatDisp->getDownBar();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL SampleAddIn::getMinMaxLine()
+ throw( uno::RuntimeException )
+{
+ if( mxChartDoc.is())
+ {
+ uno::Reference< chart::XStatisticDisplay > xStatDisp( mxChartDoc->getDiagram(), uno::UNO_QUERY );
+ if( xStatDisp.is())
+ return xStatDisp->getMinMaxLine();
+ }
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+// XServiceName
+OUString SAL_CALL SampleAddIn::getServiceName() throw( uno::RuntimeException )
+{
+ return OUString::createFromAscii( "com.sun.star.chart.SampleAddIn" );
+}
+
+// XServiceInfo
+OUString SAL_CALL SampleAddIn::getImplementationName() throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL SampleAddIn::supportsService( const OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aServiceSeq = getSupportedServiceNames_Static();
+
+ sal_Int32 nLength = aServiceSeq.getLength();
+ for( sal_Int32 i=0; i < nLength; i++ )
+ {
+ if( ServiceName.equals( aServiceSeq[ i ] ))
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< OUString > SAL_CALL SampleAddIn::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XLocalizable
+void SAL_CALL SampleAddIn::setLocale( const lang::Locale& eLocale )
+ throw( uno::RuntimeException )
+{
+ maLocale = eLocale;
+}
+
+lang::Locale SAL_CALL SampleAddIn::getLocale()
+ throw( uno::RuntimeException )
+{
+ return maLocale;
+}
diff --git a/chart2/workbench/addin/sampleaddin.def b/chart2/workbench/addin/sampleaddin.def
new file mode 100644
index 000000000000..78cb684a92f3
--- /dev/null
+++ b/chart2/workbench/addin/sampleaddin.def
@@ -0,0 +1,7 @@
+LIBRARY sampleaddin
+DESCRIPTION 'Sample Chart AddIn'
+HEAPSIZE 0
+EXPORTS
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/chart2/workbench/addin/sampleaddin.hxx b/chart2/workbench/addin/sampleaddin.hxx
new file mode 100644
index 000000000000..59b1ab32c8f1
--- /dev/null
+++ b/chart2/workbench/addin/sampleaddin.hxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SAMPLEADDIN_HXX_
+#define _SAMPLEADDIN_HXX_
+
+#include <cppuhelper/implbase9.hxx>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/chart/XDiagram.hpp>
+#include <com/sun/star/chart/XAxisXSupplier.hpp>
+#include <com/sun/star/chart/XAxisYSupplier.hpp>
+#include <com/sun/star/chart/XStatisticDisplay.hpp>
+
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XLocalizable.hpp>
+
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ SampleAddIn_CreateInstance(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& );
+
+class SampleAddIn : public cppu::WeakImplHelper9<
+ com::sun::star::lang::XInitialization,
+ com::sun::star::chart::XDiagram,
+ com::sun::star::chart::XAxisXSupplier,
+ com::sun::star::chart::XAxisYSupplier,
+ com::sun::star::chart::XStatisticDisplay,
+ com::sun::star::lang::XServiceName,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::util::XRefreshable,
+ com::sun::star::lang::XLocalizable >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDocument > mxChartDoc;
+ ::com::sun::star::lang::Locale maLocale;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxMyRedLine;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxMyText;
+
+public:
+ SampleAddIn();
+ virtual ~SampleAddIn();
+
+ // class specific code
+ static ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
+
+ sal_Bool getLogicalPosition( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxis,
+ double fValue,
+ sal_Bool bVertical,
+ ::com::sun::star::awt::Point& aOutPosition );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XDiagram
+ virtual ::rtl::OUString SAL_CALL getDiagramType() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XShape ( ::XDiagram )
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& )
+ throw( ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XShapeDescriptor ( ::XShape ::XDiagram )
+ virtual rtl::OUString SAL_CALL getShapeType() throw( com::sun::star::uno::RuntimeException );
+
+ // XAxisXSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XAxisYSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XStatisticDisplay
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceName
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XRefreshable
+ virtual void SAL_CALL refresh() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XLocalizable
+ virtual void SAL_CALL setLocale( const ::com::sun::star::lang::Locale& eLocale )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // _SAMPLEADDIN_HXX_