summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller')
-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
-rwxr-xr-xchart2/source/controller/chartapiwrapper/AreaWrapper.cxx211
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.hxx105
-rwxr-xr-xchart2/source/controller/chartapiwrapper/AxisWrapper.cxx597
-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
-rwxr-xr-xchart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx1625
-rwxr-xr-xchart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx901
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx160
-rwxr-xr-xchart2/source/controller/chartapiwrapper/DiagramWrapper.cxx2149
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx319
-rwxr-xr-xchart2/source/controller/chartapiwrapper/GridWrapper.cxx211
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.hxx103
-rwxr-xr-xchart2/source/controller/chartapiwrapper/LegendWrapper.cxx462
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.hxx113
-rwxr-xr-xchart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx447
-rwxr-xr-xchart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx133
-rw-r--r--chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx48
-rwxr-xr-xchart2/source/controller/chartapiwrapper/TitleWrapper.cxx568
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.hxx136
-rwxr-xr-xchart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx412
-rwxr-xr-xchart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx132
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx194
-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
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx154
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx49
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx445
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx76
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx171
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx102
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx190
-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
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx510
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx92
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx165
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx54
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx130
-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
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx285
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx59
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx1151
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx57
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx328
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx59
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx601
-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.cxx1363
-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.cxx830
-rw-r--r--chart2/source/controller/dialogs/DialogModel.hxx193
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx844
-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.cxx252
-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.cxx133
-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.cxx85
-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.cxx117
-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.src38
-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.cxx444
-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.cxx268
-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.cxx1616
-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.cxx272
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx919
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx2052
-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.cxx503
-rw-r--r--chart2/source/controller/main/ImplUndoManager.hxx227
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx860
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx189
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx678
-rw-r--r--chart2/source/controller/main/SelectionHelper.hxx139
-rw-r--r--chart2/source/controller/main/ShapeController.cxx739
-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.cxx153
-rw-r--r--chart2/source/controller/main/StatusBarCommandDispatch.hxx110
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx146
-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.cxx438
-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.mk135
-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
380 files changed, 80979 insertions, 0 deletions
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 100755
index 000000000000..b4422c5442ec
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.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 "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" ));
+
+struct StaticAreaWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer >
+{
+};
+
+
+} // 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 *StaticAreaWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..ebb9459e7d54
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -0,0 +1,597 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ));
+}
+
+struct StaticAxisWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::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 );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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 >();
+}
+
+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 *StaticAxisWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..e8d91cd6c124
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -0,0 +1,1625 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ) );
+}
+
+struct StaticChartDocumentWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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 *StaticChartDocumentWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..b79cab0930c6
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -0,0 +1,901 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ));
+}
+
+uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
+{
+ ::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 );
+
+ ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+}
+
+struct StaticSeriesWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
+ return &aPropSeq;
+ }
+};
+
+struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
+{
+};
+
+struct StaticPointWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
+ return &aPropSeq;
+ }
+};
+
+struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer >
+{
+};
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+//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()
+{
+ if( m_eType == DATA_SERIES )
+ return *StaticSeriesWrapperPropertyArray::get();
+ else
+ return *StaticPointWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..c174614a0bf3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -0,0 +1,2149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ));
+}
+
+struct StaticDiagramWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::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 );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
+{
+};
+
+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;
+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 *StaticDiagramWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..6586511424db
--- /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" ));
+
+struct StaticGridWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticGridWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticGridWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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()
+{}
+
+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 *StaticGridWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..5b71c7d3e768
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ));
+}
+
+struct StaticLegendWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::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 );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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 *StaticLegendWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..2885a79afe6d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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" ));
+
+struct StaticMinMaxLineWrapperDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ }
+};
+
+struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer >
+{
+};
+
+struct StaticMinMaxLineWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer >
+{
+};
+
+struct StaticMinMaxLineWrapperInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() );
+ return &aPropHelper;
+ }
+};
+
+struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer >
+{
+};
+
+struct StaticMinMaxLineWrapperInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer >
+{
+};
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , 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 ) );
+}
+
+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()
+{
+ return *StaticMinMaxLineWrapperInfoHelper::get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ return *StaticMinMaxLineWrapperInfo::get();
+}
+
+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)
+{
+ const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == rStaticDefaults.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 = *StaticMinMaxLineWrapperPropertyArray::get();
+ 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 100755
index 000000000000..31a67b600536
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.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 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;
+
+ 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 100755
index 000000000000..9a2183f089fe
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -0,0 +1,568 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ));
+}
+
+struct StaticTitleWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::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 );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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 *StaticTitleWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..16f576453869
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.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 "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" ));
+
+struct StaticUpDownBarWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer >
+{
+};
+
+struct StaticUpDownBarWrapperInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() );
+ return &aPropHelper;
+ }
+};
+
+struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer >
+{
+};
+
+struct StaticUpDownBarWrapperInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer >
+{
+};
+
+struct StaticUpDownBarWrapperDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+ }
+};
+
+struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer >
+{
+};
+
+} // 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") )
+{
+}
+
+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 ) );
+}
+
+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()
+{
+ return *StaticUpDownBarWrapperInfoHelper::get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ return *StaticUpDownBarWrapperInfo::get();
+}
+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)
+{
+ const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) );
+ if( aFound == rStaticDefaults.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 = *StaticUpDownBarWrapperPropertyArray::get();
+ 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 100755
index 000000000000..f271bcbf2bb5
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.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_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;
+};
+
+} // 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 100755
index 000000000000..be485f86aac4
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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" ));
+
+struct StaticWallFloorWrapperPropertyArray_Initializer
+{
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
+
+private:
+ Sequence< Property > lcl_GetPropertySequence()
+ {
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ //::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+};
+
+struct StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer >
+{
+};
+
+} // 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 *StaticWallFloorWrapperPropertyArray::get();
+}
+
+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 100755
index 000000000000..925b9694ba5f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
@@ -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 "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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void WrappedAutomaticPositionProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AutomaticPosition" ),
+ PROP_CHART_AUTOMATIC_POSITION,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 100755
index 000000000000..11e49850b694
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.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 "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;
+};
+
+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;
+};
+
+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;
+};
+
+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 100755
index 000000000000..bd7c49052804
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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()
+{
+}
+
+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 100755
index 000000000000..902938f04a78
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+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 ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void WrappedDataCaptionProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 100755
index 000000000000..a89ca372d9ee
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -0,0 +1,510 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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()
+{
+}
+
+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 100755
index 000000000000..2249ac1c41c3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void WrappedScaleTextProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ScaleText" ),
+ PROP_CHART_SCALE_TEXT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 100755
index 000000000000..79c09b8b41b0
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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
+{
+
+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 100755
index 000000000000..6890e06a1641
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+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 ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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(3)), 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 100755
index 000000000000..145e3423ccd8
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
@@ -0,0 +1,1151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+
+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 ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 100755
index 000000000000..37db09b977b6
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+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 ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 100755
index 000000000000..068f65f415be
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -0,0 +1,601 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+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 ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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 eOldLineStyle( drawing::LineStyle_SOLID );
+ xSeriesPropertySet->getPropertyValue( C2U("LineStyle") ) >>= eOldLineStyle;
+ if( bDrawLines )
+ {
+ //#i114298# don't overwrite dashed lines with solid lines here
+ if( eOldLineStyle == drawing::LineStyle_NONE )
+ xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ) );
+ }
+ else
+ {
+ if( eOldLineStyle != drawing::LineStyle_NONE )
+ xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+}
+
+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..fedcfaffebc4
--- /dev/null
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -0,0 +1,1363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.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();
+}
+
+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..eedd2e3c6ba9
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -0,0 +1,830 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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 ) )
+{
+}
+
+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;
+}
+
+OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString )
+{
+ return lcl_ConvertRole( rRoleString, true );
+}
+
+OUString DialogModel::GetRoleDataLabel()
+{
+ return OUString( String( ::chart::SchResId( STR_OBJECT_DATALABELS )));
+}
+
+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::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..b7f882611e47
--- /dev/null
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -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.
+ *
+ ************************************************************************/
+#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::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..9057b850332f
--- /dev/null
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -0,0 +1,844 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+}
+
+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;
+}
+
+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;
+}
+
+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;
+}
+
+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;
+}
+
+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;
+}
+
+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 );
+}
+
+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 );
+}
+
+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..3e4cba6b23ad
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+}
+
+// ----------------------------------------
+
+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..50aa10ec6e6b
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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 );
+}
+
+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..d7491156358e
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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()
+{
+}
+
+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..3c868f6aeaff
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+
+//-----------------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+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..0f8f12c3e48b
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataLabel.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_DataLabel.hrc"
+
+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..9da7f7536d28
--- /dev/null
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+ }
+ }
+ }
+ }
+}
+
+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..4b5196e7f902
--- /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 <tools/fldunit.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+namespace ConfigurationAccess
+{
+ /** @descr Retrieve the FieldUnit to be used for the UI. This unit is retrieved
+ from the registry settings of the Calc application.
+
+ If this setting can not be found there is a fallback to cm which is the most
+ common setting worldwide (or not?)
+
+ @return the FieldUnit enum. See <vcl/fldunit.hxx> for definition
+ */
+ FieldUnit getFieldUnit();
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
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..5754559ce8ae
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+}
+
+// --------------------------------------------------------------------------------
+
+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..675bcf40e7a2
--- /dev/null
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -0,0 +1,1616 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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();
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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 aClearableGuard( Application::GetSolarMutex());
+ if( impl_isDisposedOrSuspended() ) //@todo? allow attaching a new model while suspended?
+ return sal_False; //behave passive if already disposed or suspended
+ aClearableGuard.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
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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() );
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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..6091fd8ef3f8
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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..735cb9634671
--- /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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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();
+}
+
+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..885e37126dc2
--- /dev/null
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -0,0 +1,2052 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Reference<awt::XWindow> xWindow = m_xViewWindow;
+
+ if(xWindow.is() && m_pChartWindow)
+ {
+ Size aLogicSize = m_pChartWindow->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) );
+ m_pChartWindow->SetMapMode(aNewMapMode);
+ m_pChartWindow->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), m_pChartWindow->GetOutputSize());
+ m_pDrawViewWrapper->SetWorkArea( aRect );
+ }
+ }
+ else
+ {
+ //change visarea
+ ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() );
+ m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags );
+ }
+ m_pChartWindow->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();
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(pDrawViewWrapper)
+ pDrawViewWrapper->CompleteRedraw(m_pChartWindow, 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ 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();
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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();
+
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!m_pChartWindow || !pDrawViewWrapper )
+ return;
+
+ Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel());
+
+ if ( MOUSE_LEFT == rMEvt.GetButtons() )
+ {
+ m_pChartWindow->GrabFocus();
+ m_pChartWindow->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)m_pChartWindow->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());
+
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!m_pChartWindow || !pDrawViewWrapper)
+ return;
+
+ if( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( m_pDrawViewWrapper->MouseMove(rMEvt,m_pChartWindow) )
+ return;
+ }
+
+ if(pDrawViewWrapper->IsAction())
+ {
+ pDrawViewWrapper->MovAction( m_pChartWindow->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());
+
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!m_pChartWindow || !pDrawViewWrapper)
+ return;
+
+ Point aMPos = m_pChartWindow->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);
+ m_pChartWindow->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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if(m_pChartWindow)
+ 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 )
+{
+ bool bIsAction = false;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!m_pChartWindow || !pDrawViewWrapper)
+ return;
+ bIsAction = m_pDrawViewWrapper->IsAction();
+ }
+
+ // pop-up menu
+ if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
+ {
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if(m_pChartWindow)
+ 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() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if(m_pChartWindow)
+ 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() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if(m_pChartWindow)
+ 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
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( m_pDrawViewWrapper )
+ m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
+ }
+}
+
+bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
+{
+ bool bReturn=false;
+
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!m_pChartWindow || !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;
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( pDrawViewWrapper->IsTextEdit() )
+ {
+ if( pDrawViewWrapper->KeyInput(rKEvt,m_pChartWindow) )
+ {
+ 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 && m_pChartWindow )
+ {
+ // together with Alt-key: 1 px in each direction
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( m_pChartWindow )
+ {
+ Size aPixelSize = m_pChartWindow->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 && m_pChartWindow )
+ {
+ // together with Alt-key: 1 px
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if(m_pChartWindow)
+ {
+ Size aPixelSize = m_pChartWindow->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 )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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()
+{
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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());
+ if( m_pDrawViewWrapper && m_pChartWindow )
+ {
+ Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
+ sal_uInt16 nModifier = rEvent.GetModifier();
+ BOOL bLeftDown = rEvent.IsLeft();
+
+ if ( m_pDrawViewWrapper->IsTextEdit() )
+ {
+ if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) )
+ {
+ m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer(
+ aMousePos, m_pChartWindow, 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, m_pChartWindow, 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 )
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
+ else
+ m_pChartWindow->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;
+ }
+ m_pChartWindow->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()) )
+ {
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
+ return;
+ }
+ }
+
+ if( !aHitObjectCID.getLength() )
+ {
+ //additional shape was hit
+ m_pChartWindow->SetPointer( POINTER_MOVE );
+ }
+ else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) )
+ {
+ if( (m_eDragMode == SDRDRAG_ROTATE)
+ && SelectionHelper::isRotateableObject( aHitObjectCID
+ , getModel() ) )
+ m_pChartWindow->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()) )
+ {
+ m_pChartWindow->SetPointer( Pointer( POINTER_ARROW ));
+ return;
+ }
+ }
+ m_pChartWindow->SetPointer( POINTER_MOVE );
+ }
+ }
+ else
+ m_pChartWindow->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..0976b7db286e
--- /dev/null
+++ b/chart2/source/controller/main/ImplUndoManager.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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;
+}
+
+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;
+}
+
+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..19577eb4900e
--- /dev/null
+++ b/chart2/source/controller/main/ObjectHierarchy.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 "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()
+{}
+
+ObjectHierarchy::tOID ObjectHierarchy::getRootNodeOID()
+{
+ return ObjectIdentifier( C2U( "ROOT" ) );
+}
+
+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..cd51adc7842e
--- /dev/null
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+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;
+}
+
+bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject
+ , ObjectIdentifier& rOutObject
+ , bool bGivenObjectMayBeResult )
+{
+ rtl::OUString aName;
+ if ( findNamedParent( pInOutObject, aName, bGivenObjectMayBeResult ) )
+ {
+ rOutObject = ObjectIdentifier( aName );
+ return true;
+ }
+ return false;
+}
+
+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;
+}
+
+::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
+}
+
+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;
+}
+
+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;
+}
+
+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..b2eccae6c98d
--- /dev/null
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -0,0 +1,739 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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 );
+ }
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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 );
+ }
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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 );
+ }
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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() );
+ 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() );
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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() );
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( m_pChartController )
+ {
+ DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
+ if ( pDrawViewWrapper && pDrawViewWrapper->GetMarkedObjectCount() == 1 )
+ {
+ SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
+ if ( pSelectedObj )
+ {
+ String aName( pSelectedObj->GetName() );
+ 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 )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
+ if ( pDrawViewWrapper )
+ {
+ 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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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 );
+ ::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()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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) );
+
+ ::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() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ 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..68c56f2d988b
--- /dev/null
+++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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
+
+#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..128a4b4091d0
--- /dev/null
+++ b/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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 <svtools/svtools.hrc>
+#include <svtools/svtdata.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( SvtResId( STR_UNDO )));
+ aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString());
+ }
+ if( m_xUndoManager->redoPossible())
+ {
+ // using assignment for broken gcc 3.3
+ OUString aRedo = OUString( String( SvtResId( 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..21b3bbc1f725
--- /dev/null
+++ b/chart2/source/controller/main/UndoManager.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 "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;
+}
+
+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;
+}
+
+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..41d7df24acaa
--- /dev/null
+++ b/chart2/source/controller/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+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 ---------------------------------------------------------------
+
+RESLIB1LIST=\
+ $(SRS)$/chcdialogs.srs \
+ $(SRS)$/chcmenus.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