summaryrefslogtreecommitdiffstats
path: root/chart2
diff options
context:
space:
mode:
authorIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-02-15 14:04:40 +0100
committerIngrid Halama [iha] <Ingrid.Halama@oracle.com>2011-02-15 14:04:40 +0100
commitd3f3babe5fa6931a98f723b91a4ec72d8cb0d1fa (patch)
tree79865a93b14aab684a26e6dec14088811113e601 /chart2
parentchart51: #i116681# fixed defaults for lights (diff)
parentCWS-TOOLING: integrate CWS hr75 (diff)
downloadcore-d3f3babe5fa6931a98f723b91a4ec72d8cb0d1fa.tar.gz
core-d3f3babe5fa6931a98f723b91a4ec72d8cb0d1fa.zip
chart51: merge with DEV300_m100
Diffstat (limited to 'chart2')
-rw-r--r--chart2/prj/build.lst2
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.cxx2
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.hxx2
-rwxr-xr-xchart2/source/controller/chartapiwrapper/AxisWrapper.cxx110
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/AxisWrapper.hxx17
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx7
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx235
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx32
-rwxr-xr-xchart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx10
-rwxr-xr-xchart2/source/controller/chartapiwrapper/DiagramWrapper.cxx236
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx86
-rwxr-xr-xchart2/source/controller/chartapiwrapper/GridWrapper.cxx13
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/GridWrapper.hxx13
-rwxr-xr-xchart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx106
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx3
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx98
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.hxx8
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx25
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.hxx10
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx4
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx11
-rw-r--r--chart2/source/controller/dialogs/Strings.src9
-rw-r--r--chart2/source/controller/dialogs/Strings_Scale.src8
-rw-r--r--chart2/source/controller/dialogs/TabPages.hrc25
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_DataEditor.cxx24
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx6
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_NumberFormat.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx26
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeFont.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx2
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.cxx6
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.hxx6
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx50
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.hxx10
-rw-r--r--chart2/source/controller/dialogs/res_ErrorBar.cxx40
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx12
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.cxx6
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.hxx4
-rw-r--r--chart2/source/controller/dialogs/res_Titles.cxx2
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx18
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx44
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx58
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx8
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx52
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx10
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_DataLabel.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx18
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx6
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_ErrorBars.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx6
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_PointGeometry.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx26
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx10
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx488
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hrc63
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx33
-rwxr-xr-x[-rw-r--r--]chart2/source/controller/dialogs/tp_Scale.src211
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx68
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_Trendline.hxx2
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx8
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx8
-rw-r--r--chart2/source/controller/inc/AxisItemConverter.hxx17
-rw-r--r--chart2/source/controller/inc/CharacterPropertyItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx8
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx8
-rwxr-xr-xchart2/source/controller/inc/ErrorBarItemConverter.hxx8
-rw-r--r--chart2/source/controller/inc/GraphicPropertyItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/ItemConverter.hxx12
-rw-r--r--chart2/source/controller/inc/LegendItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/MultipleChartConverters.hxx10
-rw-r--r--chart2/source/controller/inc/MultipleItemConverter.hxx2
-rw-r--r--chart2/source/controller/inc/RegressionCurveItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/RegressionEquationItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/SeriesOptionsItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/StatisticsItemConverter.hxx8
-rw-r--r--chart2/source/controller/inc/TitleItemConverter.hxx6
-rw-r--r--chart2/source/controller/inc/dlg_DataEditor.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_ObjectProperties.hxx10
-rw-r--r--chart2/source/controller/inc/dlg_ShapeFont.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_ShapeParagraph.hxx2
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx2
-rw-r--r--chart2/source/controller/inc/res_ErrorBar.hxx2
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx372
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx16
-rwxr-xr-xchart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx12
-rw-r--r--chart2/source/controller/itemsetwrapper/ItemConverter.cxx22
-rw-r--r--chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx10
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx10
-rw-r--r--chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx72
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx8
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx8
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx10
-rw-r--r--chart2/source/controller/main/ChartController.cxx41
-rw-r--r--chart2/source/controller/main/ChartController.hxx11
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx6
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx198
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx14
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx10
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx42
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx74
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx32
-rw-r--r--chart2/source/controller/main/ChartDropTargetHelper.cxx77
-rwxr-xr-xchart2/source/controller/main/ChartModelClone.cxx280
-rwxr-xr-xchart2/source/controller/main/ChartModelClone.hxx89
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx2
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx10
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx6
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx6
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.hxx9
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx10
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.hxx2
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx10
-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/ShapeController.cxx24
-rw-r--r--chart2/source/controller/main/ShapeToolbarController.cxx10
-rw-r--r--chart2/source/controller/main/UndoActions.cxx178
-rw-r--r--chart2/source/controller/main/UndoActions.hxx134
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.cxx48
-rw-r--r--chart2/source/controller/main/UndoCommandDispatch.hxx7
-rw-r--r--chart2/source/controller/main/UndoGuard.cxx165
-rw-r--r--chart2/source/controller/main/UndoGuard.hxx137
-rw-r--r--chart2/source/controller/main/UndoManager.cxx438
-rw-r--r--chart2/source/controller/main/makefile.mk9
-rw-r--r--chart2/source/inc/AxisHelper.hxx15
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx1
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx3
-rw-r--r--chart2/source/inc/CommonFunctors.hxx13
-rw-r--r--chart2/source/inc/DiagramHelper.hxx23
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx43
-rwxr-xr-xchart2/source/inc/InternalData.hxx26
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx30
-rwxr-xr-x[-rw-r--r--]chart2/source/inc/NumberFormatterWrapper.hxx (renamed from chart2/source/inc/chartview/NumberFormatterWrapper.hxx)13
-rw-r--r--chart2/source/inc/OPropertySet.hxx2
-rw-r--r--chart2/source/inc/ReferenceSizeProvider.hxx2
-rw-r--r--chart2/source/inc/RelativePositionHelper.hxx8
-rw-r--r--chart2/source/inc/Strings.hrc8
-rw-r--r--chart2/source/inc/UndoGuard.hxx120
-rw-r--r--chart2/source/inc/UndoManager.hxx180
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx167
-rw-r--r--chart2/source/inc/chartview/ExplicitScaleValues.hxx165
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx11
-rw-r--r--chart2/source/inc/servicenames.hxx2
-rw-r--r--chart2/source/model/inc/Diagram.hxx11
-rwxr-xr-xchart2/source/model/main/ChartModel.cxx153
-rwxr-xr-xchart2/source/model/main/ChartModel.hxx21
-rwxr-xr-xchart2/source/model/main/Diagram.cxx17
-rwxr-xr-xchart2/source/model/main/UndoManager.cxx427
-rwxr-xr-xchart2/source/model/main/UndoManager.hxx109
-rw-r--r--chart2/source/model/main/makefile.mk1
-rw-r--r--chart2/source/model/makefile.mk3
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/BubbleDataInterpreter.cxx43
-rwxr-xr-xchart2/source/model/template/ChartTypeTemplate.cxx23
-rwxr-xr-xchart2/source/model/template/DataInterpreter.cxx8
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/DataInterpreter.hxx4
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/XYDataInterpreter.cxx31
-rwxr-xr-xchart2/source/tools/AxisHelper.cxx232
-rwxr-xr-xchart2/source/tools/ChartTypeHelper.cxx25
-rwxr-xr-x[-rw-r--r--]chart2/source/tools/DataSourceHelper.cxx19
-rwxr-xr-xchart2/source/tools/DiagramHelper.cxx214
-rwxr-xr-xchart2/source/tools/ExplicitCategoriesProvider.cxx242
-rwxr-xr-xchart2/source/tools/InternalData.cxx42
-rwxr-xr-xchart2/source/tools/InternalDataProvider.cxx337
-rwxr-xr-x[-rw-r--r--]chart2/source/tools/NumberFormatterWrapper.cxx (renamed from chart2/source/view/main/NumberFormatterWrapper.cxx)23
-rwxr-xr-x[-rw-r--r--]chart2/source/tools/ResId.cxx2
-rw-r--r--chart2/source/tools/makefile.mk1
-rw-r--r--chart2/source/view/axes/DateHelper.cxx132
-rw-r--r--chart2/source/view/axes/DateScaling.cxx216
-rw-r--r--chart2/source/view/axes/DateScaling.hxx114
-rw-r--r--chart2/source/view/axes/MinimumAndMaximumSupplier.cxx21
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx336
-rw-r--r--chart2/source/view/axes/Tickmarks.cxx333
-rw-r--r--chart2/source/view/axes/Tickmarks.hxx166
-rw-r--r--chart2/source/view/axes/Tickmarks_Dates.cxx171
-rw-r--r--chart2/source/view/axes/Tickmarks_Dates.hxx65
-rw-r--r--chart2/source/view/axes/Tickmarks_Equidistant.cxx671
-rw-r--r--chart2/source/view/axes/Tickmarks_Equidistant.hxx (renamed from chart2/source/view/axes/TickmarkHelper.hxx)160
-rw-r--r--chart2/source/view/axes/VAxisBase.cxx26
-rw-r--r--chart2/source/view/axes/VAxisBase.hxx21
-rw-r--r--chart2/source/view/axes/VAxisOrGridBase.cxx17
-rw-r--r--chart2/source/view/axes/VAxisOrGridBase.hxx21
-rw-r--r--chart2/source/view/axes/VAxisProperties.cxx19
-rw-r--r--chart2/source/view/axes/VAxisProperties.hxx1
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx406
-rw-r--r--chart2/source/view/axes/VCartesianAxis.hxx27
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.cxx17
-rw-r--r--chart2/source/view/axes/VCartesianGrid.cxx13
-rw-r--r--chart2/source/view/axes/VCartesianGrid.hxx2
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx30
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.cxx22
-rw-r--r--chart2/source/view/axes/VPolarAngleAxis.hxx9
-rw-r--r--chart2/source/view/axes/VPolarAxis.cxx6
-rw-r--r--chart2/source/view/axes/VPolarAxis.hxx8
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.cxx9
-rw-r--r--chart2/source/view/axes/VPolarGrid.cxx27
-rw-r--r--chart2/source/view/axes/VPolarGrid.hxx14
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.cxx27
-rw-r--r--chart2/source/view/axes/VPolarRadiusAxis.hxx24
-rw-r--r--chart2/source/view/axes/makefile.mk6
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx34
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx13
-rw-r--r--[-rwxr-xr-x]chart2/source/view/charttypes/BarChart.cxx103
-rw-r--r--chart2/source/view/charttypes/BarChart.hxx18
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.cxx79
-rw-r--r--chart2/source/view/charttypes/BarPositionHelper.hxx19
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx4
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx6
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx104
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.hxx13
-rw-r--r--chart2/source/view/charttypes/CategoryPositionHelper.cxx17
-rw-r--r--chart2/source/view/charttypes/CategoryPositionHelper.hxx5
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx12
-rw-r--r--chart2/source/view/charttypes/PieChart.hxx18
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx145
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx5
-rw-r--r--chart2/source/view/inc/DateHelper.hxx60
-rw-r--r--chart2/source/view/inc/MinimumAndMaximumSupplier.hxx9
-rw-r--r--chart2/source/view/inc/PlotterBase.hxx31
-rw-r--r--chart2/source/view/inc/PlottingPositionHelper.hxx78
-rw-r--r--chart2/source/view/inc/ScaleAutomatism.hxx37
-rw-r--r--chart2/source/view/inc/VCoordinateSystem.hxx27
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx4
-rw-r--r--chart2/source/view/inc/VDiagram.hxx2
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx14
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx100
-rw-r--r--chart2/source/view/main/ChartItemPool.hxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx245
-rw-r--r--chart2/source/view/main/ChartView.hxx4
-rw-r--r--chart2/source/view/main/Clipping.cxx4
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx6
-rw-r--r--chart2/source/view/main/PlotterBase.cxx9
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx77
-rw-r--r--chart2/source/view/main/VDataSeries.cxx16
-rw-r--r--chart2/source/view/main/VLegend.cxx2
-rw-r--r--chart2/source/view/main/VLegend.hxx2
-rw-r--r--chart2/source/view/main/VTitle.cxx2
-rw-r--r--chart2/source/view/main/VTitle.hxx2
-rw-r--r--chart2/source/view/main/makefile.mk1
261 files changed, 8608 insertions, 4657 deletions
diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst
index 5526e2964680..ec6658d212c6 100644
--- a/chart2/prj/build.lst
+++ b/chart2/prj/build.lst
@@ -1,4 +1,4 @@
-ch chart2 : l10n comphelper cppu cppuhelper sal svtools svx tools vcl toolkit unotools sfx2 LIBXSLT:libxslt NULL
+ch chart2 : offapi offuh l10n comphelper cppu cppuhelper sal svtools svx tools vcl toolkit unotools sfx2 LIBXSLT:libxslt NULL
ch chart2 usr1 - all ch_mkout NULL
ch chart2\inc nmake - all ch_inc NULL
ch chart2\source\inc get - all ch_source_inc NULL
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
index 5014198761f8..7936efb3d899 100644
--- a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
@@ -52,7 +52,7 @@ AccessibleViewForwarder::~AccessibleViewForwarder()
// ________ IAccessibleViewforwarder ________
-BOOL AccessibleViewForwarder::IsValid() const
+sal_Bool AccessibleViewForwarder::IsValid() const
{
return sal_True;
}
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
index e70aa58b8df7..e85e68b23830 100644
--- a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
@@ -44,7 +44,7 @@ public:
virtual ~AccessibleViewForwarder();
// ________ IAccessibleViewforwarder ________
- virtual BOOL IsValid() const;
+ virtual sal_Bool IsValid() const;
virtual Rectangle GetVisibleArea() const;
virtual Point LogicToPixel( const Point& rPoint ) const;
virtual Size LogicToPixel( const Size& rSize ) const;
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
index ebb9459e7d54..80b7cd20574b 100755
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -29,10 +29,15 @@
#include "precompiled_chart2.hxx"
#include "AxisWrapper.hxx"
#include "AxisHelper.hxx"
+#include "TitleHelper.hxx"
#include "Chart2ModelContact.hxx"
#include "ContainerHelper.hxx"
#include "macros.hxx"
#include "WrappedDirectStateProperty.hxx"
+#include "GridWrapper.hxx"
+#include "TitleWrapper.hxx"
+#include "DisposeHelper.hxx"
+
#include <comphelper/InlineContainer.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
@@ -82,6 +87,9 @@ enum
PROP_AXIS_AUTO_MIN,
PROP_AXIS_AUTO_STEPMAIN,
PROP_AXIS_AUTO_STEPHELP,
+ PROP_AXIS_TYPE,
+ PROP_AXIS_TIME_INCREMENT,
+ PROP_AXIS_EXPLICIT_TIME_INCREMENT,
PROP_AXIS_LOGARITHMIC,
PROP_AXIS_REVERSEDIRECTION,
PROP_AXIS_VISIBLE,
@@ -174,6 +182,27 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
+ Property( C2U( "AxisType" ),
+ PROP_AXIS_TYPE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), //type com::sun::star::chart::ChartAxisType
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TimeIncrement" ),
+ PROP_AXIS_TIME_INCREMENT,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)),
+ //#i111967# no PropertyChangeEvent is fired on change so far
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ExplicitTimeIncrement" ),
+ PROP_AXIS_EXPLICIT_TIME_INCREMENT,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)),
+ beans::PropertyAttribute::READONLY |
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
Property( C2U( "Logarithmic" ),
PROP_AXIS_LOGARITHMIC,
::getBooleanCppuType(),
@@ -374,6 +403,83 @@ AxisWrapper::~AxisWrapper()
{
}
+// ____ chart::XAxis ____
+Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle() throw (uno::RuntimeException)
+{
+ if( !m_xAxisTitle.is() )
+ {
+ TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE );
+ switch( m_eType )
+ {
+ case X_AXIS:
+ eTitleType = TitleHelper::X_AXIS_TITLE;
+ break;
+ case Y_AXIS:
+ eTitleType = TitleHelper::Y_AXIS_TITLE;
+ break;
+ case Z_AXIS:
+ eTitleType = TitleHelper::Z_AXIS_TITLE;
+ break;
+ case SECOND_X_AXIS:
+ eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
+ break;
+ case SECOND_Y_AXIS:
+ eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
+ break;
+ default:
+ return 0;
+ }
+ m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact );
+ }
+ return m_xAxisTitle;
+}
+Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid() throw (uno::RuntimeException)
+{
+ if( !m_xMajorGrid.is() )
+ {
+ GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
+ switch( m_eType )
+ {
+ case X_AXIS:
+ eGridType = GridWrapper::X_MAJOR_GRID;
+ break;
+ case Y_AXIS:
+ eGridType = GridWrapper::Y_MAJOR_GRID;
+ break;
+ case Z_AXIS:
+ eGridType = GridWrapper::Z_MAJOR_GRID;
+ break;
+ default:
+ return 0;
+ }
+ m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
+ }
+ return m_xMajorGrid;
+}
+Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid() throw (uno::RuntimeException)
+{
+ if( !m_xMinorGrid.is() )
+ {
+ GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
+ switch( m_eType )
+ {
+ case X_AXIS:
+ eGridType = GridWrapper::X_MINOR_GRID;
+ break;
+ case Y_AXIS:
+ eGridType = GridWrapper::Y_MINOR_GRID;
+ break;
+ case Z_AXIS:
+ eGridType = GridWrapper::Z_MINOR_GRID;
+ break;
+ default:
+ return 0;
+ }
+ m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
+ }
+ return m_xMinorGrid;
+}
+
// ____ XShape ____
awt::Point SAL_CALL AxisWrapper::getPosition()
throw (uno::RuntimeException)
@@ -454,6 +560,10 @@ void SAL_CALL AxisWrapper::dispose()
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+ DisposeHelper::DisposeAndClear( m_xAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xMajorGrid );
+ DisposeHelper::DisposeAndClear( m_xMinorGrid );
+
clearWrappedPropertySet();
}
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
index 86bd52367bbe..f7a7d514e1f4 100644..100755
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
@@ -30,9 +30,10 @@
#include "WrappedPropertySet.hxx"
#include "ReferenceSizePropertyProvider.hxx"
#include "ServiceMacros.hxx"
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart/XAxis.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/drawing/XShape.hpp>
@@ -45,14 +46,13 @@
namespace chart
{
-
namespace wrapper
{
-
class Chart2ModelContact;
-class AxisWrapper : public ::cppu::ImplInheritanceHelper4<
+class AxisWrapper : public ::cppu::ImplInheritanceHelper5<
WrappedPropertySet
+ , com::sun::star::chart::XAxis
, com::sun::star::drawing::XShape
, com::sun::star::lang::XComponent
, com::sun::star::lang::XServiceInfo
@@ -93,6 +93,11 @@ public:
::com::sun::star::lang::XEventListener >& aListener )
throw (::com::sun::star::uno::RuntimeException);
+ // ____ chart::XAxis ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getAxisTitle( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMajorGrid( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinorGrid( ) throw (::com::sun::star::uno::RuntimeException);
+
// ____ XShape ____
virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
throw (::com::sun::star::uno::RuntimeException);
@@ -131,6 +136,10 @@ private: //member
tAxisType m_eType;
::com::sun::star::uno::Any m_aTemporaryHelpStepValue;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisTitle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMajorGrid;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMinorGrid;
};
} // namespace wrapper
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index e20167e216c2..dafef0f2aa72 100644..100755
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -27,8 +27,7 @@
#ifndef CHART_CHART2MODELCONTACT_HXX
#define CHART_CHART2MODELCONTACT_HXX
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <chartview/ExplicitScaleValues.hxx>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
@@ -79,8 +78,8 @@ public:
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 );
+ ExplicitScaleData & rOutExplicitScale,
+ ExplicitIncrementData & rOutExplicitIncrement );
sal_Int32 getExplicitNumberFormatKeyForAxis(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index 062dcc1a129d..3498b812557a 100644..100755
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -64,9 +64,11 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::rtl::OUString;
using ::osl::MutexGuard;
+using ::com::sun::star::chart2::XAnyDescriptionAccess;
using ::com::sun::star::chart::XComplexDescriptionAccess;
using ::com::sun::star::chart::XChartData;
using ::com::sun::star::chart::XChartDataArray;
+using ::com::sun::star::chart::XDateCategories;
namespace
{
@@ -132,7 +134,7 @@ struct lcl_Operator
virtual ~lcl_Operator()
{
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) = 0;
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) = 0;
virtual bool setsCategories( bool /*bDataInColumns*/ )
{
@@ -155,13 +157,20 @@ struct lcl_AllOperator : public lcl_Operator
return true;
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( !xDataAccess.is() )
return;
+ Reference< XAnyDescriptionAccess > xNewAny( m_xDataToApply, uno::UNO_QUERY );
Reference< XComplexDescriptionAccess > xNewComplex( m_xDataToApply, uno::UNO_QUERY );
- if( xNewComplex.is() )
+ if( xNewAny.is() )
+ {
+ xDataAccess->setData( xNewAny->getData() );
+ xDataAccess->setComplexRowDescriptions( xNewAny->getComplexRowDescriptions() );
+ xDataAccess->setComplexColumnDescriptions( xNewAny->getComplexColumnDescriptions() );
+ }
+ else if( xNewComplex.is() )
{
xDataAccess->setData( xNewComplex->getData() );
xDataAccess->setComplexRowDescriptions( xNewComplex->getComplexRowDescriptions() );
@@ -192,7 +201,7 @@ struct lcl_DataOperator : public lcl_Operator
{
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( xDataAccess.is() )
xDataAccess->setData( lcl_getNANInsteadDBL_MIN( m_rData ) );
@@ -205,96 +214,208 @@ struct lcl_DataOperator : public lcl_Operator
struct lcl_RowDescriptionsOperator : public lcl_Operator
{
- lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions )
+ lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions
+ , const Reference< chart2::XChartDocument >& xChartDoc )
: lcl_Operator()
, m_rRowDescriptions( rRowDescriptions )
+ , m_xChartDoc(xChartDoc)
+ , m_bDataInColumns(true)
{
}
virtual bool setsCategories( bool bDataInColumns )
{
+ m_bDataInColumns = bDataInColumns;
return bDataInColumns;
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( xDataAccess.is() )
+ {
xDataAccess->setRowDescriptions( m_rRowDescriptions );
+ if( m_bDataInColumns )
+ DiagramHelper::switchToTextCategories( m_xChartDoc );
+ }
}
const Sequence< OUString >& m_rRowDescriptions;
+ Reference< chart2::XChartDocument > m_xChartDoc;
+ bool m_bDataInColumns;
};
//--------------------------------------------------------------------------
struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator
{
- lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions )
+ lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions
+ , const Reference< chart2::XChartDocument >& xChartDoc )
: lcl_Operator()
, m_rComplexRowDescriptions( rComplexRowDescriptions )
+ , m_xChartDoc(xChartDoc)
+ , m_bDataInColumns(true)
{
}
virtual bool setsCategories( bool bDataInColumns )
{
- return !bDataInColumns;
+ m_bDataInColumns = bDataInColumns;
+ return bDataInColumns;
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( xDataAccess.is() )
+ {
xDataAccess->setComplexRowDescriptions( m_rComplexRowDescriptions );
+ if( m_bDataInColumns )
+ DiagramHelper::switchToTextCategories( m_xChartDoc );
+ }
}
const Sequence< Sequence< OUString > >& m_rComplexRowDescriptions;
+ Reference< chart2::XChartDocument > m_xChartDoc;
+ bool m_bDataInColumns;
+};
+//--------------------------------------------------------------------------
+
+struct lcl_AnyRowDescriptionsOperator : public lcl_Operator
+{
+ lcl_AnyRowDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyRowDescriptions )
+ : lcl_Operator()
+ , m_rAnyRowDescriptions( rAnyRowDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setAnyRowDescriptions( m_rAnyRowDescriptions );
+ }
+
+ const Sequence< Sequence< uno::Any > >& m_rAnyRowDescriptions;
};
//--------------------------------------------------------------------------
struct lcl_ColumnDescriptionsOperator : public lcl_Operator
{
- lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions )
+ lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions
+ , const Reference< chart2::XChartDocument >& xChartDoc )
: lcl_Operator()
, m_rColumnDescriptions( rColumnDescriptions )
+ , m_xChartDoc(xChartDoc)
+ , m_bDataInColumns(true)
{
}
virtual bool setsCategories( bool bDataInColumns )
{
+ m_bDataInColumns = bDataInColumns;
return !bDataInColumns;
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( xDataAccess.is() )
+ {
xDataAccess->setColumnDescriptions( m_rColumnDescriptions );
+ if( !m_bDataInColumns )
+ DiagramHelper::switchToTextCategories( m_xChartDoc );
+ }
}
const Sequence< OUString >& m_rColumnDescriptions;
+ Reference< chart2::XChartDocument > m_xChartDoc;
+ bool m_bDataInColumns;
};
//--------------------------------------------------------------------------
struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator
{
- lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions )
+ lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions
+ , const Reference< chart2::XChartDocument >& xChartDoc )
: lcl_Operator()
, m_rComplexColumnDescriptions( rComplexColumnDescriptions )
+ , m_xChartDoc(xChartDoc)
+ , m_bDataInColumns(true)
{
}
virtual bool setsCategories( bool bDataInColumns )
{
+ m_bDataInColumns = bDataInColumns;
return !bDataInColumns;
}
- virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess )
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
{
if( xDataAccess.is() )
+ {
xDataAccess->setComplexColumnDescriptions( m_rComplexColumnDescriptions );
+ if( !m_bDataInColumns )
+ DiagramHelper::switchToTextCategories( m_xChartDoc );
+ }
}
const Sequence< Sequence< OUString > >& m_rComplexColumnDescriptions;
+ Reference< chart2::XChartDocument > m_xChartDoc;
+ bool m_bDataInColumns;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_AnyColumnDescriptionsOperator : public lcl_Operator
+{
+ lcl_AnyColumnDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyColumnDescriptions )
+ : lcl_Operator()
+ , m_rAnyColumnDescriptions( rAnyColumnDescriptions )
+ {
+ }
+
+ virtual bool setsCategories( bool bDataInColumns )
+ {
+ return bDataInColumns;
+ }
+
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
+ {
+ if( xDataAccess.is() )
+ xDataAccess->setAnyColumnDescriptions( m_rAnyColumnDescriptions );
+ }
+
+ const Sequence< Sequence< uno::Any > >& m_rAnyColumnDescriptions;
+};
+
+//--------------------------------------------------------------------------
+
+struct lcl_DateCategoriesOperator : public lcl_Operator
+{
+ lcl_DateCategoriesOperator( const Sequence< double >& rDates )
+ : lcl_Operator()
+ , m_rDates( rDates )
+ {
+ }
+
+ virtual bool setsCategories( bool /*bDataInColumns*/ )
+ {
+ return true;
+ }
+
+ virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess )
+ {
+ Reference< XDateCategories > xDateCategories( xDataAccess, uno::UNO_QUERY );
+ if( xDateCategories.is() )
+ xDateCategories->setDateCategories( m_rDates );
+ }
+
+ const Sequence< double >& m_rDates;
};
//--------------------------------------------------------------------------
@@ -353,6 +474,7 @@ Sequence< OUString > SAL_CALL ChartDataWrapper::getColumnDescriptions()
return m_xDataAccess->getColumnDescriptions();
return Sequence< OUString > ();
}
+
// ____ XComplexDescriptionAccess (read) ____
Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexRowDescriptions() throw (uno::RuntimeException)
{
@@ -369,6 +491,32 @@ Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexColumnDesc
return Sequence< Sequence< OUString > >();
}
+// ____ XAnyDescriptionAccess (read) ____
+Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyRowDescriptions() throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getAnyRowDescriptions();
+ return Sequence< Sequence< uno::Any > >();
+}
+Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyColumnDescriptions() throw (uno::RuntimeException)
+{
+ initDataAccess();
+ if( m_xDataAccess.is() )
+ return m_xDataAccess->getAnyColumnDescriptions();
+ return Sequence< Sequence< uno::Any > >();
+}
+
+// ____ XDateCategories (read) ____
+Sequence< double > SAL_CALL ChartDataWrapper::getDateCategories() throw (uno::RuntimeException)
+{
+ initDataAccess();
+ Reference< XDateCategories > xDateCategories( m_xDataAccess, uno::UNO_QUERY );
+ if( xDateCategories.is() )
+ return xDateCategories->getDateCategories();
+ return Sequence< double >();
+}
+
// ____ XChartDataArray (write)____
void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& rData )
throw (uno::RuntimeException)
@@ -379,28 +527,50 @@ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& r
void SAL_CALL ChartDataWrapper::setRowDescriptions( const Sequence< OUString >& rRowDescriptions )
throw (uno::RuntimeException)
{
- lcl_RowDescriptionsOperator aOperator( rRowDescriptions );
+ lcl_RowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() );
applyData( aOperator );
}
void SAL_CALL ChartDataWrapper::setColumnDescriptions( const Sequence< OUString >& rColumnDescriptions )
throw (uno::RuntimeException)
{
- lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions );
+ lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() );
applyData( aOperator );
}
// ____ XComplexDescriptionAccess (write) ____
void SAL_CALL ChartDataWrapper::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rRowDescriptions ) throw (uno::RuntimeException)
{
- lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions );
+ lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() );
applyData( aOperator );
}
void SAL_CALL ChartDataWrapper::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rColumnDescriptions ) throw (uno::RuntimeException)
{
- lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions );
+ lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() );
+ applyData( aOperator );
+}
+
+// ____ XAnyDescriptionAccess (write) ____
+void SAL_CALL ChartDataWrapper::setAnyRowDescriptions( const Sequence< Sequence< uno::Any > >& rRowDescriptions ) throw (uno::RuntimeException)
+{
+ lcl_AnyRowDescriptionsOperator aOperator( rRowDescriptions );
+ applyData( aOperator );
+}
+void SAL_CALL ChartDataWrapper::setAnyColumnDescriptions( const Sequence< Sequence< uno::Any > >& rColumnDescriptions ) throw (uno::RuntimeException)
+{
+ lcl_AnyColumnDescriptionsOperator aOperator( rColumnDescriptions );
applyData( aOperator );
}
+// ____ XDateCategories (write) ____
+void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ lcl_DateCategoriesOperator aOperator( rDates );
+ applyData( aOperator );
+ DiagramHelper::switchToDateCategories( xChartDoc );
+}
+
//--------------------------------------------------------------------------------------
// ____ XChartData (base of XChartDataArray) ____
@@ -508,11 +678,11 @@ void ChartDataWrapper::initDataAccess()
if( !xChartDoc.is() )
return;
if( xChartDoc->hasInternalDataProvider() )
- m_xDataAccess = Reference< XComplexDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
+ m_xDataAccess = Reference< XAnyDescriptionAccess >( 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(
+ m_xDataAccess = Reference< XAnyDescriptionAccess >( ChartModelHelper::createInternalDataProvider(
xChartDoc, false /*bConnectToModel*/ ), uno::UNO_QUERY_THROW );
}
}
@@ -569,30 +739,9 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
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 );
- }
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() );
+ if( xDia.is() )
+ xDia->setDiagramData( xSource, aArguments );
//correct stacking mode
if( bStacked || bPercent || bDeep )
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
index d56397953d79..16695914f892 100644..100755
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
@@ -29,9 +29,10 @@
#include "ServiceMacros.hxx"
#include "MutexContainer.hxx"
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
+#include <com/sun/star/chart/XDateCategories.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -48,8 +49,9 @@ class Chart2ModelContact;
struct lcl_Operator;
class ChartDataWrapper : public MutexContainer, public
- ::cppu::WeakImplHelper4<
- com::sun::star::chart::XComplexDescriptionAccess,
+ ::cppu::WeakImplHelper5<
+ com::sun::star::chart2::XAnyDescriptionAccess,
+ com::sun::star::chart::XDateCategories,
com::sun::star::lang::XServiceInfo,
com::sun::star::lang::XEventListener,
com::sun::star::lang::XComponent >
@@ -64,7 +66,25 @@ public:
APPHELPER_XSERVICEINFO_DECL()
protected:
- // ____ XComplexDescriptionAccess ____
+ // ____ XDateCategories ____
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAnyDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
+ getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAnyRowDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
+ getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAnyColumnDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
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(
@@ -136,7 +156,7 @@ private: //methods
private: //member
::com::sun::star::uno::Reference<
- ::com::sun::star::chart::XComplexDescriptionAccess > m_xDataAccess;
+ ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess;
::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index e8d91cd6c124..42d5667b7d82 100755
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -56,11 +56,9 @@
#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>
@@ -81,8 +79,8 @@
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::UNO_QUERY_THROW;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::Property;
@@ -1413,12 +1411,6 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
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
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index c174614a0bf3..e365edb7bd46 100755
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -30,14 +30,11 @@
#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"
@@ -88,6 +85,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::Property;
+using ::com::sun::star::chart::XAxis;
using ::osl::MutexGuard;
using ::rtl::OUString;
@@ -884,193 +882,209 @@ void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( cons
return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle();
}
-// ____ XAxisZSupplier ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
+// ____ XAxisSupplier ____
+Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex )
throw (uno::RuntimeException)
{
- if( !m_xZAxisTitle.is() )
+ Reference< XAxis > xAxis;
+ if(!nDimensionIndex)
+ {
+ if( !m_xXAxis.is() )
+ m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
+ xAxis = m_xXAxis;
+ }
+ else if(1==nDimensionIndex)
+ {
+ if( !m_xYAxis.is() )
+ m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
+ xAxis = m_xYAxis;
+ }
+ else if(2==nDimensionIndex)
{
- m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact );
+ if( !m_xZAxis.is() )
+ m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
+ xAxis = m_xZAxis;
}
- return m_xZAxisTitle;
+ return xAxis;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex )
throw (uno::RuntimeException)
{
- if( ! m_xZMainGrid.is())
+ Reference< XAxis > xAxis;
+ if(!nDimensionIndex)
{
- m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact );
+ if( !m_xSecondXAxis.is() )
+ m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
+ xAxis = m_xSecondXAxis;
}
- return m_xZMainGrid;
+ else if(1==nDimensionIndex)
+ {
+ if( !m_xSecondYAxis.is() )
+ m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
+ xAxis = m_xSecondYAxis;
+ }
+ return xAxis;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+// ____ XAxisZSupplier ____
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
throw (uno::RuntimeException)
{
- if( !m_xZHelpGrid.is() )
- {
- m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact );
- }
- return m_xZHelpGrid;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
+}
+
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
+}
+
+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;
+ return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY );
}
// ____ XTwoAxisXSupplier ____
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
+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;
+ return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY );
}
// ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
+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< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
+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;
+ return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY );
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
+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 > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
+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;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
}
// ____ XTwoAxisYSupplier ____
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
+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;
+ return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY );
}
// ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
+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< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
+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;
+ return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY );
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
throw (uno::RuntimeException)
{
- if( ! m_xYHelpGrid.is())
- {
- m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact );
- }
- return m_xYHelpGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
throw (uno::RuntimeException)
{
- if( ! m_xYMainGrid.is())
- {
- m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact );
- }
- return m_xYMainGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
}
// ____ XSecondAxisTitleSupplier ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
+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 > xRet;
+ Reference< XAxis > xAxis( getSecondaryAxis(0) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
+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;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getSecondaryAxis(1) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
// ____ XStatisticDisplay ____
@@ -1163,22 +1177,11 @@ void SAL_CALL DiagramWrapper::dispose()
// /--
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 );
@@ -2147,3 +2150,4 @@ 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
index 111e24bd6a8b..678041420cf3 100644..100755
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
@@ -30,7 +30,13 @@
#include "WrappedPropertySet.hxx"
#include "ServiceMacros.hxx"
#include "DiagramHelper.hxx"
-#include <cppuhelper/implbase12.hxx>
+
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13
+#include "comphelper/implbase_var.hxx"
+#endif
+
#include <comphelper/uno3.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -41,6 +47,7 @@
#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/XAxisSupplier.hpp>
#include <com/sun/star/chart/XAxisZSupplier.hpp>
#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
@@ -56,15 +63,15 @@
namespace chart
{
-
namespace wrapper
{
class Chart2ModelContact;
-class DiagramWrapper : public ::cppu::ImplInheritanceHelper12<
+class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13<
WrappedPropertySet
, ::com::sun::star::chart::XDiagram
+ , ::com::sun::star::chart::XAxisSupplier
, ::com::sun::star::chart::XAxisZSupplier
, ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier
, ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier
@@ -123,6 +130,14 @@ public:
virtual ::rtl::OUString SAL_CALL getShapeType()
throw (::com::sun::star::uno::RuntimeException);
+ // ____ XAxisSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
// ____ XAxisZSupplier ____
virtual ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle()
@@ -244,72 +259,27 @@ private:
::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::chart::XAxis > m_xXAxis;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xZMainGrid;
+ ::com::sun::star::chart::XAxis > m_xYAxis;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xXHelpGrid;
+ ::com::sun::star::chart::XAxis > m_xZAxis;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xYHelpGrid;
+ ::com::sun::star::chart::XAxis > m_xSecondXAxis;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xZHelpGrid;
+ ::com::sun::star::chart::XAxis > m_xSecondYAxis;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xWall;
+ ::com::sun::star::beans::XPropertySet > m_xWall;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xFloor;
+ ::com::sun::star::beans::XPropertySet > m_xFloor;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xMinMaxLineWrapper;
+ ::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xUpBarWrapper;
+ ::com::sun::star::beans::XPropertySet > m_xUpBarWrapper;
::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet >
- m_xDownBarWrapper;
+ ::com::sun::star::beans::XPropertySet > m_xDownBarWrapper;
};
} // namespace wrapper
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
index 6586511424db..51c269d7dd40 100755
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
@@ -112,17 +112,17 @@ void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDime
switch( eType )
{
- case X_MAIN_GRID:
+ case X_MAJOR_GRID:
rnDimensionIndex = 0; rbSubGrid = false; break;
- case Y_MAIN_GRID:
+ case Y_MAJOR_GRID:
rnDimensionIndex = 1; rbSubGrid = false; break;
- case Z_MAIN_GRID:
+ case Z_MAJOR_GRID:
rnDimensionIndex = 2; rbSubGrid = false; break;
- case X_SUB_GRID:
+ case X_MINOR_GRID:
rnDimensionIndex = 0; rbSubGrid = true; break;
- case Y_SUB_GRID:
+ case Y_MINOR_GRID:
rnDimensionIndex = 1; rbSubGrid = true; break;
- case Z_SUB_GRID:
+ case Z_MINOR_GRID:
rnDimensionIndex = 2; rbSubGrid = true; break;
}
}
@@ -209,3 +209,4 @@ 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
index c731b6c22666..653c46353676 100644..100755
--- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
@@ -42,7 +42,6 @@
namespace chart
{
-
namespace wrapper
{
@@ -57,12 +56,12 @@ class GridWrapper : public ::cppu::ImplInheritanceHelper2<
public:
enum tGridType
{
- X_MAIN_GRID,
- Y_MAIN_GRID,
- Z_MAIN_GRID,
- X_SUB_GRID,
- Y_SUB_GRID,
- Z_SUB_GRID
+ X_MAJOR_GRID,
+ Y_MAJOR_GRID,
+ Z_MAJOR_GRID,
+ X_MINOR_GRID,
+ Y_MINOR_GRID,
+ Z_MINOR_GRID
};
GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
index a89ca372d9ee..64773ad062f9 100755
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -33,9 +33,8 @@
#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>
+#include <com/sun/star/chart/ChartAxisType.hpp>
+#include <chartview/ExplicitScaleValues.hxx>
using namespace ::com::sun::star;
using ::com::sun::star::uno::Any;
@@ -43,6 +42,7 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::rtl::OUString;
+using ::com::sun::star::chart::TimeIncrement;
//.............................................................................
namespace chart
@@ -91,6 +91,15 @@ WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty
case SCALE_PROP_AUTO_STEPHELP:
m_aOuterName = C2U("AutoStepHelp");
break;
+ case SCALE_PROP_AXIS_TYPE:
+ m_aOuterName = C2U("AxisType");
+ break;
+ case SCALE_PROP_DATE_INCREMENT:
+ m_aOuterName = C2U("TimeIncrement");
+ break;
+ case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
+ m_aOuterName = C2U("ExplicitTimeIncrement");
+ break;
case SCALE_PROP_LOGARITHMIC:
m_aOuterName = C2U("Logarithmic");
break;
@@ -121,6 +130,9 @@ void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >
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_AXIS_TYPE, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_DATE_INCREMENT, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_EXPLICIT_DATE_INCREMENT, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) );
}
@@ -265,6 +277,43 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
bSetScaleData = true;
break;
}
+ case SCALE_PROP_AXIS_TYPE:
+ {
+ sal_Int32 nType = 0;
+ if( (rOuterValue >>= nType) )
+ {
+ if( ::com::sun::star::chart::ChartAxisType::AUTOMATIC == nType )
+ {
+ aScaleData.AutoDateAxis = true;
+ if( aScaleData.AxisType == AxisType::DATE )
+ aScaleData.AxisType = AxisType::CATEGORY;
+ }
+ else if( ::com::sun::star::chart::ChartAxisType::CATEGORY == nType )
+ {
+ aScaleData.AutoDateAxis = false;
+ if( aScaleData.AxisType == AxisType::DATE )
+ aScaleData.AxisType = AxisType::CATEGORY;
+ }
+ else if( ::com::sun::star::chart::ChartAxisType::DATE == nType )
+ {
+ if( aScaleData.AxisType == AxisType::CATEGORY )
+ aScaleData.AxisType = AxisType::DATE;
+ }
+ bSetScaleData = true;
+ }
+ break;
+ }
+ case SCALE_PROP_DATE_INCREMENT:
+ {
+ TimeIncrement aTimeIncrement;
+ rOuterValue >>= aTimeIncrement;
+ aScaleData.TimeIncrement = aTimeIncrement;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
+ //read only property
+ break;
case SCALE_PROP_LOGARITHMIC:
{
if( rOuterValue >>= bBool )
@@ -319,8 +368,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
chart2::ScaleData aScaleData( xAxis->getScaleData() );
- chart2::ExplicitScaleData aExplicitScale;
- chart2::ExplicitIncrementData aExplicitIncrement;
+ ExplicitScaleData aExplicitScale;
+ ExplicitIncrementData aExplicitIncrement;
switch( eScaleProperty )
{
@@ -400,7 +449,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
{
m_spChart2ModelContact->getExplicitValuesForAxis(
xAxis, aExplicitScale, aExplicitIncrement );
- if( aExplicitIncrement.SubIncrements.getLength() > 0 &&
+
+ if( !aExplicitIncrement.SubIncrements.empty() &&
aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 )
{
if( bLogarithmic )
@@ -439,7 +489,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
if( bNeedToCalculateExplicitValues )
{
m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
- if( aExplicitIncrement.SubIncrements.getLength() > 0 )
+ if( !aExplicitIncrement.SubIncrements.empty() )
nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
}
aRet = uno::makeAny( nIntervalCount );
@@ -485,6 +535,46 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
aRet <<= !hasDoubleValue(aScaleData.Origin);
break;
}
+ case SCALE_PROP_AXIS_TYPE:
+ {
+ sal_Int32 nType = ::com::sun::star::chart::ChartAxisType::AUTOMATIC;
+ if( aScaleData.AxisType == AxisType::DATE )
+ {
+ nType = ::com::sun::star::chart::ChartAxisType::DATE;
+ }
+ else if( aScaleData.AxisType == AxisType::CATEGORY )
+ {
+ if( !aScaleData.AutoDateAxis )
+ nType = ::com::sun::star::chart::ChartAxisType::CATEGORY;
+ }
+ aRet = uno::makeAny( nType );
+ break;
+ }
+ case SCALE_PROP_DATE_INCREMENT:
+ {
+ if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
+ aRet = uno::makeAny( aScaleData.TimeIncrement );
+ break;
+ }
+ case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
+ {
+ if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
+ if( aExplicitScale.AxisType == AxisType::DATE )
+ {
+ TimeIncrement aTimeIncrement;
+ aTimeIncrement.MajorTimeInterval = uno::makeAny( aExplicitIncrement.MajorTimeInterval );
+ aTimeIncrement.MinorTimeInterval = uno::makeAny( aExplicitIncrement.MinorTimeInterval );
+ aTimeIncrement.TimeResolution = uno::makeAny( aExplicitScale.TimeResolution );
+ aRet = uno::makeAny(aTimeIncrement);
+ }
+ }
+
+ if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
+ aRet = uno::makeAny( aScaleData.TimeIncrement );
+ break;
+ }
case SCALE_PROP_LOGARITHMIC:
{
aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) );
@@ -506,5 +596,5 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
}
} // namespace wrapper
-} //namespace chart
+} // namespace chart
//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
index 4d29bc009777..8df55339a46e 100644..100755
--- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
@@ -55,6 +55,9 @@ public:
, SCALE_PROP_AUTO_ORIGIN
, SCALE_PROP_AUTO_STEPMAIN
, SCALE_PROP_AUTO_STEPHELP
+ , SCALE_PROP_AXIS_TYPE
+ , SCALE_PROP_DATE_INCREMENT
+ , SCALE_PROP_EXPLICIT_DATE_INCREMENT
, SCALE_PROP_LOGARITHMIC
, SCALE_PROP_REVERSEDIRECTION
};
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index fedcfaffebc4..e92e32a57958 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -47,7 +47,7 @@
#include "ChartModelHelper.hxx"
#include "CommonConverters.hxx"
#include "macros.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "servicenames_charttypes.hxx"
#include "ResId.hxx"
#include "Bitmaps.hrc"
@@ -64,6 +64,7 @@
#include <com/sun/star/chart2/XChartType.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
#include <algorithm>
#include <functional>
@@ -105,7 +106,7 @@ sal_Int32 lcl_getRowInData( long nRow )
return static_cast< sal_Int32 >( nRow );
}
-sal_Int32 lcl_getColumnInData( USHORT nCol )
+sal_Int32 lcl_getColumnInData( sal_uInt16 nCol )
{
return static_cast< sal_Int32 >( nCol ) - 1;
}
@@ -215,7 +216,7 @@ private:
DECL_LINK( SeriesNameChanged, void * );
DECL_LINK( SeriesNameEdited, void * );
- /// @param bHC </TRUE> for hight-contrast image
+ /// @param bHC </sal_True> for hight-contrast image
static Image GetChartTypeImage(
const Reference< chart2::XChartType > & xChartType,
bool bSwapXAndYAxis,
@@ -476,13 +477,13 @@ bool lcl_SeriesHeaderHasFocus(
}
sal_Int32 lcl_getColumnInDataOrHeader(
- USHORT nCol, const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader )
+ sal_uInt16 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()));
+ nColIdx = lcl_getColumnInData( static_cast< sal_uInt16 >( rSeriesHeader[nColIdx]->GetStartColumn()));
else
nColIdx = lcl_getColumnInData( nCol );
@@ -507,7 +508,7 @@ DataBrowser::DataBrowser( Window* pParent, const ResId& rId, bool bLiveUpdate )
double fNan;
::rtl::math::setNan( & fNan );
m_aNumberEditField.SetDefaultValue( fNan );
- m_aNumberEditField.TreatAsNumber( TRUE );
+ m_aNumberEditField.TreatAsNumber( sal_True );
RenewTable();
SetClean();
}
@@ -583,10 +584,10 @@ void DataBrowser::RenewTable()
return;
long nOldRow = GetCurRow();
- USHORT nOldColId = GetCurColumnId();
+ sal_uInt16 nOldColId = GetCurColumnId();
- BOOL bLastUpdateMode = GetUpdateMode();
- SetUpdateMode( FALSE );
+ sal_Bool bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( sal_False );
if( IsModified() )
SaveModified();
@@ -614,7 +615,7 @@ void DataBrowser::RenewTable()
RowInserted( 1, nRowCountLocal );
GoToRow( ::std::min( nOldRow, GetRowCount() - 1 ));
- GoToColumnId( ::std::min( nOldColId, static_cast< USHORT >( ColCount() - 1 )));
+ GoToColumnId( ::std::min( nOldColId, static_cast< sal_uInt16 >( ColCount() - 1 )));
Window * pWin = this->GetParent();
if( !pWin )
@@ -671,7 +672,7 @@ String DataBrowser::GetRowString( sal_Int32 nRow ) const
return String::CreateFromInt32( nRow + 1 );
}
-String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const
+String DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const
{
String aResult;
@@ -696,6 +697,23 @@ String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const
GetNumberFormatKey( nRow, nColumnId ),
fData, nLabelColor, bColorChanged ));
}
+ else if( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXTORDATE )
+ {
+ uno::Any aAny = m_apDataBrowserModel->getCellAny( nColIndex, nRow );
+ OUString aText;
+ double fDouble=0.0;
+ if( aAny>>=aText )
+ aResult = aText;
+ else if( aAny>>=fDouble )
+ {
+ sal_Int32 nLabelColor;
+ bool bColorChanged = false;
+ sal_Int32 nDateNumberFormat = DiagramHelper::getDateNumberFormat( Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY) );
+ if( ! ::rtl::math::isNan( fDouble ) && m_spNumberFormatterWrapper.get() )
+ aResult = String( m_spNumberFormatterWrapper->getFormattedString(
+ nDateNumberFormat, fDouble, nLabelColor, bColorChanged ));
+ }
+ }
else
{
OSL_ASSERT( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXT );
@@ -706,7 +724,7 @@ String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const
return aResult;
}
-double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const
+double DataBrowser::GetCellNumber( long nRow, sal_uInt16 nColumnId ) const
{
double fResult;
::rtl::math::setNan( & fResult );
@@ -723,8 +741,8 @@ double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const
void DataBrowser::Resize()
{
- BOOL bLastUpdateMode = GetUpdateMode();
- SetUpdateMode( FALSE );
+ sal_Bool bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( sal_False );
::svt::EditBrowseBox::Resize();
ImplAdjustHeaderControls();
@@ -854,6 +872,9 @@ void DataBrowser::SetDataFromModel(
new NumberFormatterWrapper(
Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )));
+ if( m_spNumberFormatterWrapper.get() )
+ m_aNumberEditField.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
+
RenewTable();
const sal_Int32 nColCnt = m_apDataBrowserModel->getColumnCount();
@@ -1134,6 +1155,22 @@ sal_uInt32 DataBrowser::GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) co
return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow ));
}
+bool DataBrowser::isDateString( rtl::OUString aInputString, double& fOutDateValue )
+{
+ sal_uInt32 nNumberFormat=0;
+ SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : 0;
+ if( aInputString.getLength() > 0 && pSvNumberFormatter && pSvNumberFormatter->IsNumberFormat( aInputString, nNumberFormat, fOutDateValue ) )
+ {
+ Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( m_xChartDoc, uno::UNO_QUERY );
+ Reference< util::XNumberFormats > xNumberFormats;
+ if( xNumberFormatsSupplier.is() )
+ xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+ if( DiagramHelper::isDateNumberFormat( nNumberFormat, xNumberFormats ) )
+ return true;
+ }
+ return false;
+}
+
sal_Bool DataBrowser::SaveModified()
{
if( ! IsModified() )
@@ -1146,6 +1183,7 @@ sal_Bool DataBrowser::SaveModified()
DBG_ASSERT( nRow >= 0 || nCol >= 0, "This cell should not be modified!" );
+ SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : 0;
switch( m_apDataBrowserModel->getCellType( nCol, nRow ))
{
case DataBrowserModel::NUMBER:
@@ -1155,11 +1193,8 @@ sal_Bool DataBrowser::SaveModified()
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 ))
+ if( aText.Len() > 0 && pSvNumberFormatter &&
+ ! pSvNumberFormatter->IsNumberFormat( aText, nDummy, fDummy ) )
{
bChangeValid = sal_False;
}
@@ -1170,6 +1205,17 @@ sal_Bool DataBrowser::SaveModified()
}
}
break;
+ case DataBrowserModel::TEXTORDATE:
+ {
+ OUString aText( m_aTextEditField.GetText() );
+ double fDateValue=0.0;
+ bChangeValid = sal_False;
+ if( isDateString( aText, fDateValue ) )
+ bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::makeAny( fDateValue ) );
+ if(!bChangeValid)
+ bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::makeAny( aText ) );
+ }
+ break;
case DataBrowserModel::TEXT:
{
OUString aText( m_aTextEditField.GetText());
@@ -1210,10 +1256,10 @@ sal_Int16 DataBrowser::GetFirstVisibleColumNumber() const
return GetFirstVisibleColNumber();
}
-void DataBrowser::ColumnResized( USHORT nColId )
+void DataBrowser::ColumnResized( sal_uInt16 nColId )
{
- BOOL bLastUpdateMode = GetUpdateMode();
- SetUpdateMode( FALSE );
+ sal_Bool bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( sal_False );
EditBrowseBox::ColumnResized( nColId );
ImplAdjustHeaderControls();
@@ -1224,8 +1270,8 @@ void DataBrowser::ColumnResized( USHORT nColId )
void DataBrowser::EndScroll()
{
- BOOL bLastUpdateMode = GetUpdateMode();
- SetUpdateMode( FALSE );
+ sal_Bool bLastUpdateMode = GetUpdateMode();
+ SetUpdateMode( sal_False );
EditBrowseBox::EndScroll();
RenewSeriesHeaders();
@@ -1354,8 +1400,8 @@ IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit*, pEdit )
sal_Int32 DataBrowser::GetTotalWidth() const
{
- ULONG nWidth = 0;
- for ( USHORT nCol = 0; nCol < ColCount(); ++nCol )
+ sal_uLong nWidth = 0;
+ for ( sal_uInt16 nCol = 0; nCol < ColCount(); ++nCol )
nWidth += GetColumnWidth( nCol );
return static_cast< sal_Int32 >( nWidth );
}
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
index 3583db2770c0..251c4d29fbe3 100644
--- a/chart2/source/controller/dialogs/DataBrowser.hxx
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -68,7 +68,7 @@ protected:
virtual void CursorMoved();
// called whenever the control of the current cell has been modified
virtual void CellModified();
- virtual void ColumnResized( USHORT nColId );
+ virtual void ColumnResized( sal_uInt16 nColId );
virtual void EndScroll();
virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
@@ -86,12 +86,14 @@ public:
@return
the text out of the cell
*/
- virtual String GetCellText(long nRow, USHORT nColId) const;
+ virtual String GetCellText(long nRow, sal_uInt16 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;
+ double GetCellNumber( long nRow, sal_uInt16 nColumnId ) const;
+
+ bool isDateString( rtl::OUString aInputString, double& fOutDateValue );
// Window
virtual void Resize();
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index c0b865536686..23fda0f472af 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -43,6 +43,7 @@
#include "ExplicitCategoriesProvider.hxx"
#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -589,7 +590,7 @@ Reference< chart2::XDataSeries >
return 0;
}
-DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ )
+DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ ) const
{
eCellType eResult = TEXT;
tDataColumnVector::size_type nIndex( nAtColumn );
@@ -619,6 +620,26 @@ double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow )
return fResult;
}
+uno::Any DataBrowserModel::getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow )
+{
+ uno::Any aResult;
+
+ tDataColumnVector::size_type nIndex( nAtColumn );
+ if( nIndex < m_aColumns.size() &&
+ m_aColumns[ nIndex ].m_xLabeledDataSequence.is())
+ {
+ Reference< chart2::data::XDataSequence > xData(
+ m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues() );
+ if( xData.is() )
+ {
+ Sequence< uno::Any > aValues( xData->getData());
+ if( nAtRow < aValues.getLength())
+ aResult = aValues[nAtRow];
+ }
+ }
+ return aResult;
+}
+
OUString DataBrowserModel::getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow )
{
OUString aResult;
@@ -800,7 +821,7 @@ void DataBrowserModel::updateFromModel()
aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
else
aCategories.m_aUIRoleName = lcl_getUIRoleName( xCategories );
- aCategories.m_eCellType = TEXT;
+ aCategories.m_eCellType = TEXTORDATE;
m_aColumns.push_back( aCategories );
++nHeaderStart;
}
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx
index a4378972f70f..94af7fbead13 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -81,18 +81,20 @@ public:
enum eCellType
{
NUMBER,
- TEXT
+ TEXT,
+ TEXTORDATE
};
- eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow );
+ eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow ) const;
/// 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 );
+ ::com::sun::star::uno::Any getCellAny( 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
+ /// returns </sal_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
+ /// returns </sal_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 );
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index eedd2e3c6ba9..6e145dc1dfbf 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -160,7 +160,7 @@ void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap )
struct lcl_DataSeriesContainerAppend : public
::std::iterator< ::std::output_iterator_tag, Reference< XDataSeriesContainer > >
{
- typedef ::std::vector< chart::DialogModel::tSeriesWithChartTypeByName > tContainerType;
+ typedef ::std::vector< ::chart::DialogModel::tSeriesWithChartTypeByName > tContainerType;
explicit lcl_DataSeriesContainerAppend( tContainerType & rCnt )
: m_rDestCnt( rCnt )
@@ -180,7 +180,7 @@ struct lcl_DataSeriesContainerAppend : public
for( sal_Int32 nI = 0; nI < aSeq.getLength(); ++ nI )
{
m_rDestCnt.push_back(
- chart::DialogModel::tSeriesWithChartTypeByName(
+ ::chart::DialogModel::tSeriesWithChartTypeByName(
::chart::DataSeriesHelper::getDataSeriesLabel( aSeq[nI], aRole ),
::std::make_pair( aSeq[nI], xCT )));
}
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 9057b850332f..483424d04497 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -40,7 +40,7 @@
#include "AxisIndexDefines.hxx"
#include "ExplicitCategoriesProvider.hxx"
#include "CommonConverters.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "RegressionCurveHelper.hxx"
#include <rtl/math.hxx>
#include <tools/debug.hxx>
@@ -191,14 +191,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
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;
+ aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex );
}
else
{
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index 4b4cec65426e..1c0a066df046 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -388,11 +388,6 @@ 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";
@@ -463,6 +458,10 @@ String STR_ACTION_NOTPOSSIBLE
{
Text [ en-US ] = "This function cannot be completed with the selected objects." ;
};
+String STR_ACTION_EDIT_TEXT
+{
+ Text [ en-US ] = "Edit text";
+};
String STR_COLUMN_LABEL
{
diff --git a/chart2/source/controller/dialogs/Strings_Scale.src b/chart2/source/controller/dialogs/Strings_Scale.src
index e7a3d6c2b1cf..6f8b75d9509c 100644
--- a/chart2/source/controller/dialogs/Strings_Scale.src
+++ b/chart2/source/controller/dialogs/Strings_Scale.src
@@ -42,3 +42,11 @@ String STR_MIN_GREATER_MAX
{
Text [ en-US ] = "The minimum must be lower than the maximum. Check your input." ;
};
+String STR_INVALID_INTERVALS
+{
+ Text [ en-US ] = "The major interval needs to be greater than the minor interval. Check your input." ;
+};
+String STR_INVALID_TIME_UNIT
+{
+ Text [ en-US ] = "The major and minor interval need to be greater or equal to the resolution. Check your input." ;
+};
diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc
index 1f445083738f..dbc166e4f2cd 100644
--- a/chart2/source/controller/dialogs/TabPages.hrc
+++ b/chart2/source/controller/dialogs/TabPages.hrc
@@ -111,31 +111,6 @@
#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
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index e7a7a8bd43d8..fe035acb09e4 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -96,7 +96,7 @@ CreationWizard::CreationWizard( Window* pParent, const uno::Reference< frame::XM
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 );
+ ShowButtonFixedLine( sal_True );
defaultButton( WZB_FINISH );
if( m_nOnePageOnlyIndex < 0 || m_nOnePageOnlyIndex >= nPageCount )
@@ -236,7 +236,7 @@ void CreationWizard::setValidPage( TabPage * /* pTabPage */ )
String CreationWizard::getStateDisplayName( WizardState nState ) const
{
- USHORT nResId = 0;
+ sal_uInt16 nResId = 0;
switch( nState )
{
case STATE_CHARTTYPE:
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index f1d441921a6a..fc8e5a040321 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -191,13 +191,13 @@ 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_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, sal_False );
+ m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, sal_False );
}
m_apBrwData->SetReadOnly( m_bReadOnly );
@@ -258,7 +258,7 @@ void DataEditor::UpdateData()
// }
// {
-// BOOL bRet = TRUE;
+// sal_Bool bRet = sal_True;
// // confirm changes currently made and not saved
// m_apBrwData->EndEditing();
@@ -281,7 +281,7 @@ void DataEditor::UpdateData()
// if( bRet )
// {
// // close child window
-// SfxBoolItem aItem( SID_DIAGRAM_DATA, FALSE );
+// SfxBoolItem aItem( SID_DIAGRAM_DATA, sal_False );
// if( m_pBindings )
// {
// SfxDispatcher* pDisp = m_pBindings->GetDispatcher();
@@ -292,7 +292,7 @@ void DataEditor::UpdateData()
// }
// }
-// return ( bRet? SfxFloatingWindow::Close(): FALSE );
+// return ( bRet? SfxFloatingWindow::Close(): sal_False );
// }
void DataEditor::AdaptBrowseBoxSize()
@@ -313,12 +313,12 @@ void DataEditor::Resize()
// ImplAdjustHeaderControls( false /* bRefreshFromModel */ );
}
-BOOL DataEditor::Close()
+sal_Bool DataEditor::Close()
{
if( ApplyChangesToModel() )
return ModalDialog::Close();
else
- return TRUE;
+ return sal_True;
}
bool DataEditor::ApplyChangesToModel()
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index 3e4cba6b23ad..694a165cd411 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -146,7 +146,7 @@ void DataSourceTabControl::EnableTabToggling()
// ----------------------------------------
-USHORT DataSourceDialog::m_nLastPageId = 0;
+sal_uInt16 DataSourceDialog::m_nLastPageId = 0;
DataSourceDialog::DataSourceDialog(
Window * pParent,
@@ -220,7 +220,7 @@ void DataSourceDialog::setInvalidPage( TabPage * pTabPage )
if( ! (m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid ))
{
- m_aBtnOK.Enable( FALSE );
+ m_aBtnOK.Enable( sal_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.
@@ -242,7 +242,7 @@ void DataSourceDialog::setValidPage( TabPage * pTabPage )
if( m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid )
{
- m_aBtnOK.Enable( TRUE );
+ m_aBtnOK.Enable( sal_True );
OSL_ASSERT( m_pTabControl );
m_pTabControl->EnableTabToggling();
}
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
index 0a250b5bf874..66ffb011690f 100644
--- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -63,7 +63,7 @@ InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
//==============================
SchAxisDlg::SchAxisDlg( Window* pWindow
- , const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg )
+ , const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg )
:
ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )),
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
index 50aa10ec6e6b..9c0d8f1e1b10 100644
--- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -118,7 +118,7 @@ double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement );
fStepWidth = aExplicitIncrement.Distance;
- if( aExplicitIncrement.SubIncrements.getLength() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
+ if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
else
fStepWidth/=10;
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index d7491156358e..51df0eb21dc4 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -69,7 +69,7 @@ NumberFormatDialog::~NumberFormatDialog()
SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
{
- static const USHORT nWhichPairs[] =
+ static const sal_uInt16 nWhichPairs[] =
{
SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 2a41d35313e8..0102a970e0c5 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -56,9 +56,10 @@
#include "ChartTypeHelper.hxx"
#include "ObjectNameProvider.hxx"
#include "DiagramHelper.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "AxisIndexDefines.hxx"
#include "AxisHelper.hxx"
+#include "ExplicitCategoriesProvider.hxx"
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartType.hpp>
@@ -116,6 +117,7 @@ ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUS
, m_bIsCrossingAxisIsCategoryAxis(false)
, m_aCategories()
, m_xChartDocument( 0 )
+ , m_bComplexCategoriesAxis( false )
{
rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
@@ -179,7 +181,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
ScaleData aData( xAxis->getScaleData() );
if( chart2::AxisType::SERIES == aData.AxisType )
m_bHasScaleProperties = false;
- if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType )
+ if( chart2::AxisType::SERIES != aData.AxisType )
m_bHasNumberProperties = true;
sal_Int32 nCooSysIndex=0;
@@ -206,6 +208,13 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
if( m_bIsCrossingAxisIsCategoryAxis )
m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
}
+
+ m_bComplexCategoriesAxis = false;
+ if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
+ {
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
+ m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
+ }
}
}
@@ -322,9 +331,13 @@ uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDoc
{
return m_xChartDocument;
}
+bool ObjectPropertiesDialogParameter::IsComplexCategoriesAxis() const
+{
+ return m_bComplexCategoriesAxis;
+}
-//const USHORT nNoArrowDlg = 1100;
-const USHORT nNoArrowNoShadowDlg = 1101;
+//const sal_uInt16 nNoArrowDlg = 1100;
+const sal_uInt16 nNoArrowNoShadowDlg = 1101;
//-------------------------------------------------------------------
//-------------------------------------------------------------------
@@ -505,7 +518,7 @@ SchAttribTabDlg::~SchAttribTabDlg()
delete m_pAutoSymbolGraphic;
}
-void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
+void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
{
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
switch (nId)
@@ -566,6 +579,7 @@ void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
{
bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
+ ( dynamic_cast< SchAxisLabelTabPage& >( rPage ) ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
break;
}
@@ -609,7 +623,7 @@ void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
break;
case RID_SVXPAGE_NUMBERFORMAT:
- aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+ aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
rPage.PageCreated(aSet);
break;
diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
index 280a1adecba2..0c9edc0e1553 100644
--- a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
+++ b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx
@@ -63,7 +63,7 @@ ShapeFontDialog::~ShapeFontDialog()
{
}
-void ShapeFontDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+void ShapeFontDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
{
SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
switch ( nId )
diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
index 2f0173fc8408..38373df5e9a8 100644
--- a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
+++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx
@@ -69,7 +69,7 @@ ShapeParagraphDialog::~ShapeParagraphDialog()
{
}
-void ShapeParagraphDialog::PageCreated( USHORT nId, SfxTabPage& rPage )
+void ShapeParagraphDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
{
SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) );
switch ( nId )
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index 3c868f6aeaff..e77d180e87b3 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -57,7 +57,7 @@ using namespace ::com::sun::star::chart2;
//-------------------------------------------------------------------
//-------------------------------------------------------------------
-USHORT View3DDialog::m_nLastPageId = 0;
+sal_uInt16 View3DDialog::m_nLastPageId = 0;
View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
: TabDialog(pParent,SchResId(DLG_3D_VIEW))
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx
index f2c31fe461a9..ee2278589b89 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.cxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -92,15 +92,15 @@ void BarGeometryResources::Enable( bool bEnable )
m_aLB_Geometry.Enable( bEnable );
}
-USHORT BarGeometryResources::GetSelectEntryCount() const
+sal_uInt16 BarGeometryResources::GetSelectEntryCount() const
{
return m_aLB_Geometry.GetSelectEntryCount();
}
-USHORT BarGeometryResources::GetSelectEntryPos() const
+sal_uInt16 BarGeometryResources::GetSelectEntryPos() const
{
return m_aLB_Geometry.GetSelectEntryPos();
}
-void BarGeometryResources::SelectEntryPos( USHORT nPos )
+void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos )
{
if( nPos < m_aLB_Geometry.GetEntryCount() )
m_aLB_Geometry.SelectEntryPos( nPos );
diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx
index db2f71e2f178..4d91f74179eb 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.hxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx
@@ -49,9 +49,9 @@ public:
void Show( bool bShow );
void Enable( bool bEnable );
- USHORT GetSelectEntryCount() const;
- USHORT GetSelectEntryPos() const;
- void SelectEntryPos( USHORT nPos );
+ sal_uInt16 GetSelectEntryCount() const;
+ sal_uInt16 GetSelectEntryPos() const;
+ void SelectEntryPos( sal_uInt16 nPos );
void SetSelectHdl( const Link& rLink );
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index 25d279eaad37..e466163bd0a3 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -65,11 +65,11 @@ namespace chart
namespace
{
-bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich, USHORT nSourceFormatWhich, ULONG& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
+bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
{
bool bSet = false;
const SfxPoolItem *pItem1 = NULL;
- if( rSet.GetItemState( nValueWhich, TRUE, &pItem1 ) == SFX_ITEM_SET )
+ if( rSet.GetItemState( nValueWhich, sal_True, &pItem1 ) == SFX_ITEM_SET )
{
const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
if( pNumItem )
@@ -81,7 +81,7 @@ bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich
rbSourceFormatMixedStateOut=true;
const SfxPoolItem *pItem2 = NULL;
- if( rSet.GetItemState( nSourceFormatWhich, TRUE, &pItem2 ) == SFX_ITEM_SET )
+ if( rSet.GetItemState( nSourceFormatWhich, sal_True, &pItem2 ) == SFX_ITEM_SET )
{
const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
if( pBoolItem )
@@ -93,16 +93,16 @@ bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich
return bSet;
}
-void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, CheckBox& rCheckbox )
+void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, CheckBox& rCheckbox )
{
- rCheckbox.EnableTriState( FALSE );
+ rCheckbox.EnableTriState( sal_False );
const SfxPoolItem *pPoolItem = NULL;
- if( rInAttrs.GetItemState(nWhichId, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ if( rInAttrs.GetItemState(nWhichId, sal_True, &pPoolItem) == SFX_ITEM_SET )
rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
else
{
- rCheckbox.EnableTriState( TRUE );
+ rCheckbox.EnableTriState( sal_True );
rCheckbox.SetState( STATE_DONTKNOW );
}
}
@@ -140,17 +140,17 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
//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));
+ aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<sal_uInt16>(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 )
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, sal_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_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN );
sal_Int32 nPlacement = aAvailabelPlacementList[nN];
m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
@@ -212,7 +212,7 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
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 )
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, sal_True, &pPoolItem) == SFX_ITEM_SET )
{
bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
if( bForbidPercentValue )
@@ -245,11 +245,11 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
m_aCBPercent.Check();
SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
- aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
+ aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
- ULONG& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
+ sal_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;
@@ -267,7 +267,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
if( pResult )
{
bool bOldSource = rUseSourceFormat;
- ULONG nOldFormat = rnFormatKey;
+ sal_uLong nOldFormat = rnFormatKey;
bool bOldMixedState = rbMixedState || rbSourceMixedState;
rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
@@ -283,7 +283,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
{
if( pBox )
- pBox->EnableTriState( FALSE );
+ pBox->EnableTriState( sal_False );
EnableControls();
return 0;
}
@@ -320,7 +320,7 @@ void DataLabelResources::EnableControls()
m_aNF_Degrees.Enable( bEnableRotation );
}
-BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
+sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
{
if( m_aCBNumber.IsChecked() )
{
@@ -347,7 +347,7 @@ BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
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()) );
+ ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
if(aIt!=m_aListBoxToPlacementMap.end())
{
sal_Int32 nValue = aIt->second;
@@ -363,13 +363,13 @@ BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
- return TRUE;
+ return sal_True;
}
void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
{
// default state
- m_aCBSymbol.Enable( FALSE );
+ m_aCBSymbol.Enable( sal_False );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
@@ -380,18 +380,18 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
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 )
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, sal_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 )
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, sal_True, &pPoolItem) == SFX_ITEM_SET )
{
sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
- ::std::map< sal_Int32, USHORT >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
+ ::std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
if(aIt!=m_aPlacementToListBoxMap.end())
{
- USHORT nPos = aIt->second;
+ sal_uInt16 nPos = aIt->second;
m_aLB_LabelPlacement.SelectEntryPos( nPos );
}
else
@@ -400,10 +400,10 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
else
m_aLB_LabelPlacement.SetNoSelection();
- if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_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 )
+ if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
m_aDC_Dial.SetRotation( nDegrees );
diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx
index ef34e004bb07..37e14e7077e0 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.hxx
@@ -49,7 +49,7 @@ public:
DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs );
virtual ~DataLabelResources();
- BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+ sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const;
void Reset(const SfxItemSet& rInAttrs);
void SetNumberFormatter( SvNumberFormatter* pFormatter );
@@ -75,14 +75,14 @@ private:
FixedText m_aFT_TextDirection;
TextDirectionListBox m_aLB_TextDirection;
- ::std::map< sal_Int32, USHORT > m_aPlacementToListBoxMap;
- ::std::map< USHORT, sal_Int32 > m_aListBoxToPlacementMap;
+ ::std::map< sal_Int32, sal_uInt16 > m_aPlacementToListBoxMap;
+ ::std::map< sal_uInt16, sal_Int32 > m_aListBoxToPlacementMap;
SvNumberFormatter* m_pNumberFormatter;
bool m_bNumberFormatMixedState;
bool m_bPercentFormatMixedState;
- ULONG m_nNumberFormatForValue;
- ULONG m_nNumberFormatForPercent;
+ sal_uLong m_nNumberFormatForValue;
+ sal_uLong m_nNumberFormatForPercent;
bool m_bSourceFormatMixedState;
bool m_bPercentSourceMixedState;
diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
index 8b649072538e..46b4d30865d7 100644
--- a/chart2/source/controller/dialogs/res_ErrorBar.cxx
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -51,8 +51,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
{
if( pDialog )
{
- pDialog->Show( bEnable ? FALSE : TRUE );
- pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ pDialog->Show( bEnable ? sal_False : sal_True );
+ pDialog->SetModalInputMode( bEnable ? sal_False : sal_True );
}
}
@@ -162,7 +162,7 @@ ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog,
m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen ));
m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen ));
- m_aCbSyncPosNeg.Check( FALSE );
+ m_aCbSyncPosNeg.Check( sal_False );
m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg ));
m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged ));
@@ -474,12 +474,12 @@ IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton )
if( pButton == &m_aIbRangePositive )
{
m_pCurrentRangeChoosingField = &m_aEdRangePositive;
- aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS )));
+ aUIString = 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 )));
+ aUIString = String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS ));
}
OSL_ASSERT( m_pParentDialog );
@@ -520,7 +520,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
// category
m_eErrorKind = CHERROR_NONE;
- aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, sal_True, &pPoolItem );
m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE );
if( aState == SFX_ITEM_SET )
@@ -554,14 +554,14 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
}
else
{
- m_aRbNone.Check( FALSE );
- m_aRbConst.Check( FALSE );
- m_aRbPercent.Check( FALSE );
- m_aRbFunction.Check( FALSE );
+ m_aRbNone.Check( sal_False );
+ m_aRbConst.Check( sal_False );
+ m_aRbPercent.Check( sal_False );
+ m_aRbFunction.Check( sal_False );
}
// parameters
- aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, sal_True, &pPoolItem );
m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE );
double fPlusValue = 0.0;
if( aState == SFX_ITEM_SET )
@@ -571,7 +571,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
m_aMfPositive.SetValue( nPlusValue );
}
- aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, sal_True, &pPoolItem );
m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE );
double fMinusValue = 0.0;
if( aState == SFX_ITEM_SET )
@@ -586,7 +586,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
}
// indicator
- aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, sal_True, &pPoolItem );
m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE );
if( aState == SFX_ITEM_SET)
m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue();
@@ -609,13 +609,13 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
}
else
{
- m_aRbBoth.Check( FALSE );
- m_aRbPositive.Check( FALSE );
- m_aRbNegative.Check( FALSE );
+ m_aRbBoth.Check( sal_False );
+ m_aRbPositive.Check( sal_False );
+ m_aRbNegative.Check( sal_False );
}
// ranges
- aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, sal_True, &pPoolItem );
m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE );
if( aState == SFX_ITEM_SET )
{
@@ -623,7 +623,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
m_aEdRangePositive.SetText( sRangePositive );
}
- aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, sal_True, &pPoolItem );
m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE );
if( aState == SFX_ITEM_SET )
{
@@ -638,7 +638,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
UpdateControlStates();
}
-BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const
+sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const
{
if( m_bErrorKindUnique )
rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR ));
@@ -691,7 +691,7 @@ BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const
}
}
- return TRUE;
+ return sal_True;
}
void ErrorBarResources::FillValueSets()
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index c9206a5428df..0bbfcb7eee68 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -183,7 +183,7 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen
IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG )
{
- BOOL bEnable = m_aCbxShow.IsChecked();
+ sal_Bool bEnable = m_aCbxShow.IsChecked();
m_aRbtLeft.Enable( bEnable );
m_aRbtTop.Enable( bEnable );
@@ -201,7 +201,7 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
const SfxPoolItem* pPoolItem = NULL;
if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS,
- TRUE, &pPoolItem ) != SFX_ITEM_SET )
+ sal_True, &pPoolItem ) != SFX_ITEM_SET )
pPoolItem = &(rInAttrs.GetPool()->GetDefaultItem( SCHATTR_LEGEND_POS ));
if( pPoolItem )
@@ -210,16 +210,16 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
switch( ePos )
{
case CHLEGEND_LEFT:
- m_aRbtLeft.Check(TRUE);
+ m_aRbtLeft.Check(sal_True);
break;
case CHLEGEND_TOP:
- m_aRbtTop.Check(TRUE);
+ m_aRbtTop.Check(sal_True);
break;
case CHLEGEND_RIGHT:
- m_aRbtRight.Check(TRUE);
+ m_aRbtRight.Check(sal_True);
break;
case CHLEGEND_BOTTOM:
- m_aRbtBottom.Check(TRUE);
+ m_aRbtBottom.Check(sal_True);
break;
default:
break;
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx
index 45efd2f5e5b3..8878f5f77ffc 100644
--- a/chart2/source/controller/dialogs/res_TextSeparator.cxx
+++ b/chart2/source/controller/dialogs/res_TextSeparator.cxx
@@ -124,7 +124,7 @@ Size TextSeparatorResources::GetCurrentListBoxSize() const
void TextSeparatorResources::SetValue( const rtl::OUString& rSeparator )
{
- ::std::map< ::rtl::OUString, USHORT >::iterator aIter( m_aEntryMap.find(rSeparator) );
+ ::std::map< ::rtl::OUString, sal_uInt16 >::iterator aIter( m_aEntryMap.find(rSeparator) );
if( aIter == m_aEntryMap.end() )
m_aLB_Separator.SelectEntryPos( m_nDefaultPos );
else
@@ -138,8 +138,8 @@ void TextSeparatorResources::SetDefault()
rtl::OUString TextSeparatorResources::GetValue() const
{
- USHORT nPos = m_aLB_Separator.GetSelectEntryPos();
- ::std::map< ::rtl::OUString, USHORT >::const_iterator aIter( m_aEntryMap.begin() );
+ sal_uInt16 nPos = m_aLB_Separator.GetSelectEntryPos();
+ ::std::map< ::rtl::OUString, sal_uInt16 >::const_iterator aIter( m_aEntryMap.begin() );
while( aIter != m_aEntryMap.end() )
{
if(aIter->second==nPos )
diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx
index 4895a442fa0b..e7effee4e88a 100644
--- a/chart2/source/controller/dialogs/res_TextSeparator.hxx
+++ b/chart2/source/controller/dialogs/res_TextSeparator.hxx
@@ -63,9 +63,9 @@ private:
FixedText m_aFT_Separator;
ListBox m_aLB_Separator;
- ::std::map< ::rtl::OUString, USHORT > m_aEntryMap;
+ ::std::map< ::rtl::OUString, sal_uInt16 > m_aEntryMap;
- const USHORT m_nDefaultPos;
+ const sal_uInt16 m_nDefaultPos;
};
//.............................................................................
diff --git a/chart2/source/controller/dialogs/res_Titles.cxx b/chart2/source/controller/dialogs/res_Titles.cxx
index 225c8fe8748b..8620b81de4ab 100644
--- a/chart2/source/controller/dialogs/res_Titles.cxx
+++ b/chart2/source/controller/dialogs/res_Titles.cxx
@@ -126,7 +126,7 @@ TitleResources::~TitleResources()
void TitleResources::SetUpdateDataHdl( const Link& rLink )
{
- ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+ sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
m_aEd_Main.EnableUpdateData( nTimeout );
m_aEd_Main.SetUpdateDataHdl( rLink );
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
index a395d32c2efa..ed5ed2686aba 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -187,7 +187,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
const SfxPoolItem *pPoolItem = NULL;
SfxItemState aState = SFX_ITEM_UNKNOWN;
- aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, sal_True, &pPoolItem );
m_bTrendLineUnique = ( aState != SFX_ITEM_DONTCARE );
if( aState == SFX_ITEM_SET )
{
@@ -196,28 +196,28 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_eTrendLineType = pItem->GetValue();
}
- aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, sal_True, &pPoolItem );
if( aState == SFX_ITEM_DONTCARE )
{
- m_aCBShowEquation.EnableTriState( TRUE );
+ m_aCBShowEquation.EnableTriState( sal_True );
m_aCBShowEquation.SetState( STATE_DONTKNOW );
}
else
{
- m_aCBShowEquation.EnableTriState( FALSE );
+ m_aCBShowEquation.EnableTriState( sal_False );
if( aState == SFX_ITEM_SET )
m_aCBShowEquation.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
}
- aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, TRUE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, sal_True, &pPoolItem );
if( aState == SFX_ITEM_DONTCARE )
{
- m_aCBShowCorrelationCoeff.EnableTriState( TRUE );
+ m_aCBShowCorrelationCoeff.EnableTriState( sal_True );
m_aCBShowCorrelationCoeff.SetState( STATE_DONTKNOW );
}
else
{
- m_aCBShowCorrelationCoeff.EnableTriState( FALSE );
+ m_aCBShowCorrelationCoeff.EnableTriState( sal_False );
if( aState == SFX_ITEM_SET )
m_aCBShowCorrelationCoeff.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue());
}
@@ -246,7 +246,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
}
}
-BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
+sal_Bool TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
{
if( m_bTrendLineUnique )
rOutAttrs.Put( SvxChartRegressItem( m_eTrendLineType, SCHATTR_REGRESSION_TYPE ));
@@ -254,7 +254,7 @@ BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
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;
+ return sal_True;
}
void TrendlineResources::FillValueSets()
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
index 248a677edd21..f9c1160677b4 100644
--- a/chart2/source/controller/dialogs/res_Trendline.hxx
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -44,7 +44,7 @@ public:
virtual ~TrendlineResources();
void Reset(const SfxItemSet& rInAttrs);
- BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+ sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const;
void FillValueSets();
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index 6b3b63495126..8e32a4f6a262 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -128,9 +128,9 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
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 );
+ m_aCB_RoundedEdge.EnableTriState( sal_True );
+ m_aCB_Shading.EnableTriState( sal_True );
+ m_aCB_ObjectLines.EnableTriState( sal_True );
initControlsFromModel();
}
@@ -220,50 +220,50 @@ void ThreeD_SceneAppearance_TabPage::initControlsFromModel()
if(aProps.m_aShadeMode == drawing::ShadeMode_FLAT)
{
- m_aCB_Shading.EnableTriState( FALSE );
- m_aCB_Shading.Check(FALSE);
+ m_aCB_Shading.EnableTriState( sal_False );
+ m_aCB_Shading.Check(sal_False);
}
else if(aProps.m_aShadeMode == drawing::ShadeMode_SMOOTH)
{
- m_aCB_Shading.EnableTriState( FALSE );
- m_aCB_Shading.Check(TRUE);
+ m_aCB_Shading.EnableTriState( sal_False );
+ m_aCB_Shading.Check(sal_True);
}
else
{
- m_aCB_Shading.EnableTriState( TRUE );
+ m_aCB_Shading.EnableTriState( sal_True );
m_aCB_Shading.SetState( STATE_DONTKNOW );
}
if(aProps.m_nObjectLines == 0)
{
- m_aCB_ObjectLines.EnableTriState( FALSE );
- m_aCB_ObjectLines.Check(FALSE);
+ m_aCB_ObjectLines.EnableTriState( sal_False );
+ m_aCB_ObjectLines.Check(sal_False);
}
else if(aProps.m_nObjectLines==1)
{
- m_aCB_ObjectLines.EnableTriState( FALSE );
- m_aCB_ObjectLines.Check(TRUE);
+ m_aCB_ObjectLines.EnableTriState( sal_False );
+ m_aCB_ObjectLines.Check(sal_True);
}
else
{
- m_aCB_ObjectLines.EnableTriState( TRUE );
+ m_aCB_ObjectLines.EnableTriState( sal_True );
m_aCB_ObjectLines.SetState( STATE_DONTKNOW );
}
if(aProps.m_nRoundedEdges >= 5)
{
- m_aCB_RoundedEdge.EnableTriState( FALSE );
- m_aCB_RoundedEdge.Check(TRUE);
+ m_aCB_RoundedEdge.EnableTriState( sal_False );
+ m_aCB_RoundedEdge.Check(sal_True);
}
else if(aProps.m_nRoundedEdges<0)
{
- m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.EnableTriState( sal_False );
m_aCB_RoundedEdge.SetState( STATE_DONTKNOW );
}
else
{
- m_aCB_RoundedEdge.EnableTriState( TRUE );
- m_aCB_RoundedEdge.Check(FALSE);
+ m_aCB_RoundedEdge.EnableTriState( sal_True );
+ m_aCB_RoundedEdge.Check(sal_False);
}
m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
@@ -332,7 +332,7 @@ IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectShading, void*, EMPTYARG )
if( !m_bUpdateOtherControls )
return 0;
- m_aCB_Shading.EnableTriState( FALSE );
+ m_aCB_Shading.EnableTriState( sal_False );
applyShadeModeToModel();
updateScheme();
return 0;
@@ -344,15 +344,15 @@ IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, Check
if( pCheckBox == &m_aCB_ObjectLines )
{
- m_aCB_ObjectLines.EnableTriState( FALSE );
+ m_aCB_ObjectLines.EnableTriState( sal_False );
m_bUpdateOtherControls = false;
m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() );
if(!m_aCB_RoundedEdge.IsEnabled())
- m_aCB_RoundedEdge.Check(FALSE);
+ m_aCB_RoundedEdge.Check(sal_False);
m_bUpdateOtherControls = true;
}
else
- m_aCB_RoundedEdge.EnableTriState( FALSE );
+ m_aCB_RoundedEdge.EnableTriState( sal_False );
applyRoundedEdgeAndObjectLinesToModel();
updateScheme();
return 0;
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
index 39175695a48b..ff1e784b5ff9 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -116,7 +116,7 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( Window* pWindow
m_aMFYRotation.SetValue(m_nYRotation);
m_aMFZRotation.SetValue(m_nZRotation);
- const ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+ const sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
Link aAngleChangedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged ));
Link aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited ));
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 25b379481b7e..2310e193e5ba 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -164,13 +164,13 @@ namespace
rtl::OUString lcl_makeColorName( Color rColor )
{
String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
- aStr += String::CreateFromInt32((INT32)rColor.GetRed());
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetRed());
aStr += sal_Unicode(' ');
aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
- aStr += String::CreateFromInt32((INT32)rColor.GetGreen());
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetGreen());
aStr += sal_Unicode(' ');
aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
- aStr += String::CreateFromInt32((INT32)rColor.GetBlue());
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetBlue());
return aStr;
}
void lcl_selectColor( ColorListBox& rListBox, const Color& rColor )
@@ -179,7 +179,7 @@ namespace
rListBox.SelectEntry( rColor );
if( rListBox.GetSelectEntryCount() == 0 )
{
- USHORT nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) );
+ sal_uInt16 nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) );
rListBox.SelectEntryPos( nPos );
}
}
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index 3dcaa3092e57..e04857adbca2 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -78,11 +78,12 @@ SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rIn
m_nInitialDegrees( 0 ),
m_bHasInitialDegrees( true ),
m_bInitialStacking( false ),
- m_bHasInitialStacking( true )
+ m_bHasInitialStacking( true ),
+ m_bComplexCategories( false )
{
FreeResource();
- aCbStacked.EnableTriState( FALSE );
+ aCbStacked.EnableTriState( sal_False );
aOrientHlp.AddDependentWindow( aFlOrient );
aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
@@ -107,7 +108,7 @@ SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAtt
return new SchAxisLabelTabPage( pParent, rAttrs );
}
-BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+sal_Bool SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
{
bool bStacked = false;
if( aOrientHlp.GetStackedState() != STATE_DONTKNOW )
@@ -141,20 +142,20 @@ BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
bRadioButtonChecked = false;
if( bRadioButtonChecked )
- rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_TEXT_ORDER ));
+ rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_AXIS_LABEL_ORDER ));
}
if( aCbTextOverlap.GetState() != STATE_DONTKNOW )
- rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_OVERLAP, aCbTextOverlap.IsChecked() ) );
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_OVERLAP, aCbTextOverlap.IsChecked() ) );
if( aCbTextBreak.GetState() != STATE_DONTKNOW )
- rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXTBREAK, aCbTextBreak.IsChecked() ) );
+ rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_BREAK, 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;
+ return sal_True;
}
void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
@@ -163,16 +164,16 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
SfxItemState aState = SFX_ITEM_UNKNOWN;
// show description ----------
- aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, sal_False, &pPoolItem );
if( aState == SFX_ITEM_DONTCARE )
{
- aCbShowDescription.EnableTriState( TRUE );
+ aCbShowDescription.EnableTriState( sal_True );
aCbShowDescription.SetState( STATE_DONTKNOW );
}
else
{
- aCbShowDescription.EnableTriState( FALSE );
- BOOL bCheck = FALSE;
+ aCbShowDescription.EnableTriState( sal_False );
+ sal_Bool bCheck = sal_False;
if( aState == SFX_ITEM_SET )
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCbShowDescription.Check( bCheck );
@@ -185,7 +186,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
// check new degree item
m_nInitialDegrees = 0;
- aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_False, &pPoolItem );
if( aState == SFX_ITEM_SET )
m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
@@ -197,7 +198,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
// check stacked item
m_bInitialStacking = false;
- aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, sal_False, &pPoolItem );
if( aState == SFX_ITEM_SET )
m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
@@ -207,20 +208,20 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
else
aOrientHlp.SetStackedState( STATE_DONTKNOW );
- if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
// Text overlap ----------
- aState = rInAttrs.GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, sal_False, &pPoolItem );
if( aState == SFX_ITEM_DONTCARE )
{
- aCbTextOverlap.EnableTriState( TRUE );
+ aCbTextOverlap.EnableTriState( sal_True );
aCbTextOverlap.SetState( STATE_DONTKNOW );
}
else
{
- aCbTextOverlap.EnableTriState( FALSE );
- BOOL bCheck = FALSE;
+ aCbTextOverlap.EnableTriState( sal_False );
+ sal_Bool bCheck = sal_False;
if( aState == SFX_ITEM_SET )
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCbTextOverlap.Check( bCheck );
@@ -230,16 +231,16 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
}
// text break ----------
- aState = rInAttrs.GetItemState( SCHATTR_TEXTBREAK, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_BREAK, sal_False, &pPoolItem );
if( aState == SFX_ITEM_DONTCARE )
{
- aCbTextBreak.EnableTriState( TRUE );
+ aCbTextBreak.EnableTriState( sal_True );
aCbTextBreak.SetState( STATE_DONTKNOW );
}
else
{
- aCbTextBreak.EnableTriState( FALSE );
- BOOL bCheck = FALSE;
+ aCbTextBreak.EnableTriState( sal_False );
+ sal_Bool bCheck = sal_False;
if( aState == SFX_ITEM_SET )
bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCbTextBreak.Check( bCheck );
@@ -255,7 +256,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
// text order ----------
if( m_bShowStaggeringControls )
{
- aState = rInAttrs.GetItemState( SCHATTR_TEXT_ORDER, FALSE, &pPoolItem );
+ aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_ORDER, sal_False, &pPoolItem );
if( aState == SFX_ITEM_SET )
{
SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
@@ -281,7 +282,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
ToggleShowLabel( (void*)0 );
}
-void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls )
+void SchAxisLabelTabPage::ShowStaggeringControls( sal_Bool bShowStaggeringControls )
{
m_bShowStaggeringControls = bShowStaggeringControls;
@@ -295,12 +296,17 @@ void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls )
}
}
+void SchAxisLabelTabPage::SetComplexCategories( bool bComplexCategories )
+{
+ m_bComplexCategories = bComplexCategories;
+}
+
// event handling routines
// -----------------------
IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG )
{
- BOOL bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK );
+ sal_Bool bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK );
aOrientHlp.Enable( bEnable );
aFlOrder.Enable( bEnable );
@@ -310,7 +316,7 @@ IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG )
aRbAuto.Enable( bEnable );
aFlTextFlow.Enable( bEnable );
- aCbTextOverlap.Enable( bEnable );
+ aCbTextOverlap.Enable( bEnable && !m_bComplexCategories );
aCbTextBreak.Enable( bEnable );
m_aFtTextDirection.Enable( bEnable );
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 6043b16001ac..7da7e9a7471d 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -70,12 +70,13 @@ private:
FixedText m_aFtTextDirection;
TextDirectionListBox m_aLbTextDirection;
- BOOL m_bShowStaggeringControls;
+ sal_Bool m_bShowStaggeringControls;
sal_Int32 m_nInitialDegrees;
bool m_bHasInitialDegrees; /// false = DialControl in tristate
bool m_bInitialStacking;
bool m_bHasInitialStacking; /// false = checkbox in tristate
+ bool m_bComplexCategories;
DECL_LINK ( ToggleShowLabel, void* );
@@ -86,10 +87,11 @@ public:
void Construct();
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
- virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
virtual void Reset( const SfxItemSet& rInAttrs );
- void ShowStaggeringControls( BOOL bShowStaggeringControls );
+ void ShowStaggeringControls( sal_Bool bShowStaggeringControls );
+ void SetComplexCategories( bool bComplexCategories );
};
//.............................................................................
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
index ab4e36ff1f84..3538277c2004 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx
@@ -229,10 +229,10 @@ SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutA
return new AxisPositionsTabPage(pWindow, rOutAttrs);
}
-BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_Bool AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
// axis line
- USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos();
rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 ));
if( 2==nPos )
{
@@ -243,7 +243,7 @@ BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
}
// labels
- USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+ sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
if( nLabelPos != LISTBOX_ENTRY_NOTFOUND )
rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos ));
@@ -263,11 +263,11 @@ BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks));
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks));
- USHORT nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos();
+ sal_uInt16 nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos();
if( nMarkPos != LISTBOX_ENTRY_NOTFOUND )
rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos ));
- return TRUE;
+ return sal_True;
}
void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
@@ -281,7 +281,7 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
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();
+ sal_uInt16 nCount = m_aED_CrossesAtCategory.GetEntryCount();
if( nCount>30 )
nCount=30;
m_aED_CrossesAtCategory.SetDropDownLineCount( nCount );
@@ -299,10 +299,10 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
const SfxPoolItem *pPoolItem = NULL;
//axis line
- if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,sal_True, &pPoolItem)== SFX_ITEM_SET)
{
bool bZero = false;
- USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
if(nPos==0)
{
//switch to value
@@ -316,13 +316,13 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
m_aLB_CrossesAt.SelectEntryPos( nPos );
CrossesAtSelectHdl( (void*)0 );
- if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,TRUE, &pPoolItem)== SFX_ITEM_SET || bZero )
+ if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,sal_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)) );
+ m_aED_CrossesAtCategory.SelectEntryPos( static_cast<sal_uInt16>(::rtl::math::round(fCrossover-1.0)) );
else
m_aED_CrossesAt.SetValue(fCrossover);
}
@@ -335,13 +335,13 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
else
{
m_aLB_CrossesAt.SetNoSelection();
- m_aED_CrossesAt.Enable( FALSE );
+ m_aED_CrossesAt.Enable( sal_False );
}
// Labels
- if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET )
{
- USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
if( nPos < m_aLB_PlaceLabels.GetEntryCount() )
m_aLB_PlaceLabels.SelectEntryPos( nPos );
}
@@ -351,20 +351,20 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
// Tick marks
long nTicks=0,nMinorTicks=0;
- if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,sal_True, &pPoolItem)== SFX_ITEM_SET)
nTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
- if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET)
+ if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,sal_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));
+ m_aCB_TicksInner.Check(sal_Bool(nTicks&CHAXIS_MARK_INNER));
+ m_aCB_TicksOuter.Check(sal_Bool(nTicks&CHAXIS_MARK_OUTER));
+ m_aCB_MinorInner.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_INNER));
+ m_aCB_MinorOuter.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_OUTER));
// Tick position
- if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET )
+ if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET )
{
- USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
+ sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
if( nPos < m_aLB_PlaceTicks.GetEntryCount() )
m_aLB_PlaceTicks.SelectEntryPos( nPos );
}
@@ -439,9 +439,9 @@ void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
m_aED_CrossesAt.UseInputStringForFormatting();
const SfxPoolItem *pPoolItem = NULL;
- if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
- ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+ sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue();
m_aED_CrossesAt.SetFormatKey( nFmt );
}
}
@@ -463,7 +463,7 @@ void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning
IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG )
{
- USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos();
m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis );
m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis );
@@ -478,12 +478,12 @@ IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG )
IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG )
{
- USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
+ sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
bool bEnableTickmarkPlacement = (nLabelPos>1);
if( bEnableTickmarkPlacement )
{
- USHORT nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos();
+ sal_uInt16 nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos();
if( nLabelPos-2 == nAxisPos )
bEnableTickmarkPlacement=false;
}
diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
index 0784a7854c5e..ba23268e6c38 100644
--- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx
@@ -47,7 +47,7 @@ public:
AxisPositionsTabPage( Window* pParent, const SfxItemSet& rInAttrs );
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
- virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
virtual void Reset( const SfxItemSet& rInAttrs );
using TabPage::DeactivatePage;
virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index ec6c1d2a1c10..0504ecee4161 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -228,7 +228,7 @@ void Dim3DLookResourceGroup::fillControls( const ChartTypeParameter& rParameter
void Dim3DLookResourceGroup::fillParameter( ChartTypeParameter& rParameter )
{
rParameter.b3DLook = m_aCB_3DLook.IsChecked();
- USHORT nPos = m_aLB_Scheme.GetSelectEntryPos();
+ sal_uInt16 nPos = m_aLB_Scheme.GetSelectEntryPos();
if( POS_3DSCHEME_SIMPLE == nPos )
rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
else if( POS_3DSCHEME_REALISTIC == nPos )
@@ -707,7 +707,7 @@ IMPL_LINK( SplineResourceGroup, SplineDetailsDialogHdl, void*, EMPTYARG )
ChartTypeParameter aOldParameter;
getSplinePropertiesDialog().fillParameter( aOldParameter, m_aCB_Splines.IsChecked() );
- BOOL bOldSmoothLines = m_aCB_Splines.IsChecked();
+ sal_Bool bOldSmoothLines = m_aCB_Splines.IsChecked();
m_aCB_Splines.Check();
if( RET_OK == getSplinePropertiesDialog().Execute() )
{
@@ -768,7 +768,7 @@ void GeometryResourceGroup::setPosition( const Point& rPoint )
void GeometryResourceGroup::fillControls( const ChartTypeParameter& rParameter )
{
- USHORT nGeometry3D = static_cast<USHORT>(rParameter.nGeometry3D);
+ sal_uInt16 nGeometry3D = static_cast<sal_uInt16>(rParameter.nGeometry3D);
m_aGeometryResources.SelectEntryPos(nGeometry3D);
m_aGeometryResources.Enable(rParameter.b3DLook);
}
@@ -1090,7 +1090,7 @@ void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bo
bool bIsHighContrast = ( true && GetSettings().GetStyleSettings().GetHighContrastMode() );
m_pCurrentMainType->fillSubTypeList( m_aSubTypeList, bIsHighContrast, rParameter );
}
- m_aSubTypeList.SelectItem( static_cast<USHORT>( rParameter.nSubTypeIndex) );
+ m_aSubTypeList.SelectItem( static_cast<sal_uInt16>( rParameter.nSubTypeIndex) );
m_pAxisTypeResourceGroup->fillControls( rParameter );
m_pDim3DLookResourceGroup->fillControls( rParameter );
m_pStackingResourceGroup->fillControls( rParameter );
@@ -1115,7 +1115,7 @@ void ChartTypeTabPage::initializePage()
::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++ )
+ for( sal_uInt16 nM=0; aIter != aEnd; aIter++, nM++ )
{
if( (*aIter)->isSubType(aServiceName) )
{
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
index 909c263ba83b..9b94ae18b7a6 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -54,7 +54,7 @@ SfxTabPage* DataLabelsTabPage::Create(Window* pWindow,
return new DataLabelsTabPage(pWindow, rOutAttrs);
}
-BOOL DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_Bool DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
return m_aDataLabelResources.FillItemSet(rOutAttrs);
}
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
index 25bdf977ef0e..9a3ac3cbd7c8 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -52,7 +52,7 @@ public:
void SetNumberFormatter( SvNumberFormatter* pFormatter );
virtual void Reset(const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
private:
DataLabelResources m_aDataLabelResources;
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 70a478ea8c39..ed48747e5502 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -151,7 +151,7 @@ static long lcl_pRoleListBoxTabs[] =
void lcl_ShowChooserButton(
::chart::RangeSelectionButton & rChooserButton,
Edit & rEditField,
- BOOL bShow )
+ sal_Bool bShow )
{
if( rChooserButton.IsVisible() != bShow )
{
@@ -169,8 +169,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
{
if( pDialog )
{
- pDialog->Show( bEnable ? FALSE : TRUE );
- pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ pDialog->Show( bEnable ? sal_False : sal_True );
+ pDialog->SetModalInputMode( bEnable ? sal_False : sal_True );
}
}
@@ -459,7 +459,7 @@ void DataSourceTabPage::updateControlsFromDialogModel()
void DataSourceTabPage::fillSeriesListBox()
{
- m_apLB_SERIES->SetUpdateMode( FALSE );
+ m_apLB_SERIES->SetUpdateMode( sal_False );
Reference< XDataSeries > xSelected;
SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
@@ -511,7 +511,7 @@ void DataSourceTabPage::fillSeriesListBox()
if( bHasSelectedEntry && pSelectedEntry )
m_apLB_SERIES->Select( pSelectedEntry );
- m_apLB_SERIES->SetUpdateMode( TRUE );
+ m_apLB_SERIES->SetUpdateMode( sal_True );
}
void DataSourceTabPage::fillRoleListBox()
@@ -520,7 +520,7 @@ void DataSourceTabPage::fillRoleListBox()
bool bHasSelectedEntry = (pSeriesEntry != 0);
SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
- ULONG nRoleIndex = SAL_MAX_UINT32;
+ sal_uLong nRoleIndex = SAL_MAX_UINT32;
if( pRoleEntry )
nRoleIndex = m_aLB_ROLE.GetModel()->GetAbsPos( pRoleEntry );
@@ -533,7 +533,7 @@ void DataSourceTabPage::fillRoleListBox()
pSeriesEntry->m_xChartType ));
// fill role list
- m_aLB_ROLE.SetUpdateMode( FALSE );
+ m_aLB_ROLE.SetUpdateMode( sal_False );
m_aLB_ROLE.Clear();
m_aLB_ROLE.RemoveSelection();
@@ -551,7 +551,7 @@ void DataSourceTabPage::fillRoleListBox()
m_aLB_ROLE.Select( m_aLB_ROLE.GetEntry( nRoleIndex ));
}
- m_aLB_ROLE.SetUpdateMode( TRUE );
+ m_aLB_ROLE.SetUpdateMode( sal_True );
}
}
@@ -578,7 +578,7 @@ void DataSourceTabPage::updateControlState()
m_aFT_DATALABELS.Show(!bHasCategories);
m_aFT_CATEGORIES.Show( bHasCategories);
- BOOL bShowIB = bHasRangeChooser;
+ sal_Bool bShowIB = bHasRangeChooser;
lcl_ShowChooserButton( m_aIMB_RANGE_CAT, m_aEDT_CATEGORIES, bShowIB );
m_aFT_SERIES.Enable();
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index e65b503bfcc2..f7826ef744e5 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -126,12 +126,12 @@ protected:
::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.
+ /** @return </sal_True>, if the edit field contains a valid range entry. if no
+ XCellRangesAccess can be obtained, </sal_True> is returned.
*/
bool isRangeFieldContentValid( Edit & rEdit );
- /** @return </TRUE>, if the tab-page is in a consistent (commitable) state
+ /** @return </sal_True>, if the tab-page is in a consistent (commitable) state
*/
bool isValid();
void setDirty();
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
index 395c956372ea..71c843dfb313 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx
@@ -61,7 +61,7 @@ SfxTabPage* ErrorBarsTabPage::Create(
return new ErrorBarsTabPage( pParent, rOutAttrs );
}
-BOOL ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+sal_Bool ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
{
return m_aErrorBarResources.FillItemSet( rOutAttrs );
}
diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
index f6d6779d34a9..ec33c66108a9 100644
--- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx
+++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx
@@ -49,7 +49,7 @@ public:
::com::sun::star::chart2::XChartDocument > & xChartDocument );
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
- virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
virtual void Reset( const SfxItemSet& rInAttrs );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
index e3d23366a820..e08bd83f869d 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -64,14 +64,14 @@ SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow,
return new SchLegendPosTabPage(pWindow, rOutAttrs);
}
-BOOL SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_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;
+ return sal_True;
}
void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs)
@@ -79,7 +79,7 @@ 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 )
+ if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
}
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
index 4c0e7ce545d7..479a3993aa19 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -57,7 +57,7 @@ public:
virtual ~SchLegendPosTabPage();
static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
virtual void Reset(const SfxItemSet& rInAttrs);
};
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 661bae6ac326..298ae43ef8d6 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -66,7 +66,7 @@ SfxTabPage* SchLayoutTabPage::Create(Window* pWindow,
return new SchLayoutTabPage(pWindow, rOutAttrs);
}
-BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_Bool SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount())
@@ -81,19 +81,19 @@ BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs)
rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape));
rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs));
}
- return TRUE;
+ return sal_True;
}
void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs)
{
const SfxPoolItem *pPoolItem = NULL;
- if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
if(m_pGeometryResources)
{
- m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal));
+ m_pGeometryResources->SelectEntryPos(static_cast<sal_uInt16>(nVal));
m_pGeometryResources->Show( true );
}
}
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
index d26ce62732eb..a18c3a945254 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -43,7 +43,7 @@ public:
virtual ~SchLayoutTabPage();
static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
virtual void Reset(const SfxItemSet& rInAttrs);
private:
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 9a193c028e05..b682cd304762 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -65,7 +65,7 @@ SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutA
return new PolarOptionsTabPage( pWindow, rOutAttrs );
}
-BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+sal_Bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
{
if( m_aAngleDial.IsVisible() )
{
@@ -79,7 +79,7 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs )
if (m_aCB_IncludeHiddenCells.IsVisible())
rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked()));
- return TRUE;
+ return sal_True;
}
void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
@@ -87,7 +87,7 @@ void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
const SfxPoolItem *pPoolItem = NULL;
long nTmp;
- if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, sal_True, &pPoolItem) == SFX_ITEM_SET)
{
nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue();
@@ -95,29 +95,29 @@ void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs)
}
else
{
- m_aFL_StartingAngle.Show(FALSE);
- m_aAngleDial.Show(FALSE);
- m_aNF_StartingAngle.Show(FALSE);
- m_aFT_Degrees.Show(FALSE);
+ m_aFL_StartingAngle.Show(sal_False);
+ m_aAngleDial.Show(sal_False);
+ m_aNF_StartingAngle.Show(sal_False);
+ m_aFT_Degrees.Show(sal_False);
}
- if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, sal_True, &pPoolItem) == SFX_ITEM_SET)
{
- BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
m_aCB_Clockwise.Check(bCheck);
}
else
{
- m_aCB_Clockwise.Show(FALSE);
+ m_aCB_Clockwise.Show(sal_False);
}
- if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_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);
+ m_aCB_IncludeHiddenCells.Show(sal_False);
+ m_aFL_PlotOptions.Show(sal_False);
}
}
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
index 1465790c34bd..3ac1c70c2736 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -46,7 +46,7 @@ public:
virtual ~PolarOptionsTabPage();
static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
virtual void Reset(const SfxItemSet& rInAttrs);
private:
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index 3ba6ca0f74b2..a59f5949c0bb 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -48,7 +48,7 @@ namespace
void lcl_ShowChooserButton(
::chart::RangeSelectionButton & rChooserButton,
Edit & rEditField,
- BOOL bShow )
+ sal_Bool bShow )
{
if( rChooserButton.IsVisible() != bShow )
{
@@ -65,8 +65,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
{
if( pDialog )
{
- pDialog->Show( bEnable ? FALSE : TRUE );
- pDialog->SetModalInputMode( bEnable ? FALSE : TRUE );
+ pDialog->Show( bEnable ? sal_False : sal_True );
+ pDialog->SetModalInputMode( bEnable ? sal_False : sal_True );
}
}
void lcl_shiftControlY( Control & rControl, long nYOffset )
@@ -341,7 +341,7 @@ bool RangeChooserTabPage::isValid()
m_aCB_FirstRowAsLabel.Enable( bIsValid );
m_aCB_FirstColumnAsLabel.Enable( bIsValid );
}
- BOOL bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
+ sal_Bool bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
lcl_ShowChooserButton( m_aIB_Range, m_aED_Range, bShowIB );
return bIsValid;
@@ -366,7 +366,7 @@ 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 ) ));
+ rtl::OUString aTitle = String( SchResId( STR_PAGE_DATA_RANGE ) );
lcl_enableRangeChoosing( true, m_pParentDialog );
m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this );
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 34fc0702bafe..62f2aee5e076 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -28,9 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "tp_Scale.hxx"
+#include "tp_Scale.hrc"
#include "ResId.hxx"
-#include "TabPages.hrc"
#include "Strings.hrc"
#include "chartview/ChartSfxItemIds.hxx"
#include "NoWarningThisInCTOR.hxx"
@@ -72,6 +72,20 @@ namespace chart
namespace
{
+void lcl_placeControlAtX( Control& rControl, long nNewXPos )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.X() = nNewXPos;
+ rControl.SetPosPixel(aPos);
+}
+
+void lcl_placeControlAtY( Control& rControl, long nNewYPos )
+{
+ Point aPos( rControl.GetPosPixel() );
+ aPos.Y() = nNewYPos;
+ rControl.SetPosPixel(aPos);
+}
+
void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
{
Point aPos( rEdit.GetPosPixel() );
@@ -84,16 +98,15 @@ void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
rAuto.SetPosPixel(aPos);
}
-void lcl_placeControlsAtY( Control& rTop, Control& rBottom, long nNewYPos )
+long lcl_getLabelDistance( Control& rControl )
{
- Point aPos( rTop.GetPosPixel() );
- long nShift = nNewYPos - aPos.Y();
- aPos.Y() = nNewYPos;
- rTop.SetPosPixel(aPos);
+ return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
+}
- aPos = rBottom.GetPosPixel();
- aPos.Y() += nShift;
- rBottom.SetPosPixel(aPos);
+void lcl_setValue( FormattedField& rFmtField, double fValue )
+{
+ rFmtField.SetValue( fValue );
+ rFmtField.SetDefaultValue( fValue );
}
}
@@ -102,32 +115,51 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs),
aFlScale(this, SchResId(FL_SCALE)),
+
+ aCbxReverse(this, SchResId(CBX_REVERSE)),
+ aCbxLogarithm(this, SchResId(CBX_LOGARITHM)),
+
+ m_aTxt_AxisType(this, SchResId (TXT_AXIS_TYPE)),
+ m_aLB_AxisType(this, SchResId(LB_AXIS_TYPE)),
+
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)),
+
+ m_aTxt_TimeResolution(this, SchResId (TXT_TIME_RESOLUTION)),
+ m_aLB_TimeResolution(this, SchResId(LB_TIME_RESOLUTION)),
+ m_aCbx_AutoTimeResolution(this, SchResId(CBX_AUTO_TIME_RESOLUTION)),
+
aTxtMain (this, SchResId (TXT_STEP_MAIN)),
aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)),
+ m_aMt_MainDateStep(this, SchResId(MT_MAIN_DATE_STEP)),
+ m_aLB_MainTimeUnit(this, SchResId(LB_MAIN_TIME_UNIT)),
aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)),
+
+ aTxtHelpCount (this, SchResId (TXT_STEP_HELP_COUNT)),
aTxtHelp (this, SchResId (TXT_STEP_HELP)),
aMtStepHelp (this, SchResId (MT_STEPHELP)),
+ m_aLB_HelpTimeUnit(this, SchResId(LB_HELP_TIME_UNIT)),
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),
+ m_nTimeResolution(1),
+ m_nMainTimeUnit(1),
+ m_nHelpTimeUnit(1),
+ m_nAxisType(chart2::AxisType::REALNUMBER),
+ m_bAllowDateAxis(false),
pNumFormatter(NULL),
m_bShowAxisOrigin(false)
{
@@ -139,6 +171,26 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_aCbx_AutoTimeResolution.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
+
+ m_aLB_AxisType.SetDropDownLineCount(3);
+ m_aLB_AxisType.SetSelectHdl(LINK(this, ScaleTabPage, SelectAxisTypeHdl));
+
+ m_aLB_TimeResolution.SetDropDownLineCount(3);
+ m_aLB_MainTimeUnit.SetDropDownLineCount(3);
+ m_aLB_HelpTimeUnit.SetDropDownLineCount(3);
+
+ aFmtFldMin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
+ aFmtFldMax.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
+ aFmtFldStepMain.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
+ aFmtFldOrigin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
+}
+
+IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied )
+{
+ if( pFmtFied )
+ pFmtFied->SetDefaultValue( pFmtFied->GetValue() );
+ return 0;
}
void ScaleTabPage::StateChanged( StateChangedType nType )
@@ -155,10 +207,13 @@ void ScaleTabPage::AdjustControlPositions()
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( aTxtHelpCount.CalcMinimumSize().Width(), nLabelWidth );
nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( m_aTxt_TimeResolution.CalcMinimumSize().Width(), nLabelWidth );
+ nLabelWidth = ::std::max( m_aTxt_AxisType.CalcMinimumSize().Width(), nLabelWidth );
nLabelWidth+=1;
- long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
+ long nLabelDistance = lcl_getLabelDistance(aTxtMin);
long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance;
//ensure that the auto checkboxes are wide enough and have correct size for calculation
@@ -167,9 +222,10 @@ void ScaleTabPage::AdjustControlPositions()
aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() );
aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() );
aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() );
+ m_aCbx_AutoTimeResolution.SetSizePixel( m_aCbx_AutoTimeResolution.CalcMinimumSize() );
//ensure new pos is ok
- long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
+ long nWidthOfOtherControls = m_aLB_MainTimeUnit.GetPosPixel().X() + m_aLB_MainTimeUnit.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
long nDialogWidth = GetSizePixel().Width();
long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls;
@@ -181,85 +237,201 @@ void ScaleTabPage::AdjustControlPositions()
aTxtMax.SetSizePixel(aSize);
aTxtMain.SetSizePixel(aSize);
aTxtHelp.SetSizePixel(aSize);
+ aTxtHelpCount.SetSizePixel(aSize);
aTxtOrigin.SetSizePixel(aSize);
+ m_aTxt_TimeResolution.SetSizePixel(aSize);
+ m_aTxt_AxisType.SetSizePixel(aSize);
+
+ long nOrgAutoCheckX = aCbxAutoMin.GetPosPixel().X();
+ lcl_placeControlAtX( aCbxAutoStepMain, nOrgAutoCheckX );
+ lcl_placeControlAtX( aCbxAutoStepHelp, nOrgAutoCheckX );
lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos );
lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos );
lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos );
+ lcl_placeControlAtX( m_aMt_MainDateStep, aFmtFldStepMain.GetPosPixel().X() );
lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos );
lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos );
+ lcl_shiftControls( m_aLB_TimeResolution, m_aCbx_AutoTimeResolution, nNewXPos );
+ lcl_placeControlAtX( m_aLB_AxisType, nNewXPos );
+
+ nNewXPos = aCbxAutoStepMain.GetPosPixel().X() + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
+ lcl_placeControlAtX( m_aLB_MainTimeUnit, nNewXPos );
+ lcl_placeControlAtX( m_aLB_HelpTimeUnit, nNewXPos );
}
+ PlaceIntervalControlsAccordingToAxisType();
}
-void ScaleTabPage::EnableControls()
+void ScaleTabPage::PlaceIntervalControlsAccordingToAxisType()
{
- 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 );
+ long nMinX = std::min( aCbxAutoStepMain.GetPosPixel().X(), m_aLB_MainTimeUnit.GetPosPixel().X() );
+ long nLabelDistance = lcl_getLabelDistance(aTxtMin);
+ long nListWidth = m_aLB_MainTimeUnit.GetSizePixel().Width();
+
+ if( chart2::AxisType::DATE == m_nAxisType )
+ {
+ lcl_placeControlAtX( m_aLB_MainTimeUnit, nMinX );
+ lcl_placeControlAtX( m_aLB_HelpTimeUnit, nMinX );
+ long nSecondX = nMinX + nListWidth + nLabelDistance;
+ lcl_placeControlAtX( aCbxAutoStepMain, nSecondX );
+ lcl_placeControlAtX( aCbxAutoStepHelp, nSecondX );
+
+ long nOne = m_aMt_MainDateStep.LogicToPixel( Size(0, 1), MapMode(MAP_APPFONT) ).Height();
+
+ long nYMajor = m_aMt_MainDateStep.GetPosPixel().Y();
+ lcl_placeControlAtY( aCbxAutoStepMain , nYMajor+(3*nOne));
+ lcl_placeControlAtY( aTxtMain , nYMajor+nOne+nOne);
+
+ long nYMinor = m_aLB_HelpTimeUnit.GetPosPixel().Y();
+ lcl_placeControlAtY( aMtStepHelp , nYMinor );
+ lcl_placeControlAtY( aCbxAutoStepHelp , nYMinor+(3*nOne));
+ }
+ else
+ {
+ lcl_placeControlAtX( aCbxAutoStepMain, nMinX );
+ lcl_placeControlAtX( aCbxAutoStepHelp, nMinX );
+ long nSecondX = nMinX + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
+ long nSecondXMax = GetSizePixel().Width() - nListWidth;
+ if( nSecondX > nSecondXMax )
+ nSecondX = nSecondXMax;
+ lcl_placeControlAtX( m_aLB_MainTimeUnit, nSecondX );
+ lcl_placeControlAtX( m_aLB_HelpTimeUnit, nSecondX );
+ }
}
+void ScaleTabPage::EnableControls()
+{
+ bool bValueAxis = chart2::AxisType::REALNUMBER == m_nAxisType || chart2::AxisType::PERCENT == m_nAxisType || chart2::AxisType::DATE == m_nAxisType;
+ bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
+
+ m_aTxt_AxisType.Show(m_bAllowDateAxis);
+ m_aLB_AxisType.Show(m_bAllowDateAxis);
+
+ aCbxLogarithm.Show( bValueAxis && !bDateAxis );
+ aTxtMin.Show( bValueAxis );
+ aFmtFldMin.Show( bValueAxis );
+ aCbxAutoMin.Show( bValueAxis );
+ aTxtMax.Show( bValueAxis );
+ aFmtFldMax.Show( bValueAxis );
+ aCbxAutoMax.Show( bValueAxis );
+ aTxtMain.Show( bValueAxis );
+ aFmtFldStepMain.Show( bValueAxis );
+ aCbxAutoStepMain.Show( bValueAxis );
+ aTxtHelp.Show( bValueAxis );
+ aTxtHelpCount.Show( bValueAxis );
+ aMtStepHelp.Show( bValueAxis );
+ aCbxAutoStepHelp.Show( bValueAxis );
+
+ aTxtOrigin.Show( m_bShowAxisOrigin && bValueAxis );
+ aFmtFldOrigin.Show( m_bShowAxisOrigin && bValueAxis );
+ aCbxAutoOrigin.Show( m_bShowAxisOrigin && bValueAxis );
+
+ aTxtHelpCount.Show( bValueAxis && !bDateAxis );
+ aTxtHelp.Show( bDateAxis );
+
+ m_aTxt_TimeResolution.Show( bDateAxis );
+ m_aLB_TimeResolution.Show( bDateAxis );
+ m_aCbx_AutoTimeResolution.Show( bDateAxis );
+
+ bool bWasDateAxis = m_aMt_MainDateStep.IsVisible();
+ if( bWasDateAxis != bDateAxis )
+ {
+ //transport value from one to other control
+ if( bWasDateAxis )
+ lcl_setValue( aFmtFldStepMain, m_aMt_MainDateStep.GetValue() );
+ else
+ m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(aFmtFldStepMain.GetValue()) );
+ }
+ aFmtFldStepMain.Show( bValueAxis && !bDateAxis );
+ m_aMt_MainDateStep.Show( bDateAxis );
+
+ m_aLB_MainTimeUnit.Show( bDateAxis );
+ m_aLB_HelpTimeUnit.Show( bDateAxis );
+ EnableValueHdl(&aCbxAutoMin);
+ EnableValueHdl(&aCbxAutoMax);
+ EnableValueHdl(&aCbxAutoStepMain);
+ EnableValueHdl(&aCbxAutoStepHelp);
+ EnableValueHdl(&aCbxAutoOrigin);
+ EnableValueHdl(&m_aCbx_AutoTimeResolution);
+}
IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx )
{
+ bool bEnable = pCbx && !pCbx->IsChecked() && pCbx->IsEnabled();
if (pCbx == &aCbxAutoMin)
{
- aFmtFldMin.Enable(!aCbxAutoMin.IsChecked());
+ aFmtFldMin.Enable( bEnable );
}
else if (pCbx == &aCbxAutoMax)
{
- aFmtFldMax.Enable(!aCbxAutoMax.IsChecked());
+ aFmtFldMax.Enable( bEnable );
}
else if (pCbx == &aCbxAutoStepMain)
{
- aFmtFldStepMain.Enable(!aCbxAutoStepMain.IsChecked());
+ aFmtFldStepMain.Enable( bEnable );
+ m_aMt_MainDateStep.Enable( bEnable );
+ m_aLB_MainTimeUnit.Enable( bEnable );
}
else if (pCbx == &aCbxAutoStepHelp)
{
- aMtStepHelp.Show ();
- aMtStepHelp.Enable( ! aCbxAutoStepHelp.IsChecked() );
+ aMtStepHelp.Enable( bEnable );
+ m_aLB_HelpTimeUnit.Enable( bEnable );
+ }
+ else if (pCbx == &m_aCbx_AutoTimeResolution)
+ {
+ m_aLB_TimeResolution.Enable( bEnable );
}
else if (pCbx == &aCbxAutoOrigin)
{
- aFmtFldOrigin.Enable(!aCbxAutoOrigin.IsChecked());
+ aFmtFldOrigin.Enable( bEnable );
}
return 0;
}
+enum AxisTypeListBoxEntry
+{
+ TYPE_AUTO=0,
+ TYPE_TEXT=1,
+ TYPE_DATE=2
+};
+
+IMPL_LINK( ScaleTabPage, SelectAxisTypeHdl, void *, EMPTYARG )
+{
+ sal_uInt16 nPos = m_aLB_AxisType.GetSelectEntryPos();
+ if( nPos==TYPE_DATE )
+ m_nAxisType = chart2::AxisType::DATE;
+ else
+ m_nAxisType = chart2::AxisType::CATEGORY;
+ if( chart2::AxisType::DATE == m_nAxisType )
+ aCbxLogarithm.Check(false);
+ EnableControls();
+ PlaceIntervalControlsAccordingToAxisType();
+ SetNumFormat();
+ return 0;
+}
+
SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
{
return new ScaleTabPage(pWindow, rOutAttrs);
}
-BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_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(SfxInt32Item(SCHATTR_AXISTYPE, m_nAxisType));
+ if(m_bAllowDateAxis)
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, TYPE_AUTO==m_aLB_AxisType.GetSelectEntryPos()));
+
+ bool bAutoScale = false;
+ if( m_nAxisType==chart2::AxisType::CATEGORY )
+ bAutoScale = true;//reset scaling for category charts
+
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,bAutoScale || aCbxAutoMin.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,bAutoScale || aCbxAutoMax.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || aCbxAutoStepHelp.IsChecked()));
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,bAutoScale || 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));
@@ -267,10 +439,16 @@ BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
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(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || aCbxAutoStepMain.IsChecked()));
rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
- return TRUE;
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_aCbx_AutoTimeResolution.IsChecked()));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,m_nTimeResolution));
+
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,m_nMainTimeUnit));
+ rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,m_nHelpTimeUnit));
+
+ return sal_True;
}
void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
@@ -280,63 +458,110 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
return;
const SfxPoolItem *pPoolItem = NULL;
- nAxisType=chart2::AxisType::REALNUMBER;
- if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_ALLOW_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
+ m_bAllowDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
+ m_nAxisType=chart2::AxisType::REALNUMBER;
+ if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, sal_True, &pPoolItem) == SFX_ITEM_SET)
+ m_nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
+ if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis )
+ m_nAxisType=chart2::AxisType::CATEGORY;
+ if( m_bAllowDateAxis )
{
- nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
- EnableControls();
+ bool bAutoDateAxis = false;
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
+ bAutoDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
+
+ sal_uInt16 nPos = 0;
+ if( m_nAxisType==chart2::AxisType::DATE )
+ nPos=TYPE_DATE;
+ else if( bAutoDateAxis )
+ nPos=TYPE_AUTO;
+ else
+ nPos=TYPE_TEXT;
+ m_aLB_AxisType.SelectEntryPos( nPos );
}
- if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,TRUE,&pPoolItem) == SFX_ITEM_SET)
+ if( m_bAllowDateAxis )
+ aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:MayBeDateAxis");
+ else if( m_nAxisType==chart2::AxisType::CATEGORY || m_nAxisType==chart2::AxisType::SERIES )
+ aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:Category");
+
+ PlaceIntervalControlsAccordingToAxisType();
+
+ aCbxAutoMin.Check( true );
+ aCbxAutoMax.Check( true );
+ aCbxAutoStepMain.Check( true );
+ aCbxAutoStepHelp.Check( true );
+ aCbxAutoOrigin.Check( true );
+ m_aCbx_AutoTimeResolution.Check( true );
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,sal_True,&pPoolItem) == SFX_ITEM_SET)
aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
- aFmtFldMin.SetValue( fMin );
+ lcl_setValue( aFmtFldMin, fMin );
}
- if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue();
- aFmtFldMax.SetValue( fMax );
+ lcl_setValue( aFmtFldMax, fMax );
}
- if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue();
- aFmtFldStepMain.SetValue( fStepMain );
+ lcl_setValue( aFmtFldStepMain, fStepMain );
+ m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(fStepMain) );
}
- if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,sal_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)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
- if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
- aFmtFldOrigin.SetValue( fOrigin );
+ lcl_setValue( aFmtFldOrigin, fOrigin );
}
- EnableValueHdl(&aCbxAutoMin);
- EnableValueHdl(&aCbxAutoMax);
- EnableValueHdl(&aCbxAutoStepMain);
- EnableValueHdl(&aCbxAutoStepHelp);
- EnableValueHdl(&aCbxAutoOrigin);
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
+ m_aCbx_AutoTimeResolution.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_nTimeResolution = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ m_aLB_TimeResolution.SelectEntryPos( m_nTimeResolution );
+ }
+
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_nMainTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ m_aLB_MainTimeUnit.SelectEntryPos( m_nMainTimeUnit );
+ }
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
+ {
+ m_nHelpTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
+ m_aLB_HelpTimeUnit.SelectEntryPos( m_nHelpTimeUnit );
+ }
+
+ EnableControls();
+ SetNumFormat();
}
int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
@@ -347,84 +572,116 @@ int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
return LEAVE_PAGE;
}
+ bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
+
sal_uInt32 nIndex = pNumFormatter->GetStandardIndex(LANGUAGE_SYSTEM);
const SfxPoolItem *pPoolItem = NULL;
- if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_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;
+ Control* pControl = NULL;
+ sal_uInt16 nErrStrId = 0;
double fDummy;
fMax = aFmtFldMax.GetValue();
fMin = aFmtFldMin.GetValue();
fOrigin = aFmtFldOrigin.GetValue();
- fStepMain = aFmtFldStepMain.GetValue();
+ fStepMain = bDateAxis ? m_aMt_MainDateStep.GetValue() : aFmtFldStepMain.GetValue();
nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue());
+ m_nTimeResolution = m_aLB_TimeResolution.GetSelectEntryPos();
+ m_nMainTimeUnit = m_aLB_MainTimeUnit.GetSelectEntryPos();
+ m_nHelpTimeUnit = m_aLB_HelpTimeUnit.GetSelectEntryPos();
+
+ if( chart2::AxisType::REALNUMBER != m_nAxisType )
+ aCbxLogarithm.Show( false );
+
+ //check wich entries need user action
- //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;
+ pControl = &aFmtFldMin;
nErrStrId = STR_BAD_LOGARITHM;
}
- if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0)
+ else if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() &&
+ fMin >= fMax)
+ {
+ pControl = &aFmtFldMin;
+ nErrStrId = STR_MIN_GREATER_MAX;
+ }
+ else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0)
{
- pEdit = &aFmtFldStepMain;
+ pControl = &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()
+ else if ( aFmtFldMin.IsModified()
&& !aCbxAutoMin.IsChecked()
&& !pNumFormatter->IsNumberFormat(aFmtFldMin.GetText(), nIndex, fDummy))
{
- pEdit = &aFmtFldMin;
+ pControl = &aFmtFldMin;
nErrStrId = STR_INVALID_NUMBER;
}
else if (aFmtFldMax.IsModified() && !aCbxAutoMax.IsChecked() &&
!pNumFormatter->IsNumberFormat(aFmtFldMax.GetText(),
nIndex, fDummy))
{
- pEdit = &aFmtFldMax;
+ pControl = &aFmtFldMax;
nErrStrId = STR_INVALID_NUMBER;
}
- else if (aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() &&
+ else if ( !bDateAxis && aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() &&
!pNumFormatter->IsNumberFormat(aFmtFldStepMain.GetText(),
nIndex, fDummy))
{
- pEdit = &aFmtFldStepMain;
+ pControl = &aFmtFldStepMain;
nErrStrId = STR_STEP_GT_ZERO;
}
else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() &&
!pNumFormatter->IsNumberFormat(aFmtFldOrigin.GetText(),
nIndex, fDummy))
{
- pEdit = &aFmtFldOrigin;
+ pControl = &aFmtFldOrigin;
nErrStrId = STR_INVALID_NUMBER;
}
else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0)
{
- pEdit = &aFmtFldStepMain;
+ pControl = &aFmtFldStepMain;
nErrStrId = STR_STEP_GT_ZERO;
}
+ else if( bDateAxis )
+ {
+ if( !aCbxAutoStepMain.IsChecked() && !aCbxAutoStepHelp.IsChecked() )
+ {
+ if( m_nHelpTimeUnit > m_nMainTimeUnit )
+ {
+ pControl = &m_aLB_MainTimeUnit;
+ nErrStrId = STR_INVALID_INTERVALS;
+ }
+ else if( m_nHelpTimeUnit == m_nMainTimeUnit && nStepHelp > fStepMain )
+ {
+ pControl = &m_aLB_MainTimeUnit;
+ nErrStrId = STR_INVALID_INTERVALS;
+ }
+ }
+ if( !nErrStrId && !m_aCbx_AutoTimeResolution.IsChecked() )
+ {
+ if( (!aCbxAutoStepMain.IsChecked() && m_nTimeResolution > m_nMainTimeUnit )
+ ||
+ (!aCbxAutoStepHelp.IsChecked() && m_nTimeResolution > m_nHelpTimeUnit )
+ )
+ {
+ pControl = &m_aLB_TimeResolution;
+ nErrStrId = STR_INVALID_TIME_UNIT;
+ }
+ }
+ }
- if( ShowWarning( nErrStrId, pEdit ) )
+ if( ShowWarning( nErrStrId, pControl ) )
return KEEP_PAGE;
if( pItemSet )
@@ -457,9 +714,9 @@ void ScaleTabPage::SetNumFormat()
{
const SfxPoolItem *pPoolItem = NULL;
- if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
- ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue();
+ sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue();
aFmtFldMax.SetFormatKey( nFmt );
aFmtFldMin.SetFormatKey( nFmt );
@@ -486,6 +743,19 @@ void ScaleTabPage::SetNumFormat()
else
nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME );
}
+
+ if( chart2::AxisType::DATE == m_nAxisType && ( eType != NUMBERFORMAT_DATE && eType != NUMBERFORMAT_DATETIME) )
+ {
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
+ if( pFormat )
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE, pFormat->GetLanguage() );
+ else
+ nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE );
+
+ aFmtFldMax.SetFormatKey( nFmt );
+ aFmtFldMin.SetFormatKey( nFmt );
+ aFmtFldOrigin.SetFormatKey( nFmt );
+ }
}
aFmtFldStepMain.SetFormatKey( nFmt );
@@ -499,7 +769,7 @@ void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
m_bShowAxisOrigin = true;
}
-bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL */ )
+bool ScaleTabPage::ShowWarning( sal_uInt16 nResIdMessage, Control* pControl /* = NULL */ )
{
if( nResIdMessage == 0 )
return false;
@@ -508,7 +778,9 @@ bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL
if( pControl )
{
pControl->GrabFocus();
- pControl->SetSelection( Selection( 0, SELECTION_MAX ));
+ Edit* pEdit = dynamic_cast<Edit*>(pControl);
+ if(pEdit)
+ pEdit->SetSelection( Selection( 0, SELECTION_MAX ));
}
return true;
}
diff --git a/chart2/source/controller/dialogs/tp_Scale.hrc b/chart2/source/controller/dialogs/tp_Scale.hrc
new file mode 100644
index 000000000000..bde6c21c7924
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_Scale.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.
+ *
+ ************************************************************************/
+
+#include "ResourceIds.hrc"
+
+#define FL_SCALE 1
+
+#define TXT_MIN 1
+#define TXT_MAX 2
+#define TXT_STEP_MAIN 3
+#define TXT_STEP_HELP_COUNT 4
+#define TXT_ORIGIN 5
+#define TXT_TIME_RESOLUTION 6
+#define TXT_AXIS_TYPE 7
+#define TXT_STEP_HELP 8
+
+#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 CBX_AUTO_TIME_RESOLUTION 8
+
+#define EDT_STEP_MAIN 1
+#define EDT_MAX 2
+#define EDT_MIN 3
+#define EDT_ORIGIN 4
+
+#define MT_STEPHELP 10
+#define MT_MAIN_DATE_STEP 11
+
+#define LB_AXIS_TYPE 1
+#define LB_MAIN_TIME_UNIT 2
+#define LB_HELP_TIME_UNIT 3
+#define LB_TIME_RESOLUTION 4
+
+#define STR_LIST_TIME_UNIT 1
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
index 8d0e02186c38..a6892656ad7b 100644
--- a/chart2/source/controller/dialogs/tp_Scale.hxx
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -37,6 +37,8 @@
#include <vcl/button.hxx>
// header for MetricField
#include <vcl/field.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
//.............................................................................
namespace chart
@@ -49,7 +51,7 @@ public:
ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs );
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
- virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
virtual void Reset( const SfxItemSet& rInAttrs );
using TabPage::DeactivatePage;
virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
@@ -64,6 +66,13 @@ public:
private:
FixedLine aFlScale;
+ CheckBox aCbxReverse;
+
+ CheckBox aCbxLogarithm;
+
+ FixedText m_aTxt_AxisType;
+ ListBox m_aLB_AxisType;
+
FixedText aTxtMin;
FormattedField aFmtFldMin;
CheckBox aCbxAutoMin;
@@ -72,35 +81,47 @@ private:
FormattedField aFmtFldMax;
CheckBox aCbxAutoMax;
+ FixedText m_aTxt_TimeResolution;
+ ListBox m_aLB_TimeResolution;
+ CheckBox m_aCbx_AutoTimeResolution;
+
FixedText aTxtMain;
FormattedField aFmtFldStepMain;
+ MetricField m_aMt_MainDateStep;
+ ListBox m_aLB_MainTimeUnit;
CheckBox aCbxAutoStepMain;
+ FixedText aTxtHelpCount;
FixedText aTxtHelp;
MetricField aMtStepHelp;
+ ListBox m_aLB_HelpTimeUnit;
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;
+ sal_Int32 m_nTimeResolution;
+ sal_Int32 m_nMainTimeUnit;
+ sal_Int32 m_nHelpTimeUnit;
+ int m_nAxisType;
+ bool m_bAllowDateAxis;
SvNumberFormatter* pNumFormatter;
bool m_bShowAxisOrigin;
void AdjustControlPositions();
void EnableControls();
+ void PlaceIntervalControlsAccordingToAxisType();
+ DECL_LINK( SelectAxisTypeHdl, void* );
DECL_LINK( EnableValueHdl, CheckBox* );
+ DECL_LINK( FmtFieldModifiedHdl, FormattedField* );
/** shows a warning window due to an invalid input.
@@ -115,7 +136,7 @@ private:
@return false, if nResIdMessage was 0, true otherwise
*/
- bool ShowWarning( USHORT nResIdMessage, Edit * pControl = NULL );
+ bool ShowWarning( sal_uInt16 nResIdMessage, Control* pControl = NULL );
};
//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_Scale.src b/chart2/source/controller/dialogs/tp_Scale.src
index 9e92e70f6f43..0b0e7efcdb9c 100644..100755
--- a/chart2/source/controller/dialogs/tp_Scale.src
+++ b/chart2/source/controller/dialogs/tp_Scale.src
@@ -25,7 +25,7 @@
*
************************************************************************/
#include "HelpIds.hrc"
-#include "TabPages.hrc"
+#include "tp_Scale.hrc"
#define YLine1 3
#define Y1 (YLine1+13)
@@ -33,16 +33,26 @@
#define Y3 (Y2+16)
#define Y4 (Y3+16)
#define Y5 (Y4+16)
-#define Y6 (Y5+17)
-#define Y7 (Y6+15)
+#define Y6 (Y5+16)
+#define Y7 (Y6+16)
+#define Y8 (Y7+16)
#define LABELWIDTH 88
-#define AUTOCHECKWIDTH 88
+#define AUTOCHECKWIDTH 41
#define EDITWIDTH 50
#define X1 6
#define X2 11
#define X3 (X2+LABELWIDTH+4)
#define X4 (X3+EDITWIDTH+5)
+#define X5 (X4+AUTOCHECKWIDTH+5)
+
+#define STR_LIST_TIME_UNIT \
+ StringList [ en-US ] = \
+ { \
+ "Days" ; \
+ "Months" ; \
+ "Years" ; \
+ };
TabPage TP_SCALE
{
@@ -57,86 +67,201 @@ TabPage TP_SCALE
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Scale" ;
};
- FixedText TXT_MIN
+ //---------------------------
+ CheckBox CBX_REVERSE
{
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_REVERSE:ValueAxis";
Pos = MAP_APPFONT ( X2 , Y1 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Reverse direction" ;
+ };
+ //---------------------------
+ CheckBox CBX_LOGARITHM
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_LOGARITHM";
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Size = MAP_APPFONT ( 244 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Logarithmic scale" ;
+ };
+ //---------------------------
+ FixedText TXT_AXIS_TYPE
+ {
+ Pos = MAP_APPFONT ( X2 , Y2 ) ;
Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
- Text [ en-US ] = "~Minimum:" ;
+ Text [ en-US ] = "T~ype" ;
+ };
+ ListBox LB_AXIS_TYPE
+ {
+ HelpID = "chart2:ListBox:TP_SCALE:LB_AXIS_TYPE";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y2-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ StringList [ en-US ] =
+ {
+ "Automatic" ;
+ "Text" ;
+ "Date" ;
+ };
+ };
+ //---------------------------
+ FixedText TXT_MIN
+ {
+ Pos = MAP_APPFONT ( X2 , Y3 ) ;
+ 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 ) ;
+ Pos = MAP_APPFONT ( X3 , Y3-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 ) ;
+ Pos = MAP_APPFONT ( X4 , Y3+1 ) ;
Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "~Automatic" ;
};
-
+ //---------------------------
FixedText TXT_MAX
{
- Pos = MAP_APPFONT ( X2 , Y2 ) ;
+ Pos = MAP_APPFONT ( X2 , Y4 ) ;
Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
- Text [ en-US ] = "Ma~ximum:" ;
+ 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 ) ;
+ Pos = MAP_APPFONT ( X3 , Y4-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 ) ;
+ Pos = MAP_APPFONT ( X4 , Y4+1 ) ;
Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "A~utomatic" ;
};
+ //---------------------------
+ FixedText TXT_TIME_RESOLUTION
+ {
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "R~esolution" ;
+ };
+ ListBox LB_TIME_RESOLUTION
+ {
+ HelpID = "chart2:ListBox:TP_SCALE:LB_TIME_RESOLUTION";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y5-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ STR_LIST_TIME_UNIT
+ };
+ CheckBox CBX_AUTO_TIME_RESOLUTION
+ {
+ HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_TIME_RESOLUTION";
+ Pos = MAP_APPFONT ( X4 , Y5+1 ) ;
+ Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automat~ic" ;
+ };
+ //---------------------------
FixedText TXT_STEP_MAIN
{
- Pos = MAP_APPFONT ( X2 , Y3 ) ;
+ Pos = MAP_APPFONT ( X2 , Y5 ) ;
Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
- Text [ en-US ] = "Ma~jor interval:" ;
+ 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 ) ;
+ Pos = MAP_APPFONT ( X3 , Y5-2 ) ;
Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
TabStop = TRUE ;
};
+ MetricField MT_MAIN_DATE_STEP
+ {
+ HelpID = "chart2:MetricField:TP_SCALE:MT_MAIN_DATE_STEP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( X3 , Y6-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 100000 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 100000 ;
+ SpinSize = 1 ;
+ };
+
+ ListBox LB_MAIN_TIME_UNIT
+ {
+ HelpID = "chart2:ListBox:TP_SCALE:LB_MAIN_TIME_UNIT";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y6-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ STR_LIST_TIME_UNIT
+ };
+
CheckBox CBX_AUTO_STEP_MAIN
{
HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_MAIN";
- Pos = MAP_APPFONT ( X4 , Y3-1 ) ;
+ Pos = MAP_APPFONT ( X4 , Y5+1 ) ;
Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Au~tomatic" ;
};
+ //---------------------------
+ FixedText TXT_STEP_HELP_COUNT
+ {
+ Pos = MAP_APPFONT ( X2 , Y6 ) ;
+ Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
+ Text [ en-US ] = "Minor inter~val count" ;
+ };
FixedText TXT_STEP_HELP
{
- Pos = MAP_APPFONT ( X2 , Y4 ) ;
+ Pos = MAP_APPFONT ( X2 , Y7 ) ;
Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
- Text [ en-US ] = "Minor interval ~count:" ;
+ Text [ en-US ] = "Minor inter~val" ;
};
MetricField MT_STEPHELP
{
HelpID = "chart2:MetricField:TP_SCALE:MT_STEPHELP";
Border = TRUE ;
- Pos = MAP_APPFONT ( X3 , Y4-2 ) ;
+ Pos = MAP_APPFONT ( X3 , Y6-2 ) ;
Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
TabStop = TRUE ;
Repeat = TRUE ;
@@ -149,55 +274,51 @@ TabPage TP_SCALE
Last = 100 ;
SpinSize = 1 ;
};
+ ListBox LB_HELP_TIME_UNIT
+ {
+ HelpID = "chart2:ListBox:TP_SCALE:LB_HELP_TIME_UNIT";
+ Border = TRUE ;
+ AutoHScroll = TRUE ;
+ Pos = MAP_APPFONT ( X5 , Y7-2 ) ;
+ Size = MAP_APPFONT ( EDITWIDTH , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown=TRUE;
+ DDExtraWidth = TRUE ;
+
+ STR_LIST_TIME_UNIT
+ };
CheckBox CBX_AUTO_STEP_HELP
{
HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_HELP";
- Pos = MAP_APPFONT ( X4 , Y4-1 ) ;
+ Pos = MAP_APPFONT ( X4 , Y6+1 ) ;
Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Aut~omatic" ;
};
-
+ //---------------------------
FixedText TXT_ORIGIN
{
- Pos = MAP_APPFONT ( X2 , Y5 ) ;
+ Pos = MAP_APPFONT ( X2 , Y7 ) ;
Size = MAP_APPFONT ( LABELWIDTH , 8 ) ;
- Text [ en-US ] = "Reference ~value:" ;
+ Text [ en-US ] = "Re~ference value" ;
};
SpinField EDT_ORIGIN
{
HelpID = "chart2:SpinField:TP_SCALE:EDT_ORIGIN";
Border = TRUE ;
SVLook = TRUE ;
- Pos = MAP_APPFONT ( X3 , Y5-2 ) ;
+ Pos = MAP_APPFONT ( X3 , Y7-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 ) ;
+ Pos = MAP_APPFONT ( X4 , Y7+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
index fbe2f4bf1907..aec48d5e6ce7 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -96,7 +96,7 @@ SfxTabPage* SchOptionTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs
return new SchOptionTabPage(pWindow, rOutAttrs);
}
-BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_Bool SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
if(aRbtAxis2.IsChecked())
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
@@ -127,113 +127,113 @@ BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs)
if (m_aCBIncludeHiddenCells.IsVisible())
rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked()));
- return TRUE;
+ return sal_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)
+ aRbtAxis1.Check(sal_True);
+ aRbtAxis2.Check(sal_False);
+ if (rInAttrs.GetItemState(SCHATTR_AXIS,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
if(nVal==CHART_AXIS_SECONDARY_Y)
{
- aRbtAxis2.Check(TRUE);
- aRbtAxis1.Check(FALSE);
+ aRbtAxis2.Check(sal_True);
+ aRbtAxis1.Check(sal_False);
}
}
long nTmp;
- if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, sal_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)
+ if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, sal_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)
+ if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, sal_True, &pPoolItem) == SFX_ITEM_SET)
{
- BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
+ sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCBConnect.Check(bCheck);
}
- if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, sal_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)
+ if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, sal_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();
+ sal_Bool bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
aCBAxisSideBySide.Check( bCheck );
}
else
{
- aCBAxisSideBySide.Show(FALSE);
+ aCBAxisSideBySide.Show(sal_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 )
+ if( rInAttrs.GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, sal_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)
+ if ( aMissingValueTreatments.getLength()>1 && rInAttrs.GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,sal_True, &pPoolItem) == SFX_ITEM_SET)
{
- m_aRB_DontPaint.Enable(FALSE);
- m_aRB_AssumeZero.Enable(FALSE);
- m_aRB_ContinueLine.Enable(FALSE);
+ m_aRB_DontPaint.Enable(sal_False);
+ m_aRB_AssumeZero.Enable(sal_False);
+ m_aRB_ContinueLine.Enable(sal_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);
+ m_aRB_DontPaint.Enable(sal_True);
else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
- m_aRB_AssumeZero.Enable(TRUE);
+ m_aRB_AssumeZero.Enable(sal_True);
else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
- m_aRB_ContinueLine.Enable(TRUE);
+ m_aRB_ContinueLine.Enable(sal_True);
}
long nVal=((const SfxInt32Item*)pPoolItem)->GetValue();
if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
- m_aRB_DontPaint.Check(TRUE);
+ m_aRB_DontPaint.Check(sal_True);
else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO)
- m_aRB_AssumeZero.Check(TRUE);
+ m_aRB_AssumeZero.Check(sal_True);
else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE)
- m_aRB_ContinueLine.Check(TRUE);
+ m_aRB_ContinueLine.Check(sal_True);
}
else
{
- m_aFT_MissingValues.Show(FALSE);
- m_aRB_DontPaint.Show(FALSE);
- m_aRB_AssumeZero.Show(FALSE);
- m_aRB_ContinueLine.Show(FALSE);
+ m_aFT_MissingValues.Show(sal_False);
+ m_aRB_DontPaint.Show(sal_False);
+ m_aRB_AssumeZero.Show(sal_False);
+ m_aRB_ContinueLine.Show(sal_False);
}
}
// Include hidden cells
- if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET)
+ if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET)
{
bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
m_aCBIncludeHiddenCells.Check(bVal);
}
else
{
- m_aCBIncludeHiddenCells.Show(FALSE);
+ m_aCBIncludeHiddenCells.Show(sal_False);
if(!m_aFT_MissingValues.IsVisible())
- m_aFL_PlotOptions.Show(FALSE);
+ m_aFL_PlotOptions.Show(sal_False);
}
AdaptControlPositionsAndVisibility();
@@ -275,7 +275,7 @@ void SchOptionTabPage::AdaptControlPositionsAndVisibility()
if( !aMTGap.IsVisible() && !aMTOverlap.IsVisible() )
{
- aGrpBar.Show(FALSE);
+ aGrpBar.Show(sal_False);
Point aPos;
if( !aRbtAxis1.IsVisible() && !aRbtAxis2.IsVisible() )
aPos = aGrpAxis.GetPosPixel();
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index 63caf2885910..86a5280a00aa 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -50,7 +50,7 @@ public:
virtual ~SchOptionTabPage();
static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
virtual void Reset(const SfxItemSet& rInAttrs);
void Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors );
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index 5b1d5647dc6c..9d87f4979ebc 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -58,7 +58,7 @@ SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
{
FreeResource();
- aCbStacked.EnableTriState( FALSE );
+ aCbStacked.EnableTriState( sal_False );
aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
if( !bWithRotation )
@@ -88,7 +88,7 @@ SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
return new SchAlignmentTabPage(pParent, rInAttrs, false);
}
-BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
+sal_Bool SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
{
//Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
@@ -100,7 +100,7 @@ BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
- return TRUE;
+ return sal_True;
}
void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
@@ -115,7 +115,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
- if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pItem) == SFX_ITEM_SET)
+ if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pItem) == SFX_ITEM_SET)
aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
}
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index e02b0f29078d..ae782a792864 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -58,7 +58,7 @@ public:
static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs);
static SfxTabPage* CreateWithoutRotation(Window* pParent, const SfxItemSet& rInAttrs);
- virtual BOOL FillItemSet(SfxItemSet& rOutAttrs);
+ virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs);
virtual void Reset(const SfxItemSet& rInAttrs);
};
diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx
index 31b35b24a5b4..f336a620c8a4 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.cxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.cxx
@@ -54,7 +54,7 @@ SfxTabPage* TrendlineTabPage::Create(
return new TrendlineTabPage( pParent, rOutAttrs );
}
-BOOL TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs )
+sal_Bool TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs )
{
return m_aTrendlineResources.FillItemSet( rOutAttrs );
}
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
index f1c6eb5609fd..bd7f97a3c8e8 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.hxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -43,7 +43,7 @@ public:
virtual ~TrendlineTabPage ();
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
- virtual BOOL FillItemSet( SfxItemSet& rOutAttrs );
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
virtual void Reset( const SfxItemSet& rInAttrs );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 9da7f7536d28..102393dd59f8 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -126,7 +126,7 @@ void lcl_initOutliner( SdrOutliner* pTargetOutliner, SdrOutliner* pSourceOutline
//if( bInit )
{
pTargetOutliner->EraseVirtualDevice();
- pTargetOutliner->SetUpdateMode(FALSE);
+ pTargetOutliner->SetUpdateMode(sal_False);
pTargetOutliner->SetEditTextObjectPool( pSourceOutliner->GetEditTextObjectPool() );
pTargetOutliner->SetDefTab( pSourceOutliner->GetDefTab() );
}
@@ -140,7 +140,7 @@ void lcl_initOutliner( SdrOutliner* pTargetOutliner, SdrOutliner* pSourceOutline
pTargetOutliner->SetDefaultLanguage( pSourceOutliner->GetDefaultLanguage() );
pTargetOutliner->SetHyphenator( pSourceOutliner->GetHyphenator() );
- USHORT nX, nY;
+ sal_uInt16 nX, nY;
pSourceOutliner->GetGlobalCharStretching( nX, nY );
pTargetOutliner->SetGlobalCharStretching( nX, nY );
@@ -234,8 +234,8 @@ void DrawViewWrapper::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;
+ //sal_uLong nOptions =SDRSEARCH_DEEP|SDRSEARCH_PASS2BOUND|SDRSEARCH_PASS3NEAREST;
+ sal_uLong nOptions = SDRSEARCH_DEEP | SDRSEARCH_TESTMARKABLE;
SdrPageView* pSdrPageView = this->GetPageView();
this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pRet, pSdrPageView, nOptions);
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 755058050a2d..eb2168e07d8f 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -181,7 +181,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
aVDev.SetMapMode(MapMode(MAP_100TH_MM));
SdrModel* pModel = new SdrModel();
pModel->GetItemPool().FreezeIdRanges();
- SdrPage* pPage = new SdrPage( *pModel, FALSE );
+ SdrPage* pPage = new SdrPage( *pModel, sal_False );
pPage->SetSize(Size(1000,1000));
pModel->InsertPage( pPage, 0 );
SdrView* pView = new SdrView( pModel, &aVDev );
@@ -224,7 +224,7 @@ FontList* ViewElementListProvider::getFontList() const
OutputDevice* pDefaultOut = Application::GetDefaultDevice(); // #67730#
m_pFontList = new FontList( pRefDev ? pRefDev : pDefaultOut
, pRefDev ? pDefaultOut : NULL
- , FALSE );
+ , sal_False );
}
return m_pFontList;
}
@@ -243,14 +243,14 @@ SfxPrinter* ObjectPropertiesDialogParameter::getPrinter()
bool bOwnPrinter = true;
if (!pPrinter)
{
- SfxBoolItem aItem(SID_PRINTER_NOTFOUND_WARN, TRUE);
+ SfxBoolItem aItem(SID_PRINTER_NOTFOUND_WARN, sal_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;
+ bOwnPrinter = sal_True;
MapMode aMapMode = pPrinter->GetMapMode();
aMapMode.SetMapUnit(MAP_100TH_MM);
diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx
index 7c8f83452963..1d861f695b7d 100644
--- a/chart2/source/controller/inc/AxisItemConverter.hxx
+++ b/chart2/source/controller/inc/AxisItemConverter.hxx
@@ -27,8 +27,7 @@
#ifndef CHART_AXISITEMCONVERTER_HXX
#define CHART_AXISITEMCONVERTER_HXX
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <chartview/ExplicitScaleValues.hxx>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -55,8 +54,8 @@ public:
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,
+ ExplicitScaleData * pScale = NULL,
+ ExplicitIncrementData * pIncrement = NULL,
::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
::std::auto_ptr< ::com::sun::star::awt::Size >() );
virtual ~AxisItemConverter();
@@ -65,12 +64,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
@@ -81,8 +80,8 @@ private:
::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;
+ ExplicitScaleData* m_pExplicitScale;
+ ExplicitIncrementData* m_pExplicitIncrement;
};
} // namespace wrapper
diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
index d2590c37759c..e77323831b3d 100644
--- a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx
@@ -59,12 +59,12 @@ public:
virtual ~CharacterPropertyItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
::com::sun::star::uno::Reference<
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
index d738cf8f6245..323d3a3890ea 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -29,7 +29,7 @@
#include "ItemConverter.hxx"
#include "GraphicPropertyItemConverter.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -81,12 +81,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
index 1dbdf6a85a53..4251dbef077e 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -69,11 +69,11 @@ public:
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); }
+ //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions, SdrObject** ppRootObj, sal_uLong* pnMarkNum=NULL, sal_uInt16* pnPassNum=NULL) const;
+ //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const;
+ //sal_Bool PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
- //void MarkObj(SdrObject* pObj, SdrPageView* pPV, BOOL bUnmark=FALSE, BOOL bImpNoSetMarkHdl=FALSE);
+ //void MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark=sal_False, sal_Bool bImpNoSetMarkHdl=sal_False);
void MarkObject( SdrObject* pObj );
//----------------------
diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
index 9dffde68cd5b..1d6fa0492573 100755
--- a/chart2/source/controller/inc/ErrorBarItemConverter.hxx
+++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx
@@ -29,7 +29,7 @@
#include "ItemConverter.hxx"
#include "GraphicPropertyItemConverter.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -63,12 +63,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
index c10e1d4e5b86..8e01ceaa28b0 100644
--- a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
+++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx
@@ -63,12 +63,12 @@ public:
virtual ~GraphicPropertyItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx
index 2f52e45f070c..f803934c7f1a 100644
--- a/chart2/source/controller/inc/ItemConverter.hxx
+++ b/chart2/source/controller/inc/ItemConverter.hxx
@@ -89,9 +89,9 @@ public:
// typedefs -------------------------------
- typedef USHORT tWhichIdType;
+ typedef sal_uInt16 tWhichIdType;
typedef ::rtl::OUString tPropertyNameType;
- typedef BYTE tMemberIdType;
+ typedef sal_uInt8 tMemberIdType;
typedef ::std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId;
@@ -133,7 +133,7 @@ protected:
/** implement this method to provide an array of which-ranges of the form:
- const USHORT aMyPairs[] =
+ const sal_uInt16 aMyPairs[] =
{
from_1, to_1,
from_2, to_2,
@@ -142,7 +142,7 @@ protected:
0
};
*/
- virtual const USHORT * GetWhichPairs() const = 0;
+ virtual const sal_uInt16 * GetWhichPairs() const = 0;
/** implement this method to return a Property object for a given which id.
@@ -161,7 +161,7 @@ protected:
The default implementation does nothing except showing an assertion
*/
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
/** for items that can not be mapped directly to a property.
@@ -173,7 +173,7 @@ protected:
@return true if the item changed a property, false otherwise.
*/
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
// ________
diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx
index b1b0bcdeea75..897cf1c691da 100644
--- a/chart2/source/controller/inc/LegendItemConverter.hxx
+++ b/chart2/source/controller/inc/LegendItemConverter.hxx
@@ -60,12 +60,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx
index 9b0555ec82e1..1535f8af4405 100644
--- a/chart2/source/controller/inc/MultipleChartConverters.hxx
+++ b/chart2/source/controller/inc/MultipleChartConverters.hxx
@@ -55,7 +55,7 @@ public:
virtual ~AllAxisItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
class AllGridItemConverter : public ::comphelper::MultipleItemConverter
@@ -71,7 +71,7 @@ public:
virtual ~AllGridItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
class AllDataLabelItemConverter : public ::comphelper::MultipleItemConverter
@@ -89,7 +89,7 @@ public:
virtual ~AllDataLabelItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
class AllTitleItemConverter : public ::comphelper::MultipleItemConverter
@@ -107,7 +107,7 @@ public:
virtual ~AllTitleItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
class AllSeriesStatisticsConverter : public ::comphelper::MultipleItemConverter
@@ -120,7 +120,7 @@ public:
virtual ~AllSeriesStatisticsConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
} // namespace wrapper
diff --git a/chart2/source/controller/inc/MultipleItemConverter.hxx b/chart2/source/controller/inc/MultipleItemConverter.hxx
index 32c48ca8e7db..e7c0f3ce31bd 100644
--- a/chart2/source/controller/inc/MultipleItemConverter.hxx
+++ b/chart2/source/controller/inc/MultipleItemConverter.hxx
@@ -36,7 +36,7 @@
namespace comphelper
{
-/** Note: virtual const USHORT * GetWhichPairs() const; is still pure virtual
+/** Note: virtual const sal_uInt16 * GetWhichPairs() const; is still pure virtual
*/
class MultipleItemConverter : public ItemConverter
{
diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
index ab2d29cb5e0d..fa5c0b6b41c5 100644
--- a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
@@ -61,12 +61,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
index 5fe5313c8d4a..29b092788bf0 100644
--- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx
@@ -64,12 +64,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
index 207a6ab7f0ee..051c581bfdd4 100644
--- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
+++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx
@@ -54,12 +54,12 @@ public:
virtual ~SeriesOptionsItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/StatisticsItemConverter.hxx b/chart2/source/controller/inc/StatisticsItemConverter.hxx
index cb4227185093..0c6c45e1e0f4 100644
--- a/chart2/source/controller/inc/StatisticsItemConverter.hxx
+++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx
@@ -31,7 +31,7 @@
#include "ItemConverter.hxx"
#include "GraphicPropertyItemConverter.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include <vector>
@@ -55,12 +55,12 @@ public:
virtual ~StatisticsItemConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx
index 535e36226a12..2f382a9483ce 100644
--- a/chart2/source/controller/inc/TitleItemConverter.hxx
+++ b/chart2/source/controller/inc/TitleItemConverter.hxx
@@ -61,12 +61,12 @@ public:
virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
- virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( ::com::sun::star::uno::Exception );
- virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+ virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( ::com::sun::star::uno::Exception );
private:
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index e5cd252df69d..5f985d8f55d1 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -62,7 +62,7 @@ public:
virtual void Resize();
// Dialog
- virtual BOOL Close();
+ virtual sal_Bool Close();
void SetReadOnly( bool bReadOnly );
bool ApplyChangesToModel();
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index f94c95b33370..732b1532ad64 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -91,7 +91,7 @@ private:
bool m_bRangeChooserTabIsValid;
bool m_bDataSourceTabIsValid;
- static USHORT m_nLastPageId;
+ static sal_uInt16 m_nLastPageId;
};
} // namespace chart
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index 5ed06d365fa2..5d084d7d68b3 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -75,7 +75,7 @@ protected:
HelpButton aPbHelp;
public:
- SchAxisDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg=true );
+ SchAxisDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg=true );
virtual ~SchAxisDlg();
void getResult( InsertAxisOrGridDialogData& rOutput );
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
index 8ceabdbe33b7..250c3107138c 100644
--- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -69,6 +69,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
getDocument() const;
+ bool IsComplexCategoriesAxis() const;
+
private:
rtl::OUString m_aObjectCID;
ObjectType m_eObjectType;
@@ -96,6 +98,8 @@ private:
::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
+
+ bool m_bComplexCategoriesAxis;
};
/*************************************************************************
@@ -111,8 +115,8 @@ 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;
+ sal_uInt16 nDlgType;
+ sal_uInt16 nPageType;
const ObjectPropertiesDialogParameter * const m_pParameter;
const ViewElementListProvider* const m_pViewElementListProvider;
@@ -124,7 +128,7 @@ private:
double m_fAxisMinorStepWidthForErrorBarDecimals;
bool m_bOKPressed;
- virtual void PageCreated(USHORT nId, SfxTabPage& rPage);
+ virtual void PageCreated(sal_uInt16 nId, SfxTabPage& rPage);
Link m_aOriginalOKClickHdl;
DECL_LINK( OKPressed, void * );
diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx
index ec1b6553bd64..a84dac07ec43 100644
--- a/chart2/source/controller/inc/dlg_ShapeFont.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx
@@ -46,7 +46,7 @@ public:
virtual ~ShapeFontDialog();
private:
- virtual void PageCreated( USHORT nId, SfxTabPage& rPage );
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage );
const ViewElementListProvider* m_pViewElementListProvider;
};
diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
index 2bc57bfcffc2..cb1c250694eb 100644
--- a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
+++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx
@@ -43,7 +43,7 @@ public:
virtual ~ShapeParagraphDialog();
private:
- virtual void PageCreated( USHORT nId, SfxTabPage& rPage );
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage );
};
//.............................................................................
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index 91b16d3512d8..0cc5024683ff 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -74,7 +74,7 @@ private:
ControllerLockHelper m_aControllerLocker;
- static USHORT m_nLastPageId;
+ static sal_uInt16 m_nLastPageId;
};
//.............................................................................
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 0b5f33b5c128..e428c9c9b581 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -73,7 +73,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDocument );
void Reset(const SfxItemSet& rInAttrs);
- BOOL FillItemSet(SfxItemSet& rOutAttrs) const;
+ sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const;
void FillValueSets();
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index 8cf07aabad08..95f7d45bc27f 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -38,12 +38,14 @@
#include "ChartModelHelper.hxx"
#include "AxisHelper.hxx"
#include "CommonConverters.hxx"
+#include "ChartTypeHelper.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>
+#include <com/sun/star/chart2/AxisType.hpp>
// for SfxBoolItem
#include <svl/eitem.hxx>
@@ -58,6 +60,8 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::chart::TimeInterval;
+using ::com::sun::star::chart::TimeIncrement;
namespace
{
@@ -65,13 +69,13 @@ namespace
{
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 )
+ 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_AXIS_LABEL_ORDER, "ArrangeOrder", 0 )
+ IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 )
+ IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_BREAK, "TextBreak", 0 )
+ IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_OVERLAP, "TextOverlap", 0 )
);
return aAxisPropertyMap;
@@ -88,8 +92,8 @@ AxisItemConverter::AxisItemConverter(
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const Reference< chart2::XChartDocument > & xChartDoc,
- chart2::ExplicitScaleData * pScale /* = NULL */,
- chart2::ExplicitIncrementData * pIncrement /* = NULL */,
+ ::chart::ExplicitScaleData * pScale /* = NULL */,
+ ::chart::ExplicitIncrementData * pIncrement /* = NULL */,
::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) :
ItemConverter( rPropertySet, rItemPool ),
m_xChartDoc( xChartDoc ),
@@ -99,9 +103,9 @@ AxisItemConverter::AxisItemConverter(
Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
if( pScale )
- m_pExplicitScale = new chart2::ExplicitScaleData( *pScale );
+ m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale );
if( pIncrement )
- m_pExplicitIncrement = new chart2::ExplicitIncrementData( *pIncrement );
+ m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement );
m_aConverters.push_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel,
@@ -143,7 +147,7 @@ bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * AxisItemConverter::GetWhichPairs() const
+const sal_uInt16 * AxisItemConverter::GetWhichPairs() const
{
// must span all used items!
return nAxisWhichPairs;
@@ -162,30 +166,40 @@ bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWit
return true;
}
-void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+bool lcl_hasTimeIntervalValue( const uno::Any& rAny )
+{
+ bool bRet = false;
+ TimeInterval aValue;
+ if( rAny >>= aValue )
+ bRet = true;
+ return bRet;
+}
+
+void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
- if( ! m_xAxis.is() )
+ 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 );
+ const chart2::ScaleData& rScale( m_xAxis->getScaleData() );
+ const chart2::IncrementData& rIncrement( rScale.IncrementData );
+ const uno::Sequence< chart2::SubIncrement >& rSubIncrements( rScale.IncrementData.SubIncrements );
+ const TimeIncrement& rTimeIncrement( rScale.TimeIncrement );
+ bool bDateAxis = (chart2::AxisType::DATE == rScale.AxisType);
+ if( m_pExplicitScale )
+ bDateAxis = (chart2::AxisType::DATE == m_pExplicitScale->AxisType);
switch( nWhichId )
{
case SCHATTR_AXIS_AUTO_MAX:
- // if the any has no value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Maximum) ) );
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Maximum) ) );
break;
case SCHATTR_AXIS_MAX:
{
double fMax = 10.0;
- if( aScale.Maximum >>= fMax )
- {
+ if( rScale.Maximum >>= fMax )
rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
- }
else
{
if( m_pExplicitScale )
@@ -196,106 +210,141 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS
break;
case SCHATTR_AXIS_AUTO_MIN:
- // if the any has no value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Minimum) ) );
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Minimum) ) );
break;
case SCHATTR_AXIS_MIN:
{
double fMin = 0.0;
- if( aScale.Minimum >>= fMin )
- {
+ if( rScale.Minimum >>= fMin )
rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
- }
- else
- {
- if( m_pExplicitScale )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, 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;
+ {
+ sal_Bool bValue = AxisHelper::isLogarithmic( rScale.Scaling );
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
+ }
+ break;
case SCHATTR_AXIS_REVERSE:
- rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == aScale.Orientation) ));
+ rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == rScale.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) ) );
+ if( bDateAxis )
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MajorTimeInterval) ) );
+ else
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rIncrement.Distance) ) );
+ break;
+
+ case SCHATTR_AXIS_MAIN_TIME_UNIT:
+ {
+ TimeInterval aTimeInterval;
+ if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
+ else if( m_pExplicitIncrement )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MajorTimeInterval.TimeUnit ) );
+ }
break;
case SCHATTR_AXIS_STEP_MAIN:
+ if( bDateAxis )
+ {
+ TimeInterval aTimeInterval;
+ if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
+ rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, nWhichId ));
+ else if( m_pExplicitIncrement )
+ rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, nWhichId ));
+ }
+ else
{
double fDistance = 1.0;
- if( aInc.Distance >>= fDistance )
- {
+ if( rIncrement.Distance >>= fDistance )
rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
- }
- else
- {
- if( m_pExplicitIncrement )
- rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, 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;
+ if( bDateAxis )
+ rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MinorTimeInterval) ) );
+ else
+ rOutItemSet.Put( SfxBoolItem( nWhichId,
+ ! ( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue() )));
+ break;
+
+ case SCHATTR_AXIS_HELP_TIME_UNIT:
+ {
+ TimeInterval aTimeInterval;
+ if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
+ else if( m_pExplicitIncrement )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.TimeUnit ) );
+ }
+ break;
case SCHATTR_AXIS_STEP_HELP:
- {
- if( aSubIncs.getLength() > 0 &&
- aSubIncs[0].IntervalCount.hasValue())
+ if( bDateAxis )
{
- OSL_ASSERT( aSubIncs[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
- rOutItemSet.Put(
- SfxInt32Item(
- nWhichId,
- *reinterpret_cast< const sal_Int32 * >(
- aSubIncs[0].IntervalCount.getValue()) ));
+ TimeInterval aTimeInterval;
+ if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.Number ));
+ else if( m_pExplicitIncrement )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.Number ));
}
else
{
- if( m_pExplicitIncrement &&
- m_pExplicitIncrement->SubIncrements.getLength() > 0 )
+ if( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue())
+ {
+ OSL_ASSERT( rSubIncrements[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
+ rOutItemSet.Put( SfxInt32Item( nWhichId,
+ *reinterpret_cast< const sal_Int32 * >(
+ rSubIncrements[0].IntervalCount.getValue()) ));
+ }
+ else
{
- rOutItemSet.Put(
- SfxInt32Item(
- nWhichId,
- m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
+ if( m_pExplicitIncrement && !m_pExplicitIncrement->SubIncrements.empty() )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId,
+ m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
+ }
}
}
- }
- break;
+ break;
+
+ case SCHATTR_AXIS_AUTO_TIME_RESOLUTION:
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId,
+ !rTimeIncrement.TimeResolution.hasValue() ));
+ }
+ break;
+ case SCHATTR_AXIS_TIME_RESOLUTION:
+ {
+ long nTimeResolution=0;
+ if( rTimeIncrement.TimeResolution >>= nTimeResolution )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) );
+ else if( m_pExplicitScale )
+ rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitScale->TimeResolution ) );
+ }
+ break;
case SCHATTR_AXIS_AUTO_ORIGIN:
{
- // if the any has no double value => auto is on
- rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(aScale.Origin) )));
+ rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(rScale.Origin) )));
}
break;
case SCHATTR_AXIS_ORIGIN:
{
double fOrigin = 0.0;
- if( !(aScale.Origin >>= fOrigin) )
+ if( !(rScale.Origin >>= fOrigin) )
{
if( m_pExplicitScale )
fOrigin = m_pExplicitScale->Origin;
@@ -367,7 +416,6 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS
break;
case SID_ATTR_NUMBERFORMAT_VALUE:
-// case SCHATTR_AXIS_NUMFMT:
{
if( m_pExplicitScale )
{
@@ -391,12 +439,45 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS
break;
case SCHATTR_AXISTYPE:
- rOutItemSet.Put( SfxInt32Item( nWhichId, aScale.AxisType ));
+ rOutItemSet.Put( SfxInt32Item( nWhichId, rScale.AxisType ));
+ break;
+
+ case SCHATTR_AXIS_AUTO_DATEAXIS:
+ rOutItemSet.Put( SfxBoolItem( nWhichId, rScale.AutoDateAxis ));
+ break;
+
+ case SCHATTR_AXIS_ALLOW_DATEAXIS:
+ {
+ Reference< chart2::XCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
+ sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
+ AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), 2, nDimensionIndex );
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bChartTypeAllowsDateAxis ));
+ }
break;
}
}
-bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+bool lcl_isDateAxis( const SfxItemSet & rItemSet )
+{
+ sal_Int32 nAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( SCHATTR_AXISTYPE )).GetValue();//::com::sun::star::chart2::AxisType
+ return (chart2::AxisType::DATE == nAxisType);
+}
+
+bool lcl_isAutoMajor( const SfxItemSet & rItemSet )
+{
+ bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue();
+ return bRet;
+}
+
+bool lcl_isAutoMinor( const SfxItemSet & rItemSet )
+{
+ bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue();
+ return bRet;
+}
+
+bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
if( !m_xAxis.is() )
@@ -502,23 +583,47 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
// Increment
case SCHATTR_AXIS_AUTO_STEP_MAIN:
- if( (static_cast< const SfxBoolItem & >(
- rItemSet.Get( nWhichId )).GetValue() ))
+ if( lcl_isAutoMajor(rItemSet) )
{
aScale.IncrementData.Distance.clear();
+ aScale.TimeIncrement.MajorTimeInterval.clear();
bSetScale = true;
}
// else SCHATTR_AXIS_STEP_MAIN must have some value
break;
+ case SCHATTR_AXIS_MAIN_TIME_UNIT:
+ if( !lcl_isAutoMajor(rItemSet) )
+ {
+ if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
+ {
+ TimeInterval aTimeInterval;
+ aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
+ aValue >>= aTimeInterval.TimeUnit;
+ aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
+ bSetScale = true;
+ }
+ }
+ break;
+
case SCHATTR_AXIS_STEP_MAIN:
// only if auto if false
- if( ! (static_cast< const SfxBoolItem & >(
- rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue() ))
+ if( !lcl_isAutoMajor(rItemSet) )
{
rItemSet.Get( nWhichId ).QueryValue( aValue );
-
- if( aScale.IncrementData.Distance != aValue )
+ if( lcl_isDateAxis(rItemSet) )
+ {
+ double fValue = 1.0;
+ if( aValue >>= fValue )
+ {
+ TimeInterval aTimeInterval;
+ aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
+ aTimeInterval.Number = static_cast<double>(fValue);
+ aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
+ bSetScale = true;
+ }
+ }
+ else if( aScale.IncrementData.Distance != aValue )
{
aScale.IncrementData.Distance = aValue;
bSetScale = true;
@@ -528,35 +633,85 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
// 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() )
+ if( lcl_isAutoMinor(rItemSet) )
{
- aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
+ if( aScale.IncrementData.SubIncrements.getLength() > 0 &&
+ aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
+ {
+ aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
+ bSetScale = true;
+ }
+ if( aScale.TimeIncrement.MinorTimeInterval.hasValue() )
+ {
+ aScale.TimeIncrement.MinorTimeInterval.clear();
bSetScale = true;
+ }
}
// else SCHATTR_AXIS_STEP_MAIN must have some value
break;
+ case SCHATTR_AXIS_HELP_TIME_UNIT:
+ if( !lcl_isAutoMinor(rItemSet) )
+ {
+ if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
+ {
+ TimeInterval aTimeInterval;
+ aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
+ aValue >>= aTimeInterval.TimeUnit;
+ aScale.TimeIncrement.MinorTimeInterval = uno::makeAny( aTimeInterval );
+ bSetScale = true;
+ }
+ }
+ 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 )
+ // only if auto is false
+ if( !lcl_isAutoMinor(rItemSet) )
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+ if( lcl_isDateAxis(rItemSet) )
+ {
+ TimeInterval aTimeInterval;
+ aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
+ aValue >>= aTimeInterval.Number;
+ aScale.TimeIncrement.MinorTimeInterval = uno::makeAny(aTimeInterval);
+ bSetScale = true;
+ }
+ else if( aScale.IncrementData.SubIncrements.getLength() > 0 )
+ {
+ 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_TIME_RESOLUTION:
+ if( (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aScale.TimeIncrement.TimeResolution.clear();
+ bSetScale = true;
+ }
+ break;
+ case SCHATTR_AXIS_TIME_RESOLUTION:
+ // only if auto is false
+ if( ! (static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_TIME_RESOLUTION )).GetValue() ))
{
rItemSet.Get( nWhichId ).QueryValue( aValue );
- if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ||
- aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
+ if( aScale.TimeIncrement.TimeResolution != aValue )
{
- OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
- aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
+ aScale.TimeIncrement.TimeResolution = aValue;
bSetScale = true;
}
}
break;
+
case SCHATTR_AXIS_AUTO_ORIGIN:
{
if( (static_cast< const SfxBoolItem & >(
@@ -757,7 +912,6 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
break;
case SID_ATTR_NUMBERFORMAT_VALUE:
-// case SCHATTR_AXIS_NUMFMT:
{
if( m_pExplicitScale )
{
@@ -821,7 +975,23 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI
break;
case SCHATTR_AXISTYPE:
- //don't allow to change the axis type so far
+ {
+ sal_Int32 nNewAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();//::com::sun::star::chart2::AxisType
+ aScale.AxisType = nNewAxisType;
+ bSetScale = true;
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_DATEAXIS:
+ {
+ bool bNewValue = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
+ bool bOldValue = aScale.AutoDateAxis;
+ if( bOldValue != bNewValue )
+ {
+ aScale.AutoDateAxis = bNewValue;
+ bSetScale = true;
+ }
+ }
break;
}
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
index c1f6c1a24472..8104516c7177 100644
--- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -111,7 +111,7 @@ CharacterPropertyItemConverter::CharacterPropertyItemConverter(
CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
{}
-const USHORT * CharacterPropertyItemConverter::GetWhichPairs() const
+const sal_uInt16 * CharacterPropertyItemConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
@@ -129,7 +129,7 @@ bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPr
}
void CharacterPropertyItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
@@ -331,7 +331,7 @@ void CharacterPropertyItemConverter::FillSpecialItem(
}
bool CharacterPropertyItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 14590b6f6f9c..01b71c87d5fd 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -108,13 +108,13 @@ sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
return nStyle;
}
-bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
+bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 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;
+ sal_uInt16 nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE;
if( SFX_ITEM_SET != rItemSet.GetItemState( nSourceWhich ) )
return bChanged;
@@ -155,13 +155,13 @@ bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet &
return bChanged;
}
-bool lcl_UseSourceFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso )
+bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 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;
+ sal_uInt16 nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE;
if( SFX_ITEM_SET != rItemSet.GetItemState( nWhichId ) )
return bChanged;
@@ -291,7 +291,7 @@ bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * DataPointItemConverter::GetWhichPairs() const
+const sal_uInt16 * DataPointItemConverter::GetWhichPairs() const
{
// must span all used items!
if( m_bDataSeries )
@@ -313,7 +313,7 @@ bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNa
bool DataPointItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -545,7 +545,7 @@ bool DataPointItemConverter::ApplySpecialItem(
}
void DataPointItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
@@ -643,7 +643,7 @@ void DataPointItemConverter::FillSpecialItem(
{
SvULongs aList;
for ( sal_Int32 nN=0; nN<m_aAvailableLabelPlacements.getLength(); nN++ )
- aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< USHORT >(nN) );
+ aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< sal_uInt16 >(nN) );
rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
}
break;
diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
index 0e2e6cdd4644..8718c76c95b7 100755
--- a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx
@@ -133,7 +133,7 @@ bool ErrorBarItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * ErrorBarItemConverter::GetWhichPairs() const
+const sal_uInt16 * ErrorBarItemConverter::GetWhichPairs() const
{
// must span all used items!
return nErrorBarWhichPairs;
@@ -147,7 +147,7 @@ bool ErrorBarItemConverter::GetItemProperty(
}
bool ErrorBarItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -342,7 +342,7 @@ bool ErrorBarItemConverter::ApplySpecialItem(
}
void ErrorBarItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
index c732dfe80ede..ce7b2577767e 100644
--- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -152,7 +152,7 @@ bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter:
bool lcl_SetContentForNamedProperty(
const uno::Reference< lang::XMultiServiceFactory > & xFactory,
const ::rtl::OUString & rTableName,
- NameOrIndex & rItem, BYTE nMemberId )
+ NameOrIndex & rItem, sal_uInt8 nMemberId )
{
bool bResult = false;
if( xFactory.is())
@@ -196,9 +196,9 @@ GraphicPropertyItemConverter::GraphicPropertyItemConverter(
GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
{}
-const USHORT * GraphicPropertyItemConverter::GetWhichPairs() const
+const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const
{
- const USHORT * pResult = NULL;
+ const sal_uInt16 * pResult = NULL;
switch( m_eGraphicObjectType )
{
@@ -263,7 +263,7 @@ bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tProp
}
void GraphicPropertyItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
// if( m_eGraphicObjectType == LINE_DATA_POINT ||
@@ -310,7 +310,7 @@ void GraphicPropertyItemConverter::FillSpecialItem(
if( (aValue >>= aName) &&
aName.getLength())
{
- aItem.SetEnabled( TRUE );
+ aItem.SetEnabled( sal_True );
rOutItemSet.Put( aItem );
}
}
@@ -470,7 +470,7 @@ void GraphicPropertyItemConverter::FillSpecialItem(
}
bool GraphicPropertyItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
index 5754559ce8ae..f1a6f90f3bfe 100644
--- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -100,7 +100,7 @@ void ItemConverter::_disposing( const lang::EventObject& rSource )
void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
{
- const USHORT * pRanges = rOutItemSet.GetRanges();
+ const sal_uInt16 * pRanges = rOutItemSet.GetRanges();
tPropertyNameWithMemberId aProperty;
SfxItemPool & rPool = GetItemPool();
@@ -110,13 +110,13 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
while( (*pRanges) != 0)
{
- USHORT nBeg = (*pRanges);
+ sal_uInt16 nBeg = (*pRanges);
++pRanges;
- USHORT nEnd = (*pRanges);
+ sal_uInt16 nEnd = (*pRanges);
++pRanges;
OSL_ASSERT( nBeg <= nEnd );
- for( USHORT nWhich = nBeg; nWhich <= nEnd; ++nWhich )
+ for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich )
{
if( GetItemProperty( nWhich, aProperty ))
{
@@ -171,14 +171,14 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
}
void ItemConverter::FillSpecialItem(
- USHORT /*nWhichId*/, SfxItemSet & /*rOutItemSet*/ ) const
+ sal_uInt16 /*nWhichId*/, SfxItemSet & /*rOutItemSet*/ ) const
throw( uno::Exception )
{
OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
}
bool ItemConverter::ApplySpecialItem(
- USHORT /*nWhichId*/, const SfxItemSet & /*rItemSet*/ )
+ sal_uInt16 /*nWhichId*/, const SfxItemSet & /*rItemSet*/ )
throw( uno::Exception )
{
OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
@@ -197,7 +197,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
while( pItem )
{
- if( rItemSet.GetItemState( pItem->Which(), FALSE ) == SFX_ITEM_SET )
+ if( rItemSet.GetItemState( pItem->Which(), sal_False ) == SFX_ITEM_SET )
{
if( GetItemProperty( pItem->Which(), aProperty ))
{
@@ -242,13 +242,13 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet )
{
SfxWhichIter aIter (rSourceSet);
- USHORT nWhich = aIter.FirstWhich ();
+ sal_uInt16 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.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_SET) &&
+ (rDestSet.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_SET))
{
if (rSourceSet.Get(nWhich) != rDestSet.Get(nWhich))
{
@@ -258,7 +258,7 @@ void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItem
}
}
}
- else if( rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_DONTCARE )
+ else if( rSourceSet.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_DONTCARE )
rDestSet.InvalidateItem(nWhich);
nWhich = aIter.NextWhich ();
diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
index 3af6d9342f33..ae812d72d723 100644
--- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
@@ -91,7 +91,7 @@ bool LegendItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * LegendItemConverter::GetWhichPairs() const
+const sal_uInt16 * LegendItemConverter::GetWhichPairs() const
{
// must span all used items!
return nLegendWhichPairs;
@@ -105,7 +105,7 @@ bool LegendItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyN
bool LegendItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -185,7 +185,7 @@ bool LegendItemConverter::ApplySpecialItem(
}
void LegendItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
index e111eb314360..75965a2426fd 100644
--- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
+++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
@@ -83,7 +83,7 @@ AllAxisItemConverter::~AllAxisItemConverter()
{
}
-const USHORT * AllAxisItemConverter::GetWhichPairs() const
+const sal_uInt16 * AllAxisItemConverter::GetWhichPairs() const
{
// must span all used items!
return nAllAxisWhichPairs;
@@ -113,7 +113,7 @@ AllGridItemConverter::~AllGridItemConverter()
{
}
-const USHORT * AllGridItemConverter::GetWhichPairs() const
+const sal_uInt16 * AllGridItemConverter::GetWhichPairs() const
{
// must span all used items!
return nGridWhichPairs;
@@ -161,7 +161,7 @@ AllDataLabelItemConverter::~AllDataLabelItemConverter()
{
}
-const USHORT * AllDataLabelItemConverter::GetWhichPairs() const
+const sal_uInt16 * AllDataLabelItemConverter::GetWhichPairs() const
{
// must span all used items!
return nDataLabelWhichPairs;
@@ -195,7 +195,7 @@ AllTitleItemConverter::~AllTitleItemConverter()
{
}
-const USHORT * AllTitleItemConverter::GetWhichPairs() const
+const sal_uInt16 * AllTitleItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTitleWhichPairs;
@@ -223,7 +223,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter()
{}
-const USHORT * AllSeriesStatisticsConverter::GetWhichPairs() const
+const sal_uInt16 * AllSeriesStatisticsConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index 2fee8702e6d8..7cfd879ba85d 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -111,7 +111,7 @@ bool RegressionCurveItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * RegressionCurveItemConverter::GetWhichPairs() const
+const sal_uInt16 * RegressionCurveItemConverter::GetWhichPairs() const
{
// must span all used items!
return nRegressionCurveWhichPairs;
@@ -126,7 +126,7 @@ bool RegressionCurveItemConverter::GetItemProperty(
bool RegressionCurveItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY );
@@ -171,7 +171,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
OSL_ASSERT( xCurve.is());
if( xCurve.is())
{
- bool bNewShow = static_cast< BOOL >(
+ bool bNewShow = static_cast< sal_Bool >(
static_cast< const SfxBoolItem & >(
rItemSet.Get( nWhichId )).GetValue());
@@ -194,7 +194,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
OSL_ASSERT( xCurve.is());
if( xCurve.is())
{
- bool bNewShow = static_cast< BOOL >(
+ bool bNewShow = static_cast< sal_Bool >(
static_cast< const SfxBoolItem & >(
rItemSet.Get( nWhichId )).GetValue());
@@ -217,7 +217,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
}
void RegressionCurveItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY );
diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
index 6035f21696a9..c8bdff5f24b8 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx
@@ -116,7 +116,7 @@ bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * RegressionEquationItemConverter::GetWhichPairs() const
+const sal_uInt16 * RegressionEquationItemConverter::GetWhichPairs() const
{
// must span all used items!
return nRegEquationWhichPairs;
@@ -135,7 +135,7 @@ bool RegressionEquationItemConverter::GetItemProperty( tWhichIdType nWhichId, tP
}
bool RegressionEquationItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -166,7 +166,7 @@ bool RegressionEquationItemConverter::ApplySpecialItem(
}
void RegressionEquationItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index f7ddeb42c11e..ca8665209e44 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -43,10 +43,9 @@ namespace
EE_ITEMS_START, EE_ITEMS_END, \
SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING
-const USHORT nTitleWhichPairs[] =
+const sal_uInt16 nTitleWhichPairs[] =
{
- SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
- SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
@@ -54,40 +53,33 @@ const USHORT nTitleWhichPairs[] =
0
};
-const USHORT nAxisWhichPairs[] =
+const sal_uInt16 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
+ SCHATTR_AXIS_START, SCHATTR_AXIS_END,
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
0
};
-const USHORT nAllAxisWhichPairs[] =
+const sal_uInt16 nAllAxisWhichPairs[] =
{
- XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_LINE_FIRST, XATTR_LINE_LAST,
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
+ SCHATTR_AXIS_LABEL_START, SCHATTR_AXIS_LABEL_END,
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
0
};
-const USHORT nGridWhichPairs[] =
+const sal_uInt16 nGridWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
0
};
-const USHORT nLegendWhichPairs[] =
+const sal_uInt16 nLegendWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
@@ -97,13 +89,11 @@ const USHORT nLegendWhichPairs[] =
0
};
-const USHORT nDataLabelWhichPairs[] =
+const sal_uInt16 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
@@ -117,15 +107,13 @@ const USHORT nDataLabelWhichPairs[] =
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[] =
+const sal_uInt16 nDataPointWhichPairs[] =
{
CHART_POINT_WHICHPAIRS,
0
@@ -141,20 +129,20 @@ const USHORT nDataPointWhichPairs[] =
SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \
SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS
-const USHORT nSeriesOptionsWhichPairs[] =
+const sal_uInt16 nSeriesOptionsWhichPairs[] =
{
CHART_SERIES_OPTIONS_WHICHPAIRS,
0
};
-const USHORT nRowWhichPairs[] =
+const sal_uInt16 nRowWhichPairs[] =
{
CHART_POINT_WHICHPAIRS,
CHART_SERIES_OPTIONS_WHICHPAIRS,
0
};
-const USHORT nAreaWhichPairs[] =
+const sal_uInt16 nAreaWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
@@ -162,30 +150,28 @@ const USHORT nAreaWhichPairs[] =
0
};
-const USHORT nTextWhichPairs[] =
+const sal_uInt16 nTextWhichPairs[] =
{
CHARACTER_WHICHPAIRS,
- SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
- SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
0
};
-const USHORT nTextOrientWhichPairs[] =
+const sal_uInt16 nTextOrientWhichPairs[] =
{
CHARACTER_WHICHPAIRS,
- SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
- SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
0
};
-const USHORT nStatWhichPairs[]=
+const sal_uInt16 nStatWhichPairs[]=
{
SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
0
};
-const USHORT nErrorBarWhichPairs[]=
+const sal_uInt16 nErrorBarWhichPairs[]=
{
SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
@@ -194,26 +180,26 @@ const USHORT nErrorBarWhichPairs[]=
// for CharacterProperties
-const USHORT nCharacterPropertyWhichPairs[] =
+const sal_uInt16 nCharacterPropertyWhichPairs[] =
{
CHARACTER_WHICHPAIRS,
0
};
-const USHORT nLinePropertyWhichPairs[] =
+const sal_uInt16 nLinePropertyWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
0
};
-const USHORT nFillPropertyWhichPairs[] =
+const sal_uInt16 nFillPropertyWhichPairs[] =
{
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
0
};
-const USHORT nLineAndFillPropertyWhichPairs[] =
+const sal_uInt16 nLineAndFillPropertyWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
@@ -221,7 +207,7 @@ const USHORT nLineAndFillPropertyWhichPairs[] =
0
};
-const USHORT nChartStyleWhichPairs[] =
+const sal_uInt16 nChartStyleWhichPairs[] =
{
SCHATTR_DIAGRAM_STYLE, SCHATTR_DIAGRAM_STYLE,
SCHATTR_STYLE_SHAPE, SCHATTR_STYLE_SHAPE,
@@ -231,14 +217,14 @@ const USHORT nChartStyleWhichPairs[] =
0
};
-const USHORT nRegressionCurveWhichPairs[] =
+const sal_uInt16 nRegressionCurveWhichPairs[] =
{
SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
0
};
-const USHORT nRegEquationWhichPairs[] =
+const sal_uInt16 nRegEquationWhichPairs[] =
{
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index b1931d63cfbb..db7aa21c7a1a 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -186,7 +186,7 @@ SeriesOptionsItemConverter::~SeriesOptionsItemConverter()
{
}
-const USHORT * SeriesOptionsItemConverter::GetWhichPairs() const
+const sal_uInt16 * SeriesOptionsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nSeriesOptionsWhichPairs;
@@ -197,7 +197,7 @@ bool SeriesOptionsItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPr
return false;
}
-bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
+bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -372,7 +372,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxIte
}
void SeriesOptionsItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
@@ -434,7 +434,7 @@ void SeriesOptionsItemConverter::FillSpecialItem(
{
SvULongs aList;
for ( sal_Int32 nN=0; nN<m_aSupportedMissingValueTreatments.getLength(); nN++ )
- aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< USHORT >(nN) );
+ aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< sal_uInt16 >(nN) );
rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) );
break;
}
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
index f2df5c96dd71..8d35d5c6b2fe 100644
--- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
@@ -153,7 +153,7 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
{
SvxChartRegress eRegress = CHREGRESS_NONE;
const SfxPoolItem *pPoolItem = NULL;
- if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem ) == SFX_ITEM_SET )
+ if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
bEquationExists = ( eRegress != CHREGRESS_NONE );
@@ -203,7 +203,7 @@ StatisticsItemConverter::StatisticsItemConverter(
StatisticsItemConverter::~StatisticsItemConverter()
{}
-const USHORT * StatisticsItemConverter::GetWhichPairs() const
+const sal_uInt16 * StatisticsItemConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
@@ -217,7 +217,7 @@ bool StatisticsItemConverter::GetItemProperty(
}
bool StatisticsItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -521,7 +521,7 @@ bool StatisticsItemConverter::ApplySpecialItem(
}
void StatisticsItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
index f745dd37e9c3..7db0c06822ea 100644
--- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -75,7 +75,7 @@ public:
virtual ~FormattedStringsConverter();
protected:
- virtual const USHORT * GetWhichPairs() const;
+ virtual const sal_uInt16 * GetWhichPairs() const;
};
// ----------------------------------------
@@ -109,7 +109,7 @@ FormattedStringsConverter::~FormattedStringsConverter()
{
}
-const USHORT * FormattedStringsConverter::GetWhichPairs() const
+const sal_uInt16 * FormattedStringsConverter::GetWhichPairs() const
{
return nCharacterPropertyWhichPairs;
}
@@ -170,7 +170,7 @@ bool TitleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
}
-const USHORT * TitleItemConverter::GetWhichPairs() const
+const sal_uInt16 * TitleItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTitleWhichPairs;
@@ -190,7 +190,7 @@ bool TitleItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWi
bool TitleItemConverter::ApplySpecialItem(
- USHORT nWhichId, const SfxItemSet & rItemSet )
+ sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
throw( uno::Exception )
{
bool bChanged = false;
@@ -221,7 +221,7 @@ bool TitleItemConverter::ApplySpecialItem(
}
void TitleItemConverter::FillSpecialItem(
- USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
throw( uno::Exception )
{
switch( nWhichId )
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 675bcf40e7a2..ac3ef57a1bd9 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -49,17 +49,15 @@
#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 "UndoActions.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>
@@ -67,6 +65,8 @@
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/frame/LayoutManagerEvents.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+#include <com/sun/star/document/XUndoAction.hpp>
//-------
// header for define RET_OK
@@ -86,6 +86,7 @@
// object in the DTOR
#include <svtools/acceleratorexecute.hxx>
#include <svx/ActionDescriptionProvider.hxx>
+#include <tools/diagnose_ex.h>
// enable the following define to let the controller listen to model changes and
// react on this by rebuilding the view
@@ -133,7 +134,6 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
, m_eDrawMode( CHARTDRAW_SELECT )
{
DBG_CTOR(ChartController,NULL);
-// m_aDispatchContainer.setUndoManager( m_xUndoManager );
m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) );
}
@@ -622,9 +622,8 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
m_pChartWindow->Invalidate();
}
- uno::Reference< chart2::XUndoSupplier > xUndoSupplier( getModel(), uno::UNO_QUERY );
- if( xUndoSupplier.is())
- m_xUndoManager.set( xUndoSupplier->getUndoManager());
+ uno::Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
+ m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
return sal_True;
}
@@ -1335,7 +1334,7 @@ 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() );
+ String( SchResId( STR_ACTION_EDIT_CHARTTYPE )), m_xUndoManager );
// /--
::vos::OGuard aSolarGuard( Application::GetSolarMutex());
@@ -1344,7 +1343,7 @@ void SAL_CALL ChartController::executeDispatch_ChartType()
if( aDlg.Execute() == RET_OK )
{
impl_adaptDataSeriesAutoResize();
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
// \--
}
@@ -1360,7 +1359,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData()
// using assignment for broken gcc 3.3
UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard(
- ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_DATA_RANGES ))), m_xUndoManager, getModel() );
+ String( SchResId( STR_ACTION_EDIT_DATA_RANGES )), m_xUndoManager );
if( xChartDoc.is())
{
// /--
@@ -1369,7 +1368,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData()
if( aDlg.Execute() == RET_OK )
{
impl_adaptDataSeriesAutoResize();
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
// \--
}
@@ -1387,14 +1386,14 @@ void SAL_CALL ChartController::executeDispatch_MoveSeries( sal_Bool bForward )
UndoGuardWithSelection aUndoGuard(
ActionDescriptionProvider::createDescription(
(bForward ? ActionDescriptionProvider::MOVE_TOTOP : ActionDescriptionProvider::MOVE_TOBOTTOM),
- ::rtl::OUString( String( SchResId( STR_OBJECT_DATASERIES )))),
- m_xUndoManager, getModel());
+ String( SchResId( STR_OBJECT_DATASERIES ))),
+ m_xUndoManager );
bool bChanged = DiagramHelper::moveSeries( ChartModelHelper::findDiagram( getModel() ), xGivenDataSeries, bForward );
if( bChanged )
{
m_aSelection.setSelection( ObjectIdentifier::getMovedSeriesCID( aObjectCID, bForward ) );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -1454,13 +1453,21 @@ void SAL_CALL ChartController::modified( const lang::EventObject& /* aEvent */ )
IMPL_LINK( ChartController, NotifyUndoActionHdl, SdrUndoAction*, pUndoAction )
{
+ ENSURE_OR_RETURN( pUndoAction, "invalid Undo action", 1L );
+
::rtl::OUString aObjectCID = m_aSelection.getSelectedCID();
if ( aObjectCID.getLength() == 0 )
{
- UndoManager* pUndoManager = UndoManager::getImplementation( m_xUndoManager );
- if ( pUndoManager )
+ try
+ {
+ const Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
+ const Reference< document::XUndoManager > xUndoManager( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
+ const Reference< document::XUndoAction > xAction( new impl::ShapeUndoElement( *pUndoAction ) );
+ xUndoManager->addUndoAction( xAction );
+ }
+ catch( const uno::Exception& )
{
- pUndoManager->addShapeUndoAction( pUndoAction );
+ DBG_UNHANDLED_EXCEPTION();
}
}
return 0L;
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index f2b64eb7a9c5..f61dd48682e5 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -42,7 +42,7 @@
#include <cppuhelper/implbase12.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/document/XUndoManager.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
@@ -89,6 +89,8 @@ namespace chart
{
//.............................................................................
+class UndoGuard;
+
enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT };
class WindowController
@@ -124,7 +126,7 @@ public:
@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.
+ @return </sal_True>, if a quick help should be shown.
*/
virtual bool requestQuickHelp(
::Point aAtLogicPosition, bool bIsBalloonHelp,
@@ -578,7 +580,8 @@ private:
bool volatile m_bConnectingToView;
- ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
+ ::std::auto_ptr< UndoGuard > m_pTextActionUndoGuard;
/// needed for dispatching URLs in FeatureStateEvents
mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
@@ -700,7 +703,7 @@ private:
MOVE_OBJECT,
CENTERED_RESIZE_OBJECT
};
- /// @return </TRUE>, if resize/move was successful
+ /// @return </sal_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 );
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index 0248732a63a7..7c9bfe0c3986 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -66,12 +66,12 @@ void ChartController::executeDispatch_EditData()
::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() );
+ String( SchResId( STR_ACTION_EDIT_CHART_DATA )),
+ m_xUndoManager );
DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC );
// the dialog has no OK/Cancel
aDataEditorDialog.Execute();
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
// \--
}
}
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 0a7a4057ef9a..b6928ac99284 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -44,7 +44,7 @@
#include "DiagramHelper.hxx"
#include "macros.hxx"
#include "chartview/DrawModelWrapper.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "ViewElementListProvider.hxx"
#include "MultipleChartConverters.hxx"
#include "ControllerLockGuard.hxx"
@@ -121,8 +121,8 @@ void ChartController::executeDispatch_InsertAxes()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXES )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXES ))),
+ m_xUndoManager );
try
{
@@ -146,7 +146,7 @@ void ChartController::executeDispatch_InsertAxes()
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC
, mpRefSizeProvider.get() );
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -159,8 +159,8 @@ void ChartController::executeDispatch_InsertGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRIDS )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRIDS ))),
+ m_xUndoManager );
try
{
@@ -180,7 +180,7 @@ void ChartController::executeDispatch_InsertGrid()
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -196,8 +196,8 @@ void ChartController::executeDispatch_InsertTitles()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLES )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLES ))),
+ m_xUndoManager );
try
{
@@ -214,7 +214,7 @@ void ChartController::executeDispatch_InsertTitles()
aDlg.getResult( aDialogOutput );
bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -227,30 +227,30 @@ void ChartController::executeDispatch_DeleteLegend()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))),
+ m_xUndoManager );
LegendHelper::hideLegend( getModel() );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_InsertLegend()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))),
+ m_xUndoManager );
Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_OpenLegendDialog()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))),
+ m_xUndoManager );
try
{
@@ -264,7 +264,7 @@ void ChartController::executeDispatch_OpenLegendDialog()
ControllerLockGuard aCLGuard( getModel() );
bool bChanged = aDlg.writeToModel( getModel() );
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -280,8 +280,8 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_DATALABELS ))),
+ m_xUndoManager );
//if a series is selected insert labels for that series only:
uno::Reference< chart2::XDataSeries > xSeries(
@@ -298,7 +298,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true );
if( bSuccess )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
return;
}
@@ -330,7 +330,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
ControllerLockGuard aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -354,7 +354,7 @@ void ChartController::executeDispatch_InsertMenu_YErrorBars()
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
try
{
@@ -380,7 +380,7 @@ void ChartController::executeDispatch_InsertMenu_YErrorBars()
ControllerLockGuard aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -393,19 +393,19 @@ void ChartController::executeDispatch_InsertMeanValue()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
+ m_xUndoManager );
lcl_InsertMeanValueLine( m_xCC ).operator()(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ));
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_InsertMenu_MeanValues()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
+ m_xUndoManager );
uno::Reference< chart2::XDataSeries > xSeries(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
@@ -420,7 +420,7 @@ void ChartController::executeDispatch_InsertMenu_MeanValues()
DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( getModel() )));
::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC ));
}
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_InsertMenu_Trendlines()
@@ -437,7 +437,7 @@ void ChartController::executeDispatch_InsertMenu_Trendlines()
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
try
{
@@ -460,7 +460,7 @@ void ChartController::executeDispatch_InsertMenu_Trendlines()
ControllerLockGuard aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -477,8 +477,8 @@ void ChartController::executeDispatch_InsertTrendline()
{
UndoLiveUpdateGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE ))),
+ m_xUndoManager );
// add a linear curve
RegressionCurveHelper::addRegressionCurve(
@@ -518,7 +518,7 @@ void ChartController::executeDispatch_InsertTrendline()
ControllerLockGuard aCLGuard( getModel() );
aItemConverter.ApplyItemSet( *pOutItemSet );
}
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
}
@@ -531,8 +531,8 @@ void ChartController::executeDispatch_InsertYErrorBars()
{
UndoLiveUpdateGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_ERROR_BARS ))),
+ m_xUndoManager );
// add error bars with standard deviation
uno::Reference< beans::XPropertySet > xErrorBarProp(
@@ -568,7 +568,7 @@ void ChartController::executeDispatch_InsertYErrorBars()
ControllerLockGuard aCLGuard( getModel() );
aItemConverter.ApplyItemSet( *pOutItemSet );
}
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
}
@@ -591,11 +591,11 @@ void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
// 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() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
+ m_xUndoManager );
xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true ));
xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 ));
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
}
@@ -608,10 +608,10 @@ void ChartController::executeDispatch_InsertR2Value()
{
UndoGuard aUndoGuard = UndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
+ m_xUndoManager );
xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true ));
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -623,10 +623,10 @@ void ChartController::executeDispatch_DeleteR2Value()
{
UndoGuard aUndoGuard = UndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
+ m_xUndoManager );
xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -638,10 +638,10 @@ void ChartController::executeDispatch_DeleteMeanValue()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
+ m_xUndoManager );
RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -653,10 +653,10 @@ void ChartController::executeDispatch_DeleteTrendline()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))),
+ m_xUndoManager );
RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -668,10 +668,10 @@ void ChartController::executeDispatch_DeleteTrendlineEquation()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
+ m_xUndoManager );
RegressionCurveHelper::removeEquations( xRegCurveCnt );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -683,10 +683,10 @@ void ChartController::executeDispatch_DeleteYErrorBars()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))),
+ m_xUndoManager );
StatisticsHelper::removeErrorBars( xDataSeries );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -697,20 +697,20 @@ void ChartController::executeDispatch_InsertDataLabels()
if( xSeries.is() )
{
UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
- ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_DATALABELS ))),
+ m_xUndoManager );
DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
void ChartController::executeDispatch_InsertDataLabel()
{
UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
- ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_LABEL ))),
+ m_xUndoManager );
DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_DeleteDataLabels()
@@ -720,44 +720,44 @@ void ChartController::executeDispatch_DeleteDataLabels()
if( xSeries.is() )
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
- ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_DATALABELS ))),
+ m_xUndoManager );
DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
void ChartController::executeDispatch_DeleteDataLabel()
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
- ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_LABEL ))),
+ m_xUndoManager );
DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_ResetAllDataPoints()
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
- ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINTS )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_DATAPOINTS ))),
+ m_xUndoManager );
uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY );
if( xSeries.is() )
xSeries->resetAllDataPoints();
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_ResetDataPoint()
{
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
- ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINT )))),
- m_xUndoManager, getModel() );
+ String( SchResId( STR_OBJECT_DATAPOINT ))),
+ m_xUndoManager );
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();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_InsertAxisTitle()
@@ -768,8 +768,8 @@ void ChartController::executeDispatch_InsertAxisTitle()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLE ))),
+ m_xUndoManager );
Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() );
sal_Int32 nDimensionIndex = -1;
@@ -787,7 +787,7 @@ void ChartController::executeDispatch_InsertAxisTitle()
::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider());
xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getModel(), m_xCC, apRefSizeProvider.get() );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
/*
@@ -809,8 +809,8 @@ void ChartController::executeDispatch_InsertAxis()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXIS ))),
+ m_xUndoManager );
try
{
@@ -818,7 +818,7 @@ void ChartController::executeDispatch_InsertAxis()
if( xAxis.is() )
{
AxisHelper::makeAxisVisible( xAxis );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -831,8 +831,8 @@ void ChartController::executeDispatch_DeleteAxis()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AXIS ))),
+ m_xUndoManager );
try
{
@@ -840,7 +840,7 @@ void ChartController::executeDispatch_DeleteAxis()
if( xAxis.is() )
{
AxisHelper::makeAxisInvisible( xAxis );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -853,8 +853,8 @@ void ChartController::executeDispatch_InsertMajorGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))),
+ m_xUndoManager );
try
{
@@ -862,7 +862,7 @@ void ChartController::executeDispatch_InsertMajorGrid()
if( xAxis.is() )
{
AxisHelper::makeGridVisible( xAxis->getGridProperties() );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -875,8 +875,8 @@ void ChartController::executeDispatch_DeleteMajorGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))),
+ m_xUndoManager );
try
{
@@ -884,7 +884,7 @@ void ChartController::executeDispatch_DeleteMajorGrid()
if( xAxis.is() )
{
AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -897,8 +897,8 @@ void ChartController::executeDispatch_InsertMinorGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))),
+ m_xUndoManager );
try
{
@@ -908,7 +908,7 @@ void ChartController::executeDispatch_InsertMinorGrid()
Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
AxisHelper::makeGridVisible( aSubGrids[nN] );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
@@ -921,8 +921,8 @@ void ChartController::executeDispatch_DeleteMinorGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))),
+ m_xUndoManager );
try
{
@@ -932,7 +932,7 @@ void ChartController::executeDispatch_DeleteMinorGrid()
Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
AxisHelper::makeGridInvisible( aSubGrids[nN] );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException& e)
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index 619d308ffad2..0f2a722c2872 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -72,16 +72,16 @@ void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& r
const SfxPoolItem* pPoolItem=NULL;
//read position
- if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,TRUE,&pPoolItem))
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,sal_True,&pPoolItem))
nPosX=((const SfxInt32Item*)pPoolItem)->GetValue();
- if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,TRUE,&pPoolItem))
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,sal_True,&pPoolItem))
nPosY=((const SfxInt32Item*)pPoolItem)->GetValue();
//read size
- if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,TRUE,&pPoolItem))
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem))
nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue();
- if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,TRUE,&pPoolItem))
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem))
nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue();
- if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,TRUE,&pPoolItem))
+ if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,sal_True,&pPoolItem))
eRP=(RECT_POINT)((const SfxAllEnumItem*)pPoolItem)->GetValue();
switch( eRP )
@@ -139,7 +139,7 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize()
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::POS_SIZE,
ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
SfxAbstractTabDialog * pDlg = NULL;
try
@@ -174,7 +174,7 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize()
, awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
, awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) );
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
delete pDlg;
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 649b9cb62f9d..29f1bfa9f389 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -720,11 +720,11 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::FORMAT,
ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false );
if( bSuccess )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso )
@@ -838,15 +838,15 @@ void SAL_CALL ChartController::executeDispatch_View3D()
{
// using assignment for broken gcc 3.3
UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard(
- ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_3D_VIEW ))),
- m_xUndoManager, getModel());
+ String( SchResId( STR_ACTION_EDIT_3D_VIEW )),
+ m_xUndoManager );
// /--
//open dialog
::vos::OGuard aSolarGuard( Application::GetSolarMutex());
View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorTable() );
if( aDlg.Execute() == RET_OK )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
// \--
}
catch( uno::RuntimeException& e)
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 6091fd8ef3f8..910dcb962731 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -29,6 +29,8 @@
#include "precompiled_chart2.hxx"
#include "ChartController.hxx"
+#include "ResId.hxx"
+#include "UndoGuard.hxx"
#include "DrawViewWrapper.hxx"
#include "ChartWindow.hxx"
#include "TitleHelper.hxx"
@@ -36,6 +38,7 @@
#include "macros.hxx"
#include "ControllerLockGuard.hxx"
#include "AccessibleTextHelper.hxx"
+#include "Strings.hrc"
#include "chartview/DrawModelWrapper.hxx"
#include <svx/svdotext.hxx>
@@ -81,7 +84,9 @@ void ChartController::StartTextEdit( const Point* pMousePixel )
if(!pTextObj)
return;
- m_xUndoManager->preAction( getModel());
+ OSL_PRECOND( !m_pTextActionUndoGuard.get(), "ChartController::StartTextEdit: already have a TextUndoGuard!?" );
+ m_pTextActionUndoGuard.reset( new UndoGuard(
+ String( SchResId( STR_ACTION_EDIT_TEXT ) ), m_xUndoManager ) );
SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
//pOutliner->SetRefDevice(m_pChartWindow);
//pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool);
@@ -165,26 +170,11 @@ bool ChartController::EndTextEdit()
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 );
- }
+ OSL_ENSURE( m_pTextActionUndoGuard.get(), "ChartController::EndTextEdit: no TextUndoGuard!" );
+ if ( m_pTextActionUndoGuard.get() )
+ m_pTextActionUndoGuard->commit();
}
+ m_pTextActionUndoGuard.reset();
}
return true;
}
@@ -203,10 +193,10 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
DBG_ASSERT( pFact, "No dialog factory" );
SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
- aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
//set fixed current font
- aSet.Put( SfxBoolItem( FN_PARAM_2, TRUE ) ); //maybe not necessary in future
+ aSet.Put( SfxBoolItem( FN_PARAM_2, sal_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 ) );
@@ -218,7 +208,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
const SfxItemSet* pSet = pDlg->GetOutputItemSet();
const SfxPoolItem* pItem=0;
String aString;
- if ( pSet && pSet->GetItemState( SID_CHARMAP, TRUE, &pItem) == SFX_ITEM_SET &&
+ if ( pSet && pSet->GetItemState( SID_CHARMAP, sal_True, &pItem) == SFX_ITEM_SET &&
pItem->ISA(SfxStringItem) )
aString = dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -232,7 +222,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
// prevent flicker
pOutlinerView->HideCursor();
- pOutliner->SetUpdateMode(FALSE);
+ pOutliner->SetUpdateMode(sal_False);
// delete current selection by inserting empty String, so current
// attributes become unique (sel. has to be erased anyway)
@@ -240,7 +230,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
//SfxUndoManager& rUndoMgr = pOutliner->GetUndoManager();
//rUndoMgr.EnterListAction( String( SchResId( STR_UNDO_INSERT_SPECCHAR )), String( SchResId( STR_UNDO_INSERT_SPECCHAR )));
- pOutlinerView->InsertText(aString, TRUE);
+ pOutlinerView->InsertText(aString, sal_True);
ESelection aSel = pOutlinerView->GetSelection();
aSel.nStartPara = aSel.nEndPara;
@@ -250,7 +240,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
//rUndoMgr.LeaveListAction();
// show changes
- pOutliner->SetUpdateMode(TRUE);
+ pOutliner->SetUpdateMode(sal_True);
pOutlinerView->ShowCursor();
}
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 735cb9634671..945ccf4b4b34 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -102,7 +102,7 @@ namespace
bool lcl_deleteDataSeries(
const OUString & rCID,
const Reference< frame::XModel > & xModel,
- const Reference< chart2::XUndoManager > & xUndoManager )
+ const Reference< document::XUndoManager > & xUndoManager )
{
bool bResult = false;
uno::Reference< chart2::XDataSeries > xSeries( ::chart::ObjectIdentifier::getDataSeriesForCID( rCID, xModel ));
@@ -115,8 +115,8 @@ bool lcl_deleteDataSeries(
{
::chart::UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_DATASERIES )))),
- xUndoManager, xModel );
+ ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_DATASERIES ))),
+ xUndoManager );
Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) );
uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) );
@@ -126,7 +126,7 @@ bool lcl_deleteDataSeries(
::chart::AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram );
bResult = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
return bResult;
@@ -135,7 +135,7 @@ bool lcl_deleteDataSeries(
bool lcl_deleteDataCurve(
const OUString & rCID,
const Reference< frame::XModel > & xModel,
- const Reference< chart2::XUndoManager > & xUndoManager )
+ const Reference< document::XUndoManager > & xUndoManager )
{
bool bResult = false;
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
@@ -145,11 +145,11 @@ bool lcl_deleteDataCurve(
{
::chart::UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_CURVE )))),
- xUndoManager, xModel );
+ ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_CURVE ))),
+ xUndoManager );
::chart::RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt );
bResult = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
return bResult;
}
@@ -235,8 +235,8 @@ void ChartController::executeDispatch_NewArrangement()
{
// using assignment for broken gcc 3.3
UndoGuard aUndoGuard = UndoGuard(
- ::rtl::OUString( String( SchResId( STR_ACTION_REARRANGE_CHART ))),
- m_xUndoManager, xModel );
+ String( SchResId( STR_ACTION_REARRANGE_CHART )),
+ m_xUndoManager );
ControllerLockGuard aCtlLockGuard( xModel );
// diagram
@@ -271,7 +271,7 @@ void ChartController::executeDispatch_NewArrangement()
::std::for_each( aRegressionCurves.begin(), aRegressionCurves.end(),
RegressionCurveHelper::resetEquationPosition );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
catch( uno::RuntimeException & ex )
@@ -285,14 +285,14 @@ 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() );
+ String( SchResId( STR_ACTION_SCALE_TEXT )),
+ m_xUndoManager );
ControllerLockGuard aCtlLockGuard( getModel() );
::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider());
OSL_ASSERT( apRefSizeProv.get());
if( apRefSizeProv.get())
apRefSizeProv->toggleAutoResizeState();
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_Paste()
@@ -655,12 +655,12 @@ bool ChartController::executeDispatch_Delete()
// using assignment for broken gcc 3.3
UndoGuard aUndoGuard = UndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))),
- m_xUndoManager, getModel());
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_TITLE ))),
+ m_xUndoManager );
TitleHelper::removeTitle(
ObjectIdentifier::getTitleTypeForCID( aCID ), getModel() );
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
break;
}
case OBJECTTYPE_LEGEND:
@@ -674,11 +674,11 @@ bool ChartController::executeDispatch_Delete()
// using assignment for broken gcc 3.3
UndoGuard aUndoGuard = UndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
- m_xUndoManager, getModel() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))),
+ m_xUndoManager );
xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( false ));
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
break;
@@ -709,11 +709,11 @@ bool ChartController::executeDispatch_Delete()
// 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() );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))),
+ m_xUndoManager );
RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt );
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
break;
}
@@ -732,15 +732,15 @@ bool ChartController::executeDispatch_Delete()
// 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 );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))),
+ m_xUndoManager );
{
ControllerLockGuard aCtlLockGuard( xModel );
xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false ));
xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
}
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
break;
}
@@ -755,8 +755,8 @@ bool ChartController::executeDispatch_Delete()
// 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 );
+ ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_ERROR_BARS ))),
+ m_xUndoManager );
{
ControllerLockGuard aCtlLockGuard( xModel );
xErrorBarProp->setPropertyValue(
@@ -764,7 +764,7 @@ bool ChartController::executeDispatch_Delete()
uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ));
}
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
break;
}
@@ -780,7 +780,7 @@ bool ChartController::executeDispatch_Delete()
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::DELETE, ::rtl::OUString( String(
SchResId( aObjectType == OBJECTTYPE_DATA_LABEL ? STR_OBJECT_LABEL : STR_OBJECT_DATALABELS )))),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
chart2::DataPointLabel aLabel;
xObjectProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
aLabel.ShowNumber = false;
@@ -795,7 +795,7 @@ bool ChartController::executeDispatch_Delete()
else
xObjectProperties->setPropertyValue( C2U( "Label" ), uno::makeAny(aLabel) );
bReturn = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
break;
}
@@ -844,7 +844,7 @@ void ChartController::executeDispatch_ToggleLegend()
{
Reference< frame::XModel > xModel( getModel() );
UndoGuard aUndoGuard = UndoGuard(
- ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_LEGEND ))), m_xUndoManager, xModel );
+ String( SchResId( STR_ACTION_TOGGLE_LEGEND )), m_xUndoManager );
Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( xModel ), uno::UNO_QUERY );
bool bChanged = false;
if( xLegendProp.is())
@@ -871,14 +871,14 @@ void ChartController::executeDispatch_ToggleLegend()
}
if( bChanged )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
void ChartController::executeDispatch_ToggleGridHorizontal()
{
Reference< frame::XModel > xModel( getModel() );
UndoGuard aUndoGuard = UndoGuard(
- ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ ))), m_xUndoManager, xModel );
+ String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ )), m_xUndoManager );
Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() ));
if( xDiagram.is())
{
@@ -893,7 +893,7 @@ void ChartController::executeDispatch_ToggleGridHorizontal()
else
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram, m_xCC );
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -911,9 +911,9 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning()
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::POS_SIZE,
ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)),
- m_xUndoManager, m_aModel->getModel() );
+ m_xUndoManager );
if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) )
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
} // namespace chart
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index d3a8f7872f6f..01f241051e3c 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -565,7 +565,7 @@ void ChartController::startDoubleClickWaiting()
m_bWaitingForDoubleClick = true;
- ULONG nDblClkTime = 500;
+ sal_uLong nDblClkTime = 500;
if( m_pChartWindow )
{
const MouseSettings& rMSettings = m_pChartWindow->GetSettings().GetMouseSettings();
@@ -593,7 +593,7 @@ IMPL_LINK( ChartController, DoubleClickWaitingHdl, void*, EMPTYARG )
{
Window::PointerState aPointerState( m_pChartWindow->GetPointerState() );
MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/,
- 0/*nMode*/, static_cast< USHORT >( aPointerState.mnState )/*nButtons*/,
+ 0/*nMode*/, static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/,
0/*nModifier*/ );
impl_SetMousePointer( aMouseEvent );
}
@@ -711,7 +711,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
&& !rMEvt.IsRight() )
{
//start drag
- USHORT nDrgLog = (USHORT)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width();
+ sal_uInt16 nDrgLog = (sal_uInt16)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width();
SdrDragMethod* pDragMethod = NULL;
//change selection to 3D scene if rotate mode
@@ -801,7 +801,11 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() )
{
pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND );
- impl_switchDiagramPositioningToExcludingPositioning();
+ {
+ HiddenUndoContext aUndoContext( m_xUndoManager );
+ // don't want the positioning Undo action to appear in the UI
+ impl_switchDiagramPositioningToExcludingPositioning();
+ }
if ( pDrawViewWrapper->AreObjectsMarked() )
{
if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT )
@@ -838,12 +842,12 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if( pChartDragMethod )
{
UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
if( pDrawViewWrapper->EndDragObj(false) )
{
bDraggingDone = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
@@ -871,7 +875,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
ActionDescriptionProvider::createDescription(
eActionType,
ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ))),
- m_xUndoManager, getModel() );
+ m_xUndoManager );
bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
, getModel()
, awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight())
@@ -879,7 +883,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
if( bChanged )
{
bDraggingDone = true;
- aUndoGuard.commitAction();
+ aUndoGuard.commit();
}
}
}
@@ -974,12 +978,12 @@ void ChartController::execute_Resize()
}
void ChartController::execute_Activate()
{
- ///// pDrawViewWrapper->SetEditMode(TRUE);
+ ///// pDrawViewWrapper->SetEditMode(sal_True);
}
void ChartController::execute_Deactivate()
{
/*
- pDrawViewWrapper->SetEditMode(FALSE);
+ pDrawViewWrapper->SetEditMode(sal_False);
this->ReleaseMouse();
*/
}
@@ -1593,7 +1597,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
// 3D-Kontext wieder zerstoeren
GetWindow()->Invalidate();
- bReturn = TRUE;
+ bReturn = sal_True;
}
}
*/
@@ -1841,7 +1845,7 @@ bool ChartController::impl_moveOrResizeObject(
ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
- eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager, xChartModel );
+ eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager );
{
ControllerLockGuard aCLGuard( xChartModel );
if( bNeedShift )
@@ -1849,7 +1853,7 @@ bool ChartController::impl_moveOrResizeObject(
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();
+ aUndoGuard.commit();
}
}
return bResult;
@@ -1899,7 +1903,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent )
{
Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel()));
sal_uInt16 nModifier = rEvent.GetModifier();
- BOOL bLeftDown = rEvent.IsLeft();
+ sal_Bool bLeftDown = rEvent.IsLeft();
if ( m_pDrawViewWrapper->IsTextEdit() )
{
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx
index 8749ca1bc062..fd7dc3ad1744 100644
--- a/chart2/source/controller/main/ChartDropTargetHelper.cxx
+++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx
@@ -137,58 +137,47 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt )
// parent)
if( bDataComesFromParent )
{
+ Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() );
Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider());
- if( xDataProvider.is() &&
+ if( xDataProvider.is() && xDiagram.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 )
{
- 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")))
{
- if( aArguments[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CellRangeRepresentation")))
- {
- pCellRange = (aArguments.getArray() + i);
- aArguments[i].Value >>= aOldRange;
- break;
- }
+ pCellRange = (aArguments.getArray() + i);
+ aArguments[i].Value >>= aOldRange;
+ break;
}
- if( pCellRange )
+ }
+ 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
{
- // 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;
+ pCellRange->Value <<= aRangeString;
}
+
+ xDataSource.set( xDataProvider->createDataSource( aArguments ));
+ xDiagram->setDiagramData( xDataSource, aArguments );
+
+ // always return copy state to avoid deletion of the dragged range
+ nResult = DND_ACTION_COPY;
}
}
}
diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx
new file mode 100755
index 000000000000..69991eb081df
--- /dev/null
+++ b/chart2/source/controller/main/ChartModelClone.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "ChartModelClone.hxx"
+#include "ChartModelHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "DataSourceHelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/property.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace chart
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::chart2::XChartDocument;
+ using ::com::sun::star::chart2::XInternalDataProvider;
+ using ::com::sun::star::chart2::XAnyDescriptionAccess;
+ using ::com::sun::star::view::XSelectionSupplier;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::chart2::XTitled;
+ using ::com::sun::star::util::XModifiable;
+ using ::com::sun::star::chart2::data::XDataSource;
+ using ::com::sun::star::chart2::data::XLabeledDataSequence;
+ /** === end UNO using === **/
+
+ // =================================================================================================================
+ // = helper
+ // =================================================================================================================
+ namespace
+ {
+ Reference< XModel > lcl_cloneModel( const Reference< XModel > & xModel )
+ {
+ Reference< XModel > xResult;
+ try
+ {
+ const Reference< XCloneable > xCloneable( xModel, UNO_QUERY_THROW );
+ xResult.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xResult;
+ }
+
+ }
+
+ // =================================================================================================================
+ // = ChartModelClone
+ // =================================================================================================================
+ // -----------------------------------------------------------------------------------------------------------------
+ ChartModelClone::ChartModelClone( const Reference< XModel >& i_model, const ModelFacet i_facet )
+ {
+ m_xModelClone.set( lcl_cloneModel( i_model ) );
+
+ try
+ {
+ if ( i_facet == E_MODEL_WITH_DATA )
+ {
+ const Reference< XChartDocument > xChartDoc( m_xModelClone, UNO_QUERY_THROW );
+ ENSURE_OR_THROW( xChartDoc->hasInternalDataProvider(), "invalid chart model" );
+
+ const Reference< XCloneable > xCloneable( xChartDoc->getDataProvider(), UNO_QUERY_THROW );
+ m_xDataClone.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+
+ if ( i_facet == E_MODEL_WITH_SELECTION )
+ {
+ const Reference< XSelectionSupplier > xSelSupp( m_xModelClone->getCurrentController(), UNO_QUERY_THROW );
+ m_aSelection = xSelSupp->getSelection();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+
+ // -----------------------------------------------------------------------------------------------------------------
+ ChartModelClone::~ChartModelClone()
+ {
+ if ( !impl_isDisposed() )
+ dispose();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void ChartModelClone::dispose()
+ {
+ if ( impl_isDisposed() )
+ return;
+
+ try
+ {
+ Reference< XComponent > xComp( m_xModelClone, UNO_QUERY_THROW );
+ xComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_xModelClone.clear();
+ m_xDataClone.clear();
+ m_aSelection.clear();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ ModelFacet ChartModelClone::getFacet() const
+ {
+ if ( m_aSelection.hasValue() )
+ return E_MODEL_WITH_SELECTION;
+ if ( m_xDataClone.is() )
+ return E_MODEL_WITH_DATA;
+ return E_MODEL;
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void ChartModelClone::applyToModel( const Reference< XModel >& i_model ) const
+ {
+ applyModelContentToModel( i_model, m_xModelClone, m_xDataClone );
+
+ if ( m_aSelection.hasValue() )
+ {
+ try
+ {
+ Reference< XSelectionSupplier > xCurrentSelectionSuppl( i_model->getCurrentController(), UNO_QUERY_THROW );
+ xCurrentSelectionSuppl->select( m_aSelection );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ void ImplApplyDataToModel( const Reference< XModel >& i_model, const Reference< XInternalDataProvider > & i_data )
+ {
+ Reference< XChartDocument > xDoc( i_model, UNO_QUERY );
+ OSL_ASSERT( xDoc.is() && xDoc->hasInternalDataProvider() );
+
+ // copy data from stored internal data provider
+ if( xDoc.is() && xDoc->hasInternalDataProvider())
+ {
+ Reference< XAnyDescriptionAccess > xCurrentData( xDoc->getDataProvider(), UNO_QUERY );
+ Reference< XAnyDescriptionAccess > xSavedData( i_data, UNO_QUERY );
+ if ( xCurrentData.is() && xSavedData.is() )
+ {
+ xCurrentData->setData( xSavedData->getData() );
+ xCurrentData->setAnyRowDescriptions( xSavedData->getAnyRowDescriptions());
+ xCurrentData->setAnyColumnDescriptions( xSavedData->getAnyColumnDescriptions());
+ }
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ void ChartModelClone::applyModelContentToModel( const Reference< XModel >& i_model,
+ const Reference< XModel >& i_modelToCopyFrom, const Reference< XInternalDataProvider >& i_data )
+ {
+ ENSURE_OR_RETURN_VOID( i_model.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" );
+ ENSURE_OR_RETURN_VOID( i_modelToCopyFrom.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" );
+ try
+ {
+ // /-- loccked controllers of destination
+ ControllerLockGuard aLockedControllers( i_model );
+ Reference< XChartDocument > xSource( i_modelToCopyFrom, UNO_QUERY_THROW );
+ Reference< XChartDocument > xDestination( i_model, UNO_QUERY_THROW );
+
+ // propagate the correct flag for plotting of hidden values to the data provider and all used sequences
+ ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ) , i_model );
+
+ // diagram
+ xDestination->setFirstDiagram( xSource->getFirstDiagram() );
+
+ // main title
+ Reference< XTitled > xDestinationTitled( xDestination, UNO_QUERY_THROW );
+ Reference< XTitled > xSourceTitled( xSource, UNO_QUERY_THROW );
+ xDestinationTitled->setTitleObject( xSourceTitled->getTitleObject() );
+
+ // page background
+ ::comphelper::copyProperties(
+ xSource->getPageBackground(),
+ xDestination->getPageBackground() );
+
+ // apply data (not applied in standard Undo)
+ if ( i_data.is() )
+ ImplApplyDataToModel( i_model, i_data );
+
+ // register all sequences at the internal data provider to get adapted
+ // indexes when columns are added/removed
+ if ( xDestination->hasInternalDataProvider() )
+ {
+ Reference< XInternalDataProvider > xNewDataProvider( xDestination->getDataProvider(), UNO_QUERY );
+ Reference< XDataSource > xUsedData( DataSourceHelper::getUsedData( i_model ) );
+ if ( xUsedData.is() && xNewDataProvider.is() )
+ {
+ Sequence< Reference< 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< XModifiable > xSourceMod( xSource, UNO_QUERY );
+ Reference< XModifiable > xDestMod( xDestination, UNO_QUERY );
+ if ( xSourceMod.is() && xDestMod.is() && !xSourceMod->isModified() )
+ {
+ xDestMod->setModified( sal_False );
+ }
+ // \-- loccked controllers of destination
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+
+//......................................................................................................................
+} // namespace chart
+//......................................................................................................................
diff --git a/chart2/source/controller/main/ChartModelClone.hxx b/chart2/source/controller/main/ChartModelClone.hxx
new file mode 100755
index 000000000000..d5653b8e1ccc
--- /dev/null
+++ b/chart2/source/controller/main/ChartModelClone.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART2_CHARTMODELCLONE_HXX
+#define CHART2_CHARTMODELCLONE_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
+/** === end UNO includes === **/
+
+#include <boost/noncopyable.hpp>
+
+//......................................................................................................................
+namespace chart
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ModelFacet
+ //==================================================================================================================
+ enum ModelFacet
+ {
+ E_MODEL,
+ E_MODEL_WITH_DATA,
+ E_MODEL_WITH_SELECTION
+ };
+
+ //==================================================================================================================
+ //= ChartModelClone
+ //==================================================================================================================
+ class ChartModelClone : public ::boost::noncopyable
+ {
+ public:
+ ChartModelClone(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model,
+ const ModelFacet i_facet
+ );
+
+ ~ChartModelClone();
+
+ ModelFacet getFacet() const;
+
+ void applyToModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model ) const;
+
+ static void applyModelContentToModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_model,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_modelToCopyFrom,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > & i_data );
+
+ void dispose();
+
+ private:
+ bool impl_isDisposed() const { return !m_xModelClone.is(); }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModelClone;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xDataClone;
+ ::com::sun::star::uno::Any m_aSelection;
+ };
+
+//......................................................................................................................
+} // namespace chart
+//......................................................................................................................
+
+#endif // CHART2_CHARTMODELCLONE_HXX
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 80041d4c3818..f0c4ca80f9f2 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -64,7 +64,7 @@ ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelected
pExchgView->MarkObj( pSelectedObj, pPv );
else
pExchgView->MarkAllObj( pPv );
- Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( TRUE ));
+ Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( sal_True ));
m_xMetaFileGraphic.set( aGraphic.GetXGraphic());
if ( m_bDrawing )
{
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 54add217fb76..9d7f16faff68 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -64,9 +64,9 @@ ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent,
adjustHighContrastMode();
// chart does not depend on exact pixel painting => enable antialiased drawing
SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | GetAntialiasing() );
- EnableRTL( FALSE );
+ EnableRTL( sal_False );
if( pParent )
- pParent->EnableRTL( FALSE );// #i96215# necessary for a correct position of the context menu in rtl mode
+ pParent->EnableRTL( sal_False );// #i96215# necessary for a correct position of the context menu in rtl mode
}
ChartWindow::~ChartWindow()
@@ -247,19 +247,19 @@ void ChartWindow::ForceInvalidate()
{
::Window::Invalidate();
}
-void ChartWindow::Invalidate( USHORT nFlags )
+void ChartWindow::Invalidate( sal_uInt16 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 )
+void ChartWindow::Invalidate( const Rectangle& rRect, sal_uInt16 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 )
+void ChartWindow::Invalidate( const Region& rRegion, sal_uInt16 nFlags )
{
if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
return;
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index 2325d6be7803..2085214f0b81 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -68,9 +68,9 @@ public:
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 void Invalidate( sal_uInt16 nFlags = 0 );
+ virtual void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
+ virtual void Invalidate( const Region& rRegion, sal_uInt16 nFlags = 0 );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index e0d689340760..c0847a490ea1 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -75,12 +75,6 @@ void CommandDispatchContainer::setModel(
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 )
diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx
index 1c8769e0a6d9..a5995253e059 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.hxx
@@ -28,7 +28,6 @@
#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>
@@ -86,9 +85,6 @@ public:
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
@@ -140,9 +136,8 @@ private:
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::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xChartDispatcher;
::std::set< ::rtl::OUString > m_aChartCommands;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index aa28028c4861..f5380846dbbe 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -386,7 +386,7 @@ void DrawCommandDispatch::execute( const ::rtl::OUString& rCommand, const Sequen
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
m_pChartController->setDrawMode( eDrawMode );
- setInsertObj( sal::static_int_cast< USHORT >( eKind ) );
+ setInsertObj( sal::static_int_cast< sal_uInt16 >( eKind ) );
if ( bCreate )
{
pDrawViewWrapper->SetCreateMode();
@@ -443,7 +443,7 @@ void DrawCommandDispatch::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:StarShapes", COMMAND_ID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
}
-void DrawCommandDispatch::setInsertObj( USHORT eObj )
+void DrawCommandDispatch::setInsertObj( sal_uInt16 eObj )
{
DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
if ( pDrawViewWrapper )
@@ -527,13 +527,13 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
if ( pTextObj )
{
pTextObj->SetLogicRect( aRect );
- BOOL bVertical = ( nID == SID_DRAW_TEXT_VERTICAL );
+ sal_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( SdrTextAutoGrowWidthItem( sal_True ) );
+ aSet.Put( SdrTextAutoGrowHeightItem( sal_False ) );
aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_TOP ) );
aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) );
pTextObj->SetMergedItemSet( aSet );
diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx
index 38c886e29abb..63ddd1b7c75c 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.hxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.hxx
@@ -76,7 +76,7 @@ protected:
virtual void describeSupportedFeatures();
private:
- void setInsertObj( USHORT eObj );
+ void setInsertObj( sal_uInt16 eObj );
SdrObject* createDefaultObject( const sal_uInt16 nID );
bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType );
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index 3b41fd1b6b66..e0c4162e785a 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -162,9 +162,9 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
}
}
- USHORT nEntryPosToSelect = 0; bool bSelectionFound = false;
+ sal_uInt16 nEntryPosToSelect = 0; bool bSelectionFound = false;
aIt = m_aEntries.begin();
- for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN )
+ for( sal_uInt16 nN=0; aIt != m_aEntries.end(); ++aIt, ++nN )
{
InsertEntry( aIt->UIName );
if ( !bSelectionFound && aSelectedOID == aIt->OID )
@@ -177,7 +177,7 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
if( bSelectionFound )
SelectEntryPos(nEntryPosToSelect);
- USHORT nEntryCount = GetEntryCount();
+ sal_uInt16 nEntryCount = GetEntryCount();
if( nEntryCount > 100 )
nEntryCount = 100;
SetDropDownLineCount( nEntryCount );
@@ -205,7 +205,7 @@ void SelectorListBox::Select()
if ( !IsTravelSelect() )
{
- USHORT nPos = GetSelectEntryPos();
+ sal_uInt16 nPos = GetSelectEntryPos();
if( nPos < m_aEntries.size() )
{
ObjectHierarchy::tOID aOID = m_aEntries[nPos].OID;
@@ -223,7 +223,7 @@ long SelectorListBox::Notify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == EVENT_KEYINPUT )
{
- USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+ sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
switch ( nCode )
{
diff --git a/chart2/source/controller/main/ImplUndoManager.cxx b/chart2/source/controller/main/ImplUndoManager.cxx
deleted file mode 100644
index 0976b7db286e..000000000000
--- a/chart2/source/controller/main/ImplUndoManager.cxx
+++ /dev/null
@@ -1,503 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/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
deleted file mode 100644
index 4dde0bc65719..000000000000
--- a/chart2/source/controller/main/ImplUndoManager.hxx
+++ /dev/null
@@ -1,227 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index b2eccae6c98d..983d7cd83980 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -272,10 +272,10 @@ void ShapeController::executeDispatch_FormatLine()
{
SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
- BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
if ( bHasMarked )
{
- pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False );
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
@@ -288,11 +288,11 @@ void ShapeController::executeDispatch_FormatLine()
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
if ( bHasMarked )
{
- pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE );
+ pDrawViewWrapper->SetAttrToMarked( *pOutAttr, sal_False );
}
else
{
- pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False );
}
}
}
@@ -311,10 +311,10 @@ void ShapeController::executeDispatch_FormatArea()
if ( pParent && pDrawModelWrapper && pDrawViewWrapper )
{
SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
- BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
if ( bHasMarked )
{
- pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False );
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
@@ -336,11 +336,11 @@ void ShapeController::executeDispatch_FormatArea()
const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
if ( bHasMarked )
{
- pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE );
+ pDrawViewWrapper->SetAttrToMarked( *pOutAttr, sal_False );
}
else
{
- pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False );
}
}
}
@@ -359,10 +359,10 @@ void ShapeController::executeDispatch_TextAttributes()
if ( pParent && pDrawViewWrapper )
{
SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
- BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked();
+ sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
if ( bHasMarked )
{
- pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE );
+ pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False );
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
@@ -378,7 +378,7 @@ void ShapeController::executeDispatch_TextAttributes()
}
else
{
- pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE );
+ pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False );
}
}
}
@@ -410,7 +410,7 @@ void ShapeController::executeDispatch_TransformDialog()
pFact->CreateCaptionDialog( pParent, pDrawViewWrapper ) );
if ( pDlg.get() )
{
- const USHORT* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
+ const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
aCombAttr.Put( aAttr );
aCombAttr.Put( aGeoAttr );
diff --git a/chart2/source/controller/main/ShapeToolbarController.cxx b/chart2/source/controller/main/ShapeToolbarController.cxx
index 9c6ed747e1d5..f9cfc202e2ad 100644
--- a/chart2/source/controller/main/ShapeToolbarController.cxx
+++ b/chart2/source/controller/main/ShapeToolbarController.cxx
@@ -126,10 +126,10 @@ void ShapeToolbarController::initialize( const Sequence< uno::Any >& rArguments
ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
if ( pToolBox )
{
- const USHORT nCount = pToolBox->GetItemCount();
- for ( USHORT nPos = 0; nPos < nCount; ++nPos )
+ const sal_uInt16 nCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
{
- const USHORT nItemId = pToolBox->GetItemId( nPos );
+ const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
{
m_nToolBoxId = nItemId;
@@ -201,9 +201,9 @@ void ShapeToolbarController::statusChanged( const frame::FeatureStateEvent& Even
sal_Bool bCheckmark = sal_False;
ToolBox& rTb = m_pToolbarController->GetToolBox();
- for ( USHORT i = 0; i < rTb.GetItemCount(); ++i )
+ for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); ++i )
{
- USHORT nId = rTb.GetItemId( i );
+ sal_uInt16 nId = rTb.GetItemId( i );
if ( nId == 0 )
{
continue;
diff --git a/chart2/source/controller/main/UndoActions.cxx b/chart2/source/controller/main/UndoActions.cxx
new file mode 100644
index 000000000000..86c0e365f590
--- /dev/null
+++ b/chart2/source/controller/main/UndoActions.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 "UndoActions.hxx"
+#include "DisposeHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "PropertyHelper.hxx"
+#include "ChartModelClone.hxx"
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <tools/diagnose_ex.h>
+#include <svx/svdundo.hxx>
+
+#include <boost/bind.hpp>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+
+namespace chart
+{
+namespace impl
+{
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::view::XSelectionSupplier;
+ using ::com::sun::star::chart2::XChartDocument;
+ using ::com::sun::star::document::UndoFailedException;
+ /** === end UNO using === **/
+
+// ---------------------------------------------------------------------------------------------------------------------
+UndoElement::UndoElement( const OUString& i_actionString, const Reference< XModel >& i_documentModel, const ::boost::shared_ptr< ChartModelClone >& i_modelClone )
+ :UndoElement_MBase()
+ ,UndoElement_TBase( m_aMutex )
+ ,m_sActionString( i_actionString )
+ ,m_xDocumentModel( i_documentModel )
+ ,m_pModelClone( i_modelClone )
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+UndoElement::~UndoElement()
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UndoElement::disposing()
+{
+ if ( !!m_pModelClone )
+ m_pModelClone->dispose();
+ m_pModelClone.reset();
+ m_xDocumentModel.clear();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UndoElement::getTitle() throw (RuntimeException)
+{
+ return m_sActionString;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UndoElement::impl_toggleModelState()
+{
+ // get a snapshot of the current state of our model
+ ::boost::shared_ptr< ChartModelClone > pNewClone( new ChartModelClone( m_xDocumentModel, m_pModelClone->getFacet() ) );
+ // apply the previous snapshot to our model
+ m_pModelClone->applyToModel( m_xDocumentModel );
+ // remember the new snapshot, for the next toggle
+ m_pModelClone = pNewClone;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UndoElement::undo( ) throw (UndoFailedException, RuntimeException)
+{
+ impl_toggleModelState();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UndoElement::redo( ) throw (UndoFailedException, RuntimeException)
+{
+ impl_toggleModelState();
+}
+
+// =====================================================================================================================
+// = ShapeUndoElement
+// =====================================================================================================================
+
+// ---------------------------------------------------------------------------------------------------------------------
+ShapeUndoElement::ShapeUndoElement( SdrUndoAction& i_sdrUndoAction )
+ :ShapeUndoElement_MBase()
+ ,ShapeUndoElement_TBase( m_aMutex )
+ ,m_pAction( &i_sdrUndoAction )
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+ShapeUndoElement::~ShapeUndoElement()
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ShapeUndoElement::getTitle() throw (RuntimeException)
+{
+ if ( !m_pAction )
+ throw DisposedException( ::rtl::OUString(), *this );
+ return m_pAction->GetComment();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL ShapeUndoElement::undo( ) throw (UndoFailedException, RuntimeException)
+{
+ if ( !m_pAction )
+ throw DisposedException( ::rtl::OUString(), *this );
+ m_pAction->Undo();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL ShapeUndoElement::redo( ) throw (UndoFailedException, RuntimeException)
+{
+ if ( !m_pAction )
+ throw DisposedException( ::rtl::OUString(), *this );
+ m_pAction->Redo();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL ShapeUndoElement::disposing()
+{
+}
+
+} // namespace impl
+} // namespace chart
diff --git a/chart2/source/controller/main/UndoActions.hxx b/chart2/source/controller/main/UndoActions.hxx
new file mode 100644
index 000000000000..2c98d6af1d54
--- /dev/null
+++ b/chart2/source/controller/main/UndoActions.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_IMPLUNDOMANAGER_HXX
+#define CHART2_IMPLUNDOMANAGER_HXX
+
+#include "ConfigItemListener.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/XUndoAction.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <rtl/ustring.hxx>
+#include <unotools/configitem.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <utility>
+#include <deque>
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+class SdrUndoAction;
+
+namespace com { namespace sun { namespace star {
+namespace chart2 {
+ class XInternalDataProvider;
+}
+}}}
+
+
+namespace chart
+{
+class ChartModelClone;
+
+namespace impl
+{
+
+typedef ::cppu::BaseMutex UndoElement_MBase;
+typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::document::XUndoAction > UndoElement_TBase;
+
+class UndoElement :public UndoElement_MBase
+ ,public UndoElement_TBase
+ ,public ::boost::noncopyable
+{
+public:
+ /** creates a new undo action
+
+ @param i_actionString
+ is the title of the Undo action
+ @param i_documentModel
+ is the actual document model which the undo actions operates on
+ @param i_modelClone
+ is the cloned model from before the changes, which the Undo action represents, have been applied.
+ Upon <member>invoking</member>, the clone model is applied to the document model.
+ */
+ UndoElement( const ::rtl::OUString & i_actionString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_documentModel,
+ const ::boost::shared_ptr< ChartModelClone >& i_modelClone
+ );
+
+ // XUndoAction
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+protected:
+ virtual ~UndoElement();
+
+private:
+ void impl_toggleModelState();
+
+private:
+ ::rtl::OUString m_sActionString;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocumentModel;
+ ::boost::shared_ptr< ChartModelClone > m_pModelClone;
+};
+
+
+typedef ::cppu::BaseMutex ShapeUndoElement_MBase;
+typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::document::XUndoAction > ShapeUndoElement_TBase;
+class ShapeUndoElement :public ShapeUndoElement_MBase
+ ,public ShapeUndoElement_TBase
+{
+public:
+ ShapeUndoElement( SdrUndoAction& i_sdrUndoAction );
+
+ // XUndoAction
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+protected:
+ virtual ~ShapeUndoElement();
+
+private:
+ SdrUndoAction* m_pAction;
+};
+
+} // namespace impl
+} // namespace chart
+
+// CHART2_IMPLUNDOMANAGER_HXX
+#endif
diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx
index 128a4b4091d0..487def377d5c 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.cxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.cxx
@@ -29,13 +29,15 @@
#include "precompiled_chart2.hxx"
#include "UndoCommandDispatch.hxx"
+#include "ResId.hxx"
#include "macros.hxx"
-#include <com/sun/star/chart2/XUndoSupplier.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <tools/diagnose_ex.h>
// for ressource strings STR_UNDO and STR_REDO
#include <svtools/svtools.hrc>
@@ -56,10 +58,8 @@ UndoCommandDispatch::UndoCommandDispatch(
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());
+ uno::Reference< document::XUndoManagerSupplier > xSuppUndo( m_xModel, uno::UNO_QUERY_THROW );
+ m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
}
UndoCommandDispatch::~UndoCommandDispatch()
@@ -68,10 +68,8 @@ UndoCommandDispatch::~UndoCommandDispatch()
void UndoCommandDispatch::initialize()
{
Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY );
- if( xBroadcaster.is() )
- {
- xBroadcaster->addModifyListener( this );
- }
+ ENSURE_OR_RETURN_VOID( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing modification broadcaster interface!" );
+ xBroadcaster->addModifyListener( this );
}
void UndoCommandDispatch::fireStatusEvent(
@@ -82,23 +80,23 @@ void UndoCommandDispatch::fireStatusEvent(
{
bool bFireAll = (rURL.getLength() == 0);
uno::Any aUndoState, aRedoState;
- if( m_xUndoManager->undoPossible())
+ if( m_xUndoManager->isUndoPossible())
{
// using assignment for broken gcc 3.3
OUString aUndo = OUString( String( SvtResId( STR_UNDO )));
- aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString());
+ aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoActionTitle());
}
- if( m_xUndoManager->redoPossible())
+ if( m_xUndoManager->isRedoPossible())
{
// using assignment for broken gcc 3.3
OUString aRedo = OUString( String( SvtResId( STR_REDO )));
- aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoString());
+ aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoActionTitle());
}
if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Undo")))
- fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->undoPossible(), xSingleListener );
+ fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->isUndoPossible(), xSingleListener );
if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Redo")))
- fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->redoPossible(), xSingleListener );
+ fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->isRedoPossible(), xSingleListener );
}
}
@@ -113,10 +111,21 @@ void SAL_CALL UndoCommandDispatch::dispatch(
// 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 );
+ try
+ {
+ if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" )))
+ m_xUndoManager->undo();
+ else
+ m_xUndoManager->redo();
+ }
+ catch( const document::UndoFailedException& )
+ {
+ // silently ignore
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
// \--
}
}
@@ -126,6 +135,7 @@ void SAL_CALL UndoCommandDispatch::dispatch(
void SAL_CALL UndoCommandDispatch::disposing()
{
Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY );
+ OSL_ENSURE( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing modification broadcaster interface!" );
if( xBroadcaster.is() )
{
xBroadcaster->removeModifyListener( this );
diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx
index 28fb813f63de..891ab8b019e5 100644
--- a/chart2/source/controller/main/UndoCommandDispatch.hxx
+++ b/chart2/source/controller/main/UndoCommandDispatch.hxx
@@ -30,15 +30,12 @@
#include "CommandDispatch.hxx"
#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/chart2/XUndoManager.hpp>
+#include <com/sun/star/document/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
{
@@ -77,7 +74,7 @@ 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;
+ ::com::sun::star::document::XUndoManager > m_xUndoManager;
};
} // namespace chart
diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx
index 8513b6ba9093..52ea27aa8d49 100644
--- a/chart2/source/controller/main/UndoGuard.cxx
+++ b/chart2/source/controller/main/UndoGuard.cxx
@@ -29,6 +29,12 @@
#include "precompiled_chart2.hxx"
#include "UndoGuard.hxx"
+#include "ChartModelClone.hxx"
+#include "UndoActions.hxx"
+
+#include <com/sun/star/container/XChild.hpp>
+
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
@@ -39,105 +45,154 @@ 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::UndoGuard( const OUString& i_undoString, const uno::Reference< document::XUndoManager > & i_undoManager,
+ const ModelFacet i_facet )
+ :m_xChartModel( i_undoManager->getParent(), uno::UNO_QUERY_THROW )
+ ,m_xUndoManager( i_undoManager )
+ ,m_pDocumentSnapshot()
+ ,m_aUndoString( i_undoString )
+ ,m_bActionPosted( false )
{
+ m_pDocumentSnapshot.reset( new ChartModelClone( m_xChartModel, i_facet ) );
}
-UndoGuard_Base::~UndoGuard_Base()
+//-----------------------------------------------------------------------------
+
+UndoGuard::~UndoGuard()
{
+ if ( !!m_pDocumentSnapshot )
+ discardSnapshot();
}
-void UndoGuard_Base::commitAction()
+//-----------------------------------------------------------------------------
+
+void UndoGuard::commit()
{
- if( !m_bActionPosted && m_xUndoManager.is() )
- m_xUndoManager->postAction( m_aUndoString );
+ if ( !m_bActionPosted && !!m_pDocumentSnapshot )
+ {
+ try
+ {
+ const Reference< document::XUndoAction > xAction( new impl::UndoElement( m_aUndoString, m_xChartModel, m_pDocumentSnapshot ) );
+ m_pDocumentSnapshot.reset(); // don't dispose, it's data went over to the UndoElement
+ m_xUndoManager->addUndoAction( xAction );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
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 )
+void UndoGuard::rollback()
{
- if( m_xUndoManager.is() )
- m_xUndoManager->preAction( m_xModel );
+ ENSURE_OR_RETURN_VOID( !!m_pDocumentSnapshot, "no snapshot!" );
+ m_pDocumentSnapshot->applyToModel( m_xChartModel );
+ discardSnapshot();
}
-UndoGuard::~UndoGuard()
+//-----------------------------------------------------------------------------
+void UndoGuard::discardSnapshot()
{
- if( !m_bActionPosted && m_xUndoManager.is() )
- m_xUndoManager->cancelAction();
+ ENSURE_OR_RETURN_VOID( !!m_pDocumentSnapshot, "no snapshot!" );
+ m_pDocumentSnapshot->dispose();
+ m_pDocumentSnapshot.reset();
}
//-----------------------------------------------------------------------------
-UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& rUndoString
- , const uno::Reference< chart2::XUndoManager > & xUndoManager
- , const uno::Reference< frame::XModel > & xModel )
- : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager )
+ :UndoGuard( i_undoString, i_undoManager, E_MODEL )
{
- if( m_xUndoManager.is() )
- m_xUndoManager->preAction( m_xModel );
}
UndoLiveUpdateGuard::~UndoLiveUpdateGuard()
{
- if( !m_bActionPosted && m_xUndoManager.is() )
- m_xUndoManager->cancelActionWithUndo( m_xModel );
+ if ( !isActionPosted() )
+ rollback();
}
//-----------------------------------------------------------------------------
-UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData( const OUString& rUndoString
- , const uno::Reference< chart2::XUndoManager > & xUndoManager
- , const uno::Reference< frame::XModel > & xModel )
- : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData(
+ const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager )
+ :UndoGuard( i_undoString, i_undoManager, E_MODEL_WITH_DATA )
{
- 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 );
+ if ( !isActionPosted() )
+ rollback();
}
//-----------------------------------------------------------------------------
-UndoGuardWithSelection::UndoGuardWithSelection( const rtl::OUString& rUndoString
- , const uno::Reference< chart2::XUndoManager > & xUndoManager
- , const uno::Reference< frame::XModel > & xModel )
- : UndoGuard_Base( rUndoString, xUndoManager, xModel )
+UndoGuardWithSelection::UndoGuardWithSelection(
+ const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager )
+ :UndoGuard( i_undoString, i_undoManager, E_MODEL_WITH_SELECTION )
{
- if( m_xUndoManager.is() )
+}
+
+//-----------------------------------------------------------------------------
+
+UndoGuardWithSelection::~UndoGuardWithSelection()
+{
+ if ( !isActionPosted() )
+ rollback();
+}
+
+//-----------------------------------------------------------------------------
+
+UndoContext::UndoContext( const Reference< document::XUndoManager > & i_undoManager, const ::rtl::OUString& i_undoTitle )
+ :m_xUndoManager( i_undoManager )
+{
+ ENSURE_OR_THROW( m_xUndoManager.is(), "invalid undo manager!" );
+ m_xUndoManager->enterUndoContext( i_undoTitle );
+}
+
+//-----------------------------------------------------------------------------
+
+UndoContext::~UndoContext()
+{
+ m_xUndoManager->leaveUndoContext();
+}
+
+//-----------------------------------------------------------------------------
+
+HiddenUndoContext::HiddenUndoContext( const Reference< document::XUndoManager > & i_undoManager )
+ :m_xUndoManager( i_undoManager )
+{
+ ENSURE_OR_THROW( m_xUndoManager.is(), "invalid undo manager!" );
+ try
+ {
+ m_xUndoManager->enterHiddenUndoContext();
+ }
+ catch( const uno::Exception& )
{
- 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 );
+ DBG_UNHANDLED_EXCEPTION();
+ m_xUndoManager.clear();
+ // prevents the leaveUndoContext in the dtor
}
}
-UndoGuardWithSelection::~UndoGuardWithSelection()
+//-----------------------------------------------------------------------------
+
+HiddenUndoContext::~HiddenUndoContext()
{
- if( !m_bActionPosted && m_xUndoManager.is() )
- m_xUndoManager->cancelAction();
+ try
+ {
+ if ( m_xUndoManager.is() )
+ m_xUndoManager->leaveUndoContext();
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
} // namespace chart
diff --git a/chart2/source/controller/main/UndoGuard.hxx b/chart2/source/controller/main/UndoGuard.hxx
new file mode 100644
index 000000000000..c5c00dd62d1b
--- /dev/null
+++ b/chart2/source/controller/main/UndoGuard.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_UNDOGUARD_HXX
+#define CHART2_UNDOGUARD_HXX
+
+#include "ChartModelClone.hxx"
+
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+/** A guard which which does nothing, unless you explicitly call commitAction. In particular, in its destructor, it
+ does neither auto-commit nor auto-rollback the model changes.
+ */
+class UndoGuard
+{
+public:
+ explicit UndoGuard(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager,
+ const ModelFacet i_facet = E_MODEL
+ );
+ ~UndoGuard();
+
+ void commit();
+ void rollback();
+
+protected:
+ bool isActionPosted() const { return m_bActionPosted; }
+
+private:
+ void discardSnapshot();
+
+private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
+
+ ::boost::shared_ptr< ChartModelClone > m_pDocumentSnapshot;
+ rtl::OUString m_aUndoString;
+ bool m_bActionPosted;
+};
+
+/** A guard which, in its destructor, restores the model state it found in the constructor. If
+ <member>commitAction</member> is called inbetween, the restouration is not performed.
+ */
+class UndoLiveUpdateGuard : public UndoGuard
+{
+public:
+ explicit UndoLiveUpdateGuard(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ ~UndoLiveUpdateGuard();
+};
+
+/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
+ Only use this if the data has internal data.
+ */
+class UndoLiveUpdateGuardWithData :
+ public UndoGuard
+{
+public:
+ explicit UndoLiveUpdateGuardWithData(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ ~UndoLiveUpdateGuardWithData();
+};
+
+class UndoGuardWithSelection : public UndoGuard
+{
+public:
+ explicit UndoGuardWithSelection(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ virtual ~UndoGuardWithSelection();
+};
+
+class UndoContext
+{
+public:
+ UndoContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager,
+ const ::rtl::OUString& i_undoTitle
+ );
+ ~UndoContext();
+
+private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
+};
+
+class HiddenUndoContext
+{
+public:
+ HiddenUndoContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ ~HiddenUndoContext();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
+};
+
+}
+// CHART2_UNDOGUARD_HXX
+#endif
diff --git a/chart2/source/controller/main/UndoManager.cxx b/chart2/source/controller/main/UndoManager.cxx
deleted file mode 100644
index 21b3bbc1f725..000000000000
--- a/chart2/source/controller/main/UndoManager.cxx
+++ /dev/null
@@ -1,438 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/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/makefile.mk b/chart2/source/controller/main/makefile.mk
index 729276d5bd0e..557d6cf6216f 100644
--- a/chart2/source/controller/main/makefile.mk
+++ b/chart2/source/controller/main/makefile.mk
@@ -72,12 +72,9 @@ SLOFILES = \
$(SLO)$/DrawCommandDispatch.obj \
$(SLO)$/ShapeController.obj \
$(SLO)$/ShapeToolbarController.obj \
- $(SLO)$/ImplUndoManager.obj \
- $(SLO)$/UndoManager.obj \
- $(SLO)$/UndoGuard.obj
-
-# $(SLO)$/CommonConverters.obj \
-# $(SLO)$/Scaling.obj \
+ $(SLO)$/UndoActions.obj \
+ $(SLO)$/UndoGuard.obj \
+ $(SLO)$/ChartModelClone.obj \
# --- Targets -----------------------------------------------------------------
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index 75e69436a784..839b9276d480 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -29,10 +29,12 @@
#include "charttoolsdllapi.hxx"
#include "ReferenceSizeProvider.hxx"
+#include "ExplicitCategoriesProvider.hxx"
#include <com/sun/star/chart2/XChartType.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <vector>
@@ -58,6 +60,15 @@ public:
static bool isLogarithmic( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XScaling >& xScaling );
+ static void checkDateAxis( ::com::sun::star::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
+ static ::com::sun::star::chart2::ScaleData getDateCheckedScale( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+
+ static sal_Int32 getExplicitNumberFormatKeyForAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , bool bSearchForParallelAxisIfNothingIsFound );
+
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XAxis >
createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
@@ -178,7 +189,7 @@ public:
, sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
/** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
- </TRUE> are returned
+ </sal_True> are returned
*/
static ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Reference<
@@ -188,7 +199,7 @@ public:
, bool bOnlyVisible = false );
/** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
- </TRUE> are returned
+ </sal_True> are returned
*/
SAL_DLLPRIVATE static std::vector<
::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index fb087abf15fd..7dbf0459d870 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -31,7 +31,6 @@
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XUndoManager.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index 729cfc86bc52..67df6027d2d7 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -61,8 +61,9 @@ public:
static bool isSupportingStartingAngle( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
//starting value for bars or baseline for areas for example
static bool isSupportingBaseValue( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
- static bool shiftTicksAtXAxisPerDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool shiftCategoryPosAtXAxisPerDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
static bool isSupportingAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
+ static bool isSupportingDateAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex );
//returns sequence of ::com::sun::star::chart::DataLabelPlacement
static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedLabelPlacements(
diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx
index 13435741e63e..eec5b59dd582 100644
--- a/chart2/source/inc/CommonFunctors.hxx
+++ b/chart2/source/inc/CommonFunctors.hxx
@@ -67,18 +67,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS AnyToDouble : public ::std::unary_function< ::co
::rtl::math::setNan( & fResult );
::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() );
- if( eClass == ::com::sun::star::uno::TypeClass_STRING )
- {
- rtl_math_ConversionStatus eConversionStatus;
- fResult = ::rtl::math::stringToDouble(
- * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ),
- sal_Char( '.' ), sal_Char( ',' ),
- & eConversionStatus, NULL );
-
- if( eConversionStatus != rtl_math_ConversionStatus_Ok )
- ::rtl::math::setNan( & fResult );
- }
- else if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE )
+ if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE )
{
fResult = * reinterpret_cast< const double * >( rAny.getValue() );
}
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index c7cda6189680..7f4821bab248 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -38,6 +38,8 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <utility>
#include <vector>
@@ -108,7 +110,7 @@ public:
);
/** @param bOnlyAtFirstChartType
- If </TRUE>, the stacking mode is only set at the series found inside
+ If </sal_True>, the stacking mode is only set at the series found inside
the first chart type. This is the standard for all current
templates (the only template that has more than one chart-type and
allows stacking is bar/line combi, and for this the stacking only
@@ -240,6 +242,21 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem > & xCooSys );
+ static void switchToDateCategories(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ static void switchToTextCategories(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ static bool isSupportingDateAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
+ static bool isDateNumberFormat( sal_Int32 nNumberFormat, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& xNumberFormats );
+ static sal_Int32 getDateNumberFormat( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+
+ static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
+
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartType >
getChartTypeByIndex( const ::com::sun::star::uno::Reference<
@@ -270,7 +287,7 @@ public:
* @param bForward
* Direction of the move to be checked.
*
- * @returns </TRUE> if the series can be moved.
+ * @returns </sal_True> if the series can be moved.
*
*/
static bool isSeriesMoveable(
@@ -292,7 +309,7 @@ public:
* @param bForward
* Direction in which the series should be moved.
*
- * @returns </TRUE> if the series was moved successfully.
+ * @returns </sal_True> if the series was moved successfully.
*
*/
static bool moveSeries(
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index 18d54eb6e2ad..f8d17c277036 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -58,6 +58,24 @@ public:
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
};
+struct DatePlusIndex
+{
+ DatePlusIndex()
+ : fValue(1.0)
+ , nIndex( -1 )
+ {
+ }
+
+ DatePlusIndex( const double& _fValue, sal_Int32 _nIndex )
+ : fValue(_fValue)
+ , nIndex( _nIndex )
+ {
+ }
+
+ double fValue;
+ sal_Int32 nIndex;
+};
+
class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
{
public:
@@ -70,6 +88,9 @@ public:
void init();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence > getOriginalCategories();
+
::com::sun::star::uno::Sequence< ::rtl::OUString > getSimpleCategories();
::std::vector< ComplexCategory > getCategoriesByLevel( sal_Int32 nLevel );
@@ -83,23 +104,37 @@ public:
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getExplicitSimpleCategories(
const SplitCategoriesProvider& rSplitCategoriesProvider );
+ static void convertCategoryAnysToText( ::com::sun::star::uno::Sequence< rtl::OUString >& rOutTexts
+ , const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rInAnys
+ , ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xChartModel );
+
bool hasComplexCategories() const;
sal_Int32 getCategoryLevelCount() const;
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList();
+ bool isDateAxis();
+ const std::vector< DatePlusIndex >& getDateCategories();
+
private: //member
- ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
- ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats;
bool volatile m_bDirty;
-
::com::sun::star::uno::WeakReference<
- ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
+ ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
+
+ bool m_bIsExplicitCategoriesInited;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
+ ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
+
+ bool m_bIsDateAxis;
+ bool m_bIsAutoDate;
+ std::vector< DatePlusIndex > m_aDateCategories;
};
} // namespace chart
diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx
index 6b6590cffdac..033d2f741f39 100755
--- a/chart2/source/inc/InternalData.hxx
+++ b/chart2/source/inc/InternalData.hxx
@@ -53,11 +53,11 @@ public:
void setColumnValues( sal_Int32 nColumnIndex, const ::std::vector< double > & rNewData );
void setRowValues( sal_Int32 nRowIndex, const ::std::vector< double > & rNewData );
- void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel );
- void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel );
+ void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel );
+ void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel );
- ::std::vector< ::rtl::OUString > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
- ::std::vector< ::rtl::OUString > getComplexRowLabel( sal_Int32 nRowIndex ) const;
+ ::std::vector< ::com::sun::star::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
+ ::std::vector< ::com::sun::star::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) const;
void swapRowWithNext( sal_Int32 nRowIndex );
void swapColumnWithNext( sal_Int32 nColumnIndex );
@@ -76,12 +76,12 @@ public:
sal_Int32 getColumnCount() const;
typedef ::std::valarray< double > tDataType;
- typedef ::std::vector< ::std::vector< ::rtl::OUString > > tVecVecString; //inner index is hierarchical level
+ typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Any > > tVecVecAny; //inner index is hierarchical level
- void setComplexRowLabels( const tVecVecString& rNewRowLabels );
- tVecVecString getComplexRowLabels() const;
- void setComplexColumnLabels( const tVecVecString& rNewColumnLabels );
- tVecVecString getComplexColumnLabels() const;
+ void setComplexRowLabels( const tVecVecAny& rNewRowLabels );
+ tVecVecAny getComplexRowLabels() const;
+ void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels );
+ tVecVecAny getComplexColumnLabels() const;
#if OSL_DEBUG_LEVEL > 2
void traceData() const;
@@ -91,7 +91,7 @@ private: //methods
/** resizes the data if at least one of the given dimensions is larger than
before. The data is never becoming smaller only larger.
- @return </TRUE>, if the data was enlarged
+ @return </sal_True>, if the data was enlarged
*/
bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount );
@@ -99,9 +99,9 @@ private:
sal_Int32 m_nColumnCount;
sal_Int32 m_nRowCount;
- tDataType m_aData;
- tVecVecString m_aRowLabels;//outer index is row index, inner index is category level
- tVecVecString m_aColumnLabels;//outer index is column index
+ tDataType m_aData;
+ tVecVecAny m_aRowLabels;//outer index is row index, inner index is category level
+ tVecVecAny m_aColumnLabels;//outer index is column index
};
#endif
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
index f5e12f87f505..e467a9746df4 100644
--- a/chart2/source/inc/InternalDataProvider.hxx
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -30,7 +30,8 @@
#include "InternalData.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
+#include <com/sun/star/chart/XDateCategories.hpp>
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
@@ -38,7 +39,7 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <cppuhelper/implbase6.hxx>
+#include <cppuhelper/implbase7.hxx>
#include "ServiceMacros.hxx"
#include "CachedDataSequence.hxx"
@@ -52,10 +53,11 @@ namespace chart
namespace impl
{
-typedef ::cppu::WeakImplHelper6<
+typedef ::cppu::WeakImplHelper7<
::com::sun::star::chart2::XInternalDataProvider,
::com::sun::star::chart2::data::XRangeXMLConversion,
- ::com::sun::star::chart::XComplexDescriptionAccess,
+ ::com::sun::star::chart2::XAnyDescriptionAccess,
+ ::com::sun::star::chart::XDateCategories,
::com::sun::star::util::XCloneable,
::com::sun::star::lang::XInitialization,
::com::sun::star::lang::XServiceInfo >
@@ -149,7 +151,25 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
- // ____ XComplexDescriptionAccess ____
+ // ____ XDateCategories ____
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAnyDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
+ getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAnyRowDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL
+ getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAnyColumnDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
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(
diff --git a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx b/chart2/source/inc/NumberFormatterWrapper.hxx
index 9f5f44107997..77e2423a266f 100644..100755
--- a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx
+++ b/chart2/source/inc/NumberFormatterWrapper.hxx
@@ -24,12 +24,12 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _CHART2_VIEW_NUMBERFORMATTERWRAPPER_HXX
-#define _CHART2_VIEW_NUMBERFORMATTERWRAPPER_HXX
+#ifndef _CHART2_TOOLS_NUMBERFORMATTERWRAPPER_HXX
+#define _CHART2_TOOLS_NUMBERFORMATTERWRAPPER_HXX
+#include "charttoolsdllapi.hxx"
#include <svl/zforlist.hxx>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include "chartviewdllapi.hxx"
//.............................................................................
namespace chart
@@ -41,7 +41,7 @@ namespace chart
*/
class FixedNumberFormatter;
-class OOO_DLLPUBLIC_CHARTVIEW NumberFormatterWrapper
+class OOO_DLLPUBLIC_CHARTTOOLS NumberFormatterWrapper
{
public:
NumberFormatterWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier );
@@ -52,6 +52,7 @@ public:
getNumberFormatsSupplier() { return m_xNumberFormatsSupplier; };
rtl::OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const;
+ Date getNullDate() const;
private: //private member
::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
@@ -62,7 +63,7 @@ private: //private member
};
-class FixedNumberFormatter
+class OOO_DLLPUBLIC_CHARTTOOLS FixedNumberFormatter
{
public:
FixedNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier
@@ -73,7 +74,7 @@ public:
private:
NumberFormatterWrapper m_aNumberFormatterWrapper;
- ULONG m_nNumberFormatKey;
+ sal_uLong m_nNumberFormatKey;
};
//.............................................................................
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
index 93dce272bf6e..85a7e4d88fe5 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -102,7 +102,7 @@ protected:
Overload this method to take influence in modification of properties.
- If the conversion changed , </TRUE> is returned and the converted value
+ If the conversion changed , </sal_True> is returned and the converted value
is in <code>rConvertedValue</code>. The former value is contained in
<code>rOldValue</code>.
diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx
index 35819ba111cb..e5c98d900379 100644
--- a/chart2/source/inc/ReferenceSizeProvider.hxx
+++ b/chart2/source/inc/ReferenceSizeProvider.hxx
@@ -84,7 +84,7 @@ public:
/** Sets the ReferencePageSize according to the internal settings of this
class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
- is </TRUE>.
+ is </sal_True>.
*/
SAL_DLLPRIVATE void setValuesAtPropertySet(
const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx
index 1dd0617236ad..eb67de9d1f16 100644
--- a/chart2/source/inc/RelativePositionHelper.hxx
+++ b/chart2/source/inc/RelativePositionHelper.hxx
@@ -84,10 +84,10 @@ public:
position such that the resize is relative to the former rectangle's
center.
- @param bCheck If </TRUE>, the resize is only done, if after
+ @param bCheck If </sal_True>, the resize is only done, if after
transformation, the position and size are within the bounds [0,1].
- @return </TRUE>, if changes were applied.
+ @return </sal_True>, if changes were applied.
<p>That means, if the position's alignment is center, the position will
not change at all.</p>
@@ -100,12 +100,12 @@ public:
/** shifts a relative position about the given amount
- @param bCheck If </TRUE>, the shift is only done, if after
+ @param bCheck If </sal_True>, the shift is only done, if after
transformation, the object represented by the position
rInOutPosition and its size rObjectSize the position and size are
within the bounds [0,1].
- @return </TRUE>, if changes were applied.
+ @return </sal_True>, if changes were applied.
*/
static bool moveObject(
::com::sun::star::chart2::RelativePosition & rInOutPosition,
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 47ed75e80a9a..d7c490c1ca87 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -30,8 +30,8 @@
// this includes no link dependency
#include <svl/solar.hrc>
-//next free is 291
-//single free is: 134
+//next free is 293
+//single free: 139
//#define RID_APP_START 30000
////#define STR_NULL (RID_APP_START + 1)
@@ -165,6 +165,8 @@
#define STR_STEP_GT_ZERO (RID_APP_START + 102)
#define STR_BAD_LOGARITHM (RID_APP_START + 111)
#define STR_MIN_GREATER_MAX (RID_APP_START + 101)
+#define STR_INVALID_INTERVALS (RID_APP_START + 291)
+#define STR_INVALID_TIME_UNIT (RID_APP_START + 292)
//-----------------------------------------------------------------------------
//for range didalog
@@ -310,6 +312,7 @@
#define STR_ACTION_TOGGLE_GRID_HORZ (RID_APP_START + 86)
#define STR_ACTION_SCALE_TEXT (RID_APP_START + 93)
#define STR_ACTION_REARRANGE_CHART (RID_APP_START + 94)
+#define STR_ACTION_EDIT_TEXT (RID_APP_START + 95)
#define STR_TIP_CHOOSECOLOR (RID_APP_START + 233)
#define STR_TIP_LIGHTSOURCE_X (RID_APP_START + 234)
@@ -324,7 +327,6 @@
#define STR_TIP_DATAPOINT (RID_APP_START + 140)
#define STR_TIP_DATAPOINT_INDEX (RID_APP_START + 141)
#define STR_TIP_DATAPOINT_VALUES (RID_APP_START + 142)
-#define STR_TIP_CATEGORY_VALUE (RID_APP_START + 139)
//-----------------------------------------------------------------------------
//warning and info boxes
diff --git a/chart2/source/inc/UndoGuard.hxx b/chart2/source/inc/UndoGuard.hxx
deleted file mode 100644
index 864d5ccff994..000000000000
--- a/chart2/source/inc/UndoGuard.hxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CHART2_UNDOGUARD_HXX
-#define CHART2_UNDOGUARD_HXX
-
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/chart2/XUndoManager.hpp>
-
-// header for class OUString
-#include <rtl/ustring.hxx>
-
-namespace chart
-{
-/** Base Class for UndoGuard and UndoLiveUpdateGuard
-*/
-class UndoGuard_Base
-{
-public:
- explicit UndoGuard_Base( const rtl::OUString & rUndoMessage
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > & xUndoManager
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
- virtual ~UndoGuard_Base();
-
- void commitAction();
-
-protected:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > m_xModel;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > m_xUndoManager;
-
- rtl::OUString m_aUndoString;
- bool m_bActionPosted;
-};
-
-/** This guard calls preAction at the given Model in the CTOR and
- cancelAction in the DTOR if no other method is called.
- If commitAction is called the destructor does nothin anymore.
- */
-class UndoGuard : public UndoGuard_Base
-{
-public:
- explicit UndoGuard( const rtl::OUString& rUndoMessage
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > & xUndoManager
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
- virtual ~UndoGuard();
-};
-
-/** This guard calls preAction at the given Model in the CTOR and
- cancelActionUndo in the DTOR if no other method is called.
- If commitAction is called the destructor does nothin anymore.
- */
-class UndoLiveUpdateGuard : public UndoGuard_Base
-{
-public:
- explicit UndoLiveUpdateGuard( const rtl::OUString& rUndoMessage
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > & xUndoManager
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
- virtual ~UndoLiveUpdateGuard();
-};
-
-/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
- Only use this if the data has internal data.
- */
-class UndoLiveUpdateGuardWithData :
- public UndoGuard_Base
-{
-public:
- explicit UndoLiveUpdateGuardWithData( const rtl::OUString& rUndoMessage
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > & xUndoManager
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
- virtual ~UndoLiveUpdateGuardWithData();
-};
-
-class UndoGuardWithSelection : public UndoGuard_Base
-{
-public:
- explicit UndoGuardWithSelection( const rtl::OUString& rUndoMessage
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XUndoManager > & xUndoManager
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
- virtual ~UndoGuardWithSelection();
-};
-
-}
-// CHART2_UNDOGUARD_HXX
-#endif
diff --git a/chart2/source/inc/UndoManager.hxx b/chart2/source/inc/UndoManager.hxx
deleted file mode 100644
index a28a0d78c470..000000000000
--- a/chart2/source/inc/UndoManager.hxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CHART2_UNDOMANAGER_HXX
-#define CHART2_UNDOMANAGER_HXX
-
-#include "ConfigItemListener.hxx"
-#include "MutexContainer.hxx"
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/chart2/XUndoManager.hpp>
-#include <com/sun/star/chart2/XUndoHelper.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-
-#include <cppuhelper/compbase4.hxx>
-#include <rtl/ustring.hxx>
-
-// for pair
-#include <utility>
-// for auto_ptr
-#include <memory>
-
-class SdrUndoAction;
-
-namespace com { namespace sun { namespace star {
-namespace frame {
- class XModel;
-}
-}}}
-
-namespace chart
-{
-// ----------------------------------------
-namespace impl
-{
-
-class UndoStepsConfigItem;
-class UndoElement;
-class UndoStack;
-class ModifyBroadcaster;
-
-typedef ::cppu::WeakComponentImplHelper4<
- ::com::sun::star::util::XModifyBroadcaster,
- ::com::sun::star::chart2::XUndoManager,
- ::com::sun::star::chart2::XUndoHelper,
- ::com::sun::star::lang::XUnoTunnel >
- UndoManager_Base;
-
-} // namespace impl
-// ----------------------------------------
-
-/** Manages undo by storing the entire XModel in the undo- and redo-buffers.
- Note, that therefore this should not be used for "big" XModels.
-
- A prerequisite for this to work is that the XModels added to the undo-
- redo-stacks support the css::util::XCloneable interface, which is
- implemented such that the entire model is cloned.
- */
-class UndoManager :
- public MutexContainer,
- public ConfigItemListener,
- public impl::UndoManager_Base
-{
-public:
- explicit UndoManager();
- virtual ~UndoManager();
-
- void addShapeUndoAction( SdrUndoAction* pAction );
-
- // ____ XUnoTunnel ____
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId )
- throw (::com::sun::star::uno::RuntimeException);
-
- static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
- static UndoManager* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xObj );
-
-protected:
- // ____ ConfigItemListener ____
- virtual void notify( const ::rtl::OUString & rPropertyName );
-
- // ____ util::XModifyBroadcaster ____
- virtual void SAL_CALL addModifyListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeModifyListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
-
- // ____ chart2::XUndoManager ____
- virtual void SAL_CALL preAction( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL preActionWithArguments(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelAction()
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL cancelActionWithUndo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToRestore )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL undo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL redo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL undoPossible()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL redoPossible()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentUndoString()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getCurrentRedoString()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoStrings()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoStrings()
- throw (::com::sun::star::uno::RuntimeException);
-
- // ____ XUndoHelper ____
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModelCloneForUndo(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL applyModelContent(
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToChange,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToCopyFrom )
- throw (::com::sun::star::uno::RuntimeException);
-
-private:
- void retrieveConfigUndoSteps();
- void fireModifyEvent();
- void impl_undoRedo(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xCurrentModel,
- impl::UndoStack * pStackToRemoveFrom,
- impl::UndoStack * pStackToAddTo,
- bool bUndo = true );
-
- ::std::auto_ptr< impl::UndoStack > m_apUndoStack;
- ::std::auto_ptr< impl::UndoStack > m_apRedoStack;
-
- impl::UndoElement * m_pLastRemeberedUndoElement;
-
- ::std::auto_ptr< impl::UndoStepsConfigItem > m_apUndoStepsConfigItem;
- sal_Int32 m_nMaxNumberOfUndos;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XModifyBroadcaster > m_xModifyBroadcaster;
- // pointer is valid as long as m_xModifyBroadcaster.is()
- impl::ModifyBroadcaster * m_pModifyBroadcaster;
-};
-
-} // namespace chart
-
-// CHART2_UNDOMANAGER_HXX
-#endif
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index fbcce70bd1d6..b6390ab12b22 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -27,13 +27,6 @@
#ifndef CHARTSFXITEMIDS_HXX
#define CHARTSFXITEMIDS_HXX
-#include <sfx2/sfxdefs.hxx>
-
-/*
-// header for SID_OBJ1_START
-#include <sfx2/sfxsids.hrc>
-*/
-
// ============================================================
// SCHATTR
// ============================================================
@@ -49,68 +42,23 @@
#define SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 5)
#define SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 6)
#define SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 7) //percentage values should not be offered
-#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_NO_PERCENTVALUE
+#define SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 8)
+#define SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 9)
+#define SCHATTR_DATADESCR_END SCHATTR_PERCENT_NUMBERFORMAT_SOURCE
+//legend
#define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1)
#define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START
#define SCHATTR_LEGEND_END SCHATTR_LEGEND_POS
+//text
#define SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1)
-// #define SCHATTR_TEXT_ORIENT SCHATTR_TEXT_START
-// name changed:
-#define SCHATTR_TEXT_STACKED SCHATTR_TEXT_START
-#define SCHATTR_TEXT_ORDER (SCHATTR_TEXT_START + 1)
-#define SCHATTR_TEXT_END SCHATTR_TEXT_ORDER
-
-#define SCHATTR_Y_AXIS_START (SCHATTR_TEXT_END + 1)
-#define SCHATTR_Y_AXIS_AUTO_MIN SCHATTR_Y_AXIS_START
-#define SCHATTR_Y_AXIS_MIN (SCHATTR_Y_AXIS_START + 1)
-#define SCHATTR_Y_AXIS_AUTO_MAX (SCHATTR_Y_AXIS_START + 2)
-#define SCHATTR_Y_AXIS_MAX (SCHATTR_Y_AXIS_START + 3)
-#define SCHATTR_Y_AXIS_AUTO_STEP_MAIN (SCHATTR_Y_AXIS_START + 4)
-#define SCHATTR_Y_AXIS_STEP_MAIN (SCHATTR_Y_AXIS_START + 5)
-#define SCHATTR_Y_AXIS_AUTO_STEP_HELP (SCHATTR_Y_AXIS_START + 6)
-#define SCHATTR_Y_AXIS_STEP_HELP (SCHATTR_Y_AXIS_START + 7)
-#define SCHATTR_Y_AXIS_LOGARITHM (SCHATTR_Y_AXIS_START + 8)
-#define SCHATTR_Y_AXIS_AUTO_ORIGIN (SCHATTR_Y_AXIS_START + 9)
-#define SCHATTR_Y_AXIS_ORIGIN (SCHATTR_Y_AXIS_START + 10)
-#define SCHATTR_Y_AXIS_END SCHATTR_Y_AXIS_ORIGIN
-
-#define SCHATTR_X_AXIS_START (SCHATTR_Y_AXIS_END + 1)
-#define SCHATTR_X_AXIS_AUTO_MIN SCHATTR_X_AXIS_START
-#define SCHATTR_X_AXIS_MIN (SCHATTR_X_AXIS_START + 1)
-#define SCHATTR_X_AXIS_AUTO_MAX (SCHATTR_X_AXIS_START + 2)
-#define SCHATTR_X_AXIS_MAX (SCHATTR_X_AXIS_START + 3)
-#define SCHATTR_X_AXIS_AUTO_STEP_MAIN (SCHATTR_X_AXIS_START + 4)
-#define SCHATTR_X_AXIS_STEP_MAIN (SCHATTR_X_AXIS_START + 5)
-#define SCHATTR_X_AXIS_AUTO_STEP_HELP (SCHATTR_X_AXIS_START + 6)
-#define SCHATTR_X_AXIS_STEP_HELP (SCHATTR_X_AXIS_START + 7)
-#define SCHATTR_X_AXIS_LOGARITHM (SCHATTR_X_AXIS_START + 8)
-#define SCHATTR_X_AXIS_AUTO_ORIGIN (SCHATTR_X_AXIS_START + 9)
-#define SCHATTR_X_AXIS_ORIGIN (SCHATTR_X_AXIS_START + 10)
-#define SCHATTR_X_AXIS_END SCHATTR_X_AXIS_ORIGIN
+#define SCHATTR_TEXT_DEGREES SCHATTR_TEXT_START
+#define SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1)
+#define SCHATTR_TEXT_END SCHATTR_TEXT_STACKED
-#define SCHATTR_Z_AXIS_START (SCHATTR_X_AXIS_END + 1)
-#define SCHATTR_Z_AXIS_AUTO_MIN SCHATTR_Z_AXIS_START
-#define SCHATTR_Z_AXIS_MIN (SCHATTR_Z_AXIS_START + 1)
-#define SCHATTR_Z_AXIS_AUTO_MAX (SCHATTR_Z_AXIS_START + 2)
-#define SCHATTR_Z_AXIS_MAX (SCHATTR_Z_AXIS_START + 3)
-#define SCHATTR_Z_AXIS_AUTO_STEP_MAIN (SCHATTR_Z_AXIS_START + 4)
-#define SCHATTR_Z_AXIS_STEP_MAIN (SCHATTR_Z_AXIS_START + 5)
-#define SCHATTR_Z_AXIS_AUTO_STEP_HELP (SCHATTR_Z_AXIS_START + 6)
-#define SCHATTR_Z_AXIS_STEP_HELP (SCHATTR_Z_AXIS_START + 7)
-#define SCHATTR_Z_AXIS_LOGARITHM (SCHATTR_Z_AXIS_START + 8)
-#define SCHATTR_Z_AXIS_AUTO_ORIGIN (SCHATTR_Z_AXIS_START + 9)
-#define SCHATTR_Z_AXIS_ORIGIN (SCHATTR_Z_AXIS_START + 10)
-#define SCHATTR_Z_AXIS_END SCHATTR_Z_AXIS_ORIGIN
-
-// miscellaneous
-
-#define SCHATTR_AXISTYPE (SCHATTR_Z_AXIS_END + 1)
-#define SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_Z_AXIS_END + 2)
-#define SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_Z_AXIS_END + 3)
-
-#define SCHATTR_STAT_START (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE + 1)
+// statistic
+#define SCHATTR_STAT_START (SCHATTR_TEXT_END + 1)
#define SCHATTR_STAT_AVERAGE SCHATTR_STAT_START
#define SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1)
#define SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2)
@@ -122,16 +70,11 @@
#define SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8)
#define SCHATTR_STAT_END SCHATTR_STAT_RANGE_NEG
-#define SCHATTR_TEXT2_START ( SCHATTR_STAT_END + 1)
-#define SCHATTR_TEXT_DEGREES ( SCHATTR_TEXT2_START )
-#define SCHATTR_TEXT_OVERLAP (SCHATTR_TEXT2_START +1)
-#define SCHATTR_TEXT2_END ( SCHATTR_TEXT_OVERLAP )
-
// --------------------------------------------------------
// these attributes are for replacement of enum eChartStyle
// --------------------------------------------------------
-#define SCHATTR_STYLE_START ( SCHATTR_TEXT2_END +1 )
+#define SCHATTR_STYLE_START ( SCHATTR_STAT_END +1 )
// for whole chart
#define SCHATTR_STYLE_DEEP ( SCHATTR_STYLE_START )
@@ -155,35 +98,44 @@
#define SCHATTR_AXIS (SCHATTR_STYLE_END + 1)// see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc.
//Ummappen:
#define SCHATTR_AXIS_START (SCHATTR_AXIS + 1)
-#define SCHATTR_AXIS_AUTO_MIN SCHATTR_AXIS_START
-#define SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 1)
-#define SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 2)
-#define SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 3)
-#define SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 4)
-#define SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 5)
-#define SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 6)
-// SCHATTR_AXIS_STEP_HELP: type changed from double to sal_Int32 !
-#define SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 7)
-#define SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 8)
-#define SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 9)
-#define SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 10)
-//Neu:
-#define SCHATTR_AXIS_TICKS (SCHATTR_AXIS_START + 11)
-#define SCHATTR_AXIS_NUMFMT (SCHATTR_AXIS_START + 12)
-#define SCHATTR_AXIS_NUMFMTPERCENT (SCHATTR_AXIS_START + 13)
-#define SCHATTR_AXIS_SHOWAXIS (SCHATTR_AXIS_START + 14)
-#define SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_START + 15)
-#define SCHATTR_AXIS_SHOWMAINGRID (SCHATTR_AXIS_START + 16)
-#define SCHATTR_AXIS_SHOWHELPGRID (SCHATTR_AXIS_START + 17)
-#define SCHATTR_AXIS_TOPDOWN (SCHATTR_AXIS_START + 18)
-#define SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_START + 19)
-#define SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 20)
-#define SCHATTR_AXIS_POSITION (SCHATTR_AXIS_START + 21)
-#define SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_START + 22)
-#define SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_START + 23)
-#define SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_START + 24)
-#define SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_START + 25)
-#define SCHATTR_AXIS_END SCHATTR_AXIS_MARK_POSITION
+//axis scale
+#define SCHATTR_AXISTYPE SCHATTR_AXIS_START
+#define SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 1)
+#define SCHATTR_AXIS_AUTO_MIN (SCHATTR_AXIS_START + 2)
+#define SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 3)
+#define SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 4)
+#define SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 5)
+#define SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 6)
+#define SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 7)
+#define SCHATTR_AXIS_MAIN_TIME_UNIT (SCHATTR_AXIS_START + 8)
+#define SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 9)
+#define SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 10)
+#define SCHATTR_AXIS_HELP_TIME_UNIT (SCHATTR_AXIS_START + 11)
+#define SCHATTR_AXIS_AUTO_TIME_RESOLUTION (SCHATTR_AXIS_START + 12)
+#define SCHATTR_AXIS_TIME_RESOLUTION (SCHATTR_AXIS_START + 13)
+#define SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 14)
+#define SCHATTR_AXIS_AUTO_DATEAXIS (SCHATTR_AXIS_START + 15)
+#define SCHATTR_AXIS_ALLOW_DATEAXIS (SCHATTR_AXIS_START + 16)
+#define SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 17)
+#define SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 18)
+//axis position
+#define SCHATTR_AXIS_POSITION_START (SCHATTR_AXIS_ORIGIN +1)
+#define SCHATTR_AXIS_TICKS SCHATTR_AXIS_POSITION_START
+#define SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_POSITION_START + 1)
+#define SCHATTR_AXIS_POSITION (SCHATTR_AXIS_POSITION_START + 2)
+#define SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_POSITION_START + 3)
+#define SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_POSITION_START + 4)
+#define SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_POSITION_START + 5)
+#define SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_POSITION_START + 6)
+//axis label
+#define SCHATTR_AXIS_LABEL_START (SCHATTR_AXIS_MARK_POSITION +1)
+#define SCHATTR_AXIS_SHOWDESCR SCHATTR_AXIS_LABEL_START
+#define SCHATTR_AXIS_LABEL_ORDER (SCHATTR_AXIS_LABEL_START + 1)
+#define SCHATTR_AXIS_LABEL_OVERLAP (SCHATTR_AXIS_LABEL_START + 2)
+#define SCHATTR_AXIS_LABEL_BREAK (SCHATTR_AXIS_LABEL_START + 3)
+#define SCHATTR_AXIS_LABEL_END SCHATTR_AXIS_LABEL_BREAK
+
+#define SCHATTR_AXIS_END SCHATTR_AXIS_LABEL_END
#define SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1)
#define SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2)
@@ -201,13 +153,12 @@
#define SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4)
#define SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5)
#define SCHATTR_DIAGRAM_STYLE (SCHATTR_CHARTTYPE_START + 6)
-#define SCHATTR_TEXTBREAK (SCHATTR_CHARTTYPE_START + 7)
-#define SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 8)
-#define SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 9)
-#define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 10)
-#define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 11)
-#define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 12)
-#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 13)
+#define SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 7)
+#define SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 8)
+#define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 9)
+#define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 10)
+#define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 11)
+#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 12)
#define SCHATTR_CHARTTYPE_END SCHATTR_INCLUDE_HIDDEN_CELLS
@@ -236,9 +187,11 @@
#define CHAXIS_MARK_NONE 0
// values for SCHATTR_AXISTYPE items
-#define CHART_AXIS_X 0
-#define CHART_AXIS_Y 1
-#define CHART_AXIS_Z 2
+#define CHART_AXIS_REALNUMBER 0
+#define CHART_AXIS_PERCENT 1
+#define CHART_AXIS_CATEGORY 2
+#define CHART_AXIS_SERIES 3
+#define CHART_AXIS_DATE 4
// values for SCHATTR_STYLE_SHAPE items
#define CHART_SHAPE3D_IGNORE -2 //intern! (GetChartShapeStyle()!)
diff --git a/chart2/source/inc/chartview/ExplicitScaleValues.hxx b/chart2/source/inc/chartview/ExplicitScaleValues.hxx
new file mode 100644
index 000000000000..48c9ef942d03
--- /dev/null
+++ b/chart2/source/inc/chartview/ExplicitScaleValues.hxx
@@ -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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_EXPLICITSCALEVALUES_HXX
+#define _CHART2_EXPLICITSCALEVALUES_HXX
+
+#include "chartviewdllapi.hxx"
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart2/AxisOrientation.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/XScaling.hpp>
+#include <tools/date.hxx>
+#include <vector>
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/** This structure contains the explicit values for a scale like Minimum and Maximum.
+ See also ::com::sun::star::chart2::ScaleData.
+*/
+
+struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData
+{
+ ExplicitScaleData();
+
+ double Minimum;
+ double Maximum;
+ double Origin;
+
+ ::com::sun::star::chart2::AxisOrientation Orientation;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > Scaling;
+
+ sal_Int32 AxisType;//see ::com::sun::star::chart2::AxisType
+ bool ShiftedCategoryPosition;
+ sal_Int32 TimeResolution; //constant of type <type>::com::sun::star::chart::TimeUnit</type>
+ Date NullDate;
+};
+
+struct OOO_DLLPUBLIC_CHARTVIEW ExplicitSubIncrement
+{
+ ExplicitSubIncrement();
+
+ /** Numbers of intervals between two superior ticks. For an axis
+ this usually means, that <code>IntervalCount - 1</code>
+ sub-tick-marks are displayed between two superior ticks.
+
+ */
+ sal_Int32 IntervalCount;
+
+ /** If <TRUE/>, the distance between two sub-tick-marks on the
+ screen is always the same. If <FALSE/>, the distances may
+ differ depending on the <type>XScaling</type>.
+ */
+ bool PostEquidistant;
+};
+
+/** describes how tickmarks are positioned on the scale of an axis.
+*/
+struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData
+{
+ ExplicitIncrementData();
+
+ /** the following two members are only for date-time axis
+ */
+ ::com::sun::star::chart::TimeInterval MajorTimeInterval;
+ ::com::sun::star::chart::TimeInterval MinorTimeInterval;
+
+ /** the other members are for *not* date-time axis
+ */
+
+ /** <member>Distance</member> describes the distance between two
+ neighboring main tickmarks on a <type>Scale</type> of an axis.
+ All neighboring main tickmarks have the same constant distance.
+
+ <p>If the Scale has a <type>XScaling</type> the <member>Distance</member>
+ may be measured in two different ways - that is - before or after the
+ scaling is applied.</p>
+
+ <p>On a logarithmic scale for example the distance between two main
+ tickmarks is typically measured after the scaling is applied:
+ Distance = log(tick2)-log(tick1)
+ ( log(1000)-log(100)==log(100)-log(10)==log(10)-log(1)==1==Distance ).
+ The resulting tickmarks will always look equidistant on the screen.
+ The other possibility is to have a Distance = tick2-tick1 measured constant
+ before a scaling is applied, which may lead to non equidistant tickmarks
+ on the screen.</p>
+
+ <p><member>PostEquidistant</member> rules wether the <member>Distance</member>
+ is meant to be a value before or after scaling.</p>
+ */
+ double Distance;
+
+ /**
+ <member>PostEquidistant</member> rules wether the member <member>Distance</member>
+ describes a distance before or after the scaling is applied.
+
+ <p>If <member>PostEquidistant</member> equals <TRUE/> <member>Distance</member>
+ is given in values after <type>XScaling</type> is applied, thus resulting
+ main tickmarks will always look equidistant on the screen.
+ If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member>
+ is given in values before <type>XScaling</type> is applied.</p>
+ */
+ bool PostEquidistant;
+
+ /** The <member>BaseValue</member> gives a starting point on the scale
+ to which all further main tickmarks are relatively positioned.
+
+ <p>The <member>BaseValue</member> is always a value on the scale before
+ a possible scaling is applied. If the given value is not valid in the
+ associated scaling the minimum of the scaling is assumed,
+ if there is no minimum any other obvious value will be assumed.</p>
+
+ <p>E.g.: assume a scale from 0 to 6 with identical scaling.
+ Further assume this Increment to have Distance==2 and PostEquidistant==false.
+ Setting BaseValue=0 would lead to main tickmarks 0; 2; 4; 6;
+ Setting BaseValue=1,3 would lead to main tickmarks 1,3; 3,3; 5,3;
+ Setting BaseValue=-0,7 would also lead to main tickmarks 1,3; 3,3; 5,3;
+ And setting BaseValue to 2, -2, 4, -4 etc. in this example
+ leads to the same result as BaseValue=0.</p>
+ */
+ double BaseValue;
+
+ /** <member>SubIncrements</member> describes the positioning of further
+ sub tickmarks on the scale of an axis.
+
+ <p>The first SubIncrement in this sequence determines how the
+ distance between two neighboring main tickmarks is divided for positioning
+ of further sub tickmarks. Every following SubIncrement determines the
+ positions of subsequent tickmarks in relation to their parent tickmarks
+ iven by the preceding SubIncrement.</p>
+ */
+ ::std::vector< ExplicitSubIncrement > SubIncrements;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index d10ee8d415fc..6e2fef8feb36 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -27,9 +27,9 @@
#ifndef _CHART2_EXPLICITVALUEPROVIDER_HXX
#define _CHART2_EXPLICITVALUEPROVIDER_HXX
+#include "ExplicitScaleValues.hxx"
+
#include <boost/shared_ptr.hpp>
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
@@ -59,8 +59,8 @@ public:
*/
virtual sal_Bool getExplicitValuesForAxis(
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
- , ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
- , ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement )=0;
+ , ExplicitScaleData& rExplicitScale
+ , ExplicitIncrementData& rExplicitIncrement )=0;
/** for rotated objects the shape size and position differs from the visible rectangle
if bSnapRect is set to true you get the resulting visible position (left-top) and size
@@ -99,9 +99,6 @@ public:
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
- SAL_DLLPRIVATE static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
-
static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx
index d1af0edb3335..43de8c3485d8 100644
--- a/chart2/source/inc/servicenames.hxx
+++ b/chart2/source/inc/servicenames.hxx
@@ -62,8 +62,6 @@ namespace chart
#define CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartRenderer")
-#define CHART_UNDOMANAGER_SERVICE_NAME ::rtl::OUString::createFromAscii( "com.sun.star.chart2.UndoManager" )
-
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx
index fc672e29b24c..658cfb2b4d6e 100644
--- a/chart2/source/model/inc/Diagram.hxx
+++ b/chart2/source/model/inc/Diagram.hxx
@@ -31,11 +31,13 @@
#include "MutexContainer.hxx"
#include <cppuhelper/implbase8.hxx>
#include <comphelper/uno3.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart/X3DDefaultSetter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
@@ -117,8 +119,6 @@ protected:
// throw (::com::sun::star::lang::IllegalArgumentException);
// ____ XDiagram ____
-// virtual ::rtl::OUString SAL_CALL getChartTypeTemplateServiceName()
-// throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
throw (::com::sun::star::uno::RuntimeException);
@@ -136,7 +136,10 @@ protected:
virtual void SAL_CALL setDefaultColorScheme(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme >& xColorScheme )
throw (::com::sun::star::uno::RuntimeException);
-
+ virtual void SAL_CALL setDiagramData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments )
+ throw (::com::sun::star::uno::RuntimeException);
// ____ XCoordinateSystemContainer ____
virtual void SAL_CALL addCoordinateSystem(
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 95bc1315ad51..0d3b45367019 100755
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -42,6 +42,7 @@
#include "PageBackground.hxx"
#include "CloneHelper.hxx"
#include "NameContainer.hxx"
+#include "UndoManager.hxx"
#include <com/sun/star/chart/ChartDataRowSource.hpp>
@@ -73,6 +74,7 @@
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Any;
using ::rtl::OUString;
using ::osl::MutexGuard;
@@ -103,6 +105,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
, m_bModified( sal_False )
, m_nInLoad(0)
, m_bUpdateNotificationsPending(false)
+ , m_pUndoManager( NULL )
, m_aControllers( m_aModelMutex )
, m_nControllerLockCount(0)
, m_xContext( xContext )
@@ -114,14 +117,21 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
C2U( "com.sun.star.xml.NamespaceMap" ), C2U( "com.sun.star.comp.chart.XMLNameSpaceMap" ) ), uno::UNO_QUERY)
{
OSL_TRACE( "ChartModel: CTOR called" );
- osl_incrementInterlockedCount(&m_refCount);
- ModifyListenerHelper::addListener( m_xPageBackground, this );
- m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext(
- C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
- m_xUndoManager = Reference< chart2::XUndoManager >(
- this->createInstance( CHART_UNDOMANAGER_SERVICE_NAME ), uno::UNO_QUERY );
+ osl_incrementInterlockedCount(&m_refCount);
+ {
+ m_xOldModelAgg.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ CHART_CHARTAPIWRAPPER_SERVICE_NAME,
+ m_xContext ), uno::UNO_QUERY_THROW );
+ m_xOldModelAgg->setDelegator( *this );
+ }
+ {
+ ModifyListenerHelper::addListener( m_xPageBackground, this );
+ m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
+ }
osl_decrementInterlockedCount(&m_refCount);
}
@@ -145,33 +155,39 @@ ChartModel::ChartModel( const ChartModel & rOther )
, m_aGraphicObjectVector( rOther.m_aGraphicObjectVector )
, m_xDataProvider( rOther.m_xDataProvider )
, m_xInternalDataProvider( rOther.m_xInternalDataProvider )
- , m_xUndoManager( rOther.m_xUndoManager )
{
OSL_TRACE( "ChartModel: Copy-CTOR called" );
- osl_incrementInterlockedCount(&m_refCount);
-
- Reference< util::XModifyListener > xListener;
- Reference< chart2::XTitle > xNewTitle = CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle );
- Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< Reference< chart2::XDiagram > >()( rOther.m_xDiagram );
- Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xPageBackground );
- Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< Reference< chart2::XChartTypeManager > >()( rOther.m_xChartTypeManager );
- Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< Reference< container::XNameAccess > >()( rOther.m_xXMLNamespaceMap );
+ osl_incrementInterlockedCount(&m_refCount);
{
- MutexGuard aGuard( m_aModelMutex );
- xListener = this;
- m_xTitle = xNewTitle;
- m_xDiagram = xNewDiagram;
- m_xPageBackground = xNewPageBackground;
- m_xChartTypeManager = xChartTypeManager;
- m_xXMLNamespaceMap = xXMLNamespaceMap;
- }
+ m_xOldModelAgg.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ CHART_CHARTAPIWRAPPER_SERVICE_NAME,
+ m_xContext ), uno::UNO_QUERY_THROW );
+ m_xOldModelAgg->setDelegator( *this );
- ModifyListenerHelper::addListener( xNewTitle, xListener );
- ModifyListenerHelper::addListener( xNewDiagram, xListener );
- ModifyListenerHelper::addListener( xNewPageBackground, xListener );
- xListener.clear();
+ Reference< util::XModifyListener > xListener;
+ Reference< chart2::XTitle > xNewTitle = CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle );
+ Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< Reference< chart2::XDiagram > >()( rOther.m_xDiagram );
+ Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xPageBackground );
+ Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< Reference< chart2::XChartTypeManager > >()( rOther.m_xChartTypeManager );
+ Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< Reference< container::XNameAccess > >()( rOther.m_xXMLNamespaceMap );
+ {
+ MutexGuard aGuard( m_aModelMutex );
+ xListener = this;
+ m_xTitle = xNewTitle;
+ m_xDiagram = xNewDiagram;
+ m_xPageBackground = xNewPageBackground;
+ m_xChartTypeManager = xChartTypeManager;
+ m_xXMLNamespaceMap = xXMLNamespaceMap;
+ }
+
+ ModifyListenerHelper::addListener( xNewTitle, xListener );
+ ModifyListenerHelper::addListener( xNewDiagram, xListener );
+ ModifyListenerHelper::addListener( xNewPageBackground, xListener );
+ xListener.clear();
+ }
osl_decrementInterlockedCount(&m_refCount);
}
@@ -179,7 +195,7 @@ ChartModel::~ChartModel()
{
OSL_TRACE( "ChartModel: DTOR called" );
if( m_xOldModelAgg.is())
- m_xOldModelAgg->setDelegator( 0 );
+ m_xOldModelAgg->setDelegator( NULL );
}
void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ )
@@ -518,6 +534,8 @@ uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection() thr
//-----------------------------------------------------------------
void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
{
+ Reference< XInterface > xKeepAlive( *this );
+
//This object should release all resources and references in the
//easiest possible manner
//This object must notify all registered listeners using the method
@@ -530,6 +548,9 @@ void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
//--release all resources and references
//// @todo
+ if ( m_xDiagram.is() )
+ ModifyListenerHelper::removeListener( m_xDiagram, this );
+
m_xDataProvider.clear();
m_xInternalDataProvider.clear();
m_xNumberFormatsSupplier.clear();
@@ -540,26 +561,17 @@ void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
DisposeHelper::DisposeAndClear( m_xPageBackground );
DisposeHelper::DisposeAndClear( m_xXMLNamespaceMap );
- // not owner of storage
-// if( m_xStorage.is())
-// {
-// Reference< lang::XComponent > xComp( m_xStorage, uno::UNO_QUERY );
-// if( xComp.is())
-// xComp->dispose();
-// }
m_xStorage.clear();
+ // just clear, don't dispose - we're not the owner
- if( m_xOldModelAgg.is())
- {
- m_xOldModelAgg->setDelegator( 0 );
- m_xOldModelAgg.clear();
- }
+ if ( m_pUndoManager.is() )
+ m_pUndoManager->disposing();
+ m_pUndoManager.clear();
+ // that's important, since the UndoManager implementation delegates its ref counting to ourself.
m_aControllers.disposeAndClear( lang::EventObject( static_cast< cppu::OWeakObject * >( this )));
m_xCurrentController.clear();
- m_xStorage.clear();
- m_xParent.clear();
DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
OSL_TRACE( "ChartModel: dispose() called" );
}
@@ -689,6 +701,7 @@ uno::Sequence< uno::Type > SAL_CALL ChartModel::getTypes()
uno::Reference< document::XDocumentProperties > SAL_CALL
ChartModel::getDocumentProperties() throw (uno::RuntimeException)
{
+ ::osl::MutexGuard aGuard( m_aModelMutex );
if ( !m_xDocumentProperties.is() )
{
uno::Reference< document::XDocumentProperties > xDocProps(
@@ -700,6 +713,17 @@ uno::Reference< document::XDocumentProperties > SAL_CALL
}
//-----------------------------------------------------------------
+// document::XDocumentPropertiesSupplier
+//-----------------------------------------------------------------
+Reference< document::XUndoManager > SAL_CALL ChartModel::getUndoManager( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aModelMutex );
+ if ( !m_pUndoManager.is() )
+ m_pUndoManager.set( new UndoManager( *this, m_aModelMutex ) );
+ return m_pUndoManager.get();
+}
+
+//-----------------------------------------------------------------
// chart2::XChartDocument
//-----------------------------------------------------------------
@@ -875,28 +899,15 @@ void SAL_CALL ChartModel::setArguments( const Sequence< beans::PropertyValue >&
Reference< chart2::data::XDataSource > xDataSource( m_xDataProvider->createDataSource( aArguments ) );
if( xDataSource.is() )
{
- // set new data
- Reference< chart2::XChartTypeTemplate > xTemplate;
Reference< chart2::XDiagram > xDia( getFirstDiagram() );
- if( xDia.is())
- {
- // apply new data
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram(
- xDia, Reference< lang::XMultiServiceFactory >( m_xChartTypeManager, uno::UNO_QUERY ));
- xTemplate.set( aTemplateAndService.first );
- }
-
- if( !xTemplate.is())
- xTemplate.set( impl_createDefaultChartTypeTemplate() );
-
- if( xTemplate.is())
+ if( !xDia.is() )
{
- if( xDia.is())
- xTemplate->changeDiagramData( xDia, xDataSource, aArguments );
- else
+ Reference< chart2::XChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
+ if( xTemplate.is())
setFirstDiagram( xTemplate->createDiagramByDataSource( xDataSource, aArguments ) );
}
+ else
+ xDia->setDiagramData( xDataSource, aArguments );
}
}
catch( lang::IllegalArgumentException & )
@@ -1001,18 +1012,6 @@ void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >
setModified( sal_True );
}
-void ChartModel::impl_createOldModelAgg()
-{
- if( ! m_xOldModelAgg.is())
- {
- m_xOldModelAgg.set(
- m_xContext->getServiceManager()->createInstanceWithContext(
- CHART_CHARTAPIWRAPPER_SERVICE_NAME,
- m_xContext ), uno::UNO_QUERY_THROW );
- m_xOldModelAgg->setDelegator( static_cast< ::cppu::OWeakObject* >( this ));
- }
-}
-
// ____ XInterface (for old API wrapper) ____
uno::Any SAL_CALL ChartModel::queryInterface( const uno::Type& aType )
throw (uno::RuntimeException)
@@ -1024,7 +1023,6 @@ uno::Any SAL_CALL ChartModel::queryInterface( const uno::Type& aType )
// try old API wrapper
try
{
- impl_createOldModelAgg();
if( m_xOldModelAgg.is())
aResult = m_xOldModelAgg->queryAggregation( aType );
}
@@ -1263,7 +1261,6 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString
}
else
{
- impl_createOldModelAgg();
if( m_xOldModelAgg.is() )
{
Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
@@ -1291,7 +1288,6 @@ Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames()
{
uno::Sequence< ::rtl::OUString > aResult;
- impl_createOldModelAgg();
if( m_xOldModelAgg.is())
{
Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
@@ -1368,13 +1364,6 @@ void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent
m_xParent.set( Parent, uno::UNO_QUERY );
}
-// ____ XUndoManager ____
-Reference< chart2::XUndoManager > SAL_CALL ChartModel::getUndoManager()
- throw (uno::RuntimeException)
-{
- return m_xUndoManager;
-}
-
// ____ XDataSource ____
uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences()
throw (uno::RuntimeException)
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx
index 190d4f597c94..2cec0ec9f73c 100755
--- a/chart2/source/model/main/ChartModel.hxx
+++ b/chart2/source/model/main/ChartModel.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -46,7 +47,6 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/chart2/XUndoSupplier.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -69,6 +69,7 @@
#include "comphelper/implbase_var.hxx"
#endif
#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <svtools/grfmgr.hxx>
@@ -78,8 +79,6 @@
class SvNumberFormatter;
//=============================================================================
-/** this is an example implementation for the service ::com::sun::star::document::OfficeDocument
-*/
namespace chart
{
@@ -112,13 +111,15 @@ typedef ::comphelper::WeakImplHelper21<
,::com::sun::star::container::XChild
,::com::sun::star::util::XModifyListener
,::com::sun::star::datatransfer::XTransferable
- ,::com::sun::star::chart2::XUndoSupplier
,::com::sun::star::document::XDocumentPropertiesSupplier
,::com::sun::star::chart2::data::XDataSource
+ ,::com::sun::star::document::XUndoManagerSupplier
>
ChartModel_Base;
}
+class UndoManager;
+
class ChartModel : public impl::ChartModel_Base
{
@@ -134,6 +135,7 @@ private:
::rtl::OUString m_aResource;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aMediaDescriptor;
::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocumentProperties;
+ ::rtl::Reference< UndoManager > m_pUndoManager;
::cppu::OInterfaceContainerHelper m_aControllers;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xCurrentController;
@@ -176,8 +178,6 @@ private:
bool m_bIsDisposed;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xPageBackground;
- ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager >
- m_xUndoManager;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xXMLNamespaceMap;
@@ -208,7 +208,6 @@ private:
void impl_killInternalData() throw( com::sun::star::util::CloseVetoException );
- void impl_createOldModelAgg();
void impl_store(
const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue >& rMediaDescriptor,
@@ -439,6 +438,10 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > SAL_CALL
getDocumentProperties( ) throw (::com::sun::star::uno::RuntimeException);
+ // ____ document::XUndoManagerSupplier ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL
+ getUndoManager( ) throw (::com::sun::star::uno::RuntimeException);
+
//-----------------------------------------------------------------
// ::com::sun::star::chart2::XChartDocument
//-----------------------------------------------------------------
@@ -606,10 +609,6 @@ public:
throw (::com::sun::star::lang::NoSupportException,
::com::sun::star::uno::RuntimeException);
- // ____ XUndoSupplier ____
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > SAL_CALL getUndoManager()
- throw (::com::sun::star::uno::RuntimeException);
-
// ____ XDataSource ____ allows access to the curently used data and data ranges
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
throw (::com::sun::star::uno::RuntimeException);
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 2e81d8c8680e..c6b9a0f2e112 100755
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -33,6 +33,7 @@
#include "Wall.hxx"
#include "UserDefinedProperties.hxx"
#include "ConfigColorScheme.hxx"
+#include "DiagramHelper.hxx"
#include "ContainerHelper.hxx"
#include "ThreeDHelper.hxx"
#include "CloneHelper.hxx"
@@ -428,6 +429,22 @@ void SAL_CALL Diagram::setDefaultColorScheme( const Reference< chart2::XColorSch
fireModifyEvent();
}
+void SAL_CALL Diagram::setDiagramData(
+ const Reference< chart2::data::XDataSource >& xDataSource,
+ const Sequence< beans::PropertyValue >& aArguments )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< lang::XMultiServiceFactory > xChartTypeManager( m_xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService = DiagramHelper::getTemplateForDiagram( this, xChartTypeManager );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate( aTemplateAndService.first );
+ if( !xTemplate.is() )
+ xTemplate.set( xChartTypeManager->createInstance( C2U("com.sun.star.chart2.template.Column") ), uno::UNO_QUERY );
+ if(!xTemplate.is())
+ return;
+ xTemplate->changeDiagramData( this, xDataSource, aArguments );
+}
+
// ____ XTitled ____
uno::Reference< chart2::XTitle > SAL_CALL Diagram::getTitleObject()
throw (uno::RuntimeException)
diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx
new file mode 100755
index 000000000000..4efe57e17090
--- /dev/null
+++ b/chart2/source/model/main/UndoManager.cxx
@@ -0,0 +1,427 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "UndoManager.hxx"
+#include "ChartViewHelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <framework/undomanagerhelper.hxx>
+#include <svl/undo.hxx>
+#include <unotools/undoopt.hxx>
+
+//......................................................................................................................
+namespace chart
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::document::EmptyUndoStackException;
+ using ::com::sun::star::document::UndoContextNotClosedException;
+ using ::com::sun::star::document::UndoFailedException;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::document::XUndoAction;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::document::XUndoManagerListener;
+ using ::com::sun::star::util::NotLockedException;
+ using ::com::sun::star::lang::NoSupportException;
+ using ::com::sun::star::util::XModifyListener;
+ using ::com::sun::star::frame::XModel;
+ /** === end UNO using === **/
+
+ namespace impl
+ {
+ //==============================================================================================================
+ //= UndoManager_Impl
+ //==============================================================================================================
+ class UndoManager_Impl : public ::framework::IUndoManagerImplementation
+ {
+ public:
+ UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_rAntiImpl( i_antiImpl )
+ ,m_rParent( i_parent )
+ ,m_rMutex( i_mutex )
+ ,m_bDisposed( false )
+ ,m_aUndoManager()
+ ,m_aUndoHelper( *this )
+ {
+ m_aUndoManager.SetMaxUndoActionCount( (sal_uInt16)SvtUndoOptions().GetUndoCount() );
+ }
+
+ virtual ~UndoManager_Impl()
+ {
+ }
+
+ // .........................................................................................................
+ // IUndoManagerImplementation
+ virtual ::osl::Mutex& getMutex();
+ virtual ::svl::IUndoManager& getImplUndoManager();
+ virtual Reference< XUndoManager > getThis();
+
+ // .........................................................................................................
+ // attribute access
+ ::cppu::OWeakObject& getParent() { return m_rParent; }
+ ::framework::UndoManagerHelper& getUndoHelper() { return m_aUndoHelper; }
+
+ // .........................................................................................................
+ // public interface
+
+ /// is called when the owner of the UndoManager is being disposed
+ void disposing();
+
+ /// checks whether we're already disposed, throws a DisposedException if so
+ void checkDisposed_lck();
+
+ private:
+ UndoManager& m_rAntiImpl;
+ ::cppu::OWeakObject& m_rParent;
+ ::osl::Mutex& m_rMutex;
+ bool m_bDisposed;
+
+ SfxUndoManager m_aUndoManager;
+ ::framework::UndoManagerHelper m_aUndoHelper;
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::osl::Mutex& UndoManager_Impl::getMutex()
+ {
+ return m_rMutex;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::svl::IUndoManager& UndoManager_Impl::getImplUndoManager()
+ {
+ return m_aUndoManager;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ Reference< XUndoManager > UndoManager_Impl::getThis()
+ {
+ return &m_rAntiImpl;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManager_Impl::disposing()
+ {
+ {
+ ::osl::MutexGuard aGuard( m_rMutex );
+ m_bDisposed = true;
+ }
+ m_aUndoHelper.disposing();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManager_Impl::checkDisposed_lck()
+ {
+ if ( m_bDisposed )
+ throw DisposedException( ::rtl::OUString(), getThis() );
+ }
+
+ //==============================================================================================================
+ //= UndoManagerMethodGuard
+ //==============================================================================================================
+ /** guard for public UNO methods of the UndoManager
+
+ The only purpose of this guard is to check for the instance being disposed already. Everything else,
+ in particular the IMutexGuard functionality required by the UndoManagerHelper class, is a dummy only,
+ as all involved classes (means we ourselves, the UndoManagerHelper, the SfxUndoManager, and the Undo actions
+ we create) are inherently thread-safe, thus need no external lock (in particular no SolarMutex!).
+ */
+ class UndoManagerMethodGuard : public ::framework::IMutexGuard
+ {
+ public:
+ UndoManagerMethodGuard( UndoManager_Impl& i_impl )
+ {
+ ::osl::MutexGuard aGuard( i_impl.getMutex() );
+ // throw if the instance is already disposed
+ i_impl.checkDisposed_lck();
+ }
+ virtual ~UndoManagerMethodGuard()
+ {
+ }
+
+ // IMutexGuard
+ virtual ::framework::IMutex& getGuardedMutex();
+
+ // IGuard
+ virtual void clear();
+ virtual void reset();
+ };
+
+ class DummyMutex : public ::framework::IMutex
+ {
+ public:
+ virtual void acquire() { }
+ virtual void release() { }
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex()
+ {
+ static DummyMutex s_aDummyMutex;
+ return s_aDummyMutex;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::clear()
+ {
+ // nothing to do. This interface implementation is a dummy.
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::reset()
+ {
+ // nothing to do. This interface implementation is a dummy.
+ }
+ }
+
+ //==================================================================================================================
+ //= UndoManager
+ //==================================================================================================================
+ using impl::UndoManagerMethodGuard;
+
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_pImpl( new impl::UndoManager_Impl( *this, i_parent, i_mutex ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::~UndoManager()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::acquire() throw ()
+ {
+ m_pImpl->getParent().acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::release() throw ()
+ {
+ m_pImpl->getParent().release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UndoManager::disposing()
+ {
+ m_pImpl->disposing();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().enterUndoContext( i_title, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterHiddenUndoContext( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().enterHiddenUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::leaveUndoContext( ) throw (InvalidStateException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().leaveUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (IllegalArgumentException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().addUndoAction( i_action, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::undo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().undo( aGuard );
+
+ ChartViewHelper::setViewToDirtyState( Reference< XModel >( getParent(), UNO_QUERY ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::redo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().redo( aGuard );
+
+ ChartViewHelper::setViewToDirtyState( Reference< XModel >( getParent(), UNO_QUERY ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isUndoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().isUndoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isRedoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().isRedoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentUndoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().getCurrentUndoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentRedoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().getCurrentRedoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllUndoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().getAllUndoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllRedoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().getAllRedoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clear( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().clear( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clearRedo( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().clearRedo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::reset( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().reset( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().addUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().removeUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::lock( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().lock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::unlock( ) throw (NotLockedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().unlock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isLocked( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getUndoHelper().isLocked();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL UndoManager::getParent( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return *&m_pImpl->getParent();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ (void)i_parent;
+ throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addModifyListener( const Reference< XModifyListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().addModifyListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::removeModifyListener( const Reference< XModifyListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getUndoHelper().removeModifyListener( i_listener );
+ }
+
+//......................................................................................................................
+} // namespace chart
+//......................................................................................................................
diff --git a/chart2/source/model/main/UndoManager.hxx b/chart2/source/model/main/UndoManager.hxx
new file mode 100755
index 000000000000..07091207ebd0
--- /dev/null
+++ b/chart2/source/model/main/UndoManager.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART2_UNDOMANAGER_HXX
+#define CHART2_UNDOMANAGER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/container/XChild.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace chart
+{
+//......................................................................................................................
+
+ namespace impl
+ {
+ class UndoManager_Impl;
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::document::XUndoManager
+ , ::com::sun::star::util::XModifyBroadcaster
+ > UndoManager_Base;
+ }
+
+ //==================================================================================================================
+ //= UndoManager
+ //==================================================================================================================
+ class UndoManager : public impl::UndoManager_Base
+ {
+ public:
+ UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex );
+ virtual ~UndoManager();
+
+ // XInterface
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XComponent equivalents
+ void disposing();
+
+ // XUndoManager
+ virtual void SAL_CALL enterUndoContext( const ::rtl::OUString& i_title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enterHiddenUndoContext( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL leaveUndoContext( ) throw (::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isUndoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRedoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentUndoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentRedoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clear( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearRedo( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XLockable (base of XUndoManager)
+ virtual void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlock( ) throw (::com::sun::star::util::NotLockedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChild (base of XUndoManager)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::boost::scoped_ptr< impl::UndoManager_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace chart
+//......................................................................................................................
+
+#endif // CHART2_UNDOMANAGER_HXX
diff --git a/chart2/source/model/main/makefile.mk b/chart2/source/model/main/makefile.mk
index 8e963dfa0f5c..5ca78bbdea25 100644
--- a/chart2/source/model/main/makefile.mk
+++ b/chart2/source/model/main/makefile.mk
@@ -60,6 +60,7 @@ SLOFILES= \
$(SLO)$/StockBar.obj \
$(SLO)$/Title.obj \
$(SLO)$/Wall.obj \
+ $(SLO)$/UndoManager.obj \
$(SLO)$/_serviceregistration_model.obj
# --- Targets -----------------------------------------------------------------
diff --git a/chart2/source/model/makefile.mk b/chart2/source/model/makefile.mk
index 52cc85c10904..25d4b1b2949a 100644
--- a/chart2/source/model/makefile.mk
+++ b/chart2/source/model/makefile.mk
@@ -79,7 +79,8 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SVLLIB) \
$(SVTOOLLIB) \
$(SALLIB) \
- $(UCBHELPERLIB)
+ $(UCBHELPERLIB) \
+ $(FWELIB) \
#--------exports
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
index 1f26fff907e4..27fee7d35aff 100644..100755
--- a/chart2/source/model/template/BubbleDataInterpreter.cxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -77,16 +77,17 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
Reference< data::XLabeledDataSequence > xCategories;
bool bHasCategories = HasCategories( aArguments, aData );
+ bool bUseCategoriesAsX = UseCategoriesAsX( aArguments );
- bool bHasXValues = false;
+ bool bSetXValues = false;
sal_Int32 nDataSeqCount = aData.getLength();
- bHasXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
+ bSetXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
:( nDataSeqCount > 2 && nDataSeqCount % 2 != 0 );
bool bCategoriesUsed = false;
bool bNextIsYValues = bHasCategories ? nDataSeqCount>2 : nDataSeqCount>1;
- for( sal_Int32 nDataIdx = 0; nDataIdx < aData.getLength(); ++nDataIdx )
+ for( sal_Int32 nDataIdx = 0; nDataIdx < nDataSeqCount; ++nDataIdx )
{
try
{
@@ -94,10 +95,17 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
{
xCategories.set( aData[nDataIdx] );
if( xCategories.is())
+ {
SetRole( xCategories->getValues(), C2U("categories"));
+ if( bUseCategoriesAsX )
+ {
+ bSetXValues = false;
+ bNextIsYValues = nDataSeqCount > 2;
+ }
+ }
bCategoriesUsed = true;
}
- else if( !xValuesX.is() && bHasXValues )
+ else if( !xValuesX.is() && bSetXValues )
{
xValuesX.set( aData[nDataIdx] );
if( xValuesX.is())
@@ -115,7 +123,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
aSizeValuesVector.push_back( aData[nDataIdx] );
if( aData[nDataIdx].is())
SetRole( aData[nDataIdx]->getValues(), C2U("values-size"));
- bNextIsYValues = true;
+ bNextIsYValues = (nDataSeqCount-(nDataIdx+1)) >= 2;//two or more left
}
}
catch( uno::Exception & ex )
@@ -132,26 +140,19 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
Reference< util::XCloneable > xCloneableX( xValuesX, uno::UNO_QUERY );
- for( size_t nCount = 0; nCount < aSizeValuesVector.size(); ++nCount, ++nSeriesIndex )
+ for( size_t nN = 0; nN < aSizeValuesVector.size(); ++nN, ++nSeriesIndex )
{
- sal_Int32 nDataSequenceCount = 2;
- if( xValuesX.is() )
- nDataSequenceCount = 3;
- else if( aYValuesVector.empty() )
- nDataSequenceCount = 1;
-
- Sequence< Reference< data::XLabeledDataSequence > > aNewData( nDataSequenceCount );
- sal_Int32 nDataIndex = 0;
+ vector< Reference< data::XLabeledDataSequence > > aNewData;
if( xValuesX.is() )
{
- if( nCount > 0 && xCloneableX.is() )
+ if( nN > 0 && xCloneableX.is() )
xClonedXValues.set( xCloneableX->createClone(), uno::UNO_QUERY );
- aNewData[nDataIndex++] = xClonedXValues;
+ aNewData.push_back( xClonedXValues );
}
- if( aYValuesVector.size() > nCount )
- aNewData[nDataIndex++] = aYValuesVector[nCount];
- if( aSizeValuesVector.size() > nCount )
- aNewData[nDataIndex++] = aSizeValuesVector[nCount];
+ if( aYValuesVector.size() > nN )
+ aNewData.push_back( aYValuesVector[nN] );
+ if( aSizeValuesVector.size() > nN )
+ aNewData.push_back( aSizeValuesVector[nN] );
Reference< XDataSeries > xSeries;
if( nSeriesIndex < aSeriesToReUse.getLength())
@@ -161,7 +162,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
OSL_ASSERT( xSeries.is() );
Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
OSL_ASSERT( xSink.is() );
- xSink->setData( aNewData );
+ xSink->setData( ContainerHelper::ContainerToSequence( aNewData ) );
aSeriesVec.push_back( xSeries );
}
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index c922de69a2c7..d089a88bb30b 100755
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -643,17 +643,30 @@ void ChartTypeTemplate::adaptScales(
sal_Int32 nDim( xCooSys->getDimension());
if( nDim > 0 )
{
- const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(0);
+ const sal_Int32 nDimensionX = 0;
+ const sal_Int32 nMaxIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionX);
for(sal_Int32 nI=0; nI<=nMaxIndex; ++nI)
{
- Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,nI) );
+ Reference< XAxis > xAxis( xCooSys->getAxisByDimension(nDimensionX,nI) );
if( xAxis.is())
{
ScaleData aData( xAxis->getScaleData() );
aData.Categories = xCategories;
- aData.AxisType = bSupportsCategories ? AxisType::CATEGORY : AxisType::REALNUMBER;
- if( bSupportsCategories )
- AxisHelper::removeExplicitScaling( aData );
+ if(bSupportsCategories)
+ {
+
+ Reference< XChartType > xChartType( getChartTypeForNewSeries(Sequence< Reference< XChartType > >() ));
+ bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, 2, nDimensionX );
+ if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) )
+ {
+ aData.AxisType = AxisType::CATEGORY;
+ aData.AutoDateAxis = true;
+ AxisHelper::removeExplicitScaling( aData );
+ }
+ }
+ else
+ aData.AxisType = AxisType::REALNUMBER;
+
xAxis->setScaleData( aData );
}
}
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index b5aa13775e8e..686b02536d31 100755
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -390,6 +390,14 @@ bool DataInterpreter::HasCategories(
return bHasCategories;
}
+bool DataInterpreter::UseCategoriesAsX( const Sequence< beans::PropertyValue > & rArguments )
+{
+ bool bUseCategoriesAsX = true;
+ if( rArguments.getLength() > 0 )
+ GetProperty( rArguments, C2U(("UseCategoriesAsX"))) >>= bUseCategoriesAsX;
+ return bUseCategoriesAsX;
+}
+
// ------------------------------------------------------------
Sequence< OUString > DataInterpreter::getSupportedServiceNames_Static()
diff --git a/chart2/source/model/template/DataInterpreter.hxx b/chart2/source/model/template/DataInterpreter.hxx
index a2d6201fc023..d0f2ee922059 100644..100755
--- a/chart2/source/model/template/DataInterpreter.hxx
+++ b/chart2/source/model/template/DataInterpreter.hxx
@@ -73,6 +73,10 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence > > & rData );
+ static bool UseCategoriesAsX(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & rArguments );
+
protected:
// ____ XDataInterpreter ____
virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx
index 839c0cbac510..965e3a058f58 100644..100755
--- a/chart2/source/model/template/XYDataInterpreter.cxx
+++ b/chart2/source/model/template/XYDataInterpreter.cxx
@@ -75,11 +75,12 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
Reference< data::XLabeledDataSequence > xCategories;
- // check for categories. If true, the the categories bet parked in the axis scale, but not used via setting the Axistype to Not CATEGORY
bool bHasCategories = HasCategories( aArguments, aData );
+ bool bUseCategoriesAsX = UseCategoriesAsX( aArguments );
// parse data
bool bCategoriesUsed = false;
+ bool bSetXValues = aData.getLength()>(bCategoriesUsed?2:1);
for( sal_Int32 nDataIdx= 0; nDataIdx < aData.getLength(); ++nDataIdx )
{
try
@@ -88,10 +89,14 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
{
xCategories.set( aData[nDataIdx] );
if( xCategories.is())
+ {
SetRole( xCategories->getValues(), C2U("categories"));
+ if( bUseCategoriesAsX )
+ bSetXValues = false;
+ }
bCategoriesUsed = true;
}
- else if( !xValuesX.is() && (aData.getLength()>(bCategoriesUsed?2:1)) )
+ else if( !xValuesX.is() && bSetXValues )
{
xValuesX.set( aData[nDataIdx] );
if( xValuesX.is())
@@ -123,22 +128,14 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
for( ;aSequencesVecIt != aSequencesVec.end(); ++aSequencesVecIt, ++nSeriesIndex )
{
- Sequence< Reference< data::XLabeledDataSequence > > aNewData(xValuesX.is()?2:1);
- if( aSequencesVecIt != aSequencesVec.begin() &&
- xCloneable.is() )
- {
- xClonedXValues.set( xCloneable->createClone(), uno::UNO_QUERY );
- }
+ vector< Reference< data::XLabeledDataSequence > > aNewData;
+ if( aSequencesVecIt != aSequencesVec.begin() && xCloneable.is() )
+ xClonedXValues.set( xCloneable->createClone(), uno::UNO_QUERY );
if( xValuesX.is() )
- {
- aNewData[0] = xClonedXValues;
- aNewData[1] = (*aSequencesVecIt);
- }
- else
- {
- aNewData[0] = (*aSequencesVecIt);
- }
+ aNewData.push_back( xClonedXValues );
+
+ aNewData.push_back( *aSequencesVecIt );
Reference< XDataSeries > xSeries;
if( nSeriesIndex < aSeriesToReUse.getLength())
@@ -148,7 +145,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
OSL_ASSERT( xSeries.is() );
Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
OSL_ASSERT( xSink.is() );
- xSink->setData( aNewData );
+ xSink->setData( ContainerHelper::ContainerToSequence( aNewData ) );
aSeriesVec.push_back( xSeries );
}
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index b5f7abfb8206..4fd21e2c3b8b 100755
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -38,7 +38,10 @@
#include "servicenames_coosystems.hxx"
#include "DataSeriesHelper.hxx"
#include "Scaling.hxx"
+#include "ChartModelHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include <tools/debug.hxx>
#include <unotools/saveopt.hxx>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
@@ -50,6 +53,8 @@
// header for class OUStringBuffer
#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
@@ -78,6 +83,8 @@ ScaleData AxisHelper::createDefaultScale()
{
ScaleData aScaleData;
aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+ aScaleData.AutoDateAxis = true;
+ aScaleData.ShiftedCategoryPosition = false;//this is adapted in the view code currently
Sequence< SubIncrement > aSubIncrements(1);
aSubIncrements[0] = SubIncrement();
aScaleData.IncrementData.SubIncrements = aSubIncrements;
@@ -89,6 +96,9 @@ void AxisHelper::removeExplicitScaling( ScaleData& rScaleData )
uno::Any aEmpty;
rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = aEmpty;
rScaleData.Scaling = 0;
+ ScaleData aDefaultScale( createDefaultScale() );
+ rScaleData.IncrementData = aDefaultScale.IncrementData;
+ rScaleData.TimeIncrement = aDefaultScale.TimeIncrement;
}
bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
@@ -100,6 +110,227 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
return bReturn;
}
+chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, const Reference< frame::XModel >& xChartModel )
+{
+ DBG_ASSERT(xChartModel.is(),"missing chart model");
+ ScaleData aScale = xAxis->getScaleData();
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY )
+ {
+ sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
+ AxisHelper::getIndicesForAxis(xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), 2, nDimensionIndex );
+ if( bChartTypeAllowsDateAxis )
+ aScale.AxisType = AxisType::DATE;
+ }
+ if( aScale.AxisType == AxisType::DATE )
+ {
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys,xChartModel );
+ if( !aExplicitCategoriesProvider.isDateAxis() )
+ aScale.AxisType = AxisType::CATEGORY;
+ }
+ return aScale;
+}
+
+void AxisHelper::checkDateAxis( chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis )
+{
+ if( rScale.AutoDateAxis && rScale.AxisType == AxisType::CATEGORY && bChartTypeAllowsDateAxis )
+ {
+ rScale.AxisType = AxisType::DATE;
+ removeExplicitScaling( rScale );
+ }
+ if( rScale.AxisType == AxisType::DATE && (!pExplicitCategoriesProvider || !pExplicitCategoriesProvider->isDateAxis()) )
+ {
+ rScale.AxisType = AxisType::CATEGORY;
+ removeExplicitScaling( rScale );
+ }
+}
+
+sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
+ , bool bSearchForParallelAxisIfNothingIsFound )
+{
+ sal_Int32 nNumberFormatKey(0);
+ bool bNumberFormatKeyFoundViaAttachedData = false;
+ sal_Int32 nAxisIndex = 0;
+ sal_Int32 nDimensionIndex = 1;
+ AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
+ Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
+
+ Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is() && !( xProp->getPropertyValue( C2U( "NumberFormat" ) ) >>= nNumberFormatKey ) )
+ {
+ bool bFormatSet = false;
+ //check wether we have a percent scale -> use percent format
+ if( xNumberFormatsSupplier.is() )
+ {
+ ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, Reference< frame::XModel >( xNumberFormatsSupplier, uno::UNO_QUERY ) );
+ if( aData.AxisType==AxisType::PERCENT )
+ {
+ sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier );
+ if( nPercentFormat != -1 )
+ {
+ nNumberFormatKey = nPercentFormat;
+ bFormatSet = true;
+ }
+ }
+ else if( aData.AxisType==AxisType::DATE )
+ {
+ if( aData.Categories.is() )
+ {
+ Reference< data::XDataSequence > xSeq( aData.Categories->getValues());
+ if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) )
+ nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 );
+ else
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ bFormatSet = true;
+ }
+ }
+ else if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() && nDimensionIndex == 0 ) //maybe date axis
+ {
+ Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram() );
+ if( DiagramHelper::isSupportingDateAxis( xDiagram ) )
+ {
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ }
+ else
+ {
+ Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( xChartDoc ) );
+ if( xSource.is() )
+ {
+ ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aXValues(
+ DataSeriesHelper::getAllDataSequencesByRole( xSource->getDataSequences(), C2U("values-x"), true ) );
+ if( aXValues.empty() )
+ {
+ Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ if( xCategories.is() )
+ {
+ Reference< data::XDataSequence > xSeq( xCategories->getValues());
+ if( xSeq.is() )
+ {
+ bool bHasValidDoubles = false;
+ double fTest=0.0;
+ Sequence< uno::Any > aCats( xSeq->getData() );
+ sal_Int32 nCount = aCats.getLength();
+ for( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ if( (aCats[i]>>=fTest) && !::rtl::math::isNan(fTest) )
+ {
+ bHasValidDoubles=true;
+ break;
+ }
+ }
+ if( bHasValidDoubles )
+ nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
+ }
+ }
+ }
+ }
+ }
+ bFormatSet = true;
+ }
+ }
+
+ if( !bFormatSet )
+ {
+ typedef ::std::map< sal_Int32, sal_Int32 > tNumberformatFrequency;
+ tNumberformatFrequency aKeyMap;
+
+ try
+ {
+ Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW );
+ if( xCTCnt.is() )
+ {
+ ::rtl::OUString aRoleToMatch;
+ if( nDimensionIndex == 0 )
+ aRoleToMatch = C2U("values-x");
+ Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ {
+ if( nDimensionIndex != 0 )
+ aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
+ Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
+ {
+ Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]);
+ Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
+
+ if( nDimensionIndex == 1 )
+ {
+ //only take those series into accoutn that are attached to this axis
+ sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ if( nAttachedAxisIndex != nAxisIndex )
+ continue;
+ }
+
+ Reference< data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, aRoleToMatch ) );
+
+ if( !xLabeledSeq.is() && nDimensionIndex==0 )
+ {
+ ScaleData aData = xAxis->getScaleData();
+ xLabeledSeq = aData.Categories;
+ }
+
+ if( xLabeledSeq.is() )
+ {
+ Reference< data::XDataSequence > xSeq( xLabeledSeq->getValues());
+ if( xSeq.is() )
+ {
+ sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
+ // initialize the value
+ if( aKeyMap.find( nKey ) == aKeyMap.end())
+ aKeyMap[ nKey ] = 0;
+ // increase frequency
+ aKeyMap[ nKey ] = (aKeyMap[ nKey ] + 1);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( ! aKeyMap.empty())
+ {
+ sal_Int32 nMaxFreq = 0;
+ // find most frequent key
+ for( tNumberformatFrequency::const_iterator aIt = aKeyMap.begin();
+ aIt != aKeyMap.end(); ++aIt )
+ {
+ OSL_TRACE( "NumberFormatKey %d appears %d times", (*aIt).first, (*aIt).second );
+ // all values must at least be 1
+ if( (*aIt).second > nMaxFreq )
+ {
+ nNumberFormatKey = (*aIt).first;
+ bNumberFormatKeyFoundViaAttachedData = true;
+ nMaxFreq = (*aIt).second;
+ }
+ }
+ }
+
+ if( bSearchForParallelAxisIfNothingIsFound )
+ {
+ //no format is set to this axis and no data is set to this axis
+ //--> try to obtain the format from the parallel y-axis
+ if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
+ {
+ sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
+ Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) );
+ nNumberFormatKey = AxisHelper::getExplicitNumberFormatKeyForAxis( xParallelAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier, false );
+ }
+ }
+ }
+ }
+ return nNumberFormatKey;
+}
+
Reference< XAxis > AxisHelper::createAxis(
sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex // 0==main or 1==secondary axis
@@ -131,6 +362,7 @@ Reference< XAxis > AxisHelper::createAxis(
ScaleData aMainScale = xMainAxis->getScaleData();
aScale.AxisType = aMainScale.AxisType;
+ aScale.AutoDateAxis = aMainScale.AutoDateAxis;
aScale.Categories = aMainScale.Categories;
aScale.Orientation = aMainScale.Orientation;
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index debb241e9604..83ab4a26315b 100755
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -415,13 +415,34 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2:
return true;
}
-bool ChartTypeHelper::shiftTicksAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType )
+bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 /*nDimensionCount*/, sal_Int32 nDimensionIndex )
+{
+ if( nDimensionIndex!=0 )
+ return false;
+ if( xChartType.is() )
+ {
+ sal_Int32 nType = ChartTypeHelper::getAxisType( xChartType, nDimensionIndex );
+ if( nType != AxisType::CATEGORY )
+ return false;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ return false;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return false;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
+ }
+ return true;
+}
+
+bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType )
{
if(xChartType.is())
{
rtl::OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)
- || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return true;
}
return false;
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 0cc6ef4a4315..21fc16156397 100644..100755
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -461,25 +461,8 @@ void DataSourceHelper::setRangeSegmentation(
if( !xDataSource.is() )
return;
- DiagramHelper::tTemplateWithServiceName aTemplateAndService =
- DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateFactory );
-
- rtl::OUString aServiceName( aTemplateAndService.second );
- uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first;
-
- if( !xTemplate.is() )
- {
- if( aServiceName.getLength() == 0 )
- aServiceName = C2U("com.sun.star.chart2.template.Column");
- xTemplate.set( xTemplateFactory->createInstance( aServiceName ), uno::UNO_QUERY );
- }
- if( !xTemplate.is() )
- return;
-
- // /-- locked controllers
ControllerLockGuard aCtrlLockGuard( xChartModel );
- xTemplate->changeDiagramData( xDiagram, xDataSource, aArguments );
- // \-- locked controllers
+ xDiagram->setDiagramData( xDataSource, aArguments );
}
Sequence< OUString > DataSourceHelper::getRangesFromLabeledDataSequence(
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index b3ae733c4067..d442797d8ce1 100755
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -42,10 +42,12 @@
#include "ChartModelHelper.hxx"
#include "RelativePositionHelper.hxx"
#include "ControllerLockGuard.hxx"
+#include "NumberFormatterWrapper.hxx"
#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
+#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
@@ -57,10 +59,15 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
#include <unotools/saveopt.hxx>
#include <rtl/math.hxx>
-
-#include <com/sun/star/util/XModifiable.hpp>
+#include <svl/zformat.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -68,7 +75,9 @@ using namespace ::std;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
using ::rtl::OUString;
+using ::com::sun::star::chart2::XAnyDescriptionAccess;
namespace chart
{
@@ -864,7 +873,7 @@ bool DiagramHelper::isCategoryDiagram(
if( xAxis.is())
{
ScaleData aScaleData = xAxis->getScaleData();
- if( aScaleData.AxisType == AxisType::CATEGORY )
+ if( aScaleData.AxisType == AxisType::CATEGORY || aScaleData.AxisType == AxisType::DATE )
return true;
}
}
@@ -902,7 +911,7 @@ void DiagramHelper::setCategoriesToDiagram(
{
if( bCategoryAxis )
aScaleData.AxisType = AxisType::CATEGORY;
- else if( aScaleData.AxisType == AxisType::CATEGORY )
+ else if( aScaleData.AxisType == AxisType::CATEGORY || aScaleData.AxisType == AxisType::DATE )
aScaleData.AxisType = AxisType::REALNUMBER;
}
xCatAxis->setScaleData( aScaleData );
@@ -1018,6 +1027,203 @@ Sequence< rtl::OUString > DiagramHelper::getExplicitSimpleCategories(
return aRet;
}
+namespace
+{
+void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, const Reference< XAxis >& xAxis )
+{
+ if( !xAxis.is() )
+ return;
+ if( !xChartDoc.is() )
+ return;
+
+ ScaleData aScale( xAxis->getScaleData() );
+ if( xChartDoc->hasInternalDataProvider() )
+ {
+ //remove all content the is not of type double and remove multiple level
+ Reference< XAnyDescriptionAccess > xDataAccess( xChartDoc->getDataProvider(), uno::UNO_QUERY );
+ if( xDataAccess.is() )
+ {
+ Sequence< Sequence< Any > > aAnyCategories( xDataAccess->getAnyRowDescriptions() );
+ double fTest = 0.0;
+ double fNan = 0.0;
+ ::rtl::math::setNan( & fNan );
+ sal_Int32 nN = aAnyCategories.getLength();
+ for( ; nN--; )
+ {
+ Sequence< Any >& rCat = aAnyCategories[nN];
+ if( rCat.getLength() > 1 )
+ rCat.realloc(1);
+ if( rCat.getLength() == 1 )
+ {
+ Any& rAny = rCat[0];
+ if( !(rAny>>=fTest) )
+ {
+ rAny = uno::makeAny(fNan);
+ }
+ }
+ }
+ xDataAccess->setAnyRowDescriptions( aAnyCategories );
+ }
+ //check the numberformat at the axis
+ Reference< beans::XPropertySet > xAxisProps( xAxis, uno::UNO_QUERY );
+ Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartDoc, uno::UNO_QUERY );
+ if( xAxisProps.is() && xNumberFormatsSupplier.is() )
+ {
+ sal_Int32 nNumberFormat = -1;
+ xAxisProps->getPropertyValue( C2U("NumberFormat") ) >>= nNumberFormat;
+
+ Reference< util::XNumberFormats > xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+ if( xNumberFormats.is() )
+ {
+ Reference< beans::XPropertySet > xKeyProps;
+ try
+ {
+ xKeyProps = xNumberFormats->getByKey( nNumberFormat );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ sal_Int32 nType = util::NumberFormat::UNDEFINED;
+ if( xKeyProps.is() )
+ xKeyProps->getPropertyValue( C2U("Type") ) >>= nType;
+ if( !( nType & util::NumberFormat::DATE ) )
+ {
+ //set a date format to the axis
+ sal_Bool bCreate = sal_True;
+ const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
+ Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLocaleDataWrapper.getLocale(), bCreate );
+ if( aKeySeq.getLength() )
+ {
+ xAxisProps->setPropertyValue( C2U("NumberFormat"), uno::makeAny(aKeySeq[0]) );
+ }
+ }
+ }
+ }
+ }
+ if( aScale.AxisType != chart2::AxisType::DATE )
+ AxisHelper::removeExplicitScaling( aScale );
+ aScale.AxisType = chart2::AxisType::DATE;
+ xAxis->setScaleData( aScale );
+}
+
+void lcl_switchToTextCategories( const Reference< XChartDocument >& xChartDoc, const Reference< XAxis >& xAxis )
+{
+ if( !xAxis.is() )
+ return;
+ if( !xChartDoc.is() )
+ return;
+ ScaleData aScale( xAxis->getScaleData() );
+ if( aScale.AxisType != chart2::AxisType::CATEGORY )
+ AxisHelper::removeExplicitScaling( aScale );
+ //todo migrate dates to text?
+ aScale.AxisType = chart2::AxisType::CATEGORY;
+ aScale.AutoDateAxis = false;
+ xAxis->setScaleData( aScale );
+}
+
+}
+
+void DiagramHelper::switchToDateCategories( const Reference< XChartDocument >& xChartDoc )
+{
+ Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+ if(xChartModel.is())
+ {
+ ControllerLockGuard aCtrlLockGuard( xChartModel );
+
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ if( xCooSys.is() )
+ {
+ Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,0) );
+ lcl_switchToDateCategories( xChartDoc, xAxis );
+ }
+ }
+}
+
+void DiagramHelper::switchToTextCategories( const Reference< XChartDocument >& xChartDoc )
+{
+ Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+ if(xChartModel.is())
+ {
+ ControllerLockGuard aCtrlLockGuard( xChartModel );
+
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ if( xCooSys.is() )
+ {
+ Reference< XAxis > xAxis( xCooSys->getAxisByDimension(0,0) );
+ lcl_switchToTextCategories( xChartDoc, xAxis );
+ }
+ }
+}
+
+bool DiagramHelper::isSupportingDateAxis( const Reference< chart2::XDiagram >& xDiagram )
+{
+ return ::chart::ChartTypeHelper::isSupportingDateAxis(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), DiagramHelper::getDimension( xDiagram ), 0 );
+}
+
+bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const Reference< util::XNumberFormats >& xNumberFormats )
+{
+ bool bIsDate = false;
+ if( !xNumberFormats.is() )
+ return bIsDate;
+
+ Reference< beans::XPropertySet > xKeyProps = xNumberFormats->getByKey( nNumberFormat );
+ if( xKeyProps.is() )
+ {
+ sal_Int32 nType = util::NumberFormat::UNDEFINED;
+ xKeyProps->getPropertyValue( C2U("Type") ) >>= nType;
+ bIsDate = nType & util::NumberFormat::DATE;
+ }
+ return bIsDate;
+}
+
+sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ sal_Int32 nRet=-1;
+ Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() );
+ if( xNumberFormats.is() )
+ {
+ sal_Bool bCreate = sal_True;
+ const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
+ Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE,
+ rLocaleDataWrapper.getLocale(), bCreate );
+ if( aKeySeq.getLength() )
+ {
+ nRet = aKeySeq[0];
+ }
+ }
+
+ //try to get a date format with full year display
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
+ if( pNumFormatter )
+ {
+ const SvNumberformat* pFormat = pNumFormatter->GetEntry( nRet );
+ if( pFormat )
+ nRet = pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, pFormat->GetLanguage() );
+ }
+ return nRet;
+}
+
+sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+{
+ sal_Int32 nRet=-1;
+ Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() );
+ if( xNumberFormats.is() )
+ {
+ sal_Bool bCreate = sal_True;
+ const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
+ Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT,
+ rLocaleDataWrapper.getLocale(), bCreate );
+ if( aKeySeq.getLength() )
+ {
+ nRet = aKeySeq[0];
+ }
+ }
+ return nRet;
+}
+
Sequence< Reference< XChartType > >
DiagramHelper::getChartTypesFromDiagram(
const Reference< XDiagram > & xDiagram )
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index a59610b1fc3a..a0376aa95d46 100755
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -30,11 +30,18 @@
#include "ExplicitCategoriesProvider.hxx"
#include "DiagramHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "AxisHelper.hxx"
#include "CommonConverters.hxx"
#include "DataSourceHelper.hxx"
#include "ChartModelHelper.hxx"
#include "ContainerHelper.hxx"
#include "macros.hxx"
+#include "NumberFormatterWrapper.hxx"
+
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
//.............................................................................
namespace chart
@@ -53,7 +60,11 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
, const uno::Reference< frame::XModel >& xChartModel )
: m_bDirty(true)
, m_xCooSysModel( xCooSysModel )
+ , m_xChartModel( xChartModel )
, m_xOriginalCategories()
+ , m_bIsExplicitCategoriesInited(false)
+ , m_bIsDateAxis(false)
+ , m_bIsAutoDate(false)
{
try
{
@@ -61,7 +72,12 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
{
uno::Reference< XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
if( xAxis.is() )
- m_xOriginalCategories = xAxis->getScaleData().Categories;
+ {
+ ScaleData aScale( xAxis->getScaleData() );
+ m_xOriginalCategories = aScale.Categories;
+ m_bIsAutoDate = (aScale.AutoDateAxis && aScale.AxisType==chart2::AxisType::CATEGORY);
+ m_bIsDateAxis = (aScale.AxisType == chart2::AxisType::DATE || m_bIsAutoDate);
+ }
}
if( m_xOriginalCategories.is() )
@@ -134,6 +150,13 @@ ExplicitCategoriesProvider::~ExplicitCategoriesProvider()
{
}
+Reference< chart2::data::XDataSequence > ExplicitCategoriesProvider::getOriginalCategories()
+{
+ if( m_xOriginalCategories.is() )
+ return m_xOriginalCategories->getValues();
+ return 0;
+}
+
const Sequence< Reference< data::XLabeledDataSequence> >& ExplicitCategoriesProvider::getSplitCategoriesList()
{
return m_aSplitCategoriesList;
@@ -167,30 +190,51 @@ std::vector<sal_Int32> lcl_getLimitingBorders( const std::vector< ComplexCategor
return aLimitingBorders;
}
-uno::Sequence< rtl::OUString > lcl_DataToStringSequence( const uno::Reference< data::XDataSequence >& xDataSequence )
+void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< rtl::OUString >& rOutTexts, const uno::Sequence< uno::Any >& rInAnys, Reference< frame::XModel > xChartModel )
{
- uno::Sequence< rtl::OUString > aStrings;
+ sal_Int32 nCount = rInAnys.getLength();
+ if(!nCount)
+ return;
+ rOutTexts.realloc(nCount);
+ Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+ Reference< util::XNumberFormats > xNumberFormats;
+ if( xNumberFormatsSupplier.is() )
+ xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+
+ sal_Int32 nAxisNumberFormat = 0;
+ Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ if( xCooSysModel.is() )
+ {
+ Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
+ nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis(
+ xAxis, xCooSysModel, xNumberFormatsSupplier, false );
+ }
- OSL_ASSERT( xDataSequence.is());
- if( !xDataSequence.is() )
- return aStrings;
+ sal_Int32 nLabelColor;
+ bool bColorChanged = false;
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
- uno::Reference< data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
- if( xTextualDataSequence.is() )
+ for(sal_Int32 nN=0;nN<nCount;nN++)
{
- aStrings = xTextualDataSequence->getTextualData();
- }
- else
- {
- uno::Sequence< uno::Any > aValues = xDataSequence->getData();
- aStrings.realloc(aValues.getLength());
-
- for(sal_Int32 nN=aValues.getLength();nN--;)
- aValues[nN] >>= aStrings[nN];
+ rtl::OUString aText;
+ uno::Any aAny = rInAnys[nN];
+ if( aAny.hasValue() )
+ {
+ double fDouble = 0;
+ if( aAny>>=fDouble )
+ {
+ if( !::rtl::math::isNan(fDouble) )
+ aText = aNumberFormatterWrapper.getFormattedString(
+ nAxisNumberFormat, fDouble, nLabelColor, bColorChanged );
+ }
+ else
+ {
+ aAny>>=aText;
+ }
+ }
+ rOutTexts[nN] = aText;
}
-
- return aStrings;
}
SplitCategoriesProvider::~SplitCategoriesProvider()
@@ -201,9 +245,13 @@ class SplitCategoriesProvider_ForLabeledDataSequences : public SplitCategoriesPr
{
public:
- explicit SplitCategoriesProvider_ForLabeledDataSequences( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::data::XLabeledDataSequence> >& rSplitCategoriesList )
+ explicit SplitCategoriesProvider_ForLabeledDataSequences(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> >& rSplitCategoriesList
+ , const Reference< frame::XModel >& xChartModel )
: m_rSplitCategoriesList( rSplitCategoriesList )
+ , m_xChartModel( xChartModel )
{}
virtual ~SplitCategoriesProvider_ForLabeledDataSequences()
{}
@@ -214,6 +262,8 @@ public:
private:
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> >& m_rSplitCategoriesList;
+
+ Reference< frame::XModel > m_xChartModel;
};
sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const
@@ -225,7 +275,11 @@ uno::Sequence< rtl::OUString > SplitCategoriesProvider_ForLabeledDataSequences::
uno::Sequence< rtl::OUString > aRet;
Reference< data::XLabeledDataSequence > xLabeledDataSequence( m_rSplitCategoriesList[nLevel] );
if( xLabeledDataSequence.is() )
- aRet = lcl_DataToStringSequence( xLabeledDataSequence->getValues() );
+ {
+ uno::Reference< data::XDataSequence > xDataSequence( xLabeledDataSequence->getValues() );
+ if( xDataSequence.is() )
+ ExplicitCategoriesProvider::convertCategoryAnysToText( aRet, xDataSequence->getData(), m_xChartModel );
+ }
return aRet;
}
@@ -362,23 +416,120 @@ Sequence< OUString > ExplicitCategoriesProvider::getExplicitSimpleCategories(
return lcl_getExplicitSimpleCategories( rSplitCategoriesProvider, aComplexCats );
}
+struct DatePlusIndexComparator
+{
+ inline bool operator() ( const DatePlusIndex& aFirst,
+ const DatePlusIndex& aSecond )
+ {
+ return ( aFirst.fValue < aSecond.fValue );
+ }
+};
+
+bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier )
+{
+ bool bOnlyDatesFound = true;
+ bool bAnyDataFound = false;
+
+ if( xDataSequence.is() )
+ {
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ sal_Int32 nCount = aValues.getLength();
+ rDateCategories.reserve(nCount);
+ Reference< util::XNumberFormats > xNumberFormats;
+ if( xNumberFormatsSupplier.is() )
+ xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+
+ bool bOwnData = false;
+ bool bOwnDataAnddAxisHasAnyFormat = false;
+ bool bOwnDataAnddAxisHasDateFormat = false;
+ Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
+ Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) ) );
+ if( xChartDoc.is() && xCooSysModel.is() )
+ {
+ if( xChartDoc->hasInternalDataProvider() )
+ {
+ bOwnData = true;
+ Reference< beans::XPropertySet > xAxisProps( xCooSysModel->getAxisByDimension(0,0), uno::UNO_QUERY );
+ sal_Int32 nAxisNumberFormat = 0;
+ if( xAxisProps.is() && (xAxisProps->getPropertyValue( C2U("NumberFormat") ) >>= nAxisNumberFormat) )
+ {
+ bOwnDataAnddAxisHasAnyFormat = true;
+ bOwnDataAnddAxisHasDateFormat = DiagramHelper::isDateNumberFormat( nAxisNumberFormat, xNumberFormats );
+ }
+ }
+ }
+
+ for(sal_Int32 nN=0;nN<nCount;nN++)
+ {
+ bool bIsDate = false;
+ if( bIsAutoDate )
+ {
+ if( bOwnData )
+ bIsDate = bOwnDataAnddAxisHasAnyFormat ? bOwnDataAnddAxisHasDateFormat : true;
+ else
+ bIsDate = DiagramHelper::isDateNumberFormat( xDataSequence->getNumberFormatKeyByIndex( nN ), xNumberFormats );
+ }
+ else
+ bIsDate = true;
+
+ bool bContainsEmptyString = false;
+ bool bContainsNan = false;
+ uno::Any aAny = aValues[nN];
+ if( aAny.hasValue() )
+ {
+ OUString aTest;
+ double fTest = 0;
+ if( (aAny>>=aTest) && !aTest.getLength() ) //empty String
+ bContainsEmptyString = true;
+ else if( (aAny>>=fTest) && ::rtl::math::isNan(fTest) )
+ bContainsNan = true;
+
+ if( !bContainsEmptyString && !bContainsNan )
+ bAnyDataFound = true;
+ }
+ DatePlusIndex aDatePlusIndex( 1.0, nN );
+ if( bIsDate && (aAny >>= aDatePlusIndex.fValue) )
+ rDateCategories.push_back( aDatePlusIndex );
+ else
+ {
+ if( aAny.hasValue() && !bContainsEmptyString )//empty string does not count as non date value!
+ bOnlyDatesFound=false;
+ ::rtl::math::setNan( &aDatePlusIndex.fValue );
+ rDateCategories.push_back( aDatePlusIndex );
+ }
+ }
+ ::std::sort( rDateCategories.begin(), rDateCategories.end(), DatePlusIndexComparator() );
+ }
+
+ return bAnyDataFound && bOnlyDatesFound;
+}
+
void ExplicitCategoriesProvider::init()
{
if( m_bDirty )
{
- m_aExplicitCategories.realloc(0);
m_aComplexCats.clear();//not one per index
+ m_aDateCategories.clear();
if( m_xOriginalCategories.is() )
{
if( !hasComplexCategories() )
- m_aExplicitCategories = DataSequenceToStringSequence(m_xOriginalCategories->getValues());
+ {
+ if(m_bIsDateAxis)
+ {
+ if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 2, 0 ) )
+ m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
+ else
+ m_bIsDateAxis = false;
+ }
+ }
else
- m_aExplicitCategories = lcl_getExplicitSimpleCategories(
- SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList ), m_aComplexCats );
+ {
+ m_bIsDateAxis = false;
+ }
}
- if(!m_aExplicitCategories.getLength())
- m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel );
+ else
+ m_bIsDateAxis=false;
m_bDirty = false;
}
}
@@ -386,7 +537,28 @@ void ExplicitCategoriesProvider::init()
Sequence< ::rtl::OUString > ExplicitCategoriesProvider::getSimpleCategories()
{
- init();
+ if( !m_bIsExplicitCategoriesInited )
+ {
+ init();
+ m_aExplicitCategories.realloc(0);
+ if( m_xOriginalCategories.is() )
+ {
+ if( !hasComplexCategories() )
+ {
+ uno::Reference< data::XDataSequence > xDataSequence( m_xOriginalCategories->getValues() );
+ if( xDataSequence.is() )
+ ExplicitCategoriesProvider::convertCategoryAnysToText( m_aExplicitCategories, xDataSequence->getData(), m_xChartModel );
+ }
+ else
+ {
+ m_aExplicitCategories = lcl_getExplicitSimpleCategories(
+ SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList, m_xChartModel ), m_aComplexCats );
+ }
+ }
+ if(!m_aExplicitCategories.getLength())
+ m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel );
+ m_bIsExplicitCategoriesInited = true;
+ }
return m_aExplicitCategories;
}
@@ -415,6 +587,18 @@ OUString ExplicitCategoriesProvider::getCategoryByIndex(
return OUString();
}
+bool ExplicitCategoriesProvider::isDateAxis()
+{
+ init();
+ return m_bIsDateAxis;
+}
+
+const std::vector< DatePlusIndex >& ExplicitCategoriesProvider::getDateCategories()
+{
+ init();
+ return m_aDateCategories;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/tools/InternalData.cxx b/chart2/source/tools/InternalData.cxx
index 65fc97a04b38..e9b0cf689768 100755
--- a/chart2/source/tools/InternalData.cxx
+++ b/chart2/source/tools/InternalData.cxx
@@ -38,6 +38,7 @@
using ::com::sun::star::uno::Sequence;
using ::rtl::OUString;
+using namespace ::com::sun::star;
using namespace ::std;
namespace chart
@@ -55,10 +56,10 @@ struct lcl_NumberedStringGenerator
m_nWildcardLength( rWildcard.getLength())
{
}
- vector< OUString > operator()()
+ vector< uno::Any > operator()()
{
- vector< OUString > aRet(1);
- aRet[0] = m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::valueOf( ++m_nCounter ));
+ vector< uno::Any > aRet(1);
+ aRet[0] = uno::makeAny( m_aStub.replaceAt( m_nStubStartIndex, m_nWildcardLength, OUString::valueOf( ++m_nCounter )) );
return aRet;
}
private:
@@ -113,12 +114,12 @@ void InternalData::createDefaultData()
m_aRowLabels.clear();
m_aRowLabels.reserve( m_nRowCount );
generate_n( back_inserter( m_aRowLabels ), m_nRowCount,
- lcl_NumberedStringGenerator( aRowName, C2U("%ROWNUMBER") ));
+ lcl_NumberedStringGenerator( aRowName, C2U("%ROWNUMBER") ));
m_aColumnLabels.clear();
m_aColumnLabels.reserve( m_nColumnCount );
generate_n( back_inserter( m_aColumnLabels ), m_nColumnCount,
- lcl_NumberedStringGenerator( aColName, C2U("%COLUMNNUMBER") ));
+ lcl_NumberedStringGenerator( aColName, C2U("%COLUMNNUMBER") ));
}
void InternalData::setData( const Sequence< Sequence< double > >& rDataInRows )
@@ -199,7 +200,7 @@ void InternalData::setRowValues( sal_Int32 nRowIndex, const vector< double > & r
m_aData[ ::std::slice( nRowIndex*m_nColumnCount, m_nColumnCount, 1 ) ]= aSlice;
}
-void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector< OUString >& rComplexLabel )
+void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector< uno::Any >& rComplexLabel )
{
if( nColumnIndex < 0 )
return;
@@ -208,10 +209,10 @@ void InternalData::setComplexColumnLabel( sal_Int32 nColumnIndex, const vector<
m_aColumnLabels.resize(nColumnIndex+1);
enlargeData( nColumnIndex+1, 0 );
}
-
m_aColumnLabels[nColumnIndex]=rComplexLabel;
}
-void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< OUString >& rComplexLabel )
+
+void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< uno::Any >& rComplexLabel )
{
if( nRowIndex < 0 )
return;
@@ -220,23 +221,22 @@ void InternalData::setComplexRowLabel( sal_Int32 nRowIndex, const vector< OUStri
m_aRowLabels.resize(nRowIndex+1);
enlargeData( 0, nRowIndex+1 );
}
-
m_aRowLabels[nRowIndex] = rComplexLabel;
}
-vector< OUString > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
+vector< uno::Any > InternalData::getComplexColumnLabel( sal_Int32 nColumnIndex ) const
{
if( nColumnIndex < static_cast< sal_Int32 >( m_aColumnLabels.size() ) )
return m_aColumnLabels[nColumnIndex];
else
- return vector< OUString >();
+ return vector< uno::Any >();
}
-vector< OUString > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
+vector< uno::Any > InternalData::getComplexRowLabel( sal_Int32 nRowIndex ) const
{
if( nRowIndex < static_cast< sal_Int32 >( m_aRowLabels.size() ) )
return m_aRowLabels[nRowIndex];
else
- return vector< OUString >();
+ return vector< uno::Any >();
}
void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
@@ -253,7 +253,7 @@ void InternalData::swapRowWithNext( sal_Int32 nRowIndex )
m_aData[nIndex2] = fTemp;
}
- vector< OUString > aTemp( m_aRowLabels[nRowIndex] );
+ vector< uno::Any > aTemp( m_aRowLabels[nRowIndex] );
m_aRowLabels[nRowIndex] = m_aRowLabels[nRowIndex + 1];
m_aRowLabels[nRowIndex + 1] = aTemp;
}
@@ -273,7 +273,7 @@ void InternalData::swapColumnWithNext( sal_Int32 nColumnIndex )
m_aData[nIndex2] = fTemp;
}
- vector< OUString > aTemp( m_aColumnLabels[nColumnIndex] );
+ vector< uno::Any > aTemp( m_aColumnLabels[nColumnIndex] );
m_aColumnLabels[nColumnIndex] = m_aColumnLabels[nColumnIndex + 1];
m_aColumnLabels[nColumnIndex + 1] = aTemp;
}
@@ -336,7 +336,7 @@ void InternalData::insertColumn( sal_Int32 nAfterIndex )
// labels
if( nAfterIndex < static_cast< sal_Int32 >( m_aColumnLabels.size()))
- m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), vector< OUString >(1) );
+ m_aColumnLabels.insert( m_aColumnLabels.begin() + (nAfterIndex + 1), vector< uno::Any >(1) );
#if OSL_DEBUG_LEVEL > 2
traceData();
@@ -388,7 +388,7 @@ void InternalData::insertRow( sal_Int32 nAfterIndex )
// labels
if( nAfterIndex < static_cast< sal_Int32 >( m_aRowLabels.size()))
- m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, vector< OUString> (1));
+ m_aRowLabels.insert( m_aRowLabels.begin() + nIndex, vector< uno::Any > (1));
#if OSL_DEBUG_LEVEL > 2
traceData();
@@ -481,7 +481,7 @@ sal_Int32 InternalData::getColumnCount() const
return m_nColumnCount;
}
-void InternalData::setComplexRowLabels( const vector< vector< OUString > >& rNewRowLabels )
+void InternalData::setComplexRowLabels( const vector< vector< uno::Any > >& rNewRowLabels )
{
m_aRowLabels = rNewRowLabels;
sal_Int32 nNewRowCount = static_cast< sal_Int32 >( m_aRowLabels.size() );
@@ -491,12 +491,12 @@ void InternalData::setComplexRowLabels( const vector< vector< OUString > >& rNew
enlargeData( 0, nNewRowCount );
}
-vector< vector< OUString > > InternalData::getComplexRowLabels() const
+vector< vector< uno::Any > > InternalData::getComplexRowLabels() const
{
return m_aRowLabels;
}
-void InternalData::setComplexColumnLabels( const vector< vector< OUString > >& rNewColumnLabels )
+void InternalData::setComplexColumnLabels( const vector< vector< uno::Any > >& rNewColumnLabels )
{
m_aColumnLabels = rNewColumnLabels;
sal_Int32 nNewColumnCount = static_cast< sal_Int32 >( m_aColumnLabels.size() );
@@ -506,7 +506,7 @@ void InternalData::setComplexColumnLabels( const vector< vector< OUString > >& r
enlargeData( nNewColumnCount, 0 );
}
-vector< vector< OUString > > InternalData::getComplexColumnLabels() const
+vector< vector< uno::Any > > InternalData::getComplexColumnLabels() const
{
return m_aColumnLabels;
}
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 26b2db4fc253..2d51bd0f7acd 100755
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -93,6 +93,24 @@ static const ::rtl::OUString lcl_aCompleteRange(
typedef ::std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > >
lcl_tSequenceMap;
+Sequence< OUString > lcl_AnyToStringSequence( const Sequence< uno::Any >& aAnySeq )
+{
+ Sequence< OUString > aResult;
+ aResult.realloc( aAnySeq.getLength() );
+ transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
+ aResult.getArray(), CommonFunctors::AnyToString() );
+ return aResult;
+}
+
+Sequence< uno::Any > lcl_StringToAnySequence( const Sequence< OUString >& aStringSeq )
+{
+ Sequence< uno::Any > aResult;
+ aResult.realloc( aStringSeq.getLength() );
+ transform( aStringSeq.getConstArray(), aStringSeq.getConstArray() + aStringSeq.getLength(),
+ aResult.getArray(), CommonFunctors::makeAny< OUString >() );
+ return aResult;
+}
+
struct lcl_setModified : public ::std::unary_function< lcl_tSequenceMap, void >
{
void operator() ( const lcl_tSequenceMap::value_type & rMapEntry )
@@ -154,9 +172,9 @@ struct lcl_internalizeSeries : public ::std::unary_function< Reference< chart2::
if( xLabel.is() )
{
if( m_bDataInColumns )
- m_rInternalData.setComplexColumnLabel( nNewIndex, ContainerHelper::SequenceToVector( xLabel->getTextualData() ) );
+ m_rInternalData.setComplexColumnLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) );
else
- m_rInternalData.setComplexRowLabel( nNewIndex, ContainerHelper::SequenceToVector( xLabel->getTextualData() ) );
+ m_rInternalData.setComplexRowLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) );
if( m_bConnectToModel )
{
Reference< chart2::data::XDataSequence > xNewLabel(
@@ -187,37 +205,37 @@ private:
bool m_bDataInColumns;
};
-struct lcl_makeAnyFromLevelVector : public ::std::unary_function< vector< OUString >, uno::Any >
+struct lcl_copyFromLevel : public ::std::unary_function< vector< uno::Any >, uno::Any >
{
public:
- explicit lcl_makeAnyFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ explicit lcl_copyFromLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- uno::Any operator() ( const vector< OUString >& rVector )
+ uno::Any operator() ( const vector< uno::Any >& rVector )
{
- OUString aString;
+ uno::Any aRet;
if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
- aString = rVector[m_nLevel];
- return uno::makeAny( aString );
+ aRet = rVector[m_nLevel];
+ return aRet;
}
private:
sal_Int32 m_nLevel;
};
-struct lcl_getStringFromLevelVector : public ::std::unary_function< vector< OUString >, OUString >
+struct lcl_getStringFromLevelVector : public ::std::unary_function< vector< uno::Any >, OUString >
{
public:
explicit lcl_getStringFromLevelVector( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- OUString operator() ( const vector< OUString >& rVector )
+ OUString operator() ( const vector< uno::Any >& rVector )
{
OUString aString;
if( m_nLevel < static_cast< sal_Int32 >(rVector.size()) )
- aString = rVector[m_nLevel];
+ aString = CommonFunctors::AnyToString()(rVector[m_nLevel]);
return aString;
}
@@ -226,19 +244,19 @@ private:
};
-struct lcl_setStringAtLevel : public ::std::binary_function< vector< OUString >, OUString, vector< OUString > >
+struct lcl_setAnyAtLevel : public ::std::binary_function< vector< uno::Any >, uno::Any, vector< uno::Any > >
{
public:
- explicit lcl_setStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ explicit lcl_setAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- vector< OUString > operator() ( const vector< OUString >& rVector, const OUString& rNewText )
+ vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const uno::Any& rNewValue )
{
- vector< OUString > aRet( rVector );
+ vector< uno::Any > aRet( rVector );
if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
aRet.resize( m_nLevel+1 );
- aRet[ m_nLevel ]=rNewText;
+ aRet[ m_nLevel ]=rNewValue;
return aRet;
}
@@ -246,41 +264,61 @@ private:
sal_Int32 m_nLevel;
};
-struct lcl_insertStringAtLevel : public ::std::unary_function< vector< OUString >, void >
+struct lcl_setAnyAtLevelFromStringSequence : public ::std::binary_function< vector< uno::Any >, OUString, vector< uno::Any > >
{
public:
- explicit lcl_insertStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ explicit lcl_setAnyAtLevelFromStringSequence( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- void operator() ( vector< OUString >& rVector )
+ vector< uno::Any > operator() ( const vector< uno::Any >& rVector, const OUString& rNewValue )
+ {
+ vector< uno::Any > aRet( rVector );
+ if( m_nLevel >= static_cast< sal_Int32 >(aRet.size()) )
+ aRet.resize( m_nLevel+1 );
+ aRet[ m_nLevel ]=uno::makeAny(rNewValue);
+ return aRet;
+ }
+
+private:
+ sal_Int32 m_nLevel;
+};
+
+struct lcl_insertAnyAtLevel : public ::std::unary_function< vector< uno::Any >, void >
+{
+public:
+
+ explicit lcl_insertAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ {}
+
+ void operator() ( vector< uno::Any >& rVector )
{
if( m_nLevel > static_cast< sal_Int32 >(rVector.size()) )
rVector.resize( m_nLevel );
- vector< OUString >::iterator aIt( rVector.begin() );
+ vector< uno::Any >::iterator aIt( rVector.begin() );
for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
{
if( nN==m_nLevel )
break;
}
- rVector.insert( aIt, OUString() );
+ rVector.insert( aIt, uno::Any() );
}
private:
sal_Int32 m_nLevel;
};
-struct lcl_removeStringAtLevel : public ::std::unary_function< vector< OUString >, void >
+struct lcl_removeAnyAtLevel : public ::std::unary_function< vector< uno::Any >, void >
{
public:
- explicit lcl_removeStringAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
+ explicit lcl_removeAnyAtLevel( sal_Int32 nLevel ) : m_nLevel( nLevel )
{}
- void operator() ( vector< OUString >& rVector )
+ void operator() ( vector< uno::Any >& rVector )
{
- vector< OUString >::iterator aIt( rVector.begin() );
+ vector< uno::Any >::iterator aIt( rVector.begin() );
for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
{
if( nN==m_nLevel )
@@ -295,23 +333,6 @@ private:
sal_Int32 m_nLevel;
};
-vector< OUString > lcl_AnyToStringVector( const Sequence< uno::Any >& aAnySeq )
-{
- vector< OUString > aStringVec;
- transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
- back_inserter( aStringVec ), CommonFunctors::AnyToString() );
- return aStringVec;
-}
-
-Sequence< OUString > lcl_AnyToStringSequence( const Sequence< uno::Any >& aAnySeq )
-{
- Sequence< OUString > aResult;
- aResult.realloc( aAnySeq.getLength() );
- transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(),
- aResult.getArray(), CommonFunctors::AnyToString() );
- return aResult;
-}
-
} // anonymous namespace
// ================================================================================
@@ -341,9 +362,10 @@ InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocum
// categories
{
- vector< vector< OUString > > aNewCategories;//inner count is level
+ vector< vector< uno::Any > > aNewCategories;//inner count is level
{
ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
+
const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
@@ -351,18 +373,18 @@ InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocum
Reference< chart2::data::XLabeledDataSequence > xLDS( rSplitCategoriesList[nL] );
if( !xLDS.is() )
continue;
- Reference< chart2::data::XTextualDataSequence > xSeq( xLDS->getValues(), uno::UNO_QUERY );
- Sequence< OUString > aStringSeq;
+ Sequence< uno::Any > aDataSeq;
+ Reference< chart2::data::XDataSequence > xSeq( xLDS->getValues() );
if( xSeq.is() )
- aStringSeq = xSeq->getTextualData(); // @todo: be able to deal with XDataSequence, too
- sal_Int32 nLength = aStringSeq.getLength();
+ aDataSeq = xSeq->getData();
+ sal_Int32 nLength = aDataSeq.getLength();
sal_Int32 nCatLength = static_cast< sal_Int32 >(aNewCategories.size());
if( nCatLength < nLength )
aNewCategories.resize( nLength );
else if( nLength < nCatLength )
- aStringSeq.realloc( nCatLength );
- transform( aNewCategories.begin(), aNewCategories.end(), aStringSeq.getConstArray(),
- aNewCategories.begin(), lcl_setStringAtLevel(nL) );
+ aDataSeq.realloc( nCatLength );
+ transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.getConstArray(),
+ aNewCategories.begin(), lcl_setAnyAtLevel(nL) );
}
if( !nLevelCount )
{
@@ -371,9 +393,9 @@ InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocum
aNewCategories.reserve( nLength );
for( sal_Int32 nN=0; nN<nLength; nN++)
{
- vector< OUString > aStringVector(1);
- aStringVector[0] = aSimplecategories[nN];
- aNewCategories.push_back( aStringVector );
+ vector< uno::Any > aVector(1);
+ aVector[0] = uno::makeAny( aSimplecategories[nN] );
+ aNewCategories.push_back( aVector );
}
}
}
@@ -520,14 +542,14 @@ void InternalDataProvider::createDefaultData()
namespace
{
-sal_Int32 lcl_getInnerLevelCount( const vector< vector< OUString > >& rLabels )
+sal_Int32 lcl_getInnerLevelCount( const vector< vector< uno::Any > >& rLabels )
{
sal_Int32 nCount = 1;//minimum is 1!
- vector< vector< OUString > >::const_iterator aLevelIt( rLabels.begin() );
- vector< vector< OUString > >::const_iterator aLevelEnd( rLabels.end() );
+ vector< vector< uno::Any > >::const_iterator aLevelIt( rLabels.begin() );
+ vector< vector< uno::Any > >::const_iterator aLevelEnd( rLabels.end() );
for( ;aLevelIt!=aLevelEnd; ++aLevelIt )
{
- const vector< ::rtl::OUString >& rCurrentLevelLabels = *aLevelIt;
+ const vector< uno::Any >& rCurrentLevelLabels = *aLevelIt;
nCount = std::max<sal_Int32>( rCurrentLevelLabels.size(), nCount );
}
return nCount;
@@ -551,7 +573,7 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData
{
//return split complex categories if we have any:
::std::vector< Reference< chart2::data::XLabeledDataSequence > > aComplexCategories;
- vector< vector< OUString > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
if( bUseColumns==m_bDataInColumns )
{
sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
@@ -733,46 +755,48 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
if( aRange.match( lcl_aLabelRangePrefix ) )
{
sal_Int32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
- vector< OUString > aComplexLabel = m_bDataInColumns
+ vector< uno::Any > aComplexLabel = m_bDataInColumns
? m_aInternalData.getComplexColumnLabel( nIndex )
: m_aInternalData.getComplexRowLabel( nIndex );
if( !aComplexLabel.empty() )
- {
- aResult.realloc( aComplexLabel.size() );
- transform( aComplexLabel.begin(), aComplexLabel.end(),
- aResult.getArray(), CommonFunctors::makeAny< OUString >());
- }
+ aResult = ContainerHelper::ContainerToSequence(aComplexLabel);
}
else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
{
sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesPointRangeNamePrefix.getLength() ).toInt32();
- vector< OUString > aComplexCategory = m_bDataInColumns
+ vector< uno::Any > aComplexCategory = m_bDataInColumns
? m_aInternalData.getComplexRowLabel( nPointIndex )
: m_aInternalData.getComplexColumnLabel( nPointIndex );
if( !aComplexCategory.empty() )
- {
- aResult.realloc( aComplexCategory.size() );
- transform( aComplexCategory.begin(), aComplexCategory.end(),
- aResult.getArray(), CommonFunctors::makeAny< OUString >());
- }
+ aResult = ContainerHelper::ContainerToSequence(aComplexCategory);
}
else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
{
sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength() ).toInt32();
- vector< vector< OUString > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
if( nLevel < lcl_getInnerLevelCount( aCategories ) )
{
aResult.realloc( aCategories.size() );
transform( aCategories.begin(), aCategories.end(),
- aResult.getArray(), lcl_makeAnyFromLevelVector(nLevel) );
+ aResult.getArray(), lcl_copyFromLevel(nLevel) );
}
}
else if( aRange.equals( lcl_aCategoriesRangeName ) )
{
- Sequence< OUString > aLabels = m_bDataInColumns ? this->getRowDescriptions() : this->getColumnDescriptions();
- aResult.realloc( aLabels.getLength() );
- transform( aLabels.getConstArray(), aLabels.getConstArray() + aLabels.getLength(),
- aResult.getArray(), CommonFunctors::makeAny< OUString >() );
+ vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ sal_Int32 nLevelCount = lcl_getInnerLevelCount( aCategories );
+ if( nLevelCount == 1 )
+ {
+ sal_Int32 nL=0;
+ aResult = this->getDataByRangeRepresentation( lcl_aCategoriesLevelRangeNamePrefix + OUString::valueOf( nL ) );
+ }
+ else
+ {
+ Sequence< OUString > aLabels = m_bDataInColumns ? this->getRowDescriptions() : this->getColumnDescriptions();
+ aResult.realloc( aLabels.getLength() );
+ transform( aLabels.getConstArray(), aLabels.getConstArray() + aLabels.getLength(),
+ aResult.getArray(), CommonFunctors::makeAny< OUString >() );
+ }
}
else
{
@@ -800,38 +824,36 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
const OUString& aRange, const Sequence< uno::Any >& aNewData )
throw (uno::RuntimeException)
{
+ vector< uno::Any > aNewVector( ContainerHelper::SequenceToVector(aNewData) );
if( aRange.match( lcl_aLabelRangePrefix ) )
{
- vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
sal_uInt32 nIndex = aRange.copy( lcl_aLabelRangePrefix.getLength()).toInt32();
if( m_bDataInColumns )
- m_aInternalData.setComplexColumnLabel( nIndex, aNewStrings );
+ m_aInternalData.setComplexColumnLabel( nIndex, aNewVector );
else
- m_aInternalData.setComplexRowLabel( nIndex, aNewStrings );
+ m_aInternalData.setComplexRowLabel( nIndex, aNewVector );
}
else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
{
- vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
sal_Int32 nPointIndex = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
if( m_bDataInColumns )
- m_aInternalData.setComplexRowLabel( nPointIndex, aNewStrings );
+ m_aInternalData.setComplexRowLabel( nPointIndex, aNewVector );
else
- m_aInternalData.setComplexColumnLabel( nPointIndex, aNewStrings );
+ m_aInternalData.setComplexColumnLabel( nPointIndex, aNewVector );
}
else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
{
- vector< OUString > aNewStrings( lcl_AnyToStringVector( aNewData ) );
sal_Int32 nLevel = aRange.copy( lcl_aCategoriesLevelRangeNamePrefix.getLength()).toInt32();
- vector< vector< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
//ensure equal length
- if( aNewStrings.size() > aComplexCategories.size() )
- aComplexCategories.resize( aNewStrings.size() );
- else if( aNewStrings.size() < aComplexCategories.size() )
- aNewStrings.resize( aComplexCategories.size() );
+ if( aNewVector.size() > aComplexCategories.size() )
+ aComplexCategories.resize( aNewVector.size() );
+ else if( aNewVector.size() < aComplexCategories.size() )
+ aNewVector.resize( aComplexCategories.size() );
- transform( aComplexCategories.begin(), aComplexCategories.end(), aNewStrings.begin(),
- aComplexCategories.begin(), lcl_setStringAtLevel(nLevel) );
+ transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
+ aComplexCategories.begin(), lcl_setAnyAtLevel(nLevel) );
if( m_bDataInColumns )
m_aInternalData.setComplexRowLabels( aComplexCategories );
@@ -840,10 +862,14 @@ void SAL_CALL InternalDataProvider::setDataByRangeRepresentation(
}
else if( aRange.equals( lcl_aCategoriesRangeName ) )
{
+ vector< vector< uno::Any > > aComplexCategories;
+ aComplexCategories.resize( aNewVector.size() );
+ transform( aComplexCategories.begin(), aComplexCategories.end(), aNewVector.begin(),
+ aComplexCategories.begin(), lcl_setAnyAtLevel(0) );
if( m_bDataInColumns )
- this->setRowDescriptions( lcl_AnyToStringSequence(aNewData) );
+ m_aInternalData.setComplexRowLabels( aComplexCategories );
else
- this->setColumnDescriptions( lcl_AnyToStringSequence(aNewData) );
+ m_aInternalData.setComplexColumnLabels( aComplexCategories );
}
else
{
@@ -908,8 +934,8 @@ void SAL_CALL InternalDataProvider::insertComplexCategoryLevel( sal_Int32 nLevel
OSL_ENSURE( nLevel> 0, "you can only insert category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
if( nLevel>0 )
{
- vector< vector< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
- ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertStringAtLevel(nLevel) );
+ vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_insertAnyAtLevel(nLevel) );
if( m_bDataInColumns )
m_aInternalData.setComplexRowLabels( aComplexCategories );
else
@@ -925,8 +951,8 @@ void SAL_CALL InternalDataProvider::deleteComplexCategoryLevel( sal_Int32 nLevel
OSL_ENSURE( nLevel>0, "you can only delete category levels > 0" );//the first categories level cannot be deleted, check the calling code for error
if( nLevel>0 )
{
- vector< vector< OUString > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
- ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeStringAtLevel(nLevel) );
+ vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels();
+ ::std::for_each( aComplexCategories.begin(), aComplexCategories.end(), lcl_removeAnyAtLevel(nLevel) );
if( m_bDataInColumns )
m_aInternalData.setComplexRowLabels( aComplexCategories );
else
@@ -1136,7 +1162,36 @@ OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXM
namespace
{
-Sequence< Sequence< OUString > > lcl_convertComplexVectorToSequence( const vector< vector< OUString > >& rIn )
+
+template< class Type >
+Sequence< Sequence< Type > > lcl_convertVectorVectorToSequenceSequence( const vector< vector< Type > >& rIn )
+{
+ Sequence< Sequence< Type > > aRet;
+ sal_Int32 nOuterCount = rIn.size();
+ if( nOuterCount )
+ {
+ aRet.realloc(nOuterCount);
+ for( sal_Int32 nN=0; nN<nOuterCount; nN++)
+ aRet[nN]= ContainerHelper::ContainerToSequence( rIn[nN] );
+ }
+ return aRet;
+}
+
+template< class Type >
+vector< vector< Type > > lcl_convertSequenceSequenceToVectorVector( const Sequence< Sequence< Type > >& rIn )
+{
+ vector< vector< Type > > aRet;
+ sal_Int32 nOuterCount = rIn.getLength();
+ if( nOuterCount )
+ {
+ aRet.resize(nOuterCount);
+ for( sal_Int32 nN=0; nN<nOuterCount; nN++)
+ aRet[nN]= ContainerHelper::SequenceToVector( rIn[nN] );
+ }
+ return aRet;
+}
+
+Sequence< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const vector< vector< uno::Any > >& rIn )
{
Sequence< Sequence< OUString > > aRet;
sal_Int32 nOuterCount = rIn.size();
@@ -1144,17 +1199,17 @@ Sequence< Sequence< OUString > > lcl_convertComplexVectorToSequence( const vecto
{
aRet.realloc(nOuterCount);
for( sal_Int32 nN=0; nN<nOuterCount; nN++)
- aRet[nN]=ContainerHelper::ContainerToSequence( rIn[nN] );
+ aRet[nN]= lcl_AnyToStringSequence( ContainerHelper::ContainerToSequence( rIn[nN] ) );
}
return aRet;
}
-vector< vector< OUString > > lcl_convertComplexSequenceToVector( const Sequence< Sequence< OUString > >& rIn )
+vector< vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const Sequence< Sequence< OUString > >& rIn )
{
- vector< vector< OUString > > aRet;
+ vector< vector< uno::Any > > aRet;
sal_Int32 nOuterCount = rIn.getLength();
for( sal_Int32 nN=0; nN<nOuterCount; nN++)
- aRet.push_back( ContainerHelper::SequenceToVector( rIn[nN] ) );
+ aRet.push_back( ContainerHelper::SequenceToVector( lcl_StringToAnySequence( rIn[nN] ) ) );
return aRet;
}
@@ -1162,7 +1217,7 @@ class SplitCategoriesProvider_ForComplexDescriptions : public SplitCategoriesPro
{
public:
- explicit SplitCategoriesProvider_ForComplexDescriptions( const ::std::vector< ::std::vector< ::rtl::OUString > >& rComplexDescriptions )
+ explicit SplitCategoriesProvider_ForComplexDescriptions( const ::std::vector< ::std::vector< uno::Any > >& rComplexDescriptions )
: m_rComplexDescriptions( rComplexDescriptions )
{}
virtual ~SplitCategoriesProvider_ForComplexDescriptions()
@@ -1172,7 +1227,7 @@ public:
virtual uno::Sequence< rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const;
private:
- const ::std::vector< ::std::vector< ::rtl::OUString > >& m_rComplexDescriptions;
+ const ::std::vector< ::std::vector< uno::Any > >& m_rComplexDescriptions;
};
sal_Int32 SplitCategoriesProvider_ForComplexDescriptions::getLevelCount() const
@@ -1193,22 +1248,78 @@ uno::Sequence< rtl::OUString > SplitCategoriesProvider_ForComplexDescriptions::g
}//anonymous namespace
+// ____ XDateCategories ____
+Sequence< double > SAL_CALL InternalDataProvider::getDateCategories() throw (uno::RuntimeException)
+{
+ double fNan = InternalDataProvider::getNotANumber();
+ double fValue = fNan;
+ vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
+ sal_Int32 nCount = aCategories.size();
+ Sequence< double > aDoubles( nCount );
+ vector< vector< uno::Any > >::iterator aIt( aCategories.begin() );
+ vector< vector< uno::Any > >::const_iterator aEnd( aCategories.end() );
+ for(sal_Int32 nN=0; nN<nCount && aIt!=aEnd; ++nN, ++aIt )
+ {
+ if( !( !aIt->empty() && ((*aIt)[0]>>=fValue) ) )
+ fValue = fNan;
+ aDoubles[nN]=fValue;
+ }
+ return aDoubles;
+}
+
+void SAL_CALL InternalDataProvider::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException)
+{
+ sal_Int32 nCount = rDates.getLength();
+ vector< vector< uno::Any > > aNewCategories;
+ aNewCategories.reserve(nCount);
+ vector< uno::Any > aSingleLabel(1);
+
+ for(sal_Int32 nN=0; nN<nCount; ++nN )
+ {
+ aSingleLabel[0]=uno::makeAny(rDates[nN]);
+ aNewCategories.push_back(aSingleLabel);
+ }
+
+ if( m_bDataInColumns )
+ m_aInternalData.setComplexRowLabels( aNewCategories );
+ else
+ m_aInternalData.setComplexColumnLabels( aNewCategories );
+}
+
+// ____ XAnyDescriptionAccess ____
+Sequence< Sequence< uno::Any > > SAL_CALL InternalDataProvider::getAnyRowDescriptions() throw (uno::RuntimeException)
+{
+ return lcl_convertVectorVectorToSequenceSequence( m_aInternalData.getComplexRowLabels() );
+}
+void SAL_CALL InternalDataProvider::setAnyRowDescriptions( const Sequence< Sequence< uno::Any > >& aRowDescriptions ) throw (uno::RuntimeException)
+{
+ m_aInternalData.setComplexRowLabels( lcl_convertSequenceSequenceToVectorVector( aRowDescriptions ) );
+}
+Sequence< Sequence< uno::Any > > SAL_CALL InternalDataProvider::getAnyColumnDescriptions() throw (uno::RuntimeException)
+{
+ return lcl_convertVectorVectorToSequenceSequence( m_aInternalData.getComplexColumnLabels() );
+}
+void SAL_CALL InternalDataProvider::setAnyColumnDescriptions( const Sequence< Sequence< uno::Any > >& aColumnDescriptions ) throw (uno::RuntimeException)
+{
+ m_aInternalData.setComplexColumnLabels( lcl_convertSequenceSequenceToVectorVector( aColumnDescriptions ) );
+}
+
// ____ XComplexDescriptionAccess ____
Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException)
{
- return lcl_convertComplexVectorToSequence( m_aInternalData.getComplexRowLabels() );
+ return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() );
}
void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& aRowDescriptions ) throw (uno::RuntimeException)
{
- m_aInternalData.setComplexRowLabels( lcl_convertComplexSequenceToVector(aRowDescriptions) );
+ m_aInternalData.setComplexRowLabels( lcl_convertComplexStringSequenceToAnyVector(aRowDescriptions) );
}
Sequence< Sequence< ::rtl::OUString > > SAL_CALL InternalDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException)
{
- return lcl_convertComplexVectorToSequence( m_aInternalData.getComplexColumnLabels() );
+ return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() );
}
void SAL_CALL InternalDataProvider::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& aColumnDescriptions ) throw (uno::RuntimeException)
{
- m_aInternalData.setComplexColumnLabels( lcl_convertComplexSequenceToVector(aColumnDescriptions) );
+ m_aInternalData.setComplexColumnLabels( lcl_convertComplexStringSequenceToAnyVector(aColumnDescriptions) );
}
// ____ XChartDataArray ____
@@ -1227,25 +1338,25 @@ void SAL_CALL InternalDataProvider::setData( const Sequence< Sequence< double >
void SAL_CALL InternalDataProvider::setRowDescriptions( const Sequence< OUString >& aRowDescriptions )
throw (uno::RuntimeException)
{
- vector< vector< OUString > > aComplexDescriptions( aRowDescriptions.getLength() );
+ vector< vector< uno::Any > > aComplexDescriptions( aRowDescriptions.getLength() );
transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aRowDescriptions.getConstArray(),
- aComplexDescriptions.begin(), lcl_setStringAtLevel(0) );
+ aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
m_aInternalData.setComplexRowLabels( aComplexDescriptions );
}
void SAL_CALL InternalDataProvider::setColumnDescriptions( const Sequence< OUString >& aColumnDescriptions )
throw (uno::RuntimeException)
{
- vector< vector< OUString > > aComplexDescriptions( aColumnDescriptions.getLength() );
+ vector< vector< uno::Any > > aComplexDescriptions( aColumnDescriptions.getLength() );
transform( aComplexDescriptions.begin(), aComplexDescriptions.end(), aColumnDescriptions.getConstArray(),
- aComplexDescriptions.begin(), lcl_setStringAtLevel(0) );
+ aComplexDescriptions.begin(), lcl_setAnyAtLevelFromStringSequence(0) );
m_aInternalData.setComplexColumnLabels( aComplexDescriptions );
}
Sequence< OUString > SAL_CALL InternalDataProvider::getRowDescriptions()
throw (uno::RuntimeException)
{
- vector< vector< OUString > > aComplexLabels( m_aInternalData.getComplexRowLabels() );
+ vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexRowLabels() );
SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
}
@@ -1253,7 +1364,7 @@ Sequence< OUString > SAL_CALL InternalDataProvider::getRowDescriptions()
Sequence< OUString > SAL_CALL InternalDataProvider::getColumnDescriptions()
throw (uno::RuntimeException)
{
- vector< vector< OUString > > aComplexLabels( m_aInternalData.getComplexColumnLabels() );
+ vector< vector< uno::Any > > aComplexLabels( m_aInternalData.getComplexColumnLabels() );
SplitCategoriesProvider_ForComplexDescriptions aProvider( aComplexLabels );
return ExplicitCategoriesProvider::getExplicitSimpleCategories( aProvider );
}
diff --git a/chart2/source/view/main/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx
index 4e4cd342506c..c4711a4da8be 100644..100755
--- a/chart2/source/view/main/NumberFormatterWrapper.cxx
+++ b/chart2/source/tools/NumberFormatterWrapper.cxx
@@ -27,7 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "macros.hxx"
#include <comphelper/processfactory.hxx>
// header for class SvNumberFormatsSupplierObj
@@ -100,6 +100,25 @@ SvNumberFormatter* NumberFormatterWrapper::getSvNumberFormatter() const
return m_pNumberFormatter;
}
+Date NumberFormatterWrapper::getNullDate() const
+{
+ sal_uInt16 nYear = 1899,nDay = 30,nMonth = 12;
+ Date aRet(nDay,nMonth,nYear);
+
+ util::DateTime aUtilDate;
+ if( m_aNullDate.hasValue() && (m_aNullDate >>= aUtilDate) )
+ {
+ aRet = Date(aUtilDate.Day,aUtilDate.Month,aUtilDate.Year);
+ }
+ else if( m_pNumberFormatter )
+ {
+ Date* pDate = m_pNumberFormatter->GetNullDate();
+ if( pDate )
+ aRet = *pDate;
+ }
+ return aRet;
+}
+
rtl::OUString NumberFormatterWrapper::getFormattedString(
sal_Int32 nNumberFormatKey, double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const
{
@@ -111,7 +130,7 @@ rtl::OUString NumberFormatterWrapper::getFormattedString(
return aText;
}
// i99104 handle null date correctly
- USHORT nYear = 1899,nDay = 30,nMonth = 12;
+ sal_uInt16 nYear = 1899,nDay = 30,nMonth = 12;
if ( m_aNullDate.hasValue() )
{
Date* pDate = m_pNumberFormatter->GetNullDate();
diff --git a/chart2/source/tools/ResId.cxx b/chart2/source/tools/ResId.cxx
index 0d6e35974aaa..b7d4c725d367 100644..100755
--- a/chart2/source/tools/ResId.cxx
+++ b/chart2/source/tools/ResId.cxx
@@ -41,7 +41,7 @@ SchResId::SchResId( sal_Int16 nId )
::rtl::OUString SchResId::getResString( sal_Int16 nId )
{
- return ::rtl::OUString( String( SchResId( nId )));
+ return String( SchResId( nId ));
}
} // namespace chart
diff --git a/chart2/source/tools/makefile.mk b/chart2/source/tools/makefile.mk
index fd92b894bfab..7554bd19cd38 100644
--- a/chart2/source/tools/makefile.mk
+++ b/chart2/source/tools/makefile.mk
@@ -70,6 +70,7 @@ SLOFILES= \
$(SLO)$/LinearRegressionCurveCalculator.obj \
$(SLO)$/LogarithmicRegressionCurveCalculator.obj \
$(SLO)$/MeanValueRegressionCurveCalculator.obj \
+ $(SLO)$/NumberFormatterWrapper.obj \
$(SLO)$/OPropertySet.obj \
$(SLO)$/WrappedPropertySet.obj \
$(SLO)$/WrappedProperty.obj \
diff --git a/chart2/source/view/axes/DateHelper.cxx b/chart2/source/view/axes/DateHelper.cxx
new file mode 100644
index 000000000000..7159a733498f
--- /dev/null
+++ b/chart2/source/view/axes/DateHelper.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DateHelper.hxx"
+#include "DateScaling.hxx"
+#include <rtl/math.hxx>
+#include <com/sun/star/chart/TimeUnit.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+bool DateHelper::IsInSameYear( const Date& rD1, const Date& rD2 )
+{
+ return rD1.GetYear() == rD2.GetYear();
+}
+bool DateHelper::IsInSameMonth( const Date& rD1, const Date& rD2 )
+{
+ return (rD1.GetYear() == rD2.GetYear())
+ && (rD1.GetMonth() == rD2.GetMonth());
+}
+long DateHelper::GetMonthsBetweenDates( Date aD1, Date aD2 )
+{
+ Date aHelp = aD1;
+ long nSign = 1;
+ if( aD1 < aD2 )
+ {
+ aD1 = aD2;
+ aD2 = aHelp;
+ nSign = -1;
+ }
+
+ return nSign*( ( aD1.GetMonth() - aD2.GetMonth() )
+ + ( aD1.GetYear() - aD2.GetYear() )*12 );
+}
+
+Date DateHelper::GetDateSomeMonthsAway( const Date& rD, long nMonthDistance )
+{
+ Date aRet(rD);
+ long nMonth = rD.GetMonth()+nMonthDistance;
+ long nNewMonth = nMonth%12;
+ long nNewYear = rD.GetYear() + nMonth/12;
+ if( nMonth <= 0 || !nNewMonth )
+ nNewYear--;
+ if( nNewMonth <= 0 )
+ nNewMonth += 12;
+ aRet.SetMonth( sal_uInt16(nNewMonth) );
+ aRet.SetYear( sal_uInt16(nNewYear) );
+ while(!aRet.IsValid())
+ aRet--;
+ return aRet;
+}
+
+Date DateHelper::GetDateSomeYearsAway( const Date& rD, long nYearDistance )
+{
+ Date aRet(rD);
+ aRet.SetYear( static_cast<sal_uInt16>(rD.GetYear()+nYearDistance) );
+ while(!aRet.IsValid())
+ aRet--;
+ return aRet;
+}
+
+bool DateHelper::IsLessThanOneMonthAway( const Date& rD1, const Date& rD2 )
+{
+ Date aDMin( DateHelper::GetDateSomeMonthsAway( rD1, -1 ) );
+ Date aDMax( DateHelper::GetDateSomeMonthsAway( rD1, 1 ) );
+
+ if( rD2 > aDMin && rD2 < aDMax )
+ return true;
+ return false;
+}
+
+bool DateHelper::IsLessThanOneYearAway( const Date& rD1, const Date& rD2 )
+{
+ Date aDMin( DateHelper::GetDateSomeYearsAway( rD1, -1 ) );
+ Date aDMax( DateHelper::GetDateSomeYearsAway( rD1, 1 ) );
+
+ if( rD2 > aDMin && rD2 < aDMax )
+ return true;
+ return false;
+}
+
+double DateHelper::RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution )
+{
+ Date aDate(rNullDate); aDate += static_cast<long>(::rtl::math::approxFloor(fValue));
+ switch(TimeResolution)
+ {
+ case ::com::sun::star::chart::TimeUnit::DAY:
+ break;
+ case ::com::sun::star::chart::TimeUnit::YEAR:
+ aDate.SetMonth(1);
+ aDate.SetDay(1);
+ break;
+ case ::com::sun::star::chart::TimeUnit::MONTH:
+ default:
+ aDate.SetDay(1);
+ break;
+ }
+ return aDate - rNullDate;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/DateScaling.cxx b/chart2/source/view/axes/DateScaling.cxx
new file mode 100644
index 000000000000..8a69e83abbc8
--- /dev/null
+++ b/chart2/source/view/axes/DateScaling.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 "DateScaling.hxx"
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <rtl/math.hxx>
+#include "com/sun/star/uno/RuntimeException.hpp"
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName_DateScaling(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.DateScaling" ));
+static const ::rtl::OUString lcl_aServiceName_InverseDateScaling(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.InverseDateScaling" ));
+
+static const ::rtl::OUString lcl_aImplementationName_DateScaling(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.DateScaling" ));
+static const ::rtl::OUString lcl_aImplementationName_InverseDateScaling(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.InverseDateScaling" ));
+
+static const double lcl_fNumberOfMonths = 12.0;//todo: this needs to be offered by basic tools Date class if it should be more generic
+}
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::chart::TimeUnit::DAY;
+using ::com::sun::star::chart::TimeUnit::MONTH;
+using ::com::sun::star::chart::TimeUnit::YEAR;
+
+DateScaling::DateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted )
+ : m_aNullDate( rNullDate )
+ , m_nTimeUnit( nTimeUnit )
+ , m_bShifted( bShifted )
+{
+}
+
+DateScaling::~DateScaling()
+{
+}
+
+double SAL_CALL DateScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult(value);
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ {
+ Date aDate(m_aNullDate);
+ aDate += static_cast<long>(::rtl::math::approxFloor(value));
+ switch( m_nTimeUnit )
+ {
+ case DAY:
+ fResult = value;
+ if(m_bShifted)
+ fResult+=0.5;
+ break;
+ case YEAR:
+ case MONTH:
+ default:
+ fResult = aDate.GetYear();
+ fResult *= lcl_fNumberOfMonths;//asssuming equal count of months in each year
+ fResult += aDate.GetMonth();
+
+ double fDayOfMonth = aDate.GetDay();
+ fDayOfMonth -= 1.0;
+ double fDaysInMonth = aDate.GetDaysInMonth();
+ fResult += fDayOfMonth/fDaysInMonth;
+ if(m_bShifted)
+ {
+ if( YEAR==m_nTimeUnit )
+ fResult += 0.5*lcl_fNumberOfMonths;
+ else
+ fResult += 0.5;
+ }
+ break;
+ }
+ }
+ return fResult;
+}
+
+uno::Reference< XScaling > SAL_CALL DateScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new InverseDateScaling( m_aNullDate, m_nTimeUnit, m_bShifted );
+}
+
+::rtl::OUString SAL_CALL DateScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_DateScaling;
+}
+
+uno::Sequence< ::rtl::OUString > DateScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_DateScaling, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DateScaling, lcl_aServiceName_DateScaling )
+
+// ----------------------------------------
+
+InverseDateScaling::InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted )
+ : m_aNullDate( rNullDate )
+ , m_nTimeUnit( nTimeUnit )
+ , m_bShifted( bShifted )
+{
+}
+
+InverseDateScaling::~InverseDateScaling()
+{
+}
+
+double SAL_CALL InverseDateScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ double fResult(value);
+ if( ::rtl::math::isNan( value ) || ::rtl::math::isInf( value ) )
+ ::rtl::math::setNan( & fResult );
+ else
+ {
+ switch( m_nTimeUnit )
+ {
+ case DAY:
+ if(m_bShifted)
+ value -= 0.5;
+ fResult = value;
+ break;
+ case YEAR:
+ case MONTH:
+ default:
+ //Date aDate(m_aNullDate);
+ if(m_bShifted)
+ {
+ if( YEAR==m_nTimeUnit )
+ value -= 0.5*lcl_fNumberOfMonths;
+ else
+ value -= 0.5;
+ }
+ Date aDate;
+ double fYear = ::rtl::math::approxFloor(value/lcl_fNumberOfMonths);
+ double fMonth = ::rtl::math::approxFloor(value-(fYear*lcl_fNumberOfMonths));
+ if( fMonth==0.0 )
+ {
+ fYear--;
+ fMonth=12.0;
+ }
+ aDate.SetYear( static_cast<sal_uInt16>(fYear) );
+ aDate.SetMonth( static_cast<sal_uInt16>(fMonth) );
+ aDate.SetDay( 1 );
+ double fMonthCount = (fYear*lcl_fNumberOfMonths)+fMonth;
+ double fDay = (value-fMonthCount)*aDate.GetDaysInMonth();
+ fDay += 1.0;
+ aDate.SetDay( static_cast<sal_uInt16>(::rtl::math::round(fDay)) );
+ fResult = aDate - m_aNullDate;
+ break;
+ }
+ }
+ return fResult;
+}
+
+uno::Reference< XScaling > SAL_CALL InverseDateScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new DateScaling( m_aNullDate, m_nTimeUnit, m_bShifted );
+}
+
+::rtl::OUString SAL_CALL InverseDateScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_InverseDateScaling;
+}
+
+uno::Sequence< ::rtl::OUString > InverseDateScaling::getSupportedServiceNames_Static()
+{
+ return uno::Sequence< ::rtl::OUString >( & lcl_aServiceName_InverseDateScaling, 1 );
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( InverseDateScaling, lcl_aServiceName_InverseDateScaling )
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/DateScaling.hxx b/chart2/source/view/axes/DateScaling.hxx
new file mode 100644
index 000000000000..5e550604a957
--- /dev/null
+++ b/chart2/source/view/axes/DateScaling.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_DATESCALING_HXX
+#define _CHART2_DATESCALING_HXX
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/XScaling.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <tools/date.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class DateScaling :
+ public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ DateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
+ virtual ~DateScaling();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const Date m_aNullDate;
+ const sal_Int32 m_nTimeUnit;
+ const bool m_bShifted;
+};
+
+class InverseDateScaling :
+ public ::cppu::WeakImplHelper3 <
+ ::com::sun::star::chart2::XScaling,
+ ::com::sun::star::lang::XServiceName,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted );
+ virtual ~InverseDateScaling();
+
+ /// declare XServiceInfo methods
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XScaling ____
+ virtual double SAL_CALL doScaling( double value )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > SAL_CALL
+ getInverseScaling() throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XServiceName ____
+ virtual ::rtl::OUString SAL_CALL getServiceName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const Date m_aNullDate;
+ const sal_Int32 m_nTimeUnit;
+ const bool m_bShifted;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
+
diff --git a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
index 88f99b493144..97523d38758f 100644
--- a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
+++ b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
@@ -29,6 +29,9 @@
#include "precompiled_chart2.hxx"
#include "MinimumAndMaximumSupplier.hxx"
+
+#include <com/sun/star/chart/TimeUnit.hpp>
+
#include <rtl/math.hxx>
#include <com/sun/star/awt/Size.hpp>
@@ -196,6 +199,24 @@ void MergedMinimumAndMaximumSupplier::clearMinimumAndMaximumSupplierList()
m_aMinimumAndMaximumSupplierList.clear();
}
+long MergedMinimumAndMaximumSupplier::calculateTimeResolutionOnXAxis()
+{
+ long nRet = ::com::sun::star::chart::TimeUnit::YEAR;
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ long nCurrent = (*aIt)->calculateTimeResolutionOnXAxis();
+ if(nRet>nCurrent)
+ nRet=nCurrent;
+ }
+ return nRet;
+}
+
+void MergedMinimumAndMaximumSupplier::setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate )
+{
+ for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ (*aIt)->setTimeResolutionOnXAxis( nTimeResolution, rNullDate );
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index 890bf87df96e..075ad16347c2 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -29,8 +29,12 @@
#include "precompiled_chart2.hxx"
#include "ScaleAutomatism.hxx"
#include "macros.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks_Equidistant.hxx"
+#include "DateHelper.hxx"
+#include "DateScaling.hxx"
#include "AxisHelper.hxx"
+#include <com/sun/star/chart/TimeUnit.hpp>
+
#include <rtl/math.hxx>
#include <tools/debug.hxx>
@@ -40,6 +44,9 @@ namespace chart
//.............................................................................
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using ::com::sun::star::chart::TimeUnit::DAY;
+using ::com::sun::star::chart::TimeUnit::MONTH;
+using ::com::sun::star::chart::TimeUnit::YEAR;
const sal_Int32 MAXIMUM_MANUAL_INCREMENT_COUNT = 500;
const sal_Int32 MAXIMUM_AUTO_INCREMENT_COUNT = 10;
@@ -56,7 +63,42 @@ void lcl_ensureMaximumSubIncrementCount( sal_Int32& rnSubIntervalCount )
}//end anonymous namespace
-ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale )
+
+//.............................................................................
+
+ExplicitScaleData::ExplicitScaleData()
+ : Minimum(0.0)
+ , Maximum(10.0)
+ , Origin(0.0)
+ , Orientation(::com::sun::star::chart2::AxisOrientation_MATHEMATICAL)
+ , Scaling()
+ , AxisType(::com::sun::star::chart2::AxisType::REALNUMBER)
+ , ShiftedCategoryPosition(false)
+ , TimeResolution(::com::sun::star::chart::TimeUnit::DAY)
+ , NullDate(30,12,1899)
+{
+}
+
+ExplicitSubIncrement::ExplicitSubIncrement()
+ : IntervalCount(2)
+ , PostEquidistant(true)
+{
+}
+
+
+ExplicitIncrementData::ExplicitIncrementData()
+ : MajorTimeInterval(1,::com::sun::star::chart::TimeUnit::DAY)
+ , MinorTimeInterval(1,::com::sun::star::chart::TimeUnit::DAY)
+ , Distance(1.0)
+ , PostEquidistant(true)
+ , BaseValue(0.0)
+ , SubIncrements()
+{
+}
+
+//.............................................................................
+
+ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNullDate )
: m_aSourceScale( rSourceScale )
, m_fValueMinimum( 0.0 )
, m_fValueMaximum( 0.0 )
@@ -65,6 +107,8 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale )
, m_bExpandIfValuesCloseToBorder( false )
, m_bExpandWideValuesToZero( false )
, m_bExpandNarrowValuesTowardZero( false )
+ , m_nTimeResolution(::com::sun::star::chart::TimeUnit::DAY)
+ , m_aNullDate(rNullDate)
{
::rtl::math::setNan( &m_fValueMinimum );
::rtl::math::setNan( &m_fValueMaximum );
@@ -111,14 +155,19 @@ void ScaleAutomatism::setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMa
m_nMaximumAutoMainIncrementCount = nMaximumAutoMainIncrementCount;
}
+void ScaleAutomatism::setAutomaticTimeResolution( sal_Int32 nTimeResolution )
+{
+ m_nTimeResolution = nTimeResolution;
+}
+
void ScaleAutomatism::calculateExplicitScaleAndIncrement(
ExplicitScaleData& rExplicitScale, ExplicitIncrementData& rExplicitIncrement ) const
{
// fill explicit scale
rExplicitScale.Orientation = m_aSourceScale.Orientation;
rExplicitScale.Scaling = m_aSourceScale.Scaling;
- rExplicitScale.Breaks = m_aSourceScale.Breaks;
rExplicitScale.AxisType = m_aSourceScale.AxisType;
+ rExplicitScale.NullDate = m_aNullDate;
bool bAutoMinimum = !(m_aSourceScale.Minimum >>= rExplicitScale.Minimum);
bool bAutoMaximum = !(m_aSourceScale.Maximum >>= rExplicitScale.Maximum);
@@ -130,7 +179,12 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
if( m_aSourceScale.AxisType==AxisType::PERCENT )
rExplicitScale.Minimum = 0.0;
else if( ::rtl::math::isNan( m_fValueMinimum ) )
- rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
+ {
+ if( m_aSourceScale.AxisType==AxisType::DATE )
+ rExplicitScale.Minimum = 36526.0; //1.1.2000
+ else
+ rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
+ }
else
rExplicitScale.Minimum = m_fValueMinimum;
}
@@ -141,7 +195,12 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
if( m_aSourceScale.AxisType==AxisType::PERCENT )
rExplicitScale.Maximum = 1.0;
else if( ::rtl::math::isNan( m_fValueMaximum ) )
- rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
+ {
+ if( m_aSourceScale.AxisType==AxisType::DATE )
+ rExplicitScale.Maximum = 40179.0; //1.1.2010
+ else
+ rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
+ }
else
rExplicitScale.Maximum = m_fValueMaximum;
}
@@ -149,14 +208,14 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
//---------------------------------------------------------------
//fill explicit increment
- rExplicitIncrement.ShiftedPosition = (m_aSourceScale.AxisType==AxisType::SERIES) ? true : false;
+ rExplicitScale.ShiftedCategoryPosition = m_aSourceScale.ShiftedCategoryPosition;
bool bIsLogarithm = false;
//minimum and maximum of the ExplicitScaleData may be changed if allowed
- if( m_aSourceScale.AxisType==AxisType::CATEGORY || m_aSourceScale.AxisType==AxisType::SERIES )
- {
+ if( m_aSourceScale.AxisType==AxisType::DATE )
+ calculateExplicitIncrementAndScaleForDateTimeAxis( rExplicitScale, rExplicitIncrement, bAutoMinimum, bAutoMaximum );
+ else if( m_aSourceScale.AxisType==AxisType::CATEGORY || m_aSourceScale.AxisType==AxisType::SERIES )
calculateExplicitIncrementAndScaleForCategory( rExplicitScale, rExplicitIncrement, bAutoMinimum, bAutoMaximum );
- }
else
{
bIsLogarithm = AxisHelper::isLogarithmic( rExplicitScale.Scaling );
@@ -186,6 +245,11 @@ ScaleData ScaleAutomatism::getScale() const
return m_aSourceScale;
}
+Date ScaleAutomatism::getNullDate() const
+{
+ return m_aNullDate;
+}
+
// private --------------------------------------------------------------------
void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
@@ -196,6 +260,9 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
// no scaling for categories
rExplicitScale.Scaling.clear();
+ if( rExplicitScale.ShiftedCategoryPosition )
+ rExplicitScale.Maximum += 1.0;
+
// ensure that at least one category is visible
if( rExplicitScale.Maximum <= rExplicitScale.Minimum )
rExplicitScale.Maximum = rExplicitScale.Minimum + 1.0;
@@ -207,9 +274,9 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
// automatic minimum and maximum
if( bAutoMinimum && m_bExpandBorderToIncrementRhythm )
- rExplicitScale.Minimum = TickmarkHelper::getMinimumAtIncrement( rExplicitScale.Minimum, rExplicitIncrement );
+ rExplicitScale.Minimum = EquidistantTickFactory::getMinimumAtIncrement( rExplicitScale.Minimum, rExplicitIncrement );
if( bAutoMaximum && m_bExpandBorderToIncrementRhythm )
- rExplicitScale.Maximum = TickmarkHelper::getMaximumAtIncrement( rExplicitScale.Maximum, rExplicitIncrement );
+ rExplicitScale.Maximum = EquidistantTickFactory::getMaximumAtIncrement( rExplicitScale.Maximum, rExplicitIncrement );
//prevent performace killover
double fDistanceCount = ::rtl::math::approxFloor( (rExplicitScale.Maximum-rExplicitScale.Minimum) / rExplicitIncrement.Distance );
@@ -223,29 +290,28 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForCategory(
//---------------------------------------------------------------
//fill explicit sub increment
sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
- rExplicitIncrement.SubIncrements.realloc(nSubCount);
for( sal_Int32 nN=0; nN<nSubCount; nN++ )
{
- const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
- ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
-
- if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ ExplicitSubIncrement aExplicitSubIncrement;
+ const SubIncrement& rSubIncrement= m_aSourceScale.IncrementData.SubIncrements[nN];
+ if(!(rSubIncrement.IntervalCount>>=aExplicitSubIncrement.IntervalCount))
{
//scaling dependent
//@todo autocalculate IntervalCount dependent on MainIncrement and scaling
- rExplicitSubIncrement.IntervalCount = 2;
+ aExplicitSubIncrement.IntervalCount = 2;
}
- lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
- if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ lcl_ensureMaximumSubIncrementCount( aExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=aExplicitSubIncrement.PostEquidistant))
{
//scaling dependent
- rExplicitSubIncrement.PostEquidistant = sal_False;
+ aExplicitSubIncrement.PostEquidistant = sal_False;
}
+ rExplicitIncrement.SubIncrements.push_back(aExplicitSubIncrement);
}
}
-//@todo these method should become part of the scaling interface and implementation somehow
-//@todo problem with outparamters at api
+//-----------------------------------------------------------------------------------------
+
void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
ExplicitScaleData& rExplicitScale,
ExplicitIncrementData& rExplicitIncrement,
@@ -412,7 +478,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
// round to entire multiples of the distance and add additional space
if( bAutoMinimum && m_bExpandBorderToIncrementRhythm )
{
- fAxisMinimum = TickmarkHelper::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
+ fAxisMinimum = EquidistantTickFactory::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
//ensure valid values after scaling #i100995#
if( !bAutoDistance )
@@ -428,7 +494,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
}
if( bAutoMaximum && m_bExpandBorderToIncrementRhythm )
{
- fAxisMaximum = TickmarkHelper::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
+ fAxisMaximum = EquidistantTickFactory::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
//ensure valid values after scaling #i100995#
if( !bAutoDistance )
@@ -488,27 +554,210 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLogarithmic(
//---------------------------------------------------------------
//fill explicit sub increment
sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
- rExplicitIncrement.SubIncrements.realloc(nSubCount);
for( sal_Int32 nN=0; nN<nSubCount; nN++ )
{
- const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
- ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
-
- if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ ExplicitSubIncrement aExplicitSubIncrement;
+ const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
+ if(!(rSubIncrement.IntervalCount>>=aExplicitSubIncrement.IntervalCount))
{
//scaling dependent
//@todo autocalculate IntervalCount dependent on MainIncrement and scaling
- rExplicitSubIncrement.IntervalCount = 9;
+ aExplicitSubIncrement.IntervalCount = 9;
}
- lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
- if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ lcl_ensureMaximumSubIncrementCount( aExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=aExplicitSubIncrement.PostEquidistant))
{
//scaling dependent
- rExplicitSubIncrement.PostEquidistant = sal_False;
+ aExplicitSubIncrement.PostEquidistant = sal_False;
}
+ rExplicitIncrement.SubIncrements.push_back(aExplicitSubIncrement);
}
}
+//-----------------------------------------------------------------------------------------
+
+void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis(
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const
+{
+ Date aMinDate(m_aNullDate); aMinDate += static_cast<long>(::rtl::math::approxFloor(rExplicitScale.Minimum));
+ Date aMaxDate(m_aNullDate); aMaxDate += static_cast<long>(::rtl::math::approxFloor(rExplicitScale.Maximum));
+ rExplicitIncrement.PostEquidistant = sal_False;
+
+ if( aMinDate > aMaxDate )
+ {
+ std::swap(aMinDate,aMaxDate);
+ }
+
+ if( !(m_aSourceScale.TimeIncrement.TimeResolution >>= rExplicitScale.TimeResolution) )
+ rExplicitScale.TimeResolution = m_nTimeResolution;
+
+ rExplicitScale.Scaling = new DateScaling(m_aNullDate,rExplicitScale.TimeResolution,false);
+
+ // choose min and max suitable to time resolution
+ switch( rExplicitScale.TimeResolution )
+ {
+ case DAY:
+ if( rExplicitScale.ShiftedCategoryPosition )
+ aMaxDate++;//for explicit scales we need one interval more (maximum excluded)
+ break;
+ case MONTH:
+ aMinDate.SetDay(1);
+ aMaxDate.SetDay(1);
+ if( rExplicitScale.ShiftedCategoryPosition )
+ aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,1);//for explicit scales we need one interval more (maximum excluded)
+ if( DateHelper::IsLessThanOneMonthAway( aMinDate, aMaxDate ) )
+ {
+ if( bAutoMaximum || !bAutoMinimum )
+ aMaxDate = DateHelper::GetDateSomeMonthsAway(aMinDate,1);
+ else
+ aMinDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,-1);
+ }
+ break;
+ case YEAR:
+ aMinDate.SetDay(1);
+ aMinDate.SetMonth(1);
+ aMaxDate.SetDay(1);
+ aMaxDate.SetMonth(1);
+ if( rExplicitScale.ShiftedCategoryPosition )
+ aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate,1);//for explicit scales we need one interval more (maximum excluded)
+ if( DateHelper::IsLessThanOneYearAway( aMinDate, aMaxDate ) )
+ {
+ if( bAutoMaximum || !bAutoMinimum )
+ aMaxDate = DateHelper::GetDateSomeYearsAway(aMinDate,1);
+ else
+ aMinDate = DateHelper::GetDateSomeYearsAway(aMaxDate,-1);
+ }
+ break;
+ }
+
+ // set the resulting limits (swap back to negative range if needed)
+ rExplicitScale.Minimum = aMinDate - m_aNullDate;
+ rExplicitScale.Maximum = aMaxDate - m_aNullDate;
+
+ bool bAutoMajor = !(m_aSourceScale.TimeIncrement.MajorTimeInterval >>= rExplicitIncrement.MajorTimeInterval);
+ bool bAutoMinor = !(m_aSourceScale.TimeIncrement.MinorTimeInterval >>= rExplicitIncrement.MinorTimeInterval);
+
+ sal_Int32 nMaxMainIncrementCount = bAutoMajor ?
+ m_nMaximumAutoMainIncrementCount : MAXIMUM_MANUAL_INCREMENT_COUNT;
+ if( nMaxMainIncrementCount > 1 )
+ nMaxMainIncrementCount--;
+
+
+ //choose major time interval:
+ long nDayCount = (aMaxDate-aMinDate);
+ long nMainIncrementCount = 1;
+ if( !bAutoMajor )
+ {
+ long nIntervalDayCount = rExplicitIncrement.MajorTimeInterval.Number;
+ if( rExplicitIncrement.MajorTimeInterval.TimeUnit < rExplicitScale.TimeResolution )
+ rExplicitIncrement.MajorTimeInterval.TimeUnit = rExplicitScale.TimeResolution;
+ switch( rExplicitIncrement.MajorTimeInterval.TimeUnit )
+ {
+ case DAY:
+ break;
+ case MONTH:
+ nIntervalDayCount*=31;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ break;
+ case YEAR:
+ nIntervalDayCount*=365;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ break;
+ }
+ nMainIncrementCount = nDayCount/nIntervalDayCount;
+ if( nMainIncrementCount > nMaxMainIncrementCount )
+ bAutoMajor = true;
+ }
+ if( bAutoMajor )
+ {
+ long nNumer = 1;
+ long nIntervalDays = nDayCount / nMaxMainIncrementCount;
+ double nDaysPerInterval = 1.0;
+ if( nIntervalDays>365 || YEAR==rExplicitScale.TimeResolution )
+ {
+ rExplicitIncrement.MajorTimeInterval.TimeUnit = YEAR;
+ nDaysPerInterval = 365.0;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ }
+ else if( nIntervalDays>31 || MONTH==rExplicitScale.TimeResolution )
+ {
+ rExplicitIncrement.MajorTimeInterval.TimeUnit = MONTH;
+ nDaysPerInterval = 31.0;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ }
+ else
+ {
+ rExplicitIncrement.MajorTimeInterval.TimeUnit = DAY;
+ nDaysPerInterval = 1.0;
+ }
+
+ nNumer = static_cast<sal_Int32>( rtl::math::approxCeil( nIntervalDays/nDaysPerInterval ) );
+ if(nNumer<=0)
+ nNumer=1;
+ rExplicitIncrement.MajorTimeInterval.Number = nNumer;
+ nMainIncrementCount = nDayCount/(nNumer*nDaysPerInterval);
+ }
+
+ //choose minor time interval:
+ if( !bAutoMinor )
+ {
+ if( rExplicitIncrement.MinorTimeInterval.TimeUnit > rExplicitIncrement.MajorTimeInterval.TimeUnit )
+ rExplicitIncrement.MinorTimeInterval.TimeUnit = rExplicitIncrement.MajorTimeInterval.TimeUnit;
+ long nIntervalDayCount = rExplicitIncrement.MinorTimeInterval.Number;
+ switch( rExplicitIncrement.MinorTimeInterval.TimeUnit )
+ {
+ case DAY:
+ break;
+ case MONTH:
+ nIntervalDayCount*=31;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ break;
+ case YEAR:
+ nIntervalDayCount*=365;//todo: maybe different for other calendars... get localized calendar according to set number format at axis ...
+ break;
+ }
+ if( nDayCount/nIntervalDayCount > nMaxMainIncrementCount )
+ bAutoMinor = true;
+ }
+ if( bAutoMinor )
+ {
+ rExplicitIncrement.MinorTimeInterval.TimeUnit = rExplicitIncrement.MajorTimeInterval.TimeUnit;
+ rExplicitIncrement.MinorTimeInterval.Number = 1;
+ if( nMainIncrementCount > 100 )
+ rExplicitIncrement.MinorTimeInterval.Number = rExplicitIncrement.MajorTimeInterval.Number;
+ else
+ {
+ if( rExplicitIncrement.MajorTimeInterval.Number >= 2 )
+ {
+ if( !(rExplicitIncrement.MajorTimeInterval.Number%2) )
+ rExplicitIncrement.MinorTimeInterval.Number = rExplicitIncrement.MajorTimeInterval.Number/2;
+ else if( !(rExplicitIncrement.MajorTimeInterval.Number%3) )
+ rExplicitIncrement.MinorTimeInterval.Number = rExplicitIncrement.MajorTimeInterval.Number/3;
+ else if( !(rExplicitIncrement.MajorTimeInterval.Number%5) )
+ rExplicitIncrement.MinorTimeInterval.Number = rExplicitIncrement.MajorTimeInterval.Number/5;
+ else if( rExplicitIncrement.MajorTimeInterval.Number > 50 )
+ rExplicitIncrement.MinorTimeInterval.Number = rExplicitIncrement.MajorTimeInterval.Number;
+ }
+ else
+ {
+ switch( rExplicitIncrement.MajorTimeInterval.TimeUnit )
+ {
+ case DAY:
+ break;
+ case MONTH:
+ if( rExplicitScale.TimeResolution == DAY )
+ rExplicitIncrement.MinorTimeInterval.TimeUnit = DAY;
+ break;
+ case YEAR:
+ if( rExplicitScale.TimeResolution <= MONTH )
+ rExplicitIncrement.MinorTimeInterval.TimeUnit = MONTH;
+ break;
+ }
+ }
+ }
+ }
+
+}
+
+//-----------------------------------------------------------------------------------------
+
void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
ExplicitScaleData& rExplicitScale,
ExplicitIncrementData& rExplicitIncrement,
@@ -692,7 +941,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
{
// round to entire multiples of the distance, based on the base value
if( m_bExpandBorderToIncrementRhythm )
- fAxisMinimum = TickmarkHelper::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
+ fAxisMinimum = EquidistantTickFactory::getMinimumAtIncrement( fAxisMinimum, rExplicitIncrement );
// additional space, if source minimum is to near at axis minimum
if( m_bExpandIfValuesCloseToBorder )
if( (fAxisMinimum != 0.0) && ((fAxisMaximum - fSourceMinimum) / (fAxisMaximum - fAxisMinimum) > 20.0 / 21.0) )
@@ -702,7 +951,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
{
// round to entire multiples of the distance, based on the base value
if( m_bExpandBorderToIncrementRhythm )
- fAxisMaximum = TickmarkHelper::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
+ fAxisMaximum = EquidistantTickFactory::getMaximumAtIncrement( fAxisMaximum, rExplicitIncrement );
// additional space, if source maximum is to near at axis maximum
if( m_bExpandIfValuesCloseToBorder )
if( (fAxisMaximum != 0.0) && ((fSourceMaximum - fAxisMinimum) / (fAxisMaximum - fAxisMinimum) > 20.0 / 21.0) )
@@ -734,24 +983,23 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
//---------------------------------------------------------------
//fill explicit sub increment
sal_Int32 nSubCount = m_aSourceScale.IncrementData.SubIncrements.getLength();
- rExplicitIncrement.SubIncrements.realloc(nSubCount);
for( sal_Int32 nN=0; nN<nSubCount; nN++ )
{
- const SubIncrement& rSubIncrement = m_aSourceScale.IncrementData.SubIncrements[nN];
- ExplicitSubIncrement& rExplicitSubIncrement = rExplicitIncrement.SubIncrements[nN];
-
- if(!(rSubIncrement.IntervalCount>>=rExplicitSubIncrement.IntervalCount))
+ ExplicitSubIncrement aExplicitSubIncrement;
+ const SubIncrement& rSubIncrement= m_aSourceScale.IncrementData.SubIncrements[nN];
+ if(!(rSubIncrement.IntervalCount>>=aExplicitSubIncrement.IntervalCount))
{
//scaling dependent
//@todo autocalculate IntervalCount dependent on MainIncrement and scaling
- rExplicitSubIncrement.IntervalCount = 2;
+ aExplicitSubIncrement.IntervalCount = 2;
}
- lcl_ensureMaximumSubIncrementCount( rExplicitSubIncrement.IntervalCount );
- if(!(rSubIncrement.PostEquidistant>>=rExplicitSubIncrement.PostEquidistant))
+ lcl_ensureMaximumSubIncrementCount( aExplicitSubIncrement.IntervalCount );
+ if(!(rSubIncrement.PostEquidistant>>=aExplicitSubIncrement.PostEquidistant))
{
//scaling dependent
- rExplicitSubIncrement.PostEquidistant = sal_False;
+ aExplicitSubIncrement.PostEquidistant = sal_False;
}
+ rExplicitIncrement.SubIncrements.push_back(aExplicitSubIncrement);
}
}
diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx
new file mode 100644
index 000000000000..834fe66eb97b
--- /dev/null
+++ b/chart2/source/view/axes/Tickmarks.cxx
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Tickmarks.hxx"
+#include "Tickmarks_Equidistant.hxx"
+#include "Tickmarks_Dates.hxx"
+#include "ViewDefines.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::rtl::math;
+using ::basegfx::B2DVector;
+
+TickInfo::TickInfo( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling >& xInverse )
+: fScaledTickValue( 0.0 )
+, xInverseScaling( xInverse )
+, aTickScreenPosition(0.0,0.0)
+, bPaintIt( true )
+, xTextShape( NULL )
+, nFactorForLimitedTextWidth(1)
+{
+}
+
+double TickInfo::getUnscaledTickValue() const
+{
+ if( xInverseScaling.is() )
+ return xInverseScaling->doScaling( fScaledTickValue );
+ else
+ return fScaledTickValue;
+}
+
+sal_Int32 TickInfo::getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const
+{
+ //return the positive distance between the two first tickmarks in screen values
+
+ B2DVector aDistance = rOherTickInfo.aTickScreenPosition - aTickScreenPosition;
+ sal_Int32 nRet = static_cast<sal_Int32>(aDistance.getLength());
+ if(nRet<0)
+ nRet *= -1;
+ return nRet;
+}
+
+PureTickIter::PureTickIter( ::std::vector< TickInfo >& rTickInfoVector )
+ : m_rTickVector(rTickInfoVector)
+ , m_aTickIter(m_rTickVector.begin())
+{
+}
+PureTickIter::~PureTickIter()
+{
+}
+TickInfo* PureTickIter::firstInfo()
+{
+ m_aTickIter = m_rTickVector.begin();
+ if(m_aTickIter!=m_rTickVector.end())
+ return &*m_aTickIter;
+ return 0;
+}
+TickInfo* PureTickIter::nextInfo()
+{
+ if(m_aTickIter!=m_rTickVector.end())
+ {
+ m_aTickIter++;
+ if(m_aTickIter!=m_rTickVector.end())
+ return &*m_aTickIter;
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+TickFactory::TickFactory(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
+ : m_rScale( rScale )
+ , m_rIncrement( rIncrement )
+ , m_xInverseScaling(NULL)
+{
+ //@todo: make sure that the scale is valid for the scaling
+
+ if( m_rScale.Scaling.is() )
+ {
+ m_xInverseScaling = m_rScale.Scaling->getInverseScaling();
+ DBG_ASSERT( m_xInverseScaling.is(), "each Scaling needs to return a inverse Scaling" );
+ }
+
+ m_fScaledVisibleMin = m_rScale.Minimum;
+ if( m_xInverseScaling.is() )
+ m_fScaledVisibleMin = m_rScale.Scaling->doScaling(m_fScaledVisibleMin);
+
+ m_fScaledVisibleMax = m_rScale.Maximum;
+ if( m_xInverseScaling.is() )
+ m_fScaledVisibleMax = m_rScale.Scaling->doScaling(m_fScaledVisibleMax);
+}
+
+TickFactory::~TickFactory()
+{
+}
+
+bool TickFactory::isDateAxis() const
+{
+ return m_rScale.AxisType == AxisType::DATE;
+}
+
+void TickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ if( isDateAxis() )
+ DateTickFactory( m_rScale, m_rIncrement ).getAllTicks( rAllTickInfos );
+ else
+ EquidistantTickFactory( m_rScale, m_rIncrement ).getAllTicks( rAllTickInfos );
+}
+
+void TickFactory::getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ if( isDateAxis() )
+ DateTickFactory( m_rScale, m_rIncrement ).getAllTicksShifted( rAllTickInfos );
+ else
+ EquidistantTickFactory( m_rScale, m_rIncrement ).getAllTicksShifted( rAllTickInfos );
+}
+
+//-----------------------------------------------------------------------------
+// ___TickFactory_2D___
+//-----------------------------------------------------------------------------
+TickFactory_2D::TickFactory_2D(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement
+ //, double fStrech_SceneToScreen, double fOffset_SceneToScreen )
+ , const B2DVector& rStartScreenPos, const B2DVector& rEndScreenPos
+ , const B2DVector& rAxisLineToLabelLineShift )
+ : TickFactory( rScale, rIncrement )
+ , m_aAxisStartScreenPosition2D(rStartScreenPos)
+ , m_aAxisEndScreenPosition2D(rEndScreenPos)
+ , m_aAxisLineToLabelLineShift(rAxisLineToLabelLineShift)
+ , m_fStrech_LogicToScreen(1.0)
+ , m_fOffset_LogicToScreen(0.0)
+{
+ double fWidthY = m_fScaledVisibleMax - m_fScaledVisibleMin;
+ if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation )
+ {
+ m_fStrech_LogicToScreen = 1.0/fWidthY;
+ m_fOffset_LogicToScreen = -m_fScaledVisibleMin;
+ }
+ else
+ {
+ B2DVector aSwap(m_aAxisStartScreenPosition2D);
+ m_aAxisStartScreenPosition2D = m_aAxisEndScreenPosition2D;
+ m_aAxisEndScreenPosition2D = aSwap;
+
+ m_fStrech_LogicToScreen = -1.0/fWidthY;
+ m_fOffset_LogicToScreen = -m_fScaledVisibleMax;
+ }
+}
+
+TickFactory_2D::~TickFactory_2D()
+{
+}
+
+bool TickFactory_2D::isHorizontalAxis() const
+{
+ return ( m_aAxisStartScreenPosition2D.getY() == m_aAxisEndScreenPosition2D.getY() );
+}
+bool TickFactory_2D::isVerticalAxis() const
+{
+ return ( m_aAxisStartScreenPosition2D.getX() == m_aAxisEndScreenPosition2D.getX() );
+}
+
+//static
+sal_Int32 TickFactory_2D::getTickScreenDistance( TickIter& rIter )
+{
+ //return the positive distance between the two first tickmarks in screen values
+ //if there are less than two tickmarks -1 is returned
+
+ const TickInfo* pFirstTickInfo = rIter.firstInfo();
+ const TickInfo* pSecondTickInfo = rIter.nextInfo();
+ if(!pSecondTickInfo || !pFirstTickInfo)
+ return -1;
+
+ return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo );
+}
+
+B2DVector TickFactory_2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const
+{
+ B2DVector aRet(m_aAxisStartScreenPosition2D);
+ aRet += (m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D)
+ *((fScaledLogicTickValue+m_fOffset_LogicToScreen)*m_fStrech_LogicToScreen);
+ return aRet;
+}
+
+void TickFactory_2D::addPointSequenceForTickLine( drawing::PointSequenceSequence& rPoints
+ , sal_Int32 nSequenceIndex
+ , double fScaledLogicTickValue, double fInnerDirectionSign
+ , const TickmarkProperties& rTickmarkProperties
+ , bool bPlaceAtLabels ) const
+{
+ if( fInnerDirectionSign==0.0 )
+ fInnerDirectionSign = 1.0;
+
+ B2DVector aTickScreenPosition = this->getTickScreenPosition2D(fScaledLogicTickValue);
+ if( bPlaceAtLabels )
+ aTickScreenPosition += m_aAxisLineToLabelLineShift;
+
+ B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D;
+ aMainDirection.normalize();
+ B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX());
+ aOrthoDirection *= fInnerDirectionSign;
+ aOrthoDirection.normalize();
+
+ B2DVector aStart = aTickScreenPosition + aOrthoDirection*rTickmarkProperties.RelativePos;
+ B2DVector aEnd = aStart - aOrthoDirection*rTickmarkProperties.Length;
+
+ rPoints[nSequenceIndex].realloc(2);
+ rPoints[nSequenceIndex][0].X = static_cast<sal_Int32>(aStart.getX());
+ rPoints[nSequenceIndex][0].Y = static_cast<sal_Int32>(aStart.getY());
+ rPoints[nSequenceIndex][1].X = static_cast<sal_Int32>(aEnd.getX());
+ rPoints[nSequenceIndex][1].Y = static_cast<sal_Int32>(aEnd.getY());
+}
+
+B2DVector TickFactory_2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties, bool bIncludeFarAwayDistanceIfSo, bool bIncludeSpaceBetweenTickAndText ) const
+{
+ bool bFarAwayLabels = false;
+ if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == rAxisProperties.m_eLabelPos
+ || ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == rAxisProperties.m_eLabelPos )
+ bFarAwayLabels = true;
+
+ double fInnerDirectionSign = rAxisProperties.m_fInnerDirectionSign;
+ if( fInnerDirectionSign==0.0 )
+ fInnerDirectionSign = 1.0;
+
+ B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D;
+ aMainDirection.normalize();
+ B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX());
+ aOrthoDirection *= fInnerDirectionSign;
+ aOrthoDirection.normalize();
+
+ B2DVector aStart(0,0), aEnd(0,0);
+ if( bFarAwayLabels )
+ {
+ TickmarkProperties aProps( AxisProperties::getBiggestTickmarkProperties() );
+ aStart = aOrthoDirection*aProps.RelativePos;
+ aEnd = aStart - aOrthoDirection*aProps.Length;
+ }
+ else
+ {
+ for( sal_Int32 nN=rAxisProperties.m_aTickmarkPropertiesList.size();nN--;)
+ {
+ const TickmarkProperties& rProps = rAxisProperties.m_aTickmarkPropertiesList[nN];
+ B2DVector aNewStart = aOrthoDirection*rProps.RelativePos;
+ B2DVector aNewEnd = aNewStart - aOrthoDirection*rProps.Length;
+ if(aNewStart.getLength()>aStart.getLength())
+ aStart=aNewStart;
+ if(aNewEnd.getLength()>aEnd.getLength())
+ aEnd=aNewEnd;
+ }
+ }
+
+ B2DVector aLabelDirection(aStart);
+ if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
+ aLabelDirection = aEnd;
+
+ B2DVector aOrthoLabelDirection(aOrthoDirection);
+ if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
+ aOrthoLabelDirection*=-1.0;
+ aOrthoLabelDirection.normalize();
+ if( bIncludeSpaceBetweenTickAndText )
+ aLabelDirection += aOrthoLabelDirection*AXIS2D_TICKLABELSPACING;
+ if( bFarAwayLabels && bIncludeFarAwayDistanceIfSo )
+ aLabelDirection += m_aAxisLineToLabelLineShift;
+ return aLabelDirection;
+}
+
+void TickFactory_2D::createPointSequenceForAxisMainLine( drawing::PointSequenceSequence& rPoints ) const
+{
+ rPoints[0].realloc(2);
+ rPoints[0][0].X = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX());
+ rPoints[0][0].Y = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY());
+ rPoints[0][1].X = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX());
+ rPoints[0][1].Y = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY());
+}
+
+void TickFactory_2D::updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ //get the transformed screen values for all tickmarks in rAllTickInfos
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAllTickInfos.end();
+ for( ; aDepthIter != aDepthEnd; aDepthIter++ )
+ {
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = (*aTickIter);
+ rTickInfo.aTickScreenPosition =
+ this->getTickScreenPosition2D( rTickInfo.fScaledTickValue );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/Tickmarks.hxx b/chart2/source/view/axes/Tickmarks.hxx
new file mode 100644
index 000000000000..62fa5fef92d0
--- /dev/null
+++ b/chart2/source/view/axes/Tickmarks.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART2_TICKMARKS_HXX
+#define _CHART2_TICKMARKS_HXX
+
+#include "TickmarkProperties.hxx"
+#include "VAxisProperties.hxx"
+#include "chartview/ExplicitScaleValues.hxx"
+#include <basegfx/vector/b2dvector.hxx>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using ::basegfx::B2DVector;
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct TickInfo
+{
+ double fScaledTickValue;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling > xInverseScaling;
+
+ ::basegfx::B2DVector aTickScreenPosition;
+ bool bPaintIt;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > xTextShape;
+
+ rtl::OUString aText;//used only for complex categories so far
+ sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
+
+//methods:
+ TickInfo( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XScaling >& xInverseScaling );
+
+ double getUnscaledTickValue() const;
+ sal_Int32 getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const;
+private:
+ TickInfo();
+};
+class TickIter
+{
+public:
+ virtual ~TickIter(){};
+ virtual TickInfo* firstInfo()=0;
+ virtual TickInfo* nextInfo()=0;
+};
+
+class PureTickIter : public TickIter
+{
+public:
+ PureTickIter( ::std::vector< TickInfo >& rTickInfoVector );
+ virtual ~PureTickIter();
+ virtual TickInfo* firstInfo();
+ virtual TickInfo* nextInfo();
+
+private:
+ ::std::vector< TickInfo >& m_rTickVector;
+ ::std::vector< TickInfo >::iterator m_aTickIter;
+};
+
+class TickFactory
+{
+public:
+ TickFactory(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement );
+ virtual ~TickFactory();
+
+ void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& /*rAllTickInfos*/ ) const {}
+
+private: //methods
+ bool isDateAxis() const;
+
+protected: //member
+ ExplicitScaleData m_rScale;
+ ExplicitIncrementData m_rIncrement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
+ m_xInverseScaling;
+
+ //minimum and maximum of the visible range after scaling
+ double m_fScaledVisibleMin;
+ double m_fScaledVisibleMax;
+};
+
+class TickFactory_2D : public TickFactory
+{
+public:
+ TickFactory_2D(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement
+ , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos
+ , const ::basegfx::B2DVector& rAxisLineToLabelLineShift );
+ //, double fStrech_SceneToScreen, double fOffset_SceneToScreen );
+ virtual ~TickFactory_2D();
+
+ static sal_Int32 getTickScreenDistance( TickIter& rIter );
+
+ void createPointSequenceForAxisMainLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints ) const;
+ void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , sal_Int32 nSequenceIndex
+ , double fScaledLogicTickValue, double fInnerDirectionSign
+ , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const;
+ ::basegfx::B2DVector getDistanceAxisTickToText( const AxisProperties& rAxisProperties
+ , bool bIncludeFarAwayDistanceIfSo = false
+ , bool bIncludeSpaceBetweenTickAndText = true ) const;
+
+ virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+ bool isHorizontalAxis() const;
+ bool isVerticalAxis() const;
+
+protected: //methods
+ ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const;
+
+private: //member
+ ::basegfx::B2DVector m_aAxisStartScreenPosition2D;
+ ::basegfx::B2DVector m_aAxisEndScreenPosition2D;
+
+ //labels might be posioned high or low on the border of the diagram far away from the axis
+ //add this vector to go from the axis line to the label line (border of the diagram)
+ ::basegfx::B2DVector m_aAxisLineToLabelLineShift;
+
+ double m_fStrech_LogicToScreen;
+ double m_fOffset_LogicToScreen;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/Tickmarks_Dates.cxx b/chart2/source/view/axes/Tickmarks_Dates.cxx
new file mode 100644
index 000000000000..b5177fe307b8
--- /dev/null
+++ b/chart2/source/view/axes/Tickmarks_Dates.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 "Tickmarks_Dates.hxx"
+#include "DateScaling.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include "DateHelper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::rtl::math;
+using ::basegfx::B2DVector;
+using ::com::sun::star::chart::TimeUnit::DAY;
+using ::com::sun::star::chart::TimeUnit::MONTH;
+using ::com::sun::star::chart::TimeUnit::YEAR;
+
+DateTickFactory::DateTickFactory(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
+ : m_aScale( rScale )
+ , m_aIncrement( rIncrement )
+ , m_xInverseScaling(NULL)
+{
+ //@todo: make sure that the scale is valid for the scaling
+
+ if( m_aScale.Scaling.is() )
+ {
+ m_xInverseScaling = m_aScale.Scaling->getInverseScaling();
+ DBG_ASSERT( m_xInverseScaling.is(), "each Scaling needs to return a inverse Scaling" );
+ }
+
+ m_fScaledVisibleMin = m_aScale.Minimum;
+ if( m_xInverseScaling.is() )
+ m_fScaledVisibleMin = m_aScale.Scaling->doScaling(m_fScaledVisibleMin);
+
+ m_fScaledVisibleMax = m_aScale.Maximum;
+ if( m_xInverseScaling.is() )
+ m_fScaledVisibleMax = m_aScale.Scaling->doScaling(m_fScaledVisibleMax);
+}
+
+DateTickFactory::~DateTickFactory()
+{
+}
+
+void DateTickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShifted ) const
+{
+ rAllTickInfos.resize(2);
+ ::std::vector< TickInfo >& rMajorTicks = rAllTickInfos[0];
+ ::std::vector< TickInfo >& rMinorTicks = rAllTickInfos[1];
+ rMajorTicks.clear();
+ rMinorTicks.clear();
+
+ Date aNull(m_aScale.NullDate);
+
+ Date aDate = aNull + ::rtl::math::approxFloor(m_aScale.Minimum);
+ Date aMaxDate = aNull + ::rtl::math::approxFloor(m_aScale.Maximum);
+
+ uno::Reference< chart2::XScaling > xScaling(m_aScale.Scaling);
+ uno::Reference< chart2::XScaling > xInverseScaling(m_xInverseScaling);
+ if( bShifted )
+ {
+ xScaling = new DateScaling(aNull,m_aScale.TimeResolution,true/*bShifted*/);
+ xInverseScaling = xScaling->getInverseScaling();
+ }
+
+ //create major date tickinfos
+ while( aDate<= aMaxDate )
+ {
+ if( bShifted && aDate==aMaxDate )
+ break;
+
+ TickInfo aNewTick(xInverseScaling); aNewTick.fScaledTickValue = aDate - aNull;
+
+ if( xInverseScaling.is() )
+ aNewTick.fScaledTickValue = xScaling->doScaling(aNewTick.fScaledTickValue);
+ rMajorTicks.push_back( aNewTick );
+
+ if(m_aIncrement.MajorTimeInterval.Number<=0)
+ break;
+
+ //find next major date
+ switch( m_aIncrement.MajorTimeInterval.TimeUnit )
+ {
+ case DAY:
+ aDate += m_aIncrement.MajorTimeInterval.Number;
+ break;
+ case YEAR:
+ aDate = DateHelper::GetDateSomeYearsAway( aDate, m_aIncrement.MajorTimeInterval.Number );
+ break;
+ case MONTH:
+ default:
+ aDate = DateHelper::GetDateSomeMonthsAway( aDate, m_aIncrement.MajorTimeInterval.Number );
+ break;
+ }
+ }
+
+ //create minor date tickinfos
+ aDate = aNull + ::rtl::math::approxFloor(m_aScale.Minimum);
+ while( aDate<= aMaxDate )
+ {
+ if( bShifted && aDate==aMaxDate )
+ break;
+
+ TickInfo aNewTick(xInverseScaling); aNewTick.fScaledTickValue = aDate - aNull;
+ if( xInverseScaling.is() )
+ aNewTick.fScaledTickValue = xScaling->doScaling(aNewTick.fScaledTickValue);
+ rMinorTicks.push_back( aNewTick );
+
+ if(m_aIncrement.MinorTimeInterval.Number<=0)
+ break;
+
+ //find next minor date
+ switch( m_aIncrement.MinorTimeInterval.TimeUnit )
+ {
+ case DAY:
+ aDate += m_aIncrement.MinorTimeInterval.Number;
+ break;
+ case YEAR:
+ aDate = DateHelper::GetDateSomeYearsAway( aDate, m_aIncrement.MinorTimeInterval.Number );
+ break;
+ case MONTH:
+ default:
+ aDate = DateHelper::GetDateSomeMonthsAway( aDate, m_aIncrement.MinorTimeInterval.Number );
+ break;
+ }
+ }
+}
+
+void DateTickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ getAllTicks( rAllTickInfos, false );
+}
+
+void DateTickFactory::getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ getAllTicks( rAllTickInfos, true );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/Tickmarks_Dates.hxx b/chart2/source/view/axes/Tickmarks_Dates.hxx
new file mode 100644
index 000000000000..464e8b4ca24c
--- /dev/null
+++ b/chart2/source/view/axes/Tickmarks_Dates.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_TICKMARKS_DATES_HXX
+#define _CHART2_TICKMARKS_DATES_HXX
+
+#include "Tickmarks.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class DateTickFactory
+{
+public:
+ DateTickFactory(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement );
+ ~DateTickFactory();
+
+ void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+private: //methods
+ void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShifted ) const;
+
+private: //member
+ ExplicitScaleData m_aScale;
+ ExplicitIncrementData m_aIncrement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
+ m_xInverseScaling;
+
+ //minimum and maximum of the visible range after scaling
+ double m_fScaledVisibleMin;
+ double m_fScaledVisibleMax;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.cxx b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
new file mode 100644
index 000000000000..9344af1ffac9
--- /dev/null
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
@@ -0,0 +1,671 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "Tickmarks_Equidistant.hxx"
+#include "ViewDefines.hxx"
+#include <rtl/math.hxx>
+#include <tools/debug.hxx>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::rtl::math;
+using ::basegfx::B2DVector;
+
+//static
+double EquidistantTickFactory::getMinimumAtIncrement( double fMin, const ExplicitIncrementData& rIncrement )
+{
+ //the returned value will be <= fMin and on a Major Tick given by rIncrement
+ if(rIncrement.Distance<=0.0)
+ return fMin;
+
+ double fRet = rIncrement.BaseValue +
+ floor( approxSub( fMin, rIncrement.BaseValue )
+ / rIncrement.Distance)
+ *rIncrement.Distance;
+
+ if( fRet > fMin )
+ {
+ if( !approxEqual(fRet, fMin) )
+ fRet -= rIncrement.Distance;
+ }
+ return fRet;
+}
+//static
+double EquidistantTickFactory::getMaximumAtIncrement( double fMax, const ExplicitIncrementData& rIncrement )
+{
+ //the returned value will be >= fMax and on a Major Tick given by rIncrement
+ if(rIncrement.Distance<=0.0)
+ return fMax;
+
+ double fRet = rIncrement.BaseValue +
+ floor( approxSub( fMax, rIncrement.BaseValue )
+ / rIncrement.Distance)
+ *rIncrement.Distance;
+
+ if( fRet < fMax )
+ {
+ if( !approxEqual(fRet, fMax) )
+ fRet += rIncrement.Distance;
+ }
+ return fRet;
+}
+
+EquidistantTickFactory::EquidistantTickFactory(
+ const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement )
+ : m_rScale( rScale )
+ , m_rIncrement( rIncrement )
+ , m_xInverseScaling(NULL)
+ , m_pfCurrentValues(NULL)
+{
+ //@todo: make sure that the scale is valid for the scaling
+
+ m_pfCurrentValues = new double[getTickDepth()];
+
+ if( m_rScale.Scaling.is() )
+ {
+ m_xInverseScaling = m_rScale.Scaling->getInverseScaling();
+ DBG_ASSERT( m_xInverseScaling.is(), "each Scaling needs to return a inverse Scaling" );
+ }
+
+ double fMin = m_fScaledVisibleMin = m_rScale.Minimum;
+ if( m_xInverseScaling.is() )
+ {
+ m_fScaledVisibleMin = m_rScale.Scaling->doScaling(m_fScaledVisibleMin);
+ if(m_rIncrement.PostEquidistant )
+ fMin = m_fScaledVisibleMin;
+ }
+
+ double fMax = m_fScaledVisibleMax = m_rScale.Maximum;
+ if( m_xInverseScaling.is() )
+ {
+ m_fScaledVisibleMax = m_rScale.Scaling->doScaling(m_fScaledVisibleMax);
+ if(m_rIncrement.PostEquidistant )
+ fMax = m_fScaledVisibleMax;
+ }
+
+ //--
+ m_fOuterMajorTickBorderMin = EquidistantTickFactory::getMinimumAtIncrement( fMin, m_rIncrement );
+ m_fOuterMajorTickBorderMax = EquidistantTickFactory::getMaximumAtIncrement( fMax, m_rIncrement );
+ //--
+
+ m_fOuterMajorTickBorderMin_Scaled = m_fOuterMajorTickBorderMin;
+ m_fOuterMajorTickBorderMax_Scaled = m_fOuterMajorTickBorderMax;
+ if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() )
+ {
+ m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin);
+ m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax);
+
+ //check validity of new range: m_fOuterMajorTickBorderMin <-> m_fOuterMajorTickBorderMax
+ //it is assumed here, that the original range in the given Scale is valid
+ if( !rtl::math::isFinite(m_fOuterMajorTickBorderMin_Scaled) )
+ {
+ m_fOuterMajorTickBorderMin += m_rIncrement.Distance;
+ m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin);
+ }
+ if( !rtl::math::isFinite(m_fOuterMajorTickBorderMax_Scaled) )
+ {
+ m_fOuterMajorTickBorderMax -= m_rIncrement.Distance;
+ m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax);
+ }
+ }
+}
+
+EquidistantTickFactory::~EquidistantTickFactory()
+{
+ delete[] m_pfCurrentValues;
+}
+
+sal_Int32 EquidistantTickFactory::getTickDepth() const
+{
+ return static_cast<sal_Int32>(m_rIncrement.SubIncrements.size()) + 1;
+}
+
+void EquidistantTickFactory::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::Sequence< double > >& rParentTicks ) const
+{
+ EquidistantTickIter aIter( rParentTicks, m_rIncrement, 0, nDepth-1 );
+ double* pfNextParentTick = aIter.firstValue();
+ if(!pfNextParentTick)
+ return;
+ double fLastParentTick = *pfNextParentTick;
+ pfNextParentTick = aIter.nextValue();
+ if(!pfNextParentTick)
+ return;
+
+ sal_Int32 nMaxSubTickCount = this->getMaxTickCount( nDepth );
+ if(!nMaxSubTickCount)
+ return;
+
+ uno::Sequence< double > aSubTicks(nMaxSubTickCount);
+ sal_Int32 nRealSubTickCount = 0;
+ sal_Int32 nIntervalCount = m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+
+ double* pValue = NULL;
+ for(; pfNextParentTick; fLastParentTick=*pfNextParentTick, pfNextParentTick = aIter.nextValue())
+ {
+ for( sal_Int32 nPartTick = 1; nPartTick<nIntervalCount; nPartTick++ )
+ {
+ pValue = this->getMinorTick( nPartTick, nDepth
+ , fLastParentTick, *pfNextParentTick );
+ if(!pValue)
+ continue;
+
+ aSubTicks[nRealSubTickCount] = *pValue;
+ nRealSubTickCount++;
+ }
+ }
+
+ aSubTicks.realloc(nRealSubTickCount);
+ rParentTicks[nDepth] = aSubTicks;
+ if(static_cast<sal_Int32>(m_rIncrement.SubIncrements.size())>nDepth)
+ addSubTicks( nDepth+1, rParentTicks );
+}
+
+
+sal_Int32 EquidistantTickFactory::getMaxTickCount( sal_Int32 nDepth ) const
+{
+ //return the maximum amount of ticks
+ //possibly open intervals at the two ends of the region are handled as if they were completely visible
+ //(this is necessary for calculating the sub ticks at the borders correctly)
+
+ if( nDepth >= getTickDepth() )
+ return 0;
+ if( m_fOuterMajorTickBorderMax < m_fOuterMajorTickBorderMin )
+ return 0;
+ if( m_rIncrement.Distance<=0.0)
+ return 0;
+
+ double fSub;
+ if(m_rIncrement.PostEquidistant )
+ fSub = approxSub( m_fScaledVisibleMax, m_fScaledVisibleMin );
+ else
+ fSub = approxSub( m_rScale.Maximum, m_rScale.Minimum );
+
+ if (!isFinite(fSub))
+ return 0;
+
+ sal_Int32 nIntervalCount = static_cast<sal_Int32>( fSub / m_rIncrement.Distance );
+
+ nIntervalCount+=3;
+ for(sal_Int32 nN=0; nN<nDepth-1; nN++)
+ {
+ if( m_rIncrement.SubIncrements[nN].IntervalCount>1 )
+ nIntervalCount *= m_rIncrement.SubIncrements[nN].IntervalCount;
+ }
+
+ sal_Int32 nTickCount = nIntervalCount;
+ if(nDepth>0 && m_rIncrement.SubIncrements[nDepth-1].IntervalCount>1)
+ nTickCount = nIntervalCount * (m_rIncrement.SubIncrements[nDepth-1].IntervalCount-1);
+
+ return nTickCount;
+}
+
+double* EquidistantTickFactory::getMajorTick( sal_Int32 nTick ) const
+{
+ m_pfCurrentValues[0] = m_fOuterMajorTickBorderMin + nTick*m_rIncrement.Distance;
+
+ if(m_pfCurrentValues[0]>m_fOuterMajorTickBorderMax)
+ {
+ if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMax) )
+ return NULL;
+ }
+ if(m_pfCurrentValues[0]<m_fOuterMajorTickBorderMin)
+ {
+ if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMin) )
+ return NULL;
+ }
+
+ //return always the value after scaling
+ if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() )
+ m_pfCurrentValues[0] = m_rScale.Scaling->doScaling( m_pfCurrentValues[0] );
+
+ return &m_pfCurrentValues[0];
+}
+
+double* EquidistantTickFactory::getMinorTick( sal_Int32 nTick, sal_Int32 nDepth
+ , double fStartParentTick, double fNextParentTick ) const
+{
+ //check validity of arguments
+ {
+ //DBG_ASSERT( fStartParentTick < fNextParentTick, "fStartParentTick >= fNextParentTick");
+ if(fStartParentTick >= fNextParentTick)
+ return NULL;
+ if(nDepth>static_cast<sal_Int32>(m_rIncrement.SubIncrements.size()) || nDepth<=0)
+ return NULL;
+
+ //subticks are only calculated if they are laying between parent ticks:
+ if(nTick<=0)
+ return NULL;
+ if(nTick>=m_rIncrement.SubIncrements[nDepth-1].IntervalCount)
+ return NULL;
+ }
+
+ bool bPostEquidistant = m_rIncrement.SubIncrements[nDepth-1].PostEquidistant;
+
+ double fAdaptedStartParent = fStartParentTick;
+ double fAdaptedNextParent = fNextParentTick;
+
+ if( !bPostEquidistant && m_xInverseScaling.is() )
+ {
+ fAdaptedStartParent = m_xInverseScaling->doScaling(fStartParentTick);
+ fAdaptedNextParent = m_xInverseScaling->doScaling(fNextParentTick);
+ }
+
+ double fDistance = (fAdaptedNextParent - fAdaptedStartParent)/m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+
+ m_pfCurrentValues[nDepth] = fAdaptedStartParent + nTick*fDistance;
+
+ //return always the value after scaling
+ if(!bPostEquidistant && m_xInverseScaling.is() )
+ m_pfCurrentValues[nDepth] = m_rScale.Scaling->doScaling( m_pfCurrentValues[nDepth] );
+
+ if( !isWithinOuterBorder( m_pfCurrentValues[nDepth] ) )
+ return NULL;
+
+ return &m_pfCurrentValues[nDepth];
+}
+
+bool EquidistantTickFactory::isWithinOuterBorder( double fScaledValue ) const
+{
+ if(fScaledValue>m_fOuterMajorTickBorderMax_Scaled)
+ return false;
+ if(fScaledValue<m_fOuterMajorTickBorderMin_Scaled)
+ return false;
+
+ return true;
+}
+
+bool EquidistantTickFactory::isVisible( double fScaledValue ) const
+{
+ if(fScaledValue>m_fScaledVisibleMax)
+ {
+ if( !approxEqual(fScaledValue,m_fScaledVisibleMax) )
+ return false;
+ }
+ if(fScaledValue<m_fScaledVisibleMin)
+ {
+ if( !approxEqual(fScaledValue,m_fScaledVisibleMin) )
+ return false;
+ }
+ return true;
+}
+
+void EquidistantTickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ uno::Sequence< uno::Sequence< double > > aAllTicks;
+
+ //create point sequences for each tick depth
+ sal_Int32 nDepthCount = this->getTickDepth();
+ sal_Int32 nMaxMajorTickCount = this->getMaxTickCount( 0 );
+
+ aAllTicks.realloc(nDepthCount);
+ aAllTicks[0].realloc(nMaxMajorTickCount);
+
+ sal_Int32 nRealMajorTickCount = 0;
+ double* pValue = NULL;
+ for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ )
+ {
+ pValue = this->getMajorTick( nMajorTick );
+ if(!pValue)
+ continue;
+ aAllTicks[0][nRealMajorTickCount] = *pValue;
+ nRealMajorTickCount++;
+ }
+ if(!nRealMajorTickCount)
+ return;
+ aAllTicks[0].realloc(nRealMajorTickCount);
+
+ if(nDepthCount>0)
+ this->addSubTicks( 1, aAllTicks );
+
+ //so far we have added all ticks between the outer major tick marks
+ //this was necessary to create sub ticks correctly
+ //now we reduce all ticks to the visible ones that lie between the real borders
+ sal_Int32 nDepth = 0;
+ sal_Int32 nTick = 0;
+ for( nDepth = 0; nDepth < nDepthCount; nDepth++)
+ {
+ sal_Int32 nInvisibleAtLowerBorder = 0;
+ sal_Int32 nInvisibleAtUpperBorder = 0;
+ //we need only to check all ticks within the first major interval at each border
+ sal_Int32 nCheckCount = 1;
+ for(sal_Int32 nN=0; nN<nDepth; nN++)
+ {
+ if( m_rIncrement.SubIncrements[nN].IntervalCount>1 )
+ nCheckCount *= m_rIncrement.SubIncrements[nN].IntervalCount;
+ }
+ uno::Sequence< double >& rTicks = aAllTicks[nDepth];
+ sal_Int32 nCount = rTicks.getLength();
+ //check lower border
+ for( nTick=0; nTick<nCheckCount && nTick<nCount; nTick++)
+ {
+ if( !isVisible( rTicks[nTick] ) )
+ nInvisibleAtLowerBorder++;
+ }
+ //check upper border
+ for( nTick=nCount-1; nTick>nCount-1-nCheckCount && nTick>=0; nTick--)
+ {
+ if( !isVisible( rTicks[nTick] ) )
+ nInvisibleAtUpperBorder++;
+ }
+ //resize sequence
+ if( !nInvisibleAtLowerBorder && !nInvisibleAtUpperBorder)
+ continue;
+ if( !nInvisibleAtLowerBorder )
+ rTicks.realloc(nCount-nInvisibleAtUpperBorder);
+ else
+ {
+ sal_Int32 nNewCount = nCount-nInvisibleAtUpperBorder-nInvisibleAtLowerBorder;
+ if(nNewCount<0)
+ nNewCount=0;
+
+ uno::Sequence< double > aOldTicks(rTicks);
+ rTicks.realloc(nNewCount);
+ for(nTick = 0; nTick<nNewCount; nTick++)
+ rTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick];
+ }
+ }
+
+ //fill return value
+ rAllTickInfos.resize(aAllTicks.getLength());
+ for( nDepth=0 ;nDepth<aAllTicks.getLength(); nDepth++ )
+ {
+ sal_Int32 nCount = aAllTicks[nDepth].getLength();
+
+ ::std::vector< TickInfo >& rTickInfoVector = rAllTickInfos[nDepth];
+ rTickInfoVector.clear();
+ rTickInfoVector.reserve( nCount );
+ for(sal_Int32 nN = 0; nN<nCount; nN++)
+ {
+ TickInfo aTickInfo(m_xInverseScaling);
+ aTickInfo.fScaledTickValue = aAllTicks[nDepth][nN];
+ rTickInfoVector.push_back(aTickInfo);
+ }
+ }
+}
+
+void EquidistantTickFactory::getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ ExplicitIncrementData aShiftedIncrement( m_rIncrement );
+ aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0;
+ EquidistantTickFactory( m_rScale, aShiftedIncrement ).getAllTicks(rAllTickInfos);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+EquidistantTickIter::EquidistantTickIter( const uno::Sequence< uno::Sequence< double > >& rTicks
+ , const ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : m_pSimpleTicks(&rTicks)
+ , m_pInfoTicks(0)
+ , m_rIncrement(rIncrement)
+ , m_nMinDepth(0), m_nMaxDepth(0)
+ , m_nTickCount(0), m_pnPositions(NULL)
+ , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL)
+ , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
+{
+ initIter( nMinDepth, nMaxDepth );
+}
+
+EquidistantTickIter::EquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTicks
+ , const ExplicitIncrementData& rIncrement
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : m_pSimpleTicks(NULL)
+ , m_pInfoTicks(&rTicks)
+ , m_rIncrement(rIncrement)
+ , m_nMinDepth(0), m_nMaxDepth(0)
+ , m_nTickCount(0), m_pnPositions(NULL)
+ , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL)
+ , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
+{
+ initIter( nMinDepth, nMaxDepth );
+}
+
+void EquidistantTickIter::initIter( sal_Int32 /*nMinDepth*/, sal_Int32 nMaxDepth )
+{
+ m_nMaxDepth = nMaxDepth;
+ if(nMaxDepth<0 || m_nMaxDepth>getMaxDepth())
+ m_nMaxDepth=getMaxDepth();
+
+ sal_Int32 nDepth = 0;
+ for( nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ m_nTickCount += getTickCount(nDepth);
+
+ if(!m_nTickCount)
+ return;
+
+ m_pnPositions = new sal_Int32[m_nMaxDepth+1];
+
+ m_pnPreParentCount = new sal_Int32[m_nMaxDepth+1];
+ m_pbIntervalFinished = new bool[m_nMaxDepth+1];
+ m_pnPreParentCount[0] = 0;
+ m_pbIntervalFinished[0] = false;
+ double fParentValue = getTickValue(0,0);
+ for( nDepth = 1; nDepth<=m_nMaxDepth ;nDepth++ )
+ {
+ m_pbIntervalFinished[nDepth] = false;
+
+ sal_Int32 nPreParentCount = 0;
+ sal_Int32 nCount = getTickCount(nDepth);
+ for(sal_Int32 nN = 0; nN<nCount; nN++)
+ {
+ if(getTickValue(nDepth,nN) < fParentValue)
+ nPreParentCount++;
+ else
+ break;
+ }
+ m_pnPreParentCount[nDepth] = nPreParentCount;
+ if(nCount)
+ {
+ double fNextParentValue = getTickValue(nDepth,0);
+ if( fNextParentValue < fParentValue )
+ fParentValue = fNextParentValue;
+ }
+ }
+}
+
+EquidistantTickIter::~EquidistantTickIter()
+{
+ delete[] m_pnPositions;
+ delete[] m_pnPreParentCount;
+ delete[] m_pbIntervalFinished;
+}
+
+sal_Int32 EquidistantTickIter::getStartDepth() const
+{
+ //find the depth of the first visible tickmark:
+ //it is the depth of the smallest value
+ sal_Int32 nReturnDepth=0;
+ double fMinValue = DBL_MAX;
+ for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ {
+ sal_Int32 nCount = getTickCount(nDepth);
+ if( !nCount )
+ continue;
+ double fThisValue = getTickValue(nDepth,0);
+ if(fThisValue<fMinValue)
+ {
+ nReturnDepth = nDepth;
+ fMinValue = fThisValue;
+ }
+ }
+ return nReturnDepth;
+}
+
+double* EquidistantTickIter::firstValue()
+{
+ if( gotoFirst() )
+ {
+ m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]);
+ return &m_fCurrentValue;
+ }
+ return NULL;
+}
+
+TickInfo* EquidistantTickIter::firstInfo()
+{
+ if( m_pInfoTicks && gotoFirst() )
+ return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]];
+ return NULL;
+}
+
+sal_Int32 EquidistantTickIter::getIntervalCount( sal_Int32 nDepth )
+{
+ if(nDepth>static_cast<sal_Int32>(m_rIncrement.SubIncrements.size()) || nDepth<0)
+ return 0;
+
+ if(!nDepth)
+ return m_nTickCount;
+
+ return m_rIncrement.SubIncrements[nDepth-1].IntervalCount;
+}
+
+bool EquidistantTickIter::isAtLastPartTick()
+{
+ if(!m_nCurrentDepth)
+ return false;
+ sal_Int32 nIntervalCount = getIntervalCount( m_nCurrentDepth );
+ if(!nIntervalCount || nIntervalCount == 1)
+ return true;
+ if( m_pbIntervalFinished[m_nCurrentDepth] )
+ return false;
+ sal_Int32 nPos = m_pnPositions[m_nCurrentDepth]+1;
+ if(m_pnPreParentCount[m_nCurrentDepth])
+ nPos += nIntervalCount-1 - m_pnPreParentCount[m_nCurrentDepth];
+ bool bRet = nPos && nPos % (nIntervalCount-1) == 0;
+ if(!nPos && !m_pnPreParentCount[m_nCurrentDepth]
+ && m_pnPositions[m_nCurrentDepth-1]==-1 )
+ bRet = true;
+ return bRet;
+}
+
+bool EquidistantTickIter::gotoFirst()
+{
+ if( m_nMaxDepth<0 )
+ return false;
+ if( !m_nTickCount )
+ return false;
+
+ for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ )
+ m_pnPositions[nDepth] = -1;
+
+ m_nCurrentPos = 0;
+ m_nCurrentDepth = getStartDepth();
+ m_pnPositions[m_nCurrentDepth] = 0;
+ return true;
+}
+
+bool EquidistantTickIter::gotoNext()
+{
+ if( m_nCurrentPos < 0 )
+ return false;
+ m_nCurrentPos++;
+
+ if( m_nCurrentPos >= m_nTickCount )
+ return false;
+
+ if( m_nCurrentDepth==m_nMaxDepth && isAtLastPartTick() )
+ {
+ do
+ {
+ m_pbIntervalFinished[m_nCurrentDepth] = true;
+ m_nCurrentDepth--;
+ }
+ while( m_nCurrentDepth && isAtLastPartTick() );
+ }
+ else if( m_nCurrentDepth<m_nMaxDepth )
+ {
+ do
+ {
+ m_nCurrentDepth++;
+ }
+ while( m_nCurrentDepth<m_nMaxDepth );
+ }
+ m_pbIntervalFinished[m_nCurrentDepth] = false;
+ m_pnPositions[m_nCurrentDepth] = m_pnPositions[m_nCurrentDepth]+1;
+ return true;
+}
+
+bool EquidistantTickIter::gotoIndex( sal_Int32 nTickIndex )
+{
+ if( nTickIndex < 0 )
+ return false;
+ if( nTickIndex >= m_nTickCount )
+ return false;
+
+ if( nTickIndex < m_nCurrentPos )
+ if( !gotoFirst() )
+ return false;
+
+ while( nTickIndex > m_nCurrentPos )
+ if( !gotoNext() )
+ return false;
+
+ return true;
+}
+
+sal_Int32 EquidistantTickIter::getCurrentIndex() const
+{
+ return m_nCurrentPos;
+}
+sal_Int32 EquidistantTickIter::getMaxIndex() const
+{
+ return m_nTickCount-1;
+}
+
+double* EquidistantTickIter::nextValue()
+{
+ if( gotoNext() )
+ {
+ m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]);
+ return &m_fCurrentValue;
+ }
+ return NULL;
+}
+
+TickInfo* EquidistantTickIter::nextInfo()
+{
+ if( m_pInfoTicks && gotoNext() &&
+ static_cast< sal_Int32 >(
+ (*m_pInfoTicks)[m_nCurrentDepth].size()) > m_pnPositions[m_nCurrentDepth] )
+ {
+ return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]];
+ }
+ return NULL;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/TickmarkHelper.hxx b/chart2/source/view/axes/Tickmarks_Equidistant.hxx
index 78fc2fe1c502..836a93d28db2 100644
--- a/chart2/source/view/axes/TickmarkHelper.hxx
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.hxx
@@ -24,19 +24,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _CHART2_TICKMARKHELPER_HXX
-#define _CHART2_TICKMARKHELPER_HXX
+#ifndef _CHART2_TICKMARKS_EQUIDISTANT_HXX
+#define _CHART2_TICKMARKS_EQUIDISTANT_HXX
-#include "TickmarkProperties.hxx"
-#include "VAxisProperties.hxx"
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
-#include <basegfx/vector/b2dvector.hxx>
-#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/uno/Sequence.h>
-
-#include <vector>
+#include "Tickmarks.hxx"
//.............................................................................
namespace chart
@@ -48,57 +39,15 @@ using ::basegfx::B2DVector;
/**
*/
-struct TickInfo
-{
- double fScaledTickValue;
- double fUnscaledTickValue;
-
- ::basegfx::B2DVector aTickScreenPosition;
- bool bPaintIt;
-
- ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShape > xTextShape;
-
- rtl::OUString aText;//used only for complex categories so far
- sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
-
-//methods:
- TickInfo();
- void updateUnscaledValue( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XScaling >& xInverseScaling );
-
- sal_Int32 getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const;
-};
-class TickIter
-{
-public:
- virtual ~TickIter(){};
- virtual TickInfo* firstInfo()=0;
- virtual TickInfo* nextInfo()=0;
-};
-
-class PureTickIter : public TickIter
-{
-public:
- PureTickIter( ::std::vector< TickInfo >& rTickInfoVector );
- virtual ~PureTickIter();
- virtual TickInfo* firstInfo();
- virtual TickInfo* nextInfo();
-
-private:
- ::std::vector< TickInfo >& m_rTickVector;
- ::std::vector< TickInfo >::iterator m_aTickIter;
-};
-
class EquidistantTickIter : public TickIter
{
public:
EquidistantTickIter( const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Sequence< double > >& rTicks
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const ExplicitIncrementData& rIncrement
, sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
EquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const ExplicitIncrementData& rIncrement
, sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
virtual ~EquidistantTickIter();
@@ -152,7 +101,7 @@ private: //member
const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Sequence< double > >* m_pSimpleTicks;
::std::vector< ::std::vector< TickInfo > >* m_pInfoTicks;
- const ::com::sun::star::chart2::ExplicitIncrementData& m_rIncrement;
+ const ExplicitIncrementData& m_rIncrement;
//iteration from m_nMinDepth to m_nMaxDepth
sal_Int32 m_nMinDepth;
sal_Int32 m_nMaxDepth;
@@ -166,24 +115,21 @@ private: //member
double m_fCurrentValue;
};
-class TickmarkHelper
+class EquidistantTickFactory
{
public:
- TickmarkHelper(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
- virtual ~TickmarkHelper();
+ EquidistantTickFactory(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement );
+ ~EquidistantTickFactory();
- virtual TickmarkHelper* createShiftedTickmarkHelper() const;
+ void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
- void getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
- void getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+ static double getMinimumAtIncrement( double fMin, const ExplicitIncrementData& rIncrement );
+ static double getMaximumAtIncrement( double fMax, const ExplicitIncrementData& rIncrement );
- //
- static double getMinimumAtIncrement( double fMin, const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
- static double getMaximumAtIncrement( double fMax, const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
-
-protected: //methods
+private: //methods
void addSubTicks( sal_Int32 nDepth,
::com::sun::star::uno::Sequence<
::com::sun::star::uno::Sequence< double > >& rParentTicks ) const;
@@ -192,82 +138,26 @@ protected: //methods
, double fStartParentTick, double fNextParentTick ) const;
sal_Int32 getMaxTickCount( sal_Int32 nDepth = 0 ) const;
sal_Int32 getTickDepth() const;
+
bool isVisible( double fValue ) const;
bool isWithinOuterBorder( double fScaledValue ) const; //all within the outer major tick marks
- virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& /*rAllTickInfos*/ ) const {}
-
-protected: //member
- ::com::sun::star::chart2::ExplicitScaleData m_rScale;
- ::com::sun::star::chart2::ExplicitIncrementData m_rIncrement;
-
+private: //member
+ ExplicitScaleData m_rScale;
+ ExplicitIncrementData m_rIncrement;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
m_xInverseScaling;
+
+ //minimum and maximum of the visible range after scaling
+ double m_fScaledVisibleMin;
+ double m_fScaledVisibleMax;
+
double* m_pfCurrentValues;
//major-tick positions that may lay outside the visible range but complete partly visible intervals at the borders
double m_fOuterMajorTickBorderMin;
double m_fOuterMajorTickBorderMax;
double m_fOuterMajorTickBorderMin_Scaled;
double m_fOuterMajorTickBorderMax_Scaled;
-
- //minimum and maximum of the visible range after scaling
- double m_fScaledVisibleMin;
- double m_fScaledVisibleMax;
-};
-
-class TickmarkHelper_2D : public TickmarkHelper
-{
-public:
- TickmarkHelper_2D(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
- , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos
- , const ::basegfx::B2DVector& rAxisLineToLabelLineShift );
- //, double fStrech_SceneToScreen, double fOffset_SceneToScreen );
- virtual ~TickmarkHelper_2D();
-
- virtual TickmarkHelper* createShiftedTickmarkHelper() const;
-
- static sal_Int32 getTickScreenDistance( TickIter& rIter );
-
- void createPointSequenceForAxisMainLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints ) const;
- void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints
- , sal_Int32 nSequenceIndex
- , double fScaledLogicTickValue, double fInnerDirectionSign
- , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const;
- ::basegfx::B2DVector getDistanceAxisTickToText( const AxisProperties& rAxisProperties
- , bool bIncludeFarAwayDistanceIfSo = false
- , bool bIncludeSpaceBetweenTickAndText = true ) const;
-
- virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
-
- bool isHorizontalAxis() const;
- bool isVerticalAxis() const;
-
-protected: //methods
- ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const;
-
-private: //member
- ::basegfx::B2DVector m_aAxisStartScreenPosition2D;
- ::basegfx::B2DVector m_aAxisEndScreenPosition2D;
-
- //labels might be posioned high or low on the border of the diagram far away from the axis
- //add this vector to go from the axis line to the label line (border of the diagram)
- ::basegfx::B2DVector m_aAxisLineToLabelLineShift;
-
- double m_fStrech_LogicToScreen;
- double m_fOffset_LogicToScreen;
-};
-
-class TickmarkHelper_3D : public TickmarkHelper
-{
-public:
- TickmarkHelper_3D(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement );
- virtual ~TickmarkHelper_3D();
-
- virtual TickmarkHelper* createShiftedTickmarkHelper() const;
};
//.............................................................................
diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx
index 0159fb20cad6..fb193ec93a95 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -31,7 +31,7 @@
#include "VAxisBase.hxx"
#include "ShapeFactory.hxx"
#include "CommonConverters.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include "macros.hxx"
// header for define DBG_ASSERT
@@ -70,7 +70,7 @@ sal_Int32 VAxisBase::getDimensionCount()
return m_nDimension;
}
-void SAL_CALL VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
+void VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
, const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels )
{
m_aAxisLabelProperties.m_aFontReferenceSize = rFontReferenceSize;
@@ -106,6 +106,15 @@ void SAL_CALL VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::S
m_aAxisLabelProperties.eStaggering = SIDE_BY_SIDE;
}
+bool VAxisBase::isDateAxis() const
+{
+ return AxisType::DATE == m_aScale.AxisType;
+}
+bool VAxisBase::isComplexCategoryAxis() const
+{
+ return m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels;
+}
+
void VAxisBase::recordMaximumTextSize( const Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
{
if( m_bRecordMaximumTextSize && xShape.is() )
@@ -130,7 +139,7 @@ void VAxisBase::setExrtaLinePositionAtOtherAxis( const double& fCrossingAt )
m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis = new double(fCrossingAt);
}
-sal_Bool SAL_CALL VAxisBase::isAnythingToDraw()
+sal_Bool VAxisBase::isAnythingToDraw()
{
if( !m_aAxisProperties.m_xAxisModel.is() )
return false;
@@ -150,7 +159,7 @@ sal_Bool SAL_CALL VAxisBase::isAnythingToDraw()
return true;
}
-void SAL_CALL VAxisBase::setExplicitScaleAndIncrement(
+void VAxisBase::setExplicitScaleAndIncrement(
const ExplicitScaleData& rScale
, const ExplicitIncrementData& rIncrement )
throw (uno::RuntimeException)
@@ -162,8 +171,11 @@ void SAL_CALL VAxisBase::setExplicitScaleAndIncrement(
void VAxisBase::createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
{
- std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
- apTickmarkHelper->getAllTicks( rAllTickInfos );
+ std::auto_ptr< TickFactory > apTickFactory( this->createTickFactory() );
+ if( m_aScale.ShiftedCategoryPosition )
+ apTickFactory->getAllTicksShifted( rAllTickInfos );
+ else
+ apTickFactory->getAllTicks( rAllTickInfos );
}
bool VAxisBase::prepareShapeCreation()
@@ -244,7 +256,7 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter )
for( TickInfo* pTickInfo = rIter.firstInfo()
; pTickInfo; pTickInfo = rIter.nextInfo() )
{
- pTickInfo->updateUnscaledValue( xInverseScaling );
+ //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
}
}
diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx
index ba7e94b2070c..e51e2d8dbd9b 100644
--- a/chart2/source/view/axes/VAxisBase.hxx
+++ b/chart2/source/view/axes/VAxisBase.hxx
@@ -29,7 +29,7 @@
#include "VAxisOrGridBase.hxx"
#include "VAxisProperties.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
//.............................................................................
@@ -52,18 +52,18 @@ public:
sal_Int32 getDimensionCount();
- virtual void SAL_CALL createMaximumLabels()=0;
- virtual void SAL_CALL createLabels()=0;
- virtual void SAL_CALL updatePositions()=0;
+ virtual void createMaximumLabels()=0;
+ virtual void createLabels()=0;
+ virtual void updatePositions()=0;
- virtual sal_Bool SAL_CALL isAnythingToDraw();
- virtual void SAL_CALL initAxisLabelProperties(
+ virtual sal_Bool isAnythingToDraw();
+ virtual void initAxisLabelProperties(
const ::com::sun::star::awt::Size& rFontReferenceSize
, const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
- virtual void SAL_CALL setExplicitScaleAndIncrement(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ virtual void setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
throw (::com::sun::star::uno::RuntimeException);
virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
@@ -83,6 +83,9 @@ protected: //methods
::com::sun::star::drawing::XShape >& xShape
, double fRotationAngleDegree );
+ bool isDateAxis() const;
+ bool isComplexCategoryAxis() const;
+
protected: //member
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier;
AxisProperties m_aAxisProperties;
diff --git a/chart2/source/view/axes/VAxisOrGridBase.cxx b/chart2/source/view/axes/VAxisOrGridBase.cxx
index f2e2e90c1045..715da4972390 100644
--- a/chart2/source/view/axes/VAxisOrGridBase.cxx
+++ b/chart2/source/view/axes/VAxisOrGridBase.cxx
@@ -31,7 +31,7 @@
#include "VAxisOrGridBase.hxx"
#include "ShapeFactory.hxx"
#include "CommonConverters.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
// header for define DBG_ASSERT
#include <tools/debug.hxx>
@@ -57,7 +57,7 @@ VAxisOrGridBase::~VAxisOrGridBase()
{
}
-void SAL_CALL VAxisOrGridBase::setExplicitScaleAndIncrement(
+void VAxisOrGridBase::setExplicitScaleAndIncrement(
const ExplicitScaleData& rScale
, const ExplicitIncrementData& rIncrement )
throw (uno::RuntimeException)
@@ -79,18 +79,9 @@ void VAxisOrGridBase::set3DWallPositions( CuboidPlanePosition eLeftWallPos, Cubo
m_eBottomPos = eBottomPos;
}
-TickmarkHelper* VAxisOrGridBase::createTickmarkHelper()
+TickFactory* VAxisOrGridBase::createTickFactory()
{
- TickmarkHelper* pRet=NULL;
- if( 2==m_nDimension )
- {
- pRet = new TickmarkHelper( m_aScale, m_aIncrement );
- }
- else
- {
- pRet = new TickmarkHelper_3D( m_aScale, m_aIncrement );
- }
- return pRet;
+ return new TickFactory( m_aScale, m_aIncrement );
}
//.............................................................................
diff --git a/chart2/source/view/axes/VAxisOrGridBase.hxx b/chart2/source/view/axes/VAxisOrGridBase.hxx
index 35b32b2b1c03..9091aabf0dc5 100644
--- a/chart2/source/view/axes/VAxisOrGridBase.hxx
+++ b/chart2/source/view/axes/VAxisOrGridBase.hxx
@@ -29,9 +29,8 @@
#include "PlotterBase.hxx"
#include "ThreeDHelper.hxx"
+#include "chartview/ExplicitScaleValues.hxx"
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -46,7 +45,7 @@ namespace chart
/**
*/
class ShapeFactory;
-class TickmarkHelper;
+class TickFactory;
class VAxisOrGridBase : public PlotterBase
{
@@ -55,22 +54,22 @@ public:
virtual ~VAxisOrGridBase();
virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
- virtual void SAL_CALL setExplicitScaleAndIncrement(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ virtual void setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
throw (::com::sun::star::uno::RuntimeException);
void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
- virtual TickmarkHelper* createTickmarkHelper();
+ virtual TickFactory* createTickFactory();
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
protected: //member
- ::com::sun::star::chart2::ExplicitScaleData m_aScale;
- ::com::sun::star::chart2::ExplicitIncrementData m_aIncrement;
- sal_Int32 m_nDimensionIndex;
+ ExplicitScaleData m_aScale;
+ ExplicitIncrementData m_aIncrement;
+ sal_Int32 m_nDimensionIndex;
- ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
+ ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
CuboidPlanePosition m_eLeftWallPos;
CuboidPlanePosition m_eBackWallPos;
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
index 63c98141991b..9f710d926e0c 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -182,7 +182,6 @@ AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
, m_pfExrtaLinePositionAtOtherAxis(NULL)
, m_bCrossingAxisHasReverseDirection(false)
, m_bCrossingAxisIsCategoryAxes(false)
- , m_bAxisBetweenCategories(false)
, m_fLabelDirectionSign(1.0)
, m_fInnerDirectionSign(1.0)
, m_aLabelAlignment(LABEL_ALIGN_RIGHT_TOP)
@@ -212,7 +211,6 @@ AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
, m_pfExrtaLinePositionAtOtherAxis( NULL )
, m_bCrossingAxisHasReverseDirection( rAxisProperties.m_bCrossingAxisHasReverseDirection )
, m_bCrossingAxisIsCategoryAxes( rAxisProperties.m_bCrossingAxisIsCategoryAxes )
- , m_bAxisBetweenCategories( rAxisProperties.m_bAxisBetweenCategories )
, m_fLabelDirectionSign( rAxisProperties.m_fLabelDirectionSign )
, m_fInnerDirectionSign( rAxisProperties.m_fInnerDirectionSign )
, m_aLabelAlignment( rAxisProperties.m_aLabelAlignment )
@@ -279,11 +277,7 @@ void AxisProperties::initAxisPositioning( const uno::Reference< beans::XProperty
xAxisProp->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue;
if( m_bCrossingAxisIsCategoryAxes )
- {
fValue = ::rtl::math::round(fValue);
- if( m_bAxisBetweenCategories )
- fValue-=0.5;
- }
m_pfMainLinePositionAtOtherAxis = new double(fValue);
}
else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == m_eCrossoverType )
@@ -317,8 +311,17 @@ void AxisProperties::init( bool bCartesian )
if( m_nDimensionIndex<2 )
initAxisPositioning( xProp );
+ ScaleData aScaleData = m_xAxisModel->getScaleData();
+ if( m_nDimensionIndex==0 )
+ AxisHelper::checkDateAxis( aScaleData, m_pExplicitCategoriesProvider, bCartesian );
+ m_nAxisType = aScaleData.AxisType;
+
if( bCartesian )
{
+ if( m_nDimensionIndex == 0 && m_nAxisType == AxisType::CATEGORY
+ && m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
+ m_bComplexCategories = true;
+
if( ::com::sun::star::chart::ChartAxisPosition_END == m_eCrossoverType )
m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
else
@@ -360,10 +363,6 @@ void AxisProperties::init( bool bCartesian )
//init display labels
xProp->getPropertyValue( C2U( "DisplayLabels" ) ) >>= m_bDisplayLabels;
- //init categories
- ScaleData aScaleData = m_xAxisModel->getScaleData();
- m_nAxisType = aScaleData.AxisType;
-
//init TickmarkProperties
xProp->getPropertyValue( C2U( "MajorTickmarks" ) ) >>= m_nMajorTickmarks;
xProp->getPropertyValue( C2U( "MinorTickmarks" ) ) >>= m_nMinorTickmarks;
diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx
index 5b6bfe98f777..69e0edb82730 100644
--- a/chart2/source/view/axes/VAxisProperties.hxx
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -111,7 +111,6 @@ struct AxisProperties
bool m_bCrossingAxisHasReverseDirection;
bool m_bCrossingAxisIsCategoryAxes;
- bool m_bAxisBetweenCategories;
//this direction is used to indicate in which direction the labels are to be drawn
double m_fLabelDirectionSign;
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 8ec895fbd452..23c36a8c5ed7 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -36,11 +36,12 @@
#include "macros.hxx"
#include "ViewDefines.hxx"
#include "PropertyMapper.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "LabelPositionHelper.hxx"
#include "TrueGuard.hxx"
#include "BaseGFXHelper.hxx"
#include "AxisHelper.hxx"
+#include "Tickmarks_Equidistant.hxx"
#include <rtl/math.hxx>
#include <tools/color.hxx>
@@ -48,6 +49,8 @@
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <editeng/unoprnms.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoshtxt.hxx>
#include <algorithm>
#include <memory>
@@ -110,7 +113,7 @@ Reference< drawing::XShape > createSingleLabel(
//correctPositionForRotation
LabelPositionHelper::correctPositionForRotation( xShape2DText
- , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, false );
+ , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories );
return xShape2DText;
}
@@ -176,7 +179,7 @@ void removeShapesAtWrongRhythm( TickIter& rIter
}
}
-class EquidistantLabelIterator : public EquidistantTickIter
+class LabelIterator : public TickIter
{
//this Iterator iterates over existing text labels
@@ -190,39 +193,36 @@ class EquidistantLabelIterator : public EquidistantTickIter
//we iterate through all labels
public:
- EquidistantLabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ LabelIterator( ::std::vector< TickInfo >& rTickInfoVector
, const AxisLabelStaggering eAxisLabelStaggering
- , bool bInnerLine
- , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
+ , bool bInnerLine );
virtual TickInfo* firstInfo();
virtual TickInfo* nextInfo();
private: //methods
- EquidistantLabelIterator();
+ LabelIterator();
private: //member
+ PureTickIter m_aPureTickIter;
const AxisLabelStaggering m_eAxisLabelStaggering;
- bool m_bInnerLine;
+ bool m_bInnerLine;
};
-EquidistantLabelIterator::EquidistantLabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+LabelIterator::LabelIterator( ::std::vector< TickInfo >& rTickInfoVector
, const AxisLabelStaggering eAxisLabelStaggering
- , bool bInnerLine
- , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
- : EquidistantTickIter( rTickInfos, rIncrement, nMinDepth, nMaxDepth )
+ , bool bInnerLine )
+ : m_aPureTickIter( rTickInfoVector )
, m_eAxisLabelStaggering(eAxisLabelStaggering)
, m_bInnerLine(bInnerLine)
{
}
-TickInfo* EquidistantLabelIterator::firstInfo()
+TickInfo* LabelIterator::firstInfo()
{
- TickInfo* pTickInfo = EquidistantTickIter::firstInfo();
+ TickInfo* pTickInfo = m_aPureTickIter.firstInfo();
while( pTickInfo && !pTickInfo->xTextShape.is() )
- pTickInfo = EquidistantTickIter::nextInfo();
+ pTickInfo = m_aPureTickIter.nextInfo();
if(!pTickInfo)
return NULL;
if( (STAGGER_EVEN==m_eAxisLabelStaggering && m_bInnerLine)
@@ -232,7 +232,7 @@ TickInfo* EquidistantLabelIterator::firstInfo()
{
//skip first label
do
- pTickInfo = EquidistantTickIter::nextInfo();
+ pTickInfo = m_aPureTickIter.nextInfo();
while( pTickInfo && !pTickInfo->xTextShape.is() );
}
if(!pTickInfo)
@@ -240,12 +240,12 @@ TickInfo* EquidistantLabelIterator::firstInfo()
return pTickInfo;
}
-TickInfo* EquidistantLabelIterator::nextInfo()
+TickInfo* LabelIterator::nextInfo()
{
TickInfo* pTickInfo = NULL;
//get next label
do
- pTickInfo = EquidistantTickIter::nextInfo();
+ pTickInfo = m_aPureTickIter.nextInfo();
while( pTickInfo && !pTickInfo->xTextShape.is() );
if( STAGGER_EVEN==m_eAxisLabelStaggering
@@ -253,13 +253,13 @@ TickInfo* EquidistantLabelIterator::nextInfo()
{
//skip one label
do
- pTickInfo = EquidistantTickIter::nextInfo();
+ pTickInfo = m_aPureTickIter.nextInfo();
while( pTickInfo && !pTickInfo->xTextShape.is() );
}
return pTickInfo;
}
-B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDistanceTickToText )
+B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDistanceTickToText, double fRotationAngleDegree )
{
//calculates the height or width of a line of labels
//thus a following line of labels can be shifted for that distance
@@ -282,7 +282,7 @@ B2DVector lcl_getLabelsDistance( TickIter& rIter, const B2DVector& rDistanceTick
xShape2DText = pTickInfo->xTextShape;
if( xShape2DText.is() )
{
- awt::Size aSize = xShape2DText->getSize();
+ awt::Size aSize = ShapeFactory::getSizeAfterRotation( xShape2DText, fRotationAngleDegree );
if(fabs(aStaggerDirection.getX())>fabs(aStaggerDirection.getY()))
nDistance = ::std::max(nDistance,aSize.Width);
else
@@ -319,64 +319,102 @@ void lcl_shiftLables( TickIter& rIter, const B2DVector& rStaggerDistance )
}
}
-class MaxLabelEquidistantTickIter : public EquidistantTickIter
+bool lcl_hasWordBreak( const Reference< drawing::XShape >& rxShape )
+{
+ if ( rxShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( rxShape );
+ SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( pShape );
+ if ( pShapeText )
+ {
+ SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
+ if ( pTextEditSource )
+ {
+ pTextEditSource->UpdateOutliner();
+ SvxTextForwarder* pTextForwarder = pTextEditSource->GetTextForwarder();
+ if ( pTextForwarder )
+ {
+ sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
+ for ( sal_uInt16 nPara = 0; nPara < nParaCount; ++nPara )
+ {
+ sal_uInt16 nLineCount = pTextForwarder->GetLineCount( nPara );
+ for ( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ sal_uInt16 nLineStart = 0;
+ sal_uInt16 nLineEnd = 0;
+ pTextForwarder->GetLineBoundaries( nLineStart, nLineEnd, nPara, nLine );
+ sal_uInt16 nWordStart = 0;
+ sal_uInt16 nWordEnd = 0;
+ if ( pTextForwarder->GetWordIndices( nPara, nLineStart, nWordStart, nWordEnd ) &&
+ ( nWordStart != nLineStart ) )
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+class MaxLabelTickIter : public TickIter
{
//iterate over first two and last two labels and the longest label
public:
- MaxLabelEquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ MaxLabelTickIter( ::std::vector< TickInfo >& rTickInfoVector
, sal_Int32 nLongestLabelIndex );
- virtual ~MaxLabelEquidistantTickIter();
+ virtual ~MaxLabelTickIter();
- virtual TickInfo* nextInfo();
+ virtual TickInfo* firstInfo();
+ virtual TickInfo* nextInfo();
private:
- sal_Int32 m_nLongestLabelIndex;
+ ::std::vector< TickInfo >& m_rTickInfoVector;
+ ::std::vector< sal_Int32 > m_aValidIndices;
+ sal_Int32 m_nCurrentIndex;
};
-MaxLabelEquidistantTickIter::MaxLabelEquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+MaxLabelTickIter::MaxLabelTickIter( ::std::vector< TickInfo >& rTickInfoVector
, sal_Int32 nLongestLabelIndex )
- : EquidistantTickIter( rTickInfos, rIncrement, 0//nMinDepth
- , 0//nMaxDepth
- )
- , m_nLongestLabelIndex( nLongestLabelIndex )
+ : m_rTickInfoVector(rTickInfoVector)
+ , m_nCurrentIndex(0)
{
- sal_Int32 nMaxIndex = getMaxIndex();
-
- //ensure correct value:
- if( m_nLongestLabelIndex<0 || m_nLongestLabelIndex>nMaxIndex)
- m_nLongestLabelIndex = 0;
-
- //last label is checked anyhow
- if( m_nLongestLabelIndex==nMaxIndex )
- m_nLongestLabelIndex = 0;
- //label before last is checked anyhow
- if( m_nLongestLabelIndex+1==nMaxIndex )
- m_nLongestLabelIndex = 0;
+ sal_Int32 nMaxIndex = m_rTickInfoVector.size()-1;
+ if( nLongestLabelIndex<0 || nLongestLabelIndex>=nMaxIndex-1 )
+ nLongestLabelIndex = 0;
+
+ if( nMaxIndex>=0 )
+ m_aValidIndices.push_back(0);
+ if( nMaxIndex>=1 )
+ m_aValidIndices.push_back(1);
+ if( nLongestLabelIndex>1 )
+ m_aValidIndices.push_back(nLongestLabelIndex);
+ if( nMaxIndex > 2 )
+ m_aValidIndices.push_back(nMaxIndex-1);
+ if( nMaxIndex > 1 )
+ m_aValidIndices.push_back(nMaxIndex);
}
-MaxLabelEquidistantTickIter::~MaxLabelEquidistantTickIter()
+MaxLabelTickIter::~MaxLabelTickIter()
{
}
-TickInfo* MaxLabelEquidistantTickIter::nextInfo()
+TickInfo* MaxLabelTickIter::firstInfo()
{
- sal_Int32 nCurrentPos = getCurrentIndex();
- sal_Int32 nMaxIndex = getMaxIndex();
- if( nCurrentPos>0 )
- {
- if( m_nLongestLabelIndex>1 && nCurrentPos<m_nLongestLabelIndex )
- gotoIndex( m_nLongestLabelIndex-1 ) ;
- else
- {
- if( nMaxIndex>3 && nCurrentPos<nMaxIndex-1 )
- gotoIndex( nMaxIndex-2 );
- else if( nMaxIndex>2 && nCurrentPos<nMaxIndex )
- gotoIndex( nMaxIndex-1 );
- }
- }
+ m_nCurrentIndex = 0;
+ if( m_nCurrentIndex < static_cast<sal_Int32>(m_aValidIndices.size()) )
+ return &m_rTickInfoVector[m_aValidIndices[m_nCurrentIndex]];
+ return 0;
+}
- return EquidistantTickIter::nextInfo();
+TickInfo* MaxLabelTickIter::nextInfo()
+{
+ m_nCurrentIndex++;
+ if( m_nCurrentIndex>=0 && m_nCurrentIndex<static_cast<sal_Int32>(m_aValidIndices.size()) )
+ return &m_rTickInfoVector[m_aValidIndices[m_nCurrentIndex]];
+ return 0;
}
bool VCartesianAxis::isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
@@ -446,27 +484,27 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
for(;aIt!=aEnd;++aIt)
{
- TickInfo aTickInfo;
+ TickInfo aTickInfo(0);
ComplexCategory aCat(*aIt);
sal_Int32 nCount = aCat.Count;
- if( nCatIndex + 0.5 + nCount >= m_aScale.Maximum )
+ if( nCatIndex + 1.0 + nCount >= m_aScale.Maximum )
{
- nCount = static_cast<sal_Int32>(m_aScale.Maximum - 0.5 - nCatIndex);
+ nCount = static_cast<sal_Int32>(m_aScale.Maximum - 1.0 - nCatIndex);
if( nCount <= 0 )
nCount = 1;
}
- aTickInfo.fScaledTickValue = nCatIndex + 0.5 + nCount/2.0;
+ aTickInfo.fScaledTickValue = nCatIndex + 1.0 + nCount/2.0;
aTickInfo.nFactorForLimitedTextWidth = nCount;
aTickInfo.aText = aCat.Text;
aTickInfoVector.push_back(aTickInfo);
nCatIndex += nCount;
- if( nCatIndex + 0.5 >= m_aScale.Maximum )
+ if( nCatIndex + 1.0 >= m_aScale.Maximum )
break;
}
rAllTickInfos.push_back(aTickInfoVector);
}
}
- else //bShiftedPosition==true
+ else //bShiftedPosition==false
{
rAllTickInfos.clear();
sal_Int32 nLevel=0;
@@ -480,19 +518,19 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
std::vector< ComplexCategory >::const_iterator aEnd(aComplexCategories.end());
for(;aIt!=aEnd;++aIt)
{
- TickInfo aTickInfo;
+ TickInfo aTickInfo(0);
ComplexCategory aCat(*aIt);
- aTickInfo.fScaledTickValue = nCatIndex + 0.5;
+ aTickInfo.fScaledTickValue = nCatIndex + 1.0;
aTickInfoVector.push_back(aTickInfo);
nCatIndex += aCat.Count;
- if( nCatIndex + 0.5 > m_aScale.Maximum )
+ if( nCatIndex + 1.0 > m_aScale.Maximum )
break;
}
//fill up with single ticks until maximum scale
- while( nCatIndex + 0.5 < m_aScale.Maximum )
+ while( nCatIndex + 1.0 < m_aScale.Maximum )
{
- TickInfo aTickInfo;
- aTickInfo.fScaledTickValue = nCatIndex + 0.5;
+ TickInfo aTickInfo(0);
+ aTickInfo.fScaledTickValue = nCatIndex + 1.0;
aTickInfoVector.push_back(aTickInfo);
nCatIndex ++;
if( nLevel>0 )
@@ -500,7 +538,7 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
}
//add an additional tick at the end
{
- TickInfo aTickInfo;
+ TickInfo aTickInfo(0);
aTickInfo.fScaledTickValue = m_aScale.Maximum;
aTickInfoVector.push_back(aTickInfo);
}
@@ -511,7 +549,7 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( ::std::vector< ::s
void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
{
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() )
createAllTickInfosFromComplexCategories( rAllTickInfos, false );
else
VAxisBase::createAllTickInfos(rAllTickInfos);
@@ -519,21 +557,13 @@ void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo
::std::auto_ptr< TickIter > VCartesianAxis::createLabelTickIterator( sal_Int32 nTextLevel )
{
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
- {
- if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) )
- return ::std::auto_ptr< TickIter >( new PureTickIter( m_aAllTickInfos[nTextLevel] ) );
- }
- else
- {
- if(nTextLevel==0)
- return ::std::auto_ptr< TickIter >( new EquidistantTickIter( m_aAllTickInfos, m_aIncrement, 0, 0 ) );
- }
+ if( nTextLevel>=0 && nTextLevel < static_cast< sal_Int32 >(m_aAllTickInfos.size()) )
+ return ::std::auto_ptr< TickIter >( new PureTickIter( m_aAllTickInfos[nTextLevel] ) );
return ::std::auto_ptr< TickIter >();
}
::std::auto_ptr< TickIter > VCartesianAxis::createMaximumLabelTickIterator( sal_Int32 nTextLevel )
{
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() || isDateAxis() )
{
return createLabelTickIterator( nTextLevel ); //mmmm maybe todo: create less than all texts here
}
@@ -541,8 +571,11 @@ void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo
{
if(nTextLevel==0)
{
- sal_Int32 nLongestLabelIndex = m_bUseTextLabels ? this->getIndexOfLongestLabel( m_aTextLabels ) : 0;
- return ::std::auto_ptr< TickIter >( new MaxLabelEquidistantTickIter( m_aAllTickInfos, m_aIncrement, nLongestLabelIndex ) );
+ if( !m_aAllTickInfos.empty() )
+ {
+ sal_Int32 nLongestLabelIndex = m_bUseTextLabels ? this->getIndexOfLongestLabel( m_aTextLabels ) : 0;
+ return ::std::auto_ptr< TickIter >( new MaxLabelTickIter( m_aAllTickInfos[0], nLongestLabelIndex ) );
+ }
}
}
return ::std::auto_ptr< TickIter >();
@@ -551,7 +584,7 @@ void VCartesianAxis::createAllTickInfos( ::std::vector< ::std::vector< TickInfo
sal_Int32 VCartesianAxis::getTextLevelCount() const
{
sal_Int32 nTextLevelCount = 1;
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() )
nTextLevelCount = m_aAxisProperties.m_pExplicitCategoriesProvider->getCategoryLevelCount();
return nTextLevelCount;
}
@@ -560,7 +593,7 @@ bool VCartesianAxis::createTextShapes(
const Reference< drawing::XShapes >& xTarget
, TickIter& rTickIter
, AxisLabelProperties& rAxisLabelProperties
- , TickmarkHelper_2D* pTickmarkHelper
+ , TickFactory_2D* pTickFactory
, sal_Int32 nScreenDistanceBetweenTicks )
{
//returns true if the text shapes have been created succesfully
@@ -574,10 +607,10 @@ bool VCartesianAxis::createTextShapes(
FixedNumberFormatter aFixedNumberFormatter(
m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey );
- const bool bIsHorizontalAxis = pTickmarkHelper->isHorizontalAxis();
- const bool bIsVerticalAxis = pTickmarkHelper->isVerticalAxis();
+ const bool bIsHorizontalAxis = pTickFactory->isHorizontalAxis();
+ const bool bIsVerticalAxis = pTickFactory->isVerticalAxis();
bool bIsStaggered = rAxisLabelProperties.getIsStaggered();
- B2DVector aTextToTickDistance( pTickmarkHelper->getDistanceAxisTickToText( m_aAxisProperties, true ) );
+ B2DVector aTextToTickDistance( pTickFactory->getDistanceAxisTickToText( m_aAxisProperties, true ) );
sal_Int32 nLimitedSpaceForText = -1;
if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis ) )
{
@@ -673,7 +706,7 @@ bool VCartesianAxis::createTextShapes(
}
}
- pTickInfo->updateUnscaledValue( xInverseScaling );
+ //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
bool bHasExtraColor=false;
sal_Int32 nExtraColor=0;
@@ -681,7 +714,7 @@ bool VCartesianAxis::createTextShapes(
rtl::OUString aLabel;
if(pCategories)
{
- sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->fUnscaledTickValue) - 1; //first category (index 0) matches with real number 1.0
+ sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->getUnscaledTickValue()) - 1; //first category (index 0) matches with real number 1.0
if( nIndex>=0 && nIndex<pCategories->getLength() )
aLabel = (*pCategories)[nIndex];
}
@@ -690,7 +723,7 @@ bool VCartesianAxis::createTextShapes(
aLabel = pTickInfo->aText;
}
else
- aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+ aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->getUnscaledTickValue(), nExtraColor, bHasExtraColor );
if(pColorAny)
*pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
@@ -714,10 +747,23 @@ bool VCartesianAxis::createTextShapes(
recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree );
+ //better rotate if single words are broken apart
+ if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed
+ && ::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 )
+ && m_aAxisProperties.m_bComplexCategories
+ && lcl_hasWordBreak( pTickInfo->xTextShape ) )
+ {
+ rAxisLabelProperties.fRotationAngleDegree = 90;
+ rAxisLabelProperties.bLineBreakAllowed = false;
+ m_aAxisLabelProperties.fRotationAngleDegree = rAxisLabelProperties.fRotationAngleDegree;
+ removeTextShapesFromTicks();
+ return false;
+ }
+
//if NO OVERLAP -> remove overlapping shapes
if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
{
- if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, m_aAxisLabelProperties.fRotationAngleDegree ) )
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ) )
{
bool bOverlapAlsoAfterSwitchingOnAutoStaggering = true;
if( !bIsStaggered && isAutoStaggeringOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) )
@@ -1189,12 +1235,12 @@ void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, doub
}
}
-TickmarkHelper* VCartesianAxis::createTickmarkHelper()
+TickFactory* VCartesianAxis::createTickFactory()
{
- return createTickmarkHelper2D();
+ return createTickFactory2D();
}
-TickmarkHelper_2D* VCartesianAxis::createTickmarkHelper2D()
+TickFactory_2D* VCartesianAxis::createTickFactory2D()
{
B2DVector aStart, aEnd;
this->get2DAxisMainLine( aStart, aEnd, this->getLogicValueWhereMainLineCrossesOtherAxis() );
@@ -1202,7 +1248,7 @@ TickmarkHelper_2D* VCartesianAxis::createTickmarkHelper2D()
B2DVector aLabelLineStart, aLabelLineEnd;
this->get2DAxisMainLine( aLabelLineStart, aLabelLineEnd, this->getLogicValueWhereLabelLineCrossesOtherAxis() );
- return new TickmarkHelper_2D( m_aScale, m_aIncrement, aStart, aEnd, aLabelLineStart-aStart );
+ return new TickFactory_2D( m_aScale, m_aIncrement, aStart, aEnd, aLabelLineStart-aStart );
}
void lcl_hideIdenticalScreenValues( TickIter& rTickIter )
@@ -1226,7 +1272,7 @@ void lcl_hideIdenticalScreenValues( TickIter& rTickIter )
//'hide' tickmarks with identical screen values in aAllTickInfos
void VCartesianAxis::hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const
{
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() || isDateAxis() )
{
sal_Int32 nCount = rTickInfos.size();
for( sal_Int32 nN=0; nN<nCount; nN++ )
@@ -1272,12 +1318,12 @@ sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount()
return nRet;
}
-void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties, TickmarkHelper_2D* pTickmarkHelper2D )
+void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties, TickFactory_2D* pTickFactory2D )
{
- if( !pTickmarkHelper2D )
+ if( !pTickFactory2D )
return;
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() )
{
sal_Int32 nTextLevelCount = getTextLevelCount();
B2DVector aCummulatedLabelsDistance(0,0);
@@ -1286,27 +1332,33 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
if(apTickIter.get())
{
+ double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
if( nTextLevel>0 )
+ {
lcl_shiftLables( *apTickIter.get(), aCummulatedLabelsDistance );
+ fRotationAngleDegree = 0.0;
+ }
aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
- , pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) );
+ , pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties )
+ , fRotationAngleDegree );
}
}
}
else if( rAxisLabelProperties.getIsStaggered() )
{
- EquidistantLabelIterator aInnerIter( m_aAllTickInfos, m_aIncrement
- , rAxisLabelProperties.eStaggering, true, 0, 0 );
- EquidistantLabelIterator aOuterIter( m_aAllTickInfos, m_aIncrement
- , rAxisLabelProperties.eStaggering, false, 0, 0 );
-
- lcl_shiftLables( aOuterIter
- , lcl_getLabelsDistance( aInnerIter
- , pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) ) );
+ if( !m_aAllTickInfos.empty() )
+ {
+ LabelIterator aInnerIter( m_aAllTickInfos[0], rAxisLabelProperties.eStaggering, true );
+ LabelIterator aOuterIter( m_aAllTickInfos[0], rAxisLabelProperties.eStaggering, false );
+
+ lcl_shiftLables( aOuterIter
+ , lcl_getLabelsDistance( aInnerIter
+ , pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties ), 0.0 ) );
+ }
}
}
-void SAL_CALL VCartesianAxis::createLabels()
+void VCartesianAxis::createLabels()
{
if( !prepareShapeCreation() )
return;
@@ -1315,14 +1367,14 @@ void SAL_CALL VCartesianAxis::createLabels()
//create labels
if( m_aAxisProperties.m_bDisplayLabels )
{
- std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
- TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
- if( !pTickmarkHelper2D )
+ std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
+ TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
+ if( !pTickFactory2D )
return;
//-----------------------------------------
//get the transformed screen values for all tickmarks in aAllTickInfos
- pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+ pTickFactory2D->updateScreenValues( m_aAllTickInfos );
//-----------------------------------------
//'hide' tickmarks with identical screen values in aAllTickInfos
hideIdenticalScreenValues( m_aAllTickInfos );
@@ -1339,25 +1391,38 @@ void SAL_CALL VCartesianAxis::createLabels()
{
if(nTextLevel==0)
{
- nScreenDistanceBetweenTicks = TickmarkHelper_2D::getTickScreenDistance( *apTickIter.get() );
+ nScreenDistanceBetweenTicks = TickFactory_2D::getTickScreenDistance( *apTickIter.get() );
if( nTextLevelCount>1 )
nScreenDistanceBetweenTicks*=2; //the above used tick iter does contain also the sub ticks -> thus the given distance is only the half
}
- AxisLabelProperties aCopy(m_aAxisLabelProperties);
- aCopy.bRhythmIsFix = true;
- aCopy.nRhythm = 1;
- AxisLabelProperties& rAxisLabelProperties = nTextLevel==0 ? m_aAxisLabelProperties : aCopy;
- while( !createTextShapes( m_xTextTarget, *apTickIter.get(), rAxisLabelProperties, pTickmarkHelper2D, nScreenDistanceBetweenTicks ) )
+ AxisLabelProperties aComplexProps(m_aAxisLabelProperties);
+ if( m_aAxisProperties.m_bComplexCategories )
+ {
+ if( nTextLevel==0 )
+ {
+ aComplexProps.bLineBreakAllowed = true;
+ aComplexProps.bOverlapAllowed = !::rtl::math::approxEqual( aComplexProps.fRotationAngleDegree, 0.0 );
+ }
+ else
+ {
+ aComplexProps.bOverlapAllowed = true;
+ aComplexProps.bRhythmIsFix = true;
+ aComplexProps.nRhythm = 1;
+ aComplexProps.fRotationAngleDegree = 0.0;
+ }
+ }
+ AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
+ while( !createTextShapes( m_xTextTarget, *apTickIter.get(), rAxisLabelProperties, pTickFactory2D, nScreenDistanceBetweenTicks ) )
{
};
}
}
- doStaggeringOfLabels( m_aAxisLabelProperties, pTickmarkHelper2D );
+ doStaggeringOfLabels( m_aAxisLabelProperties, pTickFactory2D );
}
}
-void SAL_CALL VCartesianAxis::createMaximumLabels()
+void VCartesianAxis::createMaximumLabels()
{
TrueGuard aRecordMaximumTextSize(m_bRecordMaximumTextSize);
@@ -1368,20 +1433,20 @@ void SAL_CALL VCartesianAxis::createMaximumLabels()
//create labels
if( m_aAxisProperties.m_bDisplayLabels )
{
- std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
- TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
- if( !pTickmarkHelper2D )
+ std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
+ TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
+ if( !pTickFactory2D )
return;
//-----------------------------------------
//get the transformed screen values for all tickmarks in aAllTickInfos
- pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+ pTickFactory2D->updateScreenValues( m_aAllTickInfos );
//create tick mark text shapes
//@todo: iterate through all tick depth wich should be labeled
AxisLabelProperties aAxisLabelProperties( m_aAxisLabelProperties );
- if( isAutoStaggeringOfLabelsAllowed( aAxisLabelProperties, pTickmarkHelper2D->isHorizontalAxis(), pTickmarkHelper2D->isVerticalAxis() ) )
+ if( isAutoStaggeringOfLabelsAllowed( aAxisLabelProperties, pTickFactory2D->isHorizontalAxis(), pTickFactory2D->isVerticalAxis() ) )
aAxisLabelProperties.eStaggering = STAGGER_EVEN;
aAxisLabelProperties.bOverlapAllowed = true;
aAxisLabelProperties.bLineBreakAllowed = false;
@@ -1391,33 +1456,33 @@ void SAL_CALL VCartesianAxis::createMaximumLabels()
::std::auto_ptr< TickIter > apTickIter = createMaximumLabelTickIterator( nTextLevel );
if(apTickIter.get())
{
- while( !createTextShapes( m_xTextTarget, *apTickIter.get(), aAxisLabelProperties, pTickmarkHelper2D, -1 ) )
+ while( !createTextShapes( m_xTextTarget, *apTickIter.get(), aAxisLabelProperties, pTickFactory2D, -1 ) )
{
};
}
}
- doStaggeringOfLabels( aAxisLabelProperties, pTickmarkHelper2D );
+ doStaggeringOfLabels( aAxisLabelProperties, pTickFactory2D );
}
}
-void SAL_CALL VCartesianAxis::updatePositions()
+void VCartesianAxis::updatePositions()
{
//-----------------------------------------
//update positions of labels
if( m_aAxisProperties.m_bDisplayLabels )
{
- std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
- TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
- if( !pTickmarkHelper2D )
+ std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
+ TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
+ if( !pTickFactory2D )
return;
//-----------------------------------------
//update positions of all existing text shapes
- pTickmarkHelper2D->updateScreenValues( m_aAllTickInfos );
+ pTickFactory2D->updateScreenValues( m_aAllTickInfos );
::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = m_aAllTickInfos.begin();
const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = m_aAllTickInfos.end();
- for( ; aDepthIter != aDepthEnd; aDepthIter++ )
+ for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd; aDepthIter++, nDepth++ )
{
::std::vector< TickInfo >::iterator aTickIter = aDepthIter->begin();
const ::std::vector< TickInfo >::const_iterator aTickEnd = aDepthIter->end();
@@ -1427,15 +1492,19 @@ void SAL_CALL VCartesianAxis::updatePositions()
Reference< drawing::XShape > xShape2DText( rTickInfo.xTextShape );
if( xShape2DText.is() )
{
- B2DVector aTextToTickDistance( pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
+ B2DVector aTextToTickDistance( pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
B2DVector aTickScreenPos2D( rTickInfo.aTickScreenPosition );
aTickScreenPos2D += aTextToTickDistance;
awt::Point aAnchorScreenPosition2D(
static_cast<sal_Int32>(aTickScreenPos2D.getX())
,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
+ double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+ if( nDepth>0 )
+ fRotationAngleDegree = 0.0;
+
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(m_aAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+ const double fRotationAnglePi(fRotationAngleDegree * (F_PI / -180.0));
uno::Any aATransformation = ShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi);
//set new position
@@ -1454,16 +1523,16 @@ void SAL_CALL VCartesianAxis::updatePositions()
//correctPositionForRotation
LabelPositionHelper::correctPositionForRotation( xShape2DText
- , m_aAxisProperties.m_aLabelAlignment, m_aAxisLabelProperties.fRotationAngleDegree, false );
+ , m_aAxisProperties.m_aLabelAlignment, fRotationAngleDegree, m_aAxisProperties.m_bComplexCategories );
}
}
}
- doStaggeringOfLabels( m_aAxisLabelProperties, pTickmarkHelper2D );
+ doStaggeringOfLabels( m_aAxisLabelProperties, pTickFactory2D );
}
}
-void VCartesianAxis::createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickmarkHelper_2D& rTickmarkHelper2D, bool bOnlyAtLabels )
+void VCartesianAxis::createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory_2D& rTickFactory2D, bool bOnlyAtLabels )
{
sal_Int32 nPointCount = rTickInfos.size();
drawing::PointSequenceSequence aPoints(2*nPointCount);
@@ -1482,11 +1551,11 @@ void VCartesianAxis::createTickMarkLineShapes( ::std::vector< TickInfo >& rTickI
fInnerDirectionSign *= -1.0;
bTicksAtLabels = bTicksAtLabels || bOnlyAtLabels;
//add ticks at labels:
- rTickmarkHelper2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
, fInnerDirectionSign , rTickmarkProperties, bTicksAtLabels );
//add ticks at axis (without lables):
if( !bOnlyAtLabels && m_aAxisProperties.m_eTickmarkPos == ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
- rTickmarkHelper2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
, m_aAxisProperties.m_fInnerDirectionSign, rTickmarkProperties, !bTicksAtLabels );
}
aPoints.realloc(nN);
@@ -1494,14 +1563,14 @@ void VCartesianAxis::createTickMarkLineShapes( ::std::vector< TickInfo >& rTickI
, &rTickmarkProperties.aLineProperties );
}
-void SAL_CALL VCartesianAxis::createShapes()
+void VCartesianAxis::createShapes()
{
if( !prepareShapeCreation() )
return;
- std::auto_ptr< TickmarkHelper_2D > apTickmarkHelper2D( this->createTickmarkHelper2D() );
- TickmarkHelper_2D* pTickmarkHelper2D = apTickmarkHelper2D.get();
- if( !pTickmarkHelper2D )
+ std::auto_ptr< TickFactory_2D > apTickFactory2D( this->createTickFactory2D() );
+ TickFactory_2D* pTickFactory2D = apTickFactory2D.get();
+ if( !pTickFactory2D )
return;
//-----------------------------------------
@@ -1510,23 +1579,26 @@ void SAL_CALL VCartesianAxis::createShapes()
{
//-----------------------------------------
//create extra long ticks to separate complex categories (create them only there where the labels are)
- if( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels )
+ if( isComplexCategoryAxis() )
{
::std::vector< ::std::vector< TickInfo > > aComplexTickInfos;
createAllTickInfosFromComplexCategories( aComplexTickInfos, true );
- pTickmarkHelper2D->updateScreenValues( aComplexTickInfos );
+ pTickFactory2D->updateScreenValues( aComplexTickInfos );
hideIdenticalScreenValues( aComplexTickInfos );
::std::vector<TickmarkProperties> aTickmarkPropertiesList;
static bool bIncludeSpaceBetweenTickAndText = false;
- sal_Int32 nOffset = static_cast<sal_Int32>(pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, false, bIncludeSpaceBetweenTickAndText ).getLength());
+ sal_Int32 nOffset = static_cast<sal_Int32>(pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, false, bIncludeSpaceBetweenTickAndText ).getLength());
sal_Int32 nTextLevelCount = getTextLevelCount();
for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
{
::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
if( apTickIter.get() )
{
- B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties, false ) ) );
+ double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+ if( nTextLevel>0 )
+ fRotationAngleDegree = 0.0;
+ B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, false ), fRotationAngleDegree ) );
sal_Int32 nCurrentLength = static_cast<sal_Int32>(aLabelsDistance.getLength());
aTickmarkPropertiesList.push_back( m_aAxisProperties.makeTickmarkPropertiesForComplexCategories( nOffset + nCurrentLength, 0, nTextLevel ) );
nOffset += nCurrentLength;
@@ -1540,20 +1612,20 @@ void SAL_CALL VCartesianAxis::createShapes()
{
if(nDepth==0 && !m_aAxisProperties.m_nMajorTickmarks)
continue;
- createTickMarkLineShapes( *aDepthIter, aTickmarkPropertiesList[nDepth], *pTickmarkHelper2D, true /*bOnlyAtLabels*/ );
+ createTickMarkLineShapes( *aDepthIter, aTickmarkPropertiesList[nDepth], *pTickFactory2D, true /*bOnlyAtLabels*/ );
}
}
//-----------------------------------------
//create normal ticks for major and minor intervals
{
- ::std::vector< ::std::vector< TickInfo > > aAllShiftedTickInfos;
- if( m_aIncrement.ShiftedPosition || ( m_aAxisProperties.m_bComplexCategories && m_bUseTextLabels ) )
+ ::std::vector< ::std::vector< TickInfo > > aUnshiftedTickInfos;
+ if( m_aScale.ShiftedCategoryPosition )// if ShiftedCategoryPosition==true the tickmarks in m_aAllTickInfos are shifted
{
- pTickmarkHelper2D->getAllTicksShifted( aAllShiftedTickInfos );
- pTickmarkHelper2D->updateScreenValues( aAllShiftedTickInfos );
- hideIdenticalScreenValues( aAllShiftedTickInfos );
+ pTickFactory2D->getAllTicks( aUnshiftedTickInfos );
+ pTickFactory2D->updateScreenValues( aUnshiftedTickInfos );
+ hideIdenticalScreenValues( aUnshiftedTickInfos );
}
- ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos = m_aIncrement.ShiftedPosition ? aAllShiftedTickInfos : m_aAllTickInfos;
+ ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos = m_aScale.ShiftedCategoryPosition ? aUnshiftedTickInfos : m_aAllTickInfos;
::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAllTickInfos.begin();
const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAllTickInfos.end();
@@ -1562,14 +1634,14 @@ void SAL_CALL VCartesianAxis::createShapes()
sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount; aDepthIter++, nDepth++ )
- createTickMarkLineShapes( *aDepthIter, m_aAxisProperties.m_aTickmarkPropertiesList[nDepth], *pTickmarkHelper2D, false /*bOnlyAtLabels*/ );
+ createTickMarkLineShapes( *aDepthIter, m_aAxisProperties.m_aTickmarkPropertiesList[nDepth], *pTickFactory2D, false /*bOnlyAtLabels*/ );
}
//-----------------------------------------
//create axis main lines
//it serves also as the handle shape for the axis selection
{
drawing::PointSequenceSequence aPoints(1);
- apTickmarkHelper2D->createPointSequenceForAxisMainLine( aPoints );
+ apTickFactory2D->createPointSequenceForAxisMainLine( aPoints );
Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
m_xGroupShape_Shapes, aPoints
, &m_aAxisProperties.m_aLineProperties );
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx
index 4fbcd2409196..d199a112bab1 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -55,20 +55,11 @@ public:
virtual ~VCartesianAxis();
- //-------------------------------------------------------------------------
- // partly chart2::XPlotter
- //-------------------------------------------------------------------------
-
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
-
- virtual void SAL_CALL createMaximumLabels();
- virtual void SAL_CALL createLabels();
- virtual void SAL_CALL updatePositions();
+ virtual void createMaximumLabels();
+ virtual void createLabels();
+ virtual void updatePositions();
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
@@ -79,7 +70,7 @@ public:
sal_Int32 getTextLevelCount() const;
//-------------------------------------------------------------------------
- virtual TickmarkHelper* createTickmarkHelper();
+ virtual TickFactory* createTickFactory();
//-------------------------------------------------------------------------
double getLogicValueWhereMainLineCrossesOtherAxis() const;
@@ -122,16 +113,16 @@ protected: //methods
::com::sun::star::drawing::XShapes >& xTarget
, TickIter& rTickIter
, AxisLabelProperties& rAxisLabelProperties
- , TickmarkHelper_2D* pTickmarkHelper
+ , TickFactory_2D* pTickFactory
, sal_Int32 nScreenDistanceBetweenTicks );
- void createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickmarkHelper_2D& rTickmarkHelper2D, bool bOnlyAtLabels );
+ void createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory_2D& rTickFactory2D, bool bOnlyAtLabels );
- TickmarkHelper_2D* createTickmarkHelper2D();
+ TickFactory_2D* createTickFactory2D();
void hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const;
void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
- , TickmarkHelper_2D* pTickmarkHelper2D );
+ , TickFactory_2D* pTickFactory2D );
bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
, bool bIsHorizontalAxis, bool bIsVerticalAxis );
bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis );
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
index a196397e0e9f..ca83850a88ff 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -151,11 +151,7 @@ void VCartesianCoordinateSystem::createVAxisList(
aAxisProperties.m_bCrossingAxisHasReverseDirection = (AxisOrientation_REVERSE==aCrossingScale.Orientation);
if( aCrossingScale.AxisType == AxisType::CATEGORY )
- {
aAxisProperties.m_bCrossingAxisIsCategoryAxes = true;
- aAxisProperties.m_bAxisBetweenCategories = ChartTypeHelper::shiftTicksAtXAxisPerDefault( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ) )
- || ( aAxisProperties.m_pExplicitCategoriesProvider && aAxisProperties.m_pExplicitCategoriesProvider->hasComplexCategories() );
- }
}
if( nDimensionIndex == 2 )
@@ -169,25 +165,12 @@ void VCartesianCoordinateSystem::createVAxisList(
aAxisProperties.init(true);
if(aAxisProperties.m_bDisplayLabels)
aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier );
-
- if( nDimensionIndex == 0 && aAxisProperties.m_nAxisType == AxisType::CATEGORY
- && aAxisProperties.m_pExplicitCategoriesProvider )
- {
- if( aAxisProperties.m_pExplicitCategoriesProvider->hasComplexCategories() )
- aAxisProperties.m_bComplexCategories = true;
- }
//-------------------
::boost::shared_ptr< VAxisBase > apVAxis( new VCartesianAxis(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) );
tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
m_aAxisMap[aFullAxisIndex] = apVAxis;
apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
- //apVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
- //apVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
- // , this->createCIDForAxis( xAxis, nDimensionIndex, nAxisIndex ) );
- //if(2==nDimensionCount)
- // apVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
- //apVAxis->setScales( this->getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
}
}
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx
index 18b8942b6787..ff93feefa228 100644
--- a/chart2/source/view/axes/VCartesianGrid.cxx
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "VCartesianGrid.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include "PlottingPositionHelper.hxx"
#include "ShapeFactory.hxx"
#include "ObjectIdentifier.hxx"
@@ -210,7 +210,7 @@ void VCartesianGrid::fillLinePropertiesFromGridModel( ::std::vector<VLinePropert
}
};
-void SAL_CALL VCartesianGrid::createShapes()
+void VCartesianGrid::createShapes()
{
if(!m_aGridPropertiesList.getLength())
return;
@@ -230,13 +230,10 @@ void SAL_CALL VCartesianGrid::createShapes()
//-----------------------------------------
//create all scaled tickmark values
- std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
- TickmarkHelper& aTickmarkHelper = *apTickmarkHelper.get();
+ std::auto_ptr< TickFactory > apTickFactory( this->createTickFactory() );
+ TickFactory& aTickFactory = *apTickFactory.get();
::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
- if( m_aIncrement.ShiftedPosition )
- aTickmarkHelper.getAllTicksShifted( aAllTickInfos );
- else
- aTickmarkHelper.getAllTicks( aAllTickInfos );
+ aTickFactory.getAllTicks( aAllTickInfos );
//-----------------------------------------
//create tick mark line shapes
diff --git a/chart2/source/view/axes/VCartesianGrid.hxx b/chart2/source/view/axes/VCartesianGrid.hxx
index 274b543900e3..0a0f8b91716f 100644
--- a/chart2/source/view/axes/VCartesianGrid.hxx
+++ b/chart2/source/view/axes/VCartesianGrid.hxx
@@ -52,7 +52,7 @@ public:
);
virtual ~VCartesianGrid();
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
static void fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList
, const ::com::sun::star::uno::Sequence<
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index b61a58cd2238..42e6042d7e70 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -97,8 +97,8 @@ VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCoo
{
if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 )
{
- m_aExplicitScales[2].Minimum = -0.5;
- m_aExplicitScales[2].Maximum = 0.5;
+ m_aExplicitScales[2].Minimum = 1.0;
+ m_aExplicitScales[2].Maximum = 2.0;
m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL;
}
}
@@ -106,7 +106,7 @@ VCoordinateSystem::~VCoordinateSystem()
{
}
-void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
+void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
, const Reference< drawing::XShapes >& xFinalTarget
, const Reference< lang::XMultiServiceFactory >& xShapeFactory
, Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
@@ -270,9 +270,9 @@ ExplicitCategoriesProvider* VCoordinateSystem::getExplicitCategoriesProvider()
return m_apExplicitCategoriesProvider.get();
}
-Sequence< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+std::vector< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
{
- Sequence< ExplicitScaleData > aRet(m_aExplicitScales);
+ std::vector< ExplicitScaleData > aRet(m_aExplicitScales);
impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
aRet[nDimensionIndex]=this->getExplicitScale( nDimensionIndex, nAxisIndex );
@@ -280,9 +280,9 @@ Sequence< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nD
return aRet;
}
-Sequence< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
+std::vector< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
{
- Sequence< ExplicitIncrementData > aRet(m_aExplicitIncrements);
+ std::vector< ExplicitIncrementData > aRet(m_aExplicitIncrements);
impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
aRet[nDimensionIndex]=this->getExplicitIncrement( nDimensionIndex, nAxisIndex );
@@ -381,6 +381,17 @@ void VCoordinateSystem::updateScalesAndIncrementsOnAxes()
void VCoordinateSystem::prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
{
+ if( rScaleAutomatism.getScale().AxisType==AxisType::DATE && nDimIndex==0 )
+ {
+ sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::MONTH;
+ if( !(rScaleAutomatism.getScale().TimeIncrement.TimeResolution >>= nTimeResolution) )
+ {
+ nTimeResolution = m_aMergedMinimumAndMaximumSupplier.calculateTimeResolutionOnXAxis();
+ rScaleAutomatism.setAutomaticTimeResolution( nTimeResolution );
+ }
+ m_aMergedMinimumAndMaximumSupplier.setTimeResolutionOnXAxis( nTimeResolution, rScaleAutomatism.getNullDate() );
+ }
+
double fMin = 0.0;
double fMax = 0.0;
::rtl::math::setInf(&fMin, false);
@@ -402,11 +413,6 @@ void VCoordinateSystem::prepareScaleAutomatismForDimensionAndIndex( ScaleAutomat
fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumZ();
}
- this->prepareScaleAutomatism( rScaleAutomatism, fMin, fMax, nDimIndex, nAxisIndex );
-}
-
-void VCoordinateSystem::prepareScaleAutomatism( ScaleAutomatism& rScaleAutomatism, double fMin, double fMax, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
-{
//merge our values with those already contained in rScaleAutomatism
rScaleAutomatism.expandValueRange( fMin, fMax );
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx
index 865a7848aa9a..c23d6b95629d 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -33,7 +33,7 @@
#include "VPolarGrid.hxx"
#include "ShapeFactory.hxx"
#include "macros.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "PolarLabelPositionHelper.hxx"
#include <tools/color.hxx>
@@ -120,17 +120,17 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis(
rtl::OUString aLabel;
if(pLabels)
{
- sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->fUnscaledTickValue) - 1; //first category (index 0) matches with real number 1.0
+ sal_Int32 nIndex = static_cast< sal_Int32 >(pTickInfo->getUnscaledTickValue()) - 1; //first category (index 0) matches with real number 1.0
if( nIndex>=0 && nIndex<pLabels->getLength() )
aLabel = (*pLabels)[nIndex];
}
else
- aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+ aLabel = aFixedNumberFormatter.getFormattedString( pTickInfo->getUnscaledTickValue(), nExtraColor, bHasExtraColor );
if(pColorAny)
*pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
- double fLogicAngle = pTickInfo->fUnscaledTickValue;
+ double fLogicAngle = pTickInfo->getUnscaledTickValue();
LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
PolarLabelPositionHelper aPolarLabelPositionHelper(m_pPosHelper,nDimensionCount,xTarget,&aShapeFactory);
@@ -154,7 +154,7 @@ bool VPolarAngleAxis::createTextShapes_ForAngleAxis(
return true;
}
-void SAL_CALL VPolarAngleAxis::createMaximumLabels()
+void VPolarAngleAxis::createMaximumLabels()
{
if( !prepareShapeCreation() )
return;
@@ -162,7 +162,7 @@ void SAL_CALL VPolarAngleAxis::createMaximumLabels()
createLabels();
}
-void SAL_CALL VPolarAngleAxis::updatePositions()
+void VPolarAngleAxis::updatePositions()
{
//todo: really only update the positions
@@ -172,19 +172,19 @@ void SAL_CALL VPolarAngleAxis::updatePositions()
createLabels();
}
-void SAL_CALL VPolarAngleAxis::createLabels()
+void VPolarAngleAxis::createLabels()
{
if( !prepareShapeCreation() )
return;
double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
- double fLogicZ = -0.5;//as defined
+ double fLogicZ = 1.0;//as defined
if( m_aAxisProperties.m_bDisplayLabels )
{
//-----------------------------------------
//get the transformed screen values for all tickmarks in aAllTickInfos
- std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ std::auto_ptr< TickFactory > apTickFactory( this->createTickFactory() );
//create tick mark text shapes
//@todo: iterate through all tick depth wich should be labeled
@@ -207,13 +207,13 @@ void SAL_CALL VPolarAngleAxis::createLabels()
}
}
-void SAL_CALL VPolarAngleAxis::createShapes()
+void VPolarAngleAxis::createShapes()
{
if( !prepareShapeCreation() )
return;
double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
- double fLogicZ = -0.5;//as defined
+ double fLogicZ = 1.0;//as defined
//-----------------------------------------
//create axis main lines
diff --git a/chart2/source/view/axes/VPolarAngleAxis.hxx b/chart2/source/view/axes/VPolarAngleAxis.hxx
index c03cf533e22c..011033faaefa 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.hxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.hxx
@@ -28,6 +28,7 @@
#define _CHART2_VPOLARANGLEAXIS_HXX
#include "VPolarAxis.hxx"
+#include "Tickmarks_Equidistant.hxx"
//.............................................................................
namespace chart
@@ -46,11 +47,11 @@ public:
, sal_Int32 nDimensionCount );
virtual ~VPolarAngleAxis();
- virtual void SAL_CALL createMaximumLabels();
- virtual void SAL_CALL createLabels();
- virtual void SAL_CALL updatePositions();
+ virtual void createMaximumLabels();
+ virtual void createLabels();
+ virtual void updatePositions();
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
private: //methods
bool createTextShapes_ForAngleAxis(
diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx
index 23908585ec3a..5f818da6c959 100644
--- a/chart2/source/view/axes/VPolarAxis.cxx
+++ b/chart2/source/view/axes/VPolarAxis.cxx
@@ -31,7 +31,7 @@
#include "VPolarAngleAxis.hxx"
#include "VPolarRadiusAxis.hxx"
#include "macros.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include "ShapeFactory.hxx"
#include <memory>
@@ -68,12 +68,12 @@ VPolarAxis::~VPolarAxis()
m_pPosHelper = NULL;
}
-void VPolarAxis::setIncrements( const uno::Sequence< ExplicitIncrementData >& rIncrements )
+void VPolarAxis::setIncrements( const std::vector< ExplicitIncrementData >& rIncrements )
{
m_aIncrements = rIncrements;
}
-sal_Bool SAL_CALL VPolarAxis::isAnythingToDraw()
+sal_Bool VPolarAxis::isAnythingToDraw()
{
return ( 2==m_nDimension && VAxisBase::isAnythingToDraw() );
}
diff --git a/chart2/source/view/axes/VPolarAxis.hxx b/chart2/source/view/axes/VPolarAxis.hxx
index 8d4c14188258..a72b338416e2 100644
--- a/chart2/source/view/axes/VPolarAxis.hxx
+++ b/chart2/source/view/axes/VPolarAxis.hxx
@@ -47,10 +47,9 @@ public:
, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
- void setIncrements( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitIncrementData >& rIncrements );
+ void setIncrements( const std::vector< ExplicitIncrementData >& rIncrements );
- virtual sal_Bool SAL_CALL isAnythingToDraw();
+ virtual sal_Bool isAnythingToDraw();
virtual ~VPolarAxis();
@@ -61,8 +60,7 @@ protected:
protected: //member
PolarPlottingPositionHelper* m_pPosHelper;
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitIncrementData > m_aIncrements;
+ ::std::vector< ExplicitIncrementData > m_aIncrements;
};
//.............................................................................
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
index 76e057a2b32d..5d13f5c46f66 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -107,15 +107,6 @@ void VPolarCoordinateSystem::createVAxisList(
tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
m_aAxisMap[aFullAxisIndex] = apVAxis;
- //apVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
- //apVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
- // , this->createCIDForAxis( xAxis, nDimensionIndex, nAxisIndex ) );
- //VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( apVAxis.get() );
- //if( pVPolarAxis )
- // pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
- //if(2==nDimensionCount)
- // apVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
- //apVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
}
}
diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx
index b2172244f920..30becdf4725d 100644
--- a/chart2/source/view/axes/VPolarGrid.cxx
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -29,12 +29,13 @@
#include "precompiled_chart2.hxx"
#include "VPolarGrid.hxx"
#include "VCartesianGrid.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include "PlottingPositionHelper.hxx"
#include "ShapeFactory.hxx"
#include "ObjectIdentifier.hxx"
#include "macros.hxx"
#include "CommonConverters.hxx"
+#include "Tickmarks_Equidistant.hxx"
#include <com/sun/star/drawing/LineStyle.hpp>
#include <vector>
@@ -64,16 +65,16 @@ VPolarGrid::~VPolarGrid()
m_pPosHelper = NULL;
}
-void VPolarGrid::setIncrements( const uno::Sequence< ExplicitIncrementData >& rIncrements )
+void VPolarGrid::setIncrements( const std::vector< ExplicitIncrementData >& rIncrements )
{
m_aIncrements = rIncrements;
}
void VPolarGrid::getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
{
- TickmarkHelper aTickmarkHelper(
+ TickFactory aTickFactory(
m_pPosHelper->getScales()[nDimensionIndex], m_aIncrements[nDimensionIndex] );
- aTickmarkHelper.getAllTicks( rAllTickInfos );
+ aTickFactory.getAllTicks( rAllTickInfos );
}
void VPolarGrid::createLinePointSequence_ForAngleAxis(
@@ -97,8 +98,8 @@ void VPolarGrid::createLinePointSequence_ForAngleAxis(
if(nTick>=rPoints[0].getLength())
rPoints[0].realloc(rPoints[0].getLength()+30);
- pTickInfo->updateUnscaledValue( xInverseScaling );
- double fLogicAngle = pTickInfo->fUnscaledTickValue;
+ //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = pTickInfo->getUnscaledTickValue();
drawing::Position3D aScenePosition3D( pPosHelper->transformAngleRadiusToScene( fLogicAngle, fLogicRadius, fLogicZ ) );
rPoints[0][nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX);
@@ -129,7 +130,7 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT
double fLogicInnerRadius = m_pPosHelper->getInnerLogicRadius();
double fLogicOuterRadius = m_pPosHelper->getOuterLogicRadius();
- double fLogicZ = -0.5;//as defined
+ double fLogicZ = 1.0;//as defined
sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAngleTickInfos.begin();
@@ -152,8 +153,8 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT
if( !rTickInfo.bPaintIt )
continue;
- rTickInfo.updateUnscaledValue( xInverseScaling );
- double fLogicAngle = rTickInfo.fUnscaledTickValue;
+ //xxxxx rTickInfo.updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = rTickInfo.getUnscaledTickValue();
drawing::PointSequenceSequence aPoints(1);
aPoints[0].realloc(2);
@@ -219,9 +220,9 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
if( !rTickInfo.bPaintIt )
continue;
- rTickInfo.updateUnscaledValue( xInverseRadiusScaling );
- double fLogicRadius = rTickInfo.fUnscaledTickValue;
- double fLogicZ = -0.5;//as defined
+ //xxxxx rTickInfo.updateUnscaledValue( xInverseRadiusScaling );
+ double fLogicRadius = rTickInfo.getUnscaledTickValue();
+ double fLogicZ = 1.0;//as defined
drawing::PointSequenceSequence aPoints(1);
VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAngleTickInfos
@@ -237,7 +238,7 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
}
}
-void SAL_CALL VPolarGrid::createShapes()
+void VPolarGrid::createShapes()
{
DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
diff --git a/chart2/source/view/axes/VPolarGrid.hxx b/chart2/source/view/axes/VPolarGrid.hxx
index 3289d6c88be8..1ea3bccc1f90 100644
--- a/chart2/source/view/axes/VPolarGrid.hxx
+++ b/chart2/source/view/axes/VPolarGrid.hxx
@@ -28,7 +28,7 @@
#define _CHART2_VPOLARGRID_HXX
#include "VAxisOrGridBase.hxx"
-#include "TickmarkHelper.hxx"
+#include "Tickmarks.hxx"
#include "VLineProperties.hxx"
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
@@ -55,16 +55,15 @@ public:
);
virtual ~VPolarGrid();
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
- void setIncrements( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitIncrementData >& rIncrements );
+ void setIncrements( const std::vector< ExplicitIncrementData >& rIncrements );
static void createLinePointSequence_ForAngleAxis(
::com::sun::star::drawing::PointSequenceSequence& rPoints
, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement
- , const ::com::sun::star::chart2::ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement
+ , const ExplicitScaleData& rScale
, PolarPlottingPositionHelper* pPosHelper
, double fLogicRadius, double fLogicZ );
@@ -73,8 +72,7 @@ private: //member
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > > m_aGridPropertiesList;//main grid, subgrid, subsubgrid etc
PolarPlottingPositionHelper* m_pPosHelper;
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitIncrementData > m_aIncrements;
+ ::std::vector< ExplicitIncrementData > m_aIncrements;
void getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx
index 2206d4d8f559..bc56b3824e6e 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.cxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx
@@ -32,6 +32,7 @@
#include "VCartesianAxis.hxx"
#include "PlottingPositionHelper.hxx"
#include "CommonConverters.hxx"
+#include "Tickmarks_Equidistant.hxx"
#include <rtl/math.hxx>
//.............................................................................
@@ -70,7 +71,7 @@ void VPolarRadiusAxis::setTransformationSceneToScreen( const drawing::HomogenMat
m_apAxisWithLabels->setTransformationSceneToScreen( rMatrix );
}
-void SAL_CALL VPolarRadiusAxis::setExplicitScaleAndIncrement(
+void VPolarRadiusAxis::setExplicitScaleAndIncrement(
const ExplicitScaleData& rScale
, const ExplicitIncrementData& rIncrement )
throw (uno::RuntimeException)
@@ -79,7 +80,7 @@ void SAL_CALL VPolarRadiusAxis::setExplicitScaleAndIncrement(
m_apAxisWithLabels->setExplicitScaleAndIncrement( rScale, rIncrement );
}
-void SAL_CALL VPolarRadiusAxis::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
+void VPolarRadiusAxis::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
, const uno::Reference< drawing::XShapes >& xFinalTarget
, const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
, const rtl::OUString& rCID )
@@ -89,15 +90,13 @@ void SAL_CALL VPolarRadiusAxis::initPlotter( const uno::Reference< drawing::XSh
m_apAxisWithLabels->initPlotter( xLogicTarget, xFinalTarget, xShapeFactory, rCID );
}
-void SAL_CALL VPolarRadiusAxis::setScales( const uno::Sequence< ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis )
- throw (uno::RuntimeException)
+void VPolarRadiusAxis::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
{
VPolarAxis::setScales( rScales, bSwapXAndYAxis );
m_apAxisWithLabels->setScales( rScales, bSwapXAndYAxis );
}
-void SAL_CALL VPolarRadiusAxis::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
+void VPolarRadiusAxis::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
, const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels )
{
VPolarAxis::initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
@@ -121,22 +120,22 @@ bool VPolarRadiusAxis::prepareShapeCreation()
return true;
}
-void SAL_CALL VPolarRadiusAxis::createMaximumLabels()
+void VPolarRadiusAxis::createMaximumLabels()
{
m_apAxisWithLabels->createMaximumLabels();
}
-void SAL_CALL VPolarRadiusAxis::updatePositions()
+void VPolarRadiusAxis::updatePositions()
{
m_apAxisWithLabels->updatePositions();
}
-void SAL_CALL VPolarRadiusAxis::createLabels()
+void VPolarRadiusAxis::createLabels()
{
m_apAxisWithLabels->createLabels();
}
-void SAL_CALL VPolarRadiusAxis::createShapes()
+void VPolarRadiusAxis::createShapes()
{
if( !prepareShapeCreation() )
return;
@@ -145,8 +144,8 @@ void SAL_CALL VPolarRadiusAxis::createShapes()
const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
::std::vector< ::std::vector< TickInfo > > aAngleTickInfos;
- TickmarkHelper aAngleTickmarkHelper( rAngleScale, rAngleIncrement );
- aAngleTickmarkHelper.getAllTicks( aAngleTickInfos );
+ TickFactory aAngleTickFactory( rAngleScale, rAngleIncrement );
+ aAngleTickFactory.getAllTicks( aAngleTickInfos );
uno::Reference< XScaling > xInverseScaling( NULL );
if( rAngleScale.Scaling.is() )
@@ -165,8 +164,8 @@ void SAL_CALL VPolarRadiusAxis::createShapes()
continue;
}
- pTickInfo->updateUnscaledValue( xInverseScaling );
- aAxisProperties.m_pfMainLinePositionAtOtherAxis = new double( pTickInfo->fUnscaledTickValue );
+ //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
+ aAxisProperties.m_pfMainLinePositionAtOtherAxis = new double( pTickInfo->getUnscaledTickValue() );
aAxisProperties.m_bDisplayLabels=false;
//-------------------
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.hxx b/chart2/source/view/axes/VPolarRadiusAxis.hxx
index b5c5191e4c98..e1dbb8c1b1c0 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.hxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.hxx
@@ -50,7 +50,7 @@ public:
, sal_Int32 nDimensionCount );
virtual ~VPolarRadiusAxis();
- virtual void SAL_CALL initPlotter(
+ virtual void initPlotter(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xLogicTarget
, const ::com::sun::star::uno::Reference<
@@ -62,28 +62,24 @@ public:
virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
- virtual void SAL_CALL setScales(
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis )
- throw (::com::sun::star::uno::RuntimeException);
+ virtual void setScales( const ::std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
- virtual void SAL_CALL setExplicitScaleAndIncrement(
- const ::com::sun::star::chart2::ExplicitScaleData& rScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement )
+ virtual void setExplicitScaleAndIncrement(
+ const ExplicitScaleData& rScale
+ , const ExplicitIncrementData& rIncrement )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL initAxisLabelProperties(
+ virtual void initAxisLabelProperties(
const ::com::sun::star::awt::Size& rFontReferenceSize
, const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
- virtual void SAL_CALL createMaximumLabels();
- virtual void SAL_CALL createLabels();
- virtual void SAL_CALL updatePositions();
+ virtual void createMaximumLabels();
+ virtual void createLabels();
+ virtual void updatePositions();
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
protected: //methods
virtual bool prepareShapeCreation();
diff --git a/chart2/source/view/axes/makefile.mk b/chart2/source/view/axes/makefile.mk
index 96191a3a3a25..af88a61b6b37 100644
--- a/chart2/source/view/axes/makefile.mk
+++ b/chart2/source/view/axes/makefile.mk
@@ -47,7 +47,11 @@ ENABLE_EXCEPTIONS= TRUE
SLOFILES = \
$(SLO)$/VAxisOrGridBase.obj \
$(SLO)$/VAxisBase.obj \
- $(SLO)$/TickmarkHelper.obj \
+ $(SLO)$/DateHelper.obj \
+ $(SLO)$/DateScaling.obj \
+ $(SLO)$/Tickmarks.obj \
+ $(SLO)$/Tickmarks_Equidistant.obj \
+ $(SLO)$/Tickmarks_Dates.obj \
$(SLO)$/MinimumAndMaximumSupplier.obj \
$(SLO)$/ScaleAutomatism.obj \
$(SLO)$/VAxisProperties.obj \
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index fd1aaa81c3a0..06e09d60fcf1 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -43,6 +43,7 @@
#include "Clipping.hxx"
#include "Stripe.hxx"
#include "PolarLabelPositionHelper.hxx"
+#include "DateHelper.hxx"
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -96,6 +97,11 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
{
if( !m_pMainPosHelper )
m_pMainPosHelper = new PlottingPositionHelper();
+ if( m_pMainPosHelper )
+ {
+ m_pMainPosHelper->AllowShiftXAxisPos(true);
+ m_pMainPosHelper->AllowShiftZAxisPos(true);
+ }
PlotterBase::m_pPosHelper = m_pMainPosHelper;
VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
@@ -121,18 +127,12 @@ AreaChart::~AreaChart()
delete m_pMainPosHelper;
}
-double AreaChart::getMinimumX()
-{
- if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling
- return 1.0;//first category (index 0) matches with real number 1.0
- return VSeriesPlotter::getMinimumX();
-}
-
double AreaChart::getMaximumX()
{
+ double fMax = VSeriesPlotter::getMaximumX();
if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling
- return getPointCount()+1;
- return VSeriesPlotter::getMaximumX();
+ fMax += 1.0;
+ return fMax;
}
bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
@@ -183,18 +183,6 @@ APPHELPER_XSERVICEINFO_IMPL(AreaChart,CHART2_VIEW_AREACHART_SERVICE_IMPLEMENTATI
return aSNS;
}
*/
-/*
-//-----------------------------------------------------------------
-// chart2::XPlotter
-//-----------------------------------------------------------------
-
- ::rtl::OUString SAL_CALL AreaChart
-::getCoordinateSystemTypeID()
- throw (uno::RuntimeException)
-{
- return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
-}
-*/
drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
{
if( m_nKeepAspectRatio == 1 )
@@ -628,7 +616,7 @@ void AreaChart::createShapes()
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
//update/create information for current group
- double fLogicZ = 0.5;//as defined
+ double fLogicZ = 1.0;//as defined
sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
@@ -729,6 +717,8 @@ void AreaChart::createShapes()
//collect data point information (logic coordinates, style ):
double fLogicX = (*aSeriesIter)->getXValue(nIndex);
+ if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() )
+ fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
double fLogicY = (*aSeriesIter)->getYValue(nIndex);
if( m_bIsPolarCooSys && m_bArea &&
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index 6924509a62a1..4b6ff3f45251 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -55,17 +55,7 @@ public:
);
virtual ~AreaChart();
- //-------------------------------------------------------------------------
- // chart2::XPlotter
- //-------------------------------------------------------------------------
-
- virtual void SAL_CALL createShapes();
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
-
+ virtual void createShapes();
virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
//-------------------
@@ -75,7 +65,6 @@ public:
//-------------------------------------------------------------------------
// MinimumAndMaximumSupplier
//-------------------------------------------------------------------------
- virtual double getMinimumX();
virtual double getMaximumX();
virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index 0d7ef403f87d..dbf01165bf79 100755..100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -40,6 +40,7 @@
#include "macros.hxx"
#include "AxisIndexDefines.hxx"
#include "Clipping.hxx"
+#include "DateHelper.hxx"
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -91,7 +92,6 @@ BarChart::~BarChart()
PlottingPositionHelper& BarChart::getPlottingPositionHelper( sal_Int32 nAxisIndex ) const
{
PlottingPositionHelper& rPosHelper = VSeriesPlotter::getPlottingPositionHelper( nAxisIndex );
-
BarPositionHelper* pBarPosHelper = dynamic_cast<BarPositionHelper*>(&rPosHelper);
if( pBarPosHelper && nAxisIndex >= 0 )
{
@@ -100,7 +100,6 @@ PlottingPositionHelper& BarChart::getPlottingPositionHelper( sal_Int32 nAxisInde
if( nAxisIndex < m_aGapwidthSequence.getLength() )
pBarPosHelper->setOuterDistance( m_aGapwidthSequence[nAxisIndex]/100.0 );
}
-
return rPosHelper;
}
@@ -118,7 +117,7 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
if(!m_aZSlots.empty())
fXSlotCount = m_aZSlots.begin()->size();
- aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getSlotWidth());
+ aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getScaledSlotWidth());
}
else
return VSeriesPlotter::getPreferredDiagramAspectRatio();
@@ -146,54 +145,6 @@ bool BarChart::keepAspectRatio() const
return true;
}
-//-------------------------------------------------------------------------
-// MinimumAndMaximumSupplier
-//-------------------------------------------------------------------------
-
-double BarChart::getMinimumX()
-{
- if( m_bCategoryXAxis )
- return 0.5;//first category (index 0) matches with real number 1.0
- return VSeriesPlotter::getMinimumX();
-}
-double BarChart::getMaximumX()
-{
- if( m_bCategoryXAxis )
- {
- //return category count
- sal_Int32 nPointCount = getPointCount();
- return nPointCount+0.5;//first category (index 0) matches with real number 1.0
- }
- return VSeriesPlotter::getMaximumX();
-}
-
-//-----------------------------------------------------------------
-// lang::XServiceInfo
-//-----------------------------------------------------------------
-/*
-APPHELPER_XSERVICEINFO_IMPL(BarChart,CHART2_VIEW_BARCHART_SERVICE_IMPLEMENTATION_NAME)
-
- uno::Sequence< rtl::OUString > BarChart
-::getSupportedServiceNames_Static()
-{
- uno::Sequence< rtl::OUString > aSNS( 1 );
- aSNS.getArray()[ 0 ] = CHART2_VIEW_BARCHART_SERVICE_NAME;
- return aSNS;
-}
-*/
-/*
-//-----------------------------------------------------------------
-// chart2::XPlotter
-//-----------------------------------------------------------------
-
- ::rtl::OUString SAL_CALL BarChart
-::getCoordinateSystemTypeID()
- throw (uno::RuntimeException)
-{
- return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
-}
-*/
-
awt::Point BarChart::getLabelScreenPositionAndAlignment(
LabelAlignment& rAlignment, sal_Int32 nLabelPlacement
, double fScaledX, double fScaledLowerYValue, double fScaledUpperYValue, double fScaledZ
@@ -499,7 +450,7 @@ void BarChart::createShapes()
m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
- double fLogicZ = 0.0;//as defined
+ double fLogicZ = 1.0;//as defined
bool bDrawConnectionLines = false;
bool bDrawConnectionLinesInited = false;
@@ -514,12 +465,11 @@ void BarChart::createShapes()
sal_Int32 nCreatedPoints = 0;
//
- //(@todo maybe different iteration for breaks in axis ?)
- sal_Int32 nStartCategoryIndex = m_pMainPosHelper->getStartCategoryIndex(); // inclusive
- sal_Int32 nEndCategoryIndex = m_pMainPosHelper->getEndCategoryIndex(); //inclusive
+ sal_Int32 nStartIndex = 0;
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
//=============================================================================
- //iterate through all shown categories
- for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex < nEndCategoryIndex; nCatIndex++ )
+ //iterate through all x values per indices
+ for( sal_Int32 nPointIndex = nStartIndex; nPointIndex < nEndIndex; nPointIndex++ )
{
::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
@@ -538,7 +488,7 @@ void BarChart::createShapes()
aLogicYSumMap[nAttachedAxisIndex]=0.0;
double fMinimumY = 0.0, fMaximumY = 0.0;
- aXSlotIter->calculateYMinAndMaxForCategory( nCatIndex
+ aXSlotIter->calculateYMinAndMaxForCategory( nPointIndex
, isSeperateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
if( !::rtl::math::isNan( fMaximumY ) && fMaximumY > 0)
@@ -574,14 +524,14 @@ void BarChart::createShapes()
//update/create information for current group
pPosHelper->updateSeriesCount( aZSlotIter->size() );
- double fLogicBaseWidth = pPosHelper->getSlotWidth();
+ double fLogicBaseWidth = pPosHelper->getScaledSlotWidth();
::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
// get distance from base value to maximum and minimum
double fMinimumY = 0.0, fMaximumY = 0.0;
- aXSlotIter->calculateYMinAndMaxForCategory( nCatIndex
+ aXSlotIter->calculateYMinAndMaxForCategory( nPointIndex
, isSeperateStackingForDifferentSigns( 1 ), fMinimumY, fMaximumY, nAttachedAxisIndex );
double fLogicPositiveYSum = 0.0;
@@ -633,7 +583,7 @@ void BarChart::createShapes()
bOnlyConnectionLinesForThisPoint = false;
- if(nCatIndex==nStartCategoryIndex)//do not create a regression line for each point
+ if(nPointIndex==nStartIndex)//do not create a regression line for each point
createRegressionCurvesShapes( **aSeriesIter, xRegressionCurveTarget, xRegressionCurveEquationTarget,
m_pPosHelper->maySkipPointsInRegressionCalculation());
@@ -658,8 +608,17 @@ void BarChart::createShapes()
getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nCatIndex ), fSlotX );
- double fLogicBarHeight = (*aSeriesIter)->getYValue( nCatIndex );
+ double fUnscaledLogicX = (*aSeriesIter)->getXValue( nPointIndex );
+ fUnscaledLogicX = DateHelper::RasterizeDateValue( fUnscaledLogicX, m_aNullDate, m_nTimeResolution );
+ if(fUnscaledLogicX<pPosHelper->getLogicMinX())
+ continue;//point not visible
+ if(fUnscaledLogicX>pPosHelper->getLogicMaxX())
+ continue;//point not visible
+ if(pPosHelper->isStrongLowerRequested(0) && fUnscaledLogicX==pPosHelper->getLogicMaxX())
+ continue;//point not visible
+ double fLogicX = pPosHelper->getScaledSlotPos( fUnscaledLogicX, fSlotX );
+
+ double fLogicBarHeight = (*aSeriesIter)->getYValue( nPointIndex );
if( ::rtl::math::isNan( fLogicBarHeight )) //no value at this category
continue;
@@ -684,9 +643,9 @@ void BarChart::createShapes()
fNegativeLogicYForNextSeries += fLogicBarHeight;
if(m_nDimension==3)
- fLogicZ = nZ;
+ fLogicZ = nZ+0.5;
- drawing::Position3D aUnscaledLogicPosition( fLogicX, fUpperYValue, fLogicZ );
+ drawing::Position3D aUnscaledLogicPosition( fUnscaledLogicX, fUpperYValue, fLogicZ );
//@todo ... start an iteration over the different breaks of the axis
//each subsystem may add an additional shape to form the whole point
@@ -696,7 +655,7 @@ void BarChart::createShapes()
// uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
//as long as we do not iterate we do not need to create an additional group for each point
uno::Reference< drawing::XShapes > xPointGroupShape_Shapes = xSeriesGroupShape_Shapes;
- uno::Reference< beans::XPropertySet > xDataPointProperties( (*aSeriesIter)->getPropertiesOfPoint( nCatIndex ) );
+ uno::Reference< beans::XPropertySet > xDataPointProperties( (*aSeriesIter)->getPropertiesOfPoint( nPointIndex ) );
sal_Int32 nGeometry3D = DataPointGeometry3D::CUBOID;
if(m_nDimension==3) try
{
@@ -763,7 +722,7 @@ void BarChart::createShapes()
//better performance for big data
FormerBarPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
- if( !pSeries->isAttributedDataPoint(nCatIndex)
+ if( !pSeries->isAttributedDataPoint(nPointIndex)
&&
pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fUpperY, aFormerPoint.m_fZ
, fLogicX, fUpperYValue, fLogicZ )
@@ -883,20 +842,20 @@ void BarChart::createShapes()
//set name/classified ObjectID (CID)
ShapeFactory::setShapeName(xShape
, ObjectIdentifier::createPointCID(
- (*aSeriesIter)->getPointCID_Stub(),nCatIndex) );
+ (*aSeriesIter)->getPointCID_Stub(),nPointIndex) );
}
//create error bar
- createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nCatIndex, m_xLogicTarget );
+ createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nPointIndex, m_xLogicTarget, &fLogicX );
//------------
//create data point label
- if( (**aSeriesIter).getDataPointLabelIfLabel(nCatIndex) )
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nPointIndex) )
{
double fLogicSum = aLogicYSumMap[nAttachedAxisIndex];
LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
- sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nCatIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
double fLowerBarDepth = fLogicBarDepth;
double fUpperBarDepth = fLogicBarDepth;
@@ -921,7 +880,7 @@ void BarChart::createShapes()
if( m_nDimension == 3 )
nOffset = 260;
}
- this->createDataLabel( xTextTarget, **aSeriesIter, nCatIndex
+ this->createDataLabel( xTextTarget, **aSeriesIter, nPointIndex
, fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset );
}
diff --git a/chart2/source/view/charttypes/BarChart.hxx b/chart2/source/view/charttypes/BarChart.hxx
index 403628f7fc43..c20c85168b5d 100644
--- a/chart2/source/view/charttypes/BarChart.hxx
+++ b/chart2/source/view/charttypes/BarChart.hxx
@@ -47,17 +47,7 @@ public:
, sal_Int32 nDimensionCount );
virtual ~BarChart();
- //-------------------------------------------------------------------------
- // chart2::XPlotter
- //-------------------------------------------------------------------------
-
- virtual void SAL_CALL createShapes();
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
-
+ virtual void createShapes();
virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
//-------------------
@@ -65,12 +55,6 @@ public:
virtual bool keepAspectRatio() const;
//-------------------------------------------------------------------------
- // MinimumAndMaximumSupplier
- //-------------------------------------------------------------------------
- virtual double getMinimumX();
- virtual double getMaximumX();
-
- //-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
diff --git a/chart2/source/view/charttypes/BarPositionHelper.cxx b/chart2/source/view/charttypes/BarPositionHelper.cxx
index b1735e99de5d..45dab527da11 100644
--- a/chart2/source/view/charttypes/BarPositionHelper.cxx
+++ b/chart2/source/view/charttypes/BarPositionHelper.cxx
@@ -32,6 +32,8 @@
#include "Linear3DTransformation.hxx"
#include "ViewDefines.hxx"
#include "CommonConverters.hxx"
+#include "DateHelper.hxx"
+#include <com/sun/star/chart/TimeUnit.hpp>
//.............................................................................
namespace chart
@@ -43,6 +45,8 @@ using namespace ::com::sun::star::chart2;
BarPositionHelper::BarPositionHelper( bool /* bSwapXAndY */ )
: CategoryPositionHelper( 1 )
{
+ AllowShiftXAxisPos(true);
+ AllowShiftZAxisPos(true);
}
BarPositionHelper::BarPositionHelper( const BarPositionHelper& rSource )
@@ -66,73 +70,22 @@ void BarPositionHelper::updateSeriesCount( double fSeriesCount )
m_fSeriesCount = fSeriesCount;
}
-uno::Reference< XTransformation > BarPositionHelper::getTransformationScaledLogicToScene() const
+double BarPositionHelper::getScaledSlotPos( double fUnscaledLogicX, double fSeriesNumber ) const
{
- //transformation from 2) to 4) //@todo 2) and 4) need a link to a document
+ if( m_bDateAxis )
+ fUnscaledLogicX = DateHelper::RasterizeDateValue( fUnscaledLogicX, m_aNullDate, m_nTimeResolution );
+ double fScaledLogicX(fUnscaledLogicX);
+ doLogicScaling(&fScaledLogicX,NULL,NULL);
+ fScaledLogicX = CategoryPositionHelper::getScaledSlotPos( fScaledLogicX, fSeriesNumber );
+ return fScaledLogicX;
- //we need to apply this transformation to each geometric object because of a bug/problem
- //of the old drawing layer (the UNO_NAME_3D_EXTRUDE_DEPTH is an integer value instead of an double )
-
- if( !m_xTransformationLogicToScene.is() )
- {
- ::basegfx::B3DHomMatrix aMatrix;
-
- double MinX = getLogicMinX();
- double MinY = getLogicMinY();
- double MinZ = getLogicMinZ();
- double MaxX = getLogicMaxX();
- double MaxY = getLogicMaxY();
- double MaxZ = getLogicMaxZ();
-
- AxisOrientation nXAxisOrientation = m_aScales[0].Orientation;
- AxisOrientation nYAxisOrientation = m_aScales[1].Orientation;
- AxisOrientation nZAxisOrientation = m_aScales[2].Orientation;
-
- //apply scaling
- //scaling of x axis is refused/ignored
- doLogicScaling( NULL, &MinY, &MinZ );
- doLogicScaling( NULL, &MaxY, &MaxZ);
-
- if(m_bSwapXAndY)
- {
- std::swap(MinX,MinY);
- std::swap(MaxX,MaxY);
- std::swap(nXAxisOrientation,nYAxisOrientation);
- }
-
- if( AxisOrientation_MATHEMATICAL==nXAxisOrientation )
- aMatrix.translate(-MinX,0.0,0.0);
- else
- aMatrix.translate(-MaxX,0.0,0.0);
- if( AxisOrientation_MATHEMATICAL==nYAxisOrientation )
- aMatrix.translate(0.0,-MinY,0.0);
- else
- aMatrix.translate(0.0,-MaxY,0.0);
- if( AxisOrientation_MATHEMATICAL==nZAxisOrientation )
- aMatrix.translate(0.0,0.0,-MaxZ);//z direction in draw is reverse mathematical direction
- else
- aMatrix.translate(0.0,0.0,-MinZ);
-
- double fWidthX = MaxX - MinX;
- double fWidthY = MaxY - MinY;
- double fWidthZ = MaxZ - MinZ;
-
- double fScaleDirectionX = AxisOrientation_MATHEMATICAL==nXAxisOrientation ? 1.0 : -1.0;
- double fScaleDirectionY = AxisOrientation_MATHEMATICAL==nYAxisOrientation ? 1.0 : -1.0;
- double fScaleDirectionZ = AxisOrientation_MATHEMATICAL==nZAxisOrientation ? -1.0 : 1.0;
-
- aMatrix.scale(fScaleDirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthX
- , fScaleDirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthY
- , fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ);
-
- //if(nDim==2)
- aMatrix = m_aMatrixScreenToScene*aMatrix;
-
- m_xTransformationLogicToScene = new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix ),m_bSwapXAndY);
- }
- return m_xTransformationLogicToScene;
}
+void BarPositionHelper::setScaledCategoryWidth( double fScaledCategoryWidth )
+{
+ m_fScaledCategoryWidth = fScaledCategoryWidth;
+ CategoryPositionHelper::setCategoryWidth( m_fScaledCategoryWidth );
+}
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/charttypes/BarPositionHelper.hxx b/chart2/source/view/charttypes/BarPositionHelper.hxx
index 32899de62aef..3a905877bcb9 100644
--- a/chart2/source/view/charttypes/BarPositionHelper.hxx
+++ b/chart2/source/view/charttypes/BarPositionHelper.hxx
@@ -49,25 +49,10 @@ public:
virtual PlottingPositionHelper* clone() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >
- getTransformationScaledLogicToScene() const;
-
void updateSeriesCount( double fSeriesCount ); /*only enter the size of x stacked series*/
- sal_Int32 getStartCategoryIndex() const {
- //first category (index 0) matches with real number 1.0
- sal_Int32 nStart = static_cast<sal_Int32>(getLogicMinX() - 0.5);
- if( nStart < 0 )
- nStart = 0;
- return nStart;
- }
- sal_Int32 getEndCategoryIndex() const {
- //first category (index 0) matches with real number 1.0
- sal_Int32 nEnd = static_cast<sal_Int32>(getLogicMaxX() - 0.5);
- if( nEnd < 0 )
- nEnd = 0;
- return nEnd;
- }
+ virtual double getScaledSlotPos( double fCategoryX, double fSeriesNumber ) const;
+ virtual void setScaledCategoryWidth( double fScaledCategoryWidth );
};
//.............................................................................
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index c5454edcc6fd..0cbcff33bfcd 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -121,7 +121,7 @@ void BubbleChart::calculateMaximumLogicBubbleSize()
void BubbleChart::calculateBubbleSizeScalingFactor()
{
- double fLogicZ=0.5;
+ double fLogicZ=1.0;
drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) );
drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) );
@@ -223,7 +223,7 @@ void BubbleChart::createShapes()
m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
//update/create information for current group
- double fLogicZ = 0.5;//as defined
+ double fLogicZ = 1.0;//as defined
sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
index 9c04ce8d3719..ed3d9e051cc4 100644
--- a/chart2/source/view/charttypes/BubbleChart.hxx
+++ b/chart2/source/view/charttypes/BubbleChart.hxx
@@ -46,11 +46,7 @@ public:
, sal_Int32 nDimensionCount );
virtual ~BubbleChart();
- //-------------------------------------------------------------------------
- // chart2::XPlotter
- //-------------------------------------------------------------------------
-
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
index ddfe50deed2f..61c49c61d4a0 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -30,8 +30,6 @@
#include "CandleStickChart.hxx"
#include "ShapeFactory.hxx"
-//#include "chartview/servicenames_charttypes.hxx"
-//#include "servicenames_coosystems.hxx"
#include "CommonConverters.hxx"
#include "ObjectIdentifier.hxx"
#include "LabelPositionHelper.hxx"
@@ -40,6 +38,7 @@
#include "VLegendSymbolFactory.hxx"
#include "FormattedStringHelper.hxx"
#include "DataSeriesHelper.hxx"
+#include "DateHelper.hxx"
#include <tools/debug.hxx>
#include <rtl/math.hxx>
#include <editeng/unoprnms.hxx>
@@ -76,22 +75,6 @@ CandleStickChart::~CandleStickChart()
// MinimumAndMaximumSupplier
//-------------------------------------------------------------------------
-double CandleStickChart::getMinimumX()
-{
- if( m_bCategoryXAxis )
- return 0.5;//first category (index 0) matches with real number 1.0
- return VSeriesPlotter::getMinimumX();
-}
-double CandleStickChart::getMaximumX()
-{
- if( m_bCategoryXAxis )
- {
- //return category count
- sal_Int32 nPointCount = getPointCount();
- return nPointCount+0.5;//first category (index 0) matches with real number 1.0
- }
- return VSeriesPlotter::getMaximumX();
-}
bool CandleStickChart::isSeperateStackingForDifferentSigns( sal_Int32 /* nDimensionIndex */ )
{
return false;
@@ -120,18 +103,6 @@ APPHELPER_XSERVICEINFO_IMPL(CandleStickChart,CHART2_VIEW_CANDLESTICKCHART_SERVIC
return aSNS;
}
*/
-/*
-//-----------------------------------------------------------------
-// chart2::XPlotter
-//-----------------------------------------------------------------
-
- ::rtl::OUString SAL_CALL CandleStickChart
-::getCoordinateSystemTypeID()
- throw (uno::RuntimeException)
-{
- return CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME;
-}
-*/
drawing::Direction3D CandleStickChart::getPreferredDiagramAspectRatio() const
{
@@ -205,11 +176,12 @@ void CandleStickChart::createShapes()
}
//(@todo maybe different iteration for breaks in axis ?)
- sal_Int32 nStartCategoryIndex = m_pMainPosHelper->getStartCategoryIndex(); // inclusive
- sal_Int32 nEndCategoryIndex = m_pMainPosHelper->getEndCategoryIndex(); //inclusive
+ sal_Int32 nStartIndex = 0;
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ double fLogicZ = 1.5;//as defined
//=============================================================================
- //iterate through all shown categories
- for( sal_Int32 nIndex = nStartCategoryIndex; nIndex < nEndCategoryIndex; nIndex++ )
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
{
::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
@@ -247,28 +219,48 @@ void CandleStickChart::createShapes()
for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
{
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nIndex ), fSlotX );
- double fY_First = (*aSeriesIter)->getY_First( nIndex );
- double fY_Last = (*aSeriesIter)->getY_Last( nIndex );
- double fY_Min = (*aSeriesIter)->getY_Min( nIndex );
- double fY_Max = (*aSeriesIter)->getY_Max( nIndex );
+ double fUnscaledX = (*aSeriesIter)->getXValue( nIndex );
+ if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() )
+ fUnscaledX = DateHelper::RasterizeDateValue( fUnscaledX, m_aNullDate, m_nTimeResolution );
+ if(fUnscaledX<pPosHelper->getLogicMinX() || fUnscaledX>pPosHelper->getLogicMaxX())
+ continue;//point not visible
+ double fScaledX = pPosHelper->getScaledSlotPos( fUnscaledX, fSlotX );
+
+ double fUnscaledY_First = (*aSeriesIter)->getY_First( nIndex );
+ double fUnscaledY_Last = (*aSeriesIter)->getY_Last( nIndex );
+ double fUnscaledY_Min = (*aSeriesIter)->getY_Min( nIndex );
+ double fUnscaledY_Max = (*aSeriesIter)->getY_Max( nIndex );
bool bBlack=false;
- if(fY_Last<=fY_First)
+ if(fUnscaledY_Last<=fUnscaledY_First)
{
- std::swap(fY_First,fY_Last);
+ std::swap(fUnscaledY_First,fUnscaledY_Last);
bBlack=true;
}
- if(fY_Max<fY_Min)
- std::swap(fY_Min,fY_Max);
+ if(fUnscaledY_Max<fUnscaledY_Min)
+ std::swap(fUnscaledY_Min,fUnscaledY_Max);
//transformation 3) -> 4)
- double fHalfWidth = pPosHelper->getSlotWidth()/2.0;
- drawing::Position3D aPosLeftFirst( pPosHelper->transformLogicToScene( fLogicX-fHalfWidth, fY_First ,0 ,true ) );
- drawing::Position3D aPosRightLast( pPosHelper->transformLogicToScene( fLogicX+fHalfWidth, fY_Last ,0 ,true ) );
- drawing::Position3D aPosMiddleFirst( pPosHelper->transformLogicToScene( fLogicX, fY_First ,0 ,true ) );
- drawing::Position3D aPosMiddleLast( pPosHelper->transformLogicToScene( fLogicX, fY_Last ,0 ,true ) );
- drawing::Position3D aPosMiddleMinimum( pPosHelper->transformLogicToScene( fLogicX, fY_Min ,0 ,true ) );
- drawing::Position3D aPosMiddleMaximum( pPosHelper->transformLogicToScene( fLogicX, fY_Max ,0 ,true ) );
+ double fHalfScaledWidth = pPosHelper->getScaledSlotWidth()/2.0;
+
+ double fScaledY_First(fUnscaledY_First);
+ double fScaledY_Last(fUnscaledY_Last);
+ double fScaledY_Min(fUnscaledY_Min);
+ double fScaledY_Max(fUnscaledY_Max);
+ pPosHelper->clipLogicValues( 0,&fScaledY_First,0 );
+ pPosHelper->clipLogicValues( 0,&fScaledY_Last,0 );
+ pPosHelper->clipLogicValues( 0,&fScaledY_Min,0 );
+ pPosHelper->clipLogicValues( 0,&fScaledY_Max,0 );
+ pPosHelper->doLogicScaling( 0,&fScaledY_First,0 );
+ pPosHelper->doLogicScaling( 0,&fScaledY_Last,0 );
+ pPosHelper->doLogicScaling( 0,&fScaledY_Min,0 );
+ pPosHelper->doLogicScaling( 0,&fScaledY_Max,0 );
+
+ drawing::Position3D aPosLeftFirst( pPosHelper->transformScaledLogicToScene( fScaledX-fHalfScaledWidth, fScaledY_First ,0 ,true ) );
+ drawing::Position3D aPosRightLast( pPosHelper->transformScaledLogicToScene( fScaledX+fHalfScaledWidth, fScaledY_Last ,0 ,true ) );
+ drawing::Position3D aPosMiddleFirst( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_First ,0 ,true ) );
+ drawing::Position3D aPosMiddleLast( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Last ,0 ,true ) );
+ drawing::Position3D aPosMiddleMinimum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Min ,0 ,true ) );
+ drawing::Position3D aPosMiddleMaximum( pPosHelper->transformScaledLogicToScene( fScaledX, fScaledY_Max ,0 ,true ) );
uno::Reference< drawing::XShapes > xLossGainTarget( xGainTarget );
if(bBlack)
@@ -329,13 +321,13 @@ void CandleStickChart::createShapes()
drawing::PolyPolygonShape3D aPoly;
sal_Int32 nLineIndex = 0;
- if( bShowFirst && pPosHelper->isLogicVisible( fLogicX, fY_First ,0 )
+ if( bShowFirst && pPosHelper->isLogicVisible( fUnscaledX, fUnscaledY_First ,fLogicZ )
&& isValidPosition(aPosLeftFirst) && isValidPosition(aPosMiddleFirst) )
{
AddPointToPoly( aPoly, aPosLeftFirst, nLineIndex );
AddPointToPoly( aPoly, aPosMiddleFirst, nLineIndex++ );
}
- if( pPosHelper->isLogicVisible( fLogicX, fY_Last ,0 )
+ if( pPosHelper->isLogicVisible( fUnscaledX, fUnscaledY_Last ,fLogicZ )
&& isValidPosition(aPosMiddleLast) && isValidPosition(aPosRightLast) )
{
AddPointToPoly( aPoly, aPosMiddleLast, nLineIndex );
@@ -361,16 +353,16 @@ void CandleStickChart::createShapes()
{
if(isValidPosition(aPosMiddleFirst))
this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
- , fY_First, 1.0, Position3DToAWTPoint(aPosMiddleFirst), LABEL_ALIGN_LEFT_BOTTOM );
+ , fUnscaledY_First, 1.0, Position3DToAWTPoint(aPosMiddleFirst), LABEL_ALIGN_LEFT_BOTTOM );
if(isValidPosition(aPosMiddleLast))
this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
- , fY_Last, 1.0, Position3DToAWTPoint(aPosMiddleLast), LABEL_ALIGN_RIGHT_TOP );
+ , fUnscaledY_Last, 1.0, Position3DToAWTPoint(aPosMiddleLast), LABEL_ALIGN_RIGHT_TOP );
if(isValidPosition(aPosMiddleMinimum))
this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
- , fY_Min, 1.0, Position3DToAWTPoint(aPosMiddleMinimum), LABEL_ALIGN_BOTTOM );
+ , fUnscaledY_Min, 1.0, Position3DToAWTPoint(aPosMiddleMinimum), LABEL_ALIGN_BOTTOM );
if(isValidPosition(aPosMiddleMaximum))
this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
- , fY_Max, 1.0, Position3DToAWTPoint(aPosMiddleMaximum), LABEL_ALIGN_TOP );
+ , fUnscaledY_Max, 1.0, Position3DToAWTPoint(aPosMiddleMaximum), LABEL_ALIGN_TOP );
}
}//next series in x slot (next y slot)
}//next x slot
diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx b/chart2/source/view/charttypes/CandleStickChart.hxx
index 60018dbe8621..6fbf980058e7 100644
--- a/chart2/source/view/charttypes/CandleStickChart.hxx
+++ b/chart2/source/view/charttypes/CandleStickChart.hxx
@@ -47,16 +47,7 @@ public:
, sal_Int32 nDimensionCount );
virtual ~CandleStickChart();
- //-------------------------------------------------------------------------
- // chart2::XPlotter
- //-------------------------------------------------------------------------
-
- virtual void SAL_CALL createShapes();
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
+ virtual void createShapes();
virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
@@ -64,8 +55,6 @@ public:
//-------------------------------------------------------------------------
// MinimumAndMaximumSupplier
//-------------------------------------------------------------------------
- virtual double getMinimumX();
- virtual double getMaximumX();
virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
//-------------------------------------------------------------------------
diff --git a/chart2/source/view/charttypes/CategoryPositionHelper.cxx b/chart2/source/view/charttypes/CategoryPositionHelper.cxx
index d43fd0856e02..76f07168bdf2 100644
--- a/chart2/source/view/charttypes/CategoryPositionHelper.cxx
+++ b/chart2/source/view/charttypes/CategoryPositionHelper.cxx
@@ -57,7 +57,7 @@ CategoryPositionHelper::~CategoryPositionHelper()
{
}
-double CategoryPositionHelper::getSlotWidth() const
+double CategoryPositionHelper::getScaledSlotWidth() const
{
double fWidth = m_fCategoryWidth /
( m_fSeriesCount
@@ -66,14 +66,14 @@ double CategoryPositionHelper::getSlotWidth() const
return fWidth;
}
-double CategoryPositionHelper::getSlotPos( double fCategoryX, double fSeriesNumber ) const
+double CategoryPositionHelper::getScaledSlotPos( double fScaledXPos, double fSeriesNumber ) const
{
//the returned position is in the middle of the rect
//fSeriesNumber 0...n-1
- double fPos = fCategoryX - (m_fCategoryWidth/2.0)
- + (m_fOuterDistance/2.0 + fSeriesNumber*(1.0+m_fInnerDistance)) * getSlotWidth()
- + getSlotWidth()/2.0;
-
+ double fPos = fScaledXPos
+ - (m_fCategoryWidth/2.0)
+ + (m_fOuterDistance/2.0 + fSeriesNumber*(1.0+m_fInnerDistance)) * getScaledSlotWidth()
+ + getScaledSlotWidth()/2.0;
return fPos;
}
@@ -95,6 +95,11 @@ void CategoryPositionHelper::setOuterDistance( double fOuterDistance )
m_fOuterDistance = fOuterDistance;
}
+void CategoryPositionHelper::setCategoryWidth( double fCategoryWidth )
+{
+ m_fCategoryWidth = fCategoryWidth;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/charttypes/CategoryPositionHelper.hxx b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
index 08cb1978faa1..c12d17d40b03 100644
--- a/chart2/source/view/charttypes/CategoryPositionHelper.hxx
+++ b/chart2/source/view/charttypes/CategoryPositionHelper.hxx
@@ -44,8 +44,9 @@ public:
CategoryPositionHelper( const CategoryPositionHelper& rSource );
virtual ~CategoryPositionHelper();
- double getSlotWidth() const;
- double getSlotPos( double fCategoryX, double fSeriesNumber ) const;
+ double getScaledSlotWidth() const;
+ virtual double getScaledSlotPos( double fCategoryX, double fSeriesNumber ) const;
+ virtual void setCategoryWidth( double fCategoryWidth );
//Distance between two neighboring bars in same category, seen relative to width of the bar
void setInnerDistance( double fInnerDistance );
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index eee13848b11b..abb30c2a67a9 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -159,11 +159,9 @@ PieChart::~PieChart()
//-----------------------------------------------------------------
-void SAL_CALL PieChart::setScales( const uno::Sequence< ExplicitScaleData >& rScales
- , sal_Bool /* bSwapXAndYAxis */ )
- throw (uno::RuntimeException)
+void PieChart::setScales( const std::vector< ExplicitScaleData >& rScales, bool /* bSwapXAndYAxis */ )
{
- DBG_ASSERT(m_nDimension<=rScales.getLength(),"Dimension of Plotter does not fit two dimension of given scale sequence");
+ DBG_ASSERT(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
m_pPosHelper->setScales( rScales, true );
}
@@ -411,7 +409,7 @@ void PieChart::createShapes()
if( !bIsVisible )
continue;
- double fLogicZ = -0.5;//as defined
+ double fLogicZ = -1.0;//as defined
double fDepth = this->getTransformedDepth();
//=============================================================================
@@ -495,11 +493,11 @@ void PieChart::createShapes()
awt::Point aScreenPosition2D(
aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment, nLabelPlacement
, fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
- , fUnitCircleInnerRadius, fUnitCircleOuterRadius, 0.0, 0 ));
+ , fUnitCircleInnerRadius, fUnitCircleOuterRadius, fLogicZ+0.5, 0 ));
PieLabelInfo aPieLabelInfo;
aPieLabelInfo.aFirstPosition = basegfx::B2IVector( aScreenPosition2D.X, aScreenPosition2D.Y );
- awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, 0.5 ) ) );
+ awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, fLogicZ+1.0 ) ) );
aPieLabelInfo.aOrigin = basegfx::B2IVector( aOrigin.X, aOrigin.Y );
//add a scaling independent Offset if requested
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
index e6fedb05d52e..c306e2db256f 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -49,24 +49,10 @@ public:
, sal_Int32 nDimensionCount, bool bExcludingPositioning );
virtual ~PieChart();
- //-------------------------------------------------------------------------
- // chart2::XPlotter
- //-------------------------------------------------------------------------
-
- virtual void SAL_CALL createShapes();
+ virtual void createShapes();
virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
- virtual void SAL_CALL setScales(
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis )
- throw (::com::sun::star::uno::RuntimeException);
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
-
+ virtual void setScales( const ::std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
//-------------------
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 4150fade8834..c37842e19888 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -43,7 +43,7 @@
#include "ChartTypeHelper.hxx"
#include "Clipping.hxx"
#include "servicenames_charttypes.hxx"
-#include "chartview/NumberFormatterWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "ContainerHelper.hxx"
#include "DataSeriesHelper.hxx"
#include "RegressionCurveHelper.hxx"
@@ -52,6 +52,8 @@
#include "ResId.hxx"
#include "Strings.hrc"
#include "RelativePositionHelper.hxx"
+#include "DateHelper.hxx"
+#include "DiagramHelper.hxx"
//only for creation: @todo remove if all plotter are uno components and instanciated via servicefactory
#include "BarChart.hxx"
@@ -62,6 +64,7 @@
//
#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
@@ -155,6 +158,8 @@ VSeriesPlotter::VSeriesPlotter( const uno::Reference<XChartType>& xChartTypeMode
, m_xChartTypeModelProps( uno::Reference< beans::XPropertySet >::query( xChartTypeModel ))
, m_aZSlots()
, m_bCategoryXAxis(bCategoryXAxis)
+ , m_nTimeResolution(::com::sun::star::chart::TimeUnit::DAY)
+ , m_aNullDate(30,12,1899)
, m_xColorScheme()
, m_pExplicitCategoriesProvider(0)
, m_bPointsWereSkipped(false)
@@ -201,7 +206,17 @@ void VSeriesPlotter::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32
return;
if(m_bCategoryXAxis)
- pSeries->setCategoryXAxis();
+ {
+ if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() )
+ pSeries->setXValues( m_pExplicitCategoriesProvider->getOriginalCategories() );
+ else
+ pSeries->setCategoryXAxis();
+ }
+ else
+ {
+ if( m_pExplicitCategoriesProvider )
+ pSeries->setXValuesIfNone( m_pExplicitCategoriesProvider->getOriginalCategories() );
+ }
if(zSlot<0 || zSlot>=static_cast<sal_Int32>(m_aZSlots.size()))
{
@@ -381,7 +396,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries& rDataSeries
nNumberFormatKey = rDataSeries.getExplicitNumberFormat(nPointIndex,bAsPercentage);
else if( bAsPercentage )
{
- sal_Int32 nPercentFormat = ExplicitValueProvider::getPercentNumberFormat( m_apNumberFormatterWrapper->getNumberFormatsSupplier() );
+ sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( m_apNumberFormatterWrapper->getNumberFormatsSupplier() );
if( nPercentFormat != -1 )
nNumberFormatKey = nPercentFormat;
}
@@ -758,6 +773,17 @@ void lcl_AddErrorBottomLine( const drawing::Position3D& rPosition, ::basegfx::B2
return aMainDirection;
}
+drawing::Position3D lcl_transformMixedToScene( PlottingPositionHelper* pPosHelper
+ , double fX /*scaled*/, double fY /*unscaled*/, double fZ /*unscaled*/, bool bClip )
+{
+ if(!pPosHelper)
+ return drawing::Position3D(0,0,0);
+ pPosHelper->doLogicScaling( 0,&fY,&fZ );
+ if(bClip)
+ pPosHelper->clipScaledLogicValues( &fX,&fY,&fZ );
+ return pPosHelper->transformScaledLogicToScene( fX, fY, fZ, false );
+}
+
} // anonymous namespace
// virtual
@@ -768,6 +794,7 @@ void VSeriesPlotter::createErrorBar(
, const VDataSeries& rVDataSeries
, sal_Int32 nIndex
, bool bYError /* = true */
+ , double* pfScaledLogicX
)
{
if( !ChartTypeHelper::isSupportingStatisticProperties( m_xChartTypeModel, m_nDimension ) )
@@ -802,7 +829,13 @@ void VSeriesPlotter::createErrorBar(
const double fX = aUnscaledLogicPosition.PositionX;
const double fY = aUnscaledLogicPosition.PositionY;
const double fZ = aUnscaledLogicPosition.PositionZ;
- aMiddle = m_pPosHelper->transformLogicToScene( fX, fY, fZ, true );
+ double fScaledX = fX;
+ if( pfScaledLogicX )
+ fScaledX = *pfScaledLogicX;
+ else
+ m_pPosHelper->doLogicScaling( &fScaledX, 0, 0 );
+
+ aMiddle = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fY, fZ, true );
drawing::Position3D aNegative(aMiddle);
drawing::Position3D aPositive(aMiddle);
@@ -817,11 +850,16 @@ void VSeriesPlotter::createErrorBar(
double fLocalX = fX;
double fLocalY = fY;
if( bYError )
+ {
fLocalY+=fLength;
+ aPositive = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ, true );
+ }
else
+ {
fLocalX+=fLength;
+ aPositive = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
+ }
bCreatePositiveBorder = m_pPosHelper->isLogicVisible(fLocalX, fLocalY, fZ);
- aPositive = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
}
else
bShowPositive = false;
@@ -835,12 +873,16 @@ void VSeriesPlotter::createErrorBar(
double fLocalX = fX;
double fLocalY = fY;
if( bYError )
+ {
fLocalY-=fLength;
+ aNegative = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ, true );
+ }
else
+ {
fLocalX-=fLength;
-
+ aNegative = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
+ }
bCreateNegativeBorder = m_pPosHelper->isLogicVisible( fLocalX, fLocalY, fZ);
- aNegative = m_pPosHelper->transformLogicToScene( fLocalX, fLocalY, fZ, true );
}
else
bShowNegative = false;
@@ -884,7 +926,8 @@ void VSeriesPlotter::createErrorBar(
// virtual
void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
- , const uno::Reference< drawing::XShapes >& xTarget )
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , double* pfScaledLogicX )
{
if(m_nDimension!=2)
return;
@@ -898,7 +941,8 @@ void VSeriesPlotter::createErrorBar_Y( const drawing::Position3D& rUnscaledLogic
createErrorBar( xErrorBarsGroup_Shapes
, rUnscaledLogicPosition, xErrorBarProp
, rVDataSeries, nPointIndex
- , true /* bYError */ );
+ , true /* bYError */
+ , pfScaledLogicX );
}
}
@@ -936,13 +980,13 @@ void VSeriesPlotter::createRegressionCurvesShapes( VDataSeries& rVDataSeries
aRegressionPoly.SequenceZ[0].realloc(nRegressionPointCount);
sal_Int32 nRealPointCount=0;
- uno::Sequence< chart2::ExplicitScaleData > aScaleDataSeq( m_pPosHelper->getScales());
+ std::vector< ExplicitScaleData > aScales( m_pPosHelper->getScales());
uno::Reference< chart2::XScaling > xScalingX;
uno::Reference< chart2::XScaling > xScalingY;
- if( aScaleDataSeq.getLength() >= 2 )
+ if( aScales.size() >= 2 )
{
- xScalingX.set( aScaleDataSeq[0].Scaling );
- xScalingY.set( aScaleDataSeq[1].Scaling );
+ xScalingX.set( aScales[0].Scaling );
+ xScalingY.set( aScales[1].Scaling );
}
uno::Sequence< geometry::RealPoint2D > aCalculatedPoints(
@@ -1126,35 +1170,58 @@ void VSeriesPlotter::setMappedProperties(
PropertyMapper::setMappedProperties(xTargetProp,xSource,rMap,pOverwriteMap);
}
+void VSeriesPlotter::setTimeResolutionOnXAxis( long TimeResolution, const Date& rNullDate )
+{
+ m_nTimeResolution = TimeResolution;
+ m_aNullDate = rNullDate;
+}
+
//-------------------------------------------------------------------------
// MinimumAndMaximumSupplier
//-------------------------------------------------------------------------
-
-double VSeriesPlotter::getMinimumX()
+long VSeriesPlotter::calculateTimeResolutionOnXAxis()
{
- if( m_bCategoryXAxis )
+ long nRet = ::com::sun::star::chart::TimeUnit::YEAR;
+ if( m_pExplicitCategoriesProvider )
{
- double fRet = 1.0;//first category (index 0) matches with real number 1.0
- if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
- fRet -= 0.5;
- return fRet;
+ const std::vector< DatePlusIndex >& rDateCategories = m_pExplicitCategoriesProvider->getDateCategories();
+ std::vector< DatePlusIndex >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end();
+ Date aNullDate(30,12,1899);
+ if( m_apNumberFormatterWrapper.get() )
+ aNullDate = m_apNumberFormatterWrapper->getNullDate();
+ if( aIt!=aEnd )
+ {
+ Date aPrevious(aNullDate); aPrevious+=rtl::math::approxFloor(aIt->fValue);
+ ++aIt;
+ for(;aIt!=aEnd;++aIt)
+ {
+ Date aCurrent(aNullDate); aCurrent+=rtl::math::approxFloor(aIt->fValue);
+ if( ::com::sun::star::chart::TimeUnit::YEAR == nRet )
+ {
+ if( DateHelper::IsInSameYear( aPrevious, aCurrent ) )
+ nRet = ::com::sun::star::chart::TimeUnit::MONTH;
+ }
+ if( ::com::sun::star::chart::TimeUnit::MONTH == nRet )
+ {
+ if( DateHelper::IsInSameMonth( aPrevious, aCurrent ) )
+ nRet = ::com::sun::star::chart::TimeUnit::DAY;
+ }
+ if( ::com::sun::star::chart::TimeUnit::DAY == nRet )
+ break;
+ aPrevious=aCurrent;
+ }
+ }
}
-
+ return nRet;
+}
+double VSeriesPlotter::getMinimumX()
+{
double fMinimum, fMaximum;
this->getMinimumAndMaximiumX( fMinimum, fMaximum );
return fMinimum;
}
double VSeriesPlotter::getMaximumX()
{
- if( m_bCategoryXAxis )
- {
- //return category count
- double fRet = getPointCount();//first category (index 0) matches with real number 1.0
- if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->hasComplexCategories() )
- fRet += 0.5;
- return fRet;
- }
-
double fMinimum, fMaximum;
this->getMinimumAndMaximiumX( fMinimum, fMaximum );
return fMaximum;
@@ -1162,7 +1229,7 @@ double VSeriesPlotter::getMaximumX()
double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
{
- if( !m_bCategoryXAxis )
+ if( !m_bCategoryXAxis || ( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) )
{
double fMinY, fMaxY;
this->getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
@@ -1196,7 +1263,7 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
{
- if( !m_bCategoryXAxis )
+ if( !m_bCategoryXAxis || ( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() ) )
{
double fMinY, fMaxY;
this->getMinimumAndMaximiumYInContinuousXRange( fMinY, fMaxY, fMinimumX, fMaximumX, nAxisIndex );
@@ -1231,13 +1298,13 @@ double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, s
double VSeriesPlotter::getMinimumZ()
{
//this is the default for all charts without a meaningfull z axis
- return 0.5;
+ return 1.0;
}
double VSeriesPlotter::getMaximumZ()
{
- if( 3!=m_nDimension )
- return 0.5;
- return m_aZSlots.size()+0.5;
+ if( 3!=m_nDimension || !m_aZSlots.size() )
+ return getMinimumZ()+1;
+ return m_aZSlots.size();
}
namespace
@@ -1603,7 +1670,7 @@ double VSeriesPlotter::getTransformedDepth() const
return FIXED_SIZE_FOR_3D_CHART_VOLUME/(MaxZ-MinZ);
}
-void SAL_CALL VSeriesPlotter::addSecondaryValueScale( const ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
+void VSeriesPlotter::addSecondaryValueScale( const ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
throw (uno::RuntimeException)
{
if( nAxisIndex<1 )
@@ -1633,9 +1700,9 @@ PlottingPositionHelper& VSeriesPlotter::getPlottingPositionHelper( sal_Int32 nAx
}
}
if( !pRet )
- {
pRet = m_pMainPosHelper;
- }
+ if(pRet)
+ pRet->setTimeResolution( m_nTimeResolution, m_aNullDate );
return *pRet;
}
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 4174226b6f62..0aad597d2475 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -49,11 +49,8 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
// header for class SvxShape
#include <svx/unoshape.hxx>
-// header for GetSdrObjectFromXShape
-#include <svx/unoapi.hxx>
// header for class E3dScene
#include <svx/scene3d.hxx>
-#include <rtl/math.hxx>
#include <svx/e3dsceneupdater.hxx>
//.............................................................................
@@ -107,7 +104,7 @@ VDiagram::~VDiagram()
delete m_pShapeFactory;
}
-void SAL_CALL VDiagram::init(
+void VDiagram::init(
const uno::Reference< drawing::XShapes >& xLogicTarget
, const uno::Reference< drawing::XShapes >& xFinalTarget
, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
diff --git a/chart2/source/view/inc/DateHelper.hxx b/chart2/source/view/inc/DateHelper.hxx
new file mode 100644
index 000000000000..c2352e246695
--- /dev/null
+++ b/chart2/source/view/inc/DateHelper.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_DATEHELPER_HXX
+#define _CHART2_DATEHELPER_HXX
+
+#include <com/sun/star/chart2/XScaling.hpp>
+#include <tools/date.hxx>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class DateHelper
+{
+public:
+ static bool IsInSameYear( const Date& rD1, const Date& rD2 );
+ static bool IsInSameMonth( const Date& rD1, const Date& rD2 );
+
+ static long GetMonthsBetweenDates( Date aD1, Date aD2 );
+ static Date GetDateSomeMonthsAway( const Date& rD, long nMonthDistance );
+ static Date GetDateSomeYearsAway( const Date& rD, long nYearDistance );
+ static bool IsLessThanOneMonthAway( const Date& rD1, const Date& rD2 );
+ static bool IsLessThanOneYearAway( const Date& rD1, const Date& rD2 );
+
+ static double RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
index 1e53d5c144c5..dee1fec8e67d 100644
--- a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
+++ b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
@@ -29,7 +29,7 @@
#define _CHART2_MINIMUMANDMAXIMUMSUPPLIER_HXX
#include <sal/types.h>
-
+#include <tools/date.hxx>
#include <set>
//.............................................................................
@@ -60,6 +60,10 @@ public:
virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex ) = 0;
virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex ) = 0;
virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex ) = 0;
+
+ //return a constant out of ::com::sun::star::chart::TimeUnit that allows to display the smallest distance between occuring dates
+ virtual long calculateTimeResolutionOnXAxis() = 0;
+ virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) = 0;
};
class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier
@@ -86,6 +90,9 @@ public:
virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+ virtual long calculateTimeResolutionOnXAxis();
+ virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate );
+
private:
typedef ::std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet;
MinimumAndMaximumSupplierSet m_aMinimumAndMaximumSupplierList;
diff --git a/chart2/source/view/inc/PlotterBase.hxx b/chart2/source/view/inc/PlotterBase.hxx
index 63e276b19e44..7920845248e4 100644
--- a/chart2/source/view/inc/PlotterBase.hxx
+++ b/chart2/source/view/inc/PlotterBase.hxx
@@ -27,28 +27,18 @@
#ifndef _CHART2_PLOTTERBASE_HXX
#define _CHART2_PLOTTERBASE_HXX
+#include "chartview/ExplicitScaleValues.hxx"
+
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-/*
-#include <com/sun/star/lang/XComponent.hpp>
-*/
-
-//----
-#include <vector>
-
-//---- chart2
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
#include <com/sun/star/chart2/XTransformation.hpp>
-/*
-#include <com/sun/star/chart2/XPlotter.hpp>
-*/
-//----
#include <cppuhelper/implbase1.hxx>
+#include <vector>
//.............................................................................
namespace chart
@@ -64,8 +54,7 @@ public:
PlotterBase( sal_Int32 nDimension );
virtual ~PlotterBase();
- // ___chart2::XPlotter___
- virtual void SAL_CALL initPlotter(
+ virtual void initPlotter(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xLogicTarget
, const ::com::sun::star::uno::Reference<
@@ -75,21 +64,13 @@ public:
, const rtl::OUString& rCID
) throw (::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL setScales(
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis )
- throw (::com::sun::star::uno::RuntimeException);
+ virtual void setScales( const ::std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
- virtual void SAL_CALL createShapes() = 0;
+ virtual void createShapes() = 0;
static bool isValidPosition( const ::com::sun::star::drawing::Position3D& rPos );
- /*
- virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
- */
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx
index a1f16883b779..42c7a90a0116 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -28,9 +28,10 @@
#define _CHART2_PLOTTINGPOSITIONHELPER_HXX
#include "LabelAlignment.hxx"
+#include "chartview/ExplicitScaleValues.hxx"
+
#include <basegfx/range/b2drectangle.hxx>
#include <rtl/math.hxx>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
#include <com/sun/star/chart2/XTransformation.hpp>
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/HomogenMatrix.hpp>
@@ -62,23 +63,22 @@ public:
virtual ~PlottingPositionHelper();
virtual PlottingPositionHelper* clone() const;
- virtual PlottingPositionHelper* createSecondaryPosHelper( const ::com::sun::star::chart2::ExplicitScaleData& rSecondaryScale );
+ virtual PlottingPositionHelper* createSecondaryPosHelper( const ExplicitScaleData& rSecondaryScale );
virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix);
- virtual void setScales( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis );
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& getScales() const;
+ virtual void setScales( const ::std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
+ const ::std::vector< ExplicitScaleData >& getScales() const;
//better performance for big data
inline void setCoordinateSystemResolution( const ::com::sun::star::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution );
inline bool isSameForGivenResolution( double fX, double fY, double fZ
, double fX2, double fY2, double fZ2 );
+ inline bool isStrongLowerRequested( sal_Int32 nDimensionIndex ) const;
inline bool isLogicVisible( double fX, double fY, double fZ ) const;
inline void doLogicScaling( double* pX, double* pY, double* pZ, bool bClip=false ) const;
+ inline void doUnshiftedLogicScaling( double* pX, double* pY, double* pZ, bool bClip=false ) const;
inline void clipLogicValues( double* pX, double* pY, double* pZ ) const;
void clipScaledLogicValues( double* pX, double* pY, double* pZ ) const;
inline bool clipYRange( double& rMin, double& rMax ) const;
@@ -123,10 +123,14 @@ public:
inline bool maySkipPointsInRegressionCalculation() const;
+ void setTimeResolution( long nTimeResolution, const Date& rNullDate );
+ virtual void setScaledCategoryWidth( double fScaledCategoryWidth );
+ void AllowShiftXAxisPos( bool bAllowShift );
+ void AllowShiftZAxisPos( bool bAllowShift );
+
protected: //member
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData > m_aScales;
- ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
+ ::std::vector< ExplicitScaleData > m_aScales;
+ ::basegfx::B3DHomMatrix m_aMatrixScreenToScene;
//this is calculated based on m_aScales and m_aMatrixScreenToScene
mutable ::com::sun::star::uno::Reference<
@@ -139,6 +143,14 @@ protected: //member
sal_Int32 m_nZResolution;
bool m_bMaySkipPointsInRegressionCalculation;
+
+ bool m_bDateAxis;
+ long m_nTimeResolution;
+ Date m_aNullDate;
+
+ double m_fScaledCategoryWidth;
+ bool m_bAllowShiftXAxisPos;
+ bool m_bAllowShiftZAxisPos;
};
//describes wich axis of the drawinglayer scene or sreen axis are the normal axis
@@ -163,9 +175,7 @@ public:
virtual PlottingPositionHelper* clone() const;
virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix);
- virtual void setScales( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::chart2::ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis );
+ virtual void setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis );
::basegfx::B3DHomMatrix getUnitCartesianToScene() const;
@@ -227,14 +237,14 @@ private:
bool PolarPlottingPositionHelper::isMathematicalOrientationAngle() const
{
- const ::com::sun::star::chart2::ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[2];
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[2];
if( ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL==rScale.Orientation )
return true;
return false;
}
bool PolarPlottingPositionHelper::isMathematicalOrientationRadius() const
{
- const ::com::sun::star::chart2::ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
+ const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
if( ::com::sun::star::chart2::AxisOrientation_MATHEMATICAL==rScale.Orientation )
return true;
return false;
@@ -283,12 +293,23 @@ bool PlottingPositionHelper::isSameForGivenResolution( double fX, double fY, dou
return (bSameX && bSameY && bSameZ);
}
+bool PlottingPositionHelper::isStrongLowerRequested( sal_Int32 nDimensionIndex ) const
+{
+ if( m_aScales.empty() )
+ return false;
+ if( 0==nDimensionIndex )
+ return m_bAllowShiftXAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition;
+ else if( 2==nDimensionIndex )
+ return m_bAllowShiftZAxisPos && m_aScales[nDimensionIndex].ShiftedCategoryPosition;
+ return false;
+}
+
bool PlottingPositionHelper::isLogicVisible(
double fX, double fY, double fZ ) const
{
- return fX >= m_aScales[0].Minimum && fX <= m_aScales[0].Maximum
+ return fX >= m_aScales[0].Minimum && ( isStrongLowerRequested(0) ? fX < m_aScales[0].Maximum : fX <= m_aScales[0].Maximum )
&& fY >= m_aScales[1].Minimum && fY <= m_aScales[1].Maximum
- && fZ >= m_aScales[2].Minimum && fZ <= m_aScales[2].Maximum;
+ && fZ >= m_aScales[2].Minimum && ( isStrongLowerRequested(2) ? fZ < m_aScales[2].Maximum : fZ <= m_aScales[2].Maximum );
}
void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ, bool bClip ) const
@@ -296,6 +317,29 @@ void PlottingPositionHelper::doLogicScaling( double* pX, double* pY, double* pZ,
if(bClip)
this->clipLogicValues( pX,pY,pZ );
+ if(pX)
+ {
+ if( m_aScales[0].Scaling.is())
+ *pX = m_aScales[0].Scaling->doScaling(*pX);
+ if( m_bAllowShiftXAxisPos && m_aScales[0].ShiftedCategoryPosition )
+ (*pX) += m_fScaledCategoryWidth/2.0;
+ }
+ if(pY && m_aScales[1].Scaling.is())
+ *pY = m_aScales[1].Scaling->doScaling(*pY);
+ if(pZ)
+ {
+ if( m_aScales[2].Scaling.is())
+ *pZ = m_aScales[2].Scaling->doScaling(*pZ);
+ if( m_bAllowShiftZAxisPos && m_aScales[2].ShiftedCategoryPosition)
+ (*pZ) += 0.5;
+ }
+}
+
+void PlottingPositionHelper::doUnshiftedLogicScaling( double* pX, double* pY, double* pZ, bool bClip ) const
+{
+ if(bClip)
+ this->clipLogicValues( pX,pY,pZ );
+
if(pX && m_aScales[0].Scaling.is())
*pX = m_aScales[0].Scaling->doScaling(*pX);
if(pY && m_aScales[1].Scaling.is())
diff --git a/chart2/source/view/inc/ScaleAutomatism.hxx b/chart2/source/view/inc/ScaleAutomatism.hxx
index 4440ad26ac5a..327027efcf39 100644
--- a/chart2/source/view/inc/ScaleAutomatism.hxx
+++ b/chart2/source/view/inc/ScaleAutomatism.hxx
@@ -27,10 +27,11 @@
#ifndef _CHART2_SCALEAUTOMATISM_HXX
#define _CHART2_SCALEAUTOMATISM_HXX
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include "chartview/ExplicitScaleValues.hxx"
#include <com/sun/star/chart2/ScaleData.hpp>
+#include <tools/date.hxx>
+
//.............................................................................
namespace chart
{
@@ -44,7 +45,7 @@ class ScaleAutomatism
{
public:
explicit ScaleAutomatism(
- const ::com::sun::star::chart2::ScaleData& rSourceScale );
+ const ::com::sun::star::chart2::ScaleData& rSourceScale, const Date& rNullDate );
virtual ~ScaleAutomatism();
/** Expands own value range with the passed minimum and maximum. */
@@ -75,30 +76,41 @@ public:
of the axis and the font size of the axis caption text. */
void setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMainIncrementCount );
+ /** Sets the time resolution to be used in case it is not set explicitly within the scale
+ */
+ void setAutomaticTimeResolution( sal_Int32 nTimeResolution );
+
/** Fills the passed scale data and increment data according to the own settings. */
void calculateExplicitScaleAndIncrement(
- ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
- ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement ) const;
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement ) const;
::com::sun::star::chart2::ScaleData getScale() const;
+ Date getNullDate() const;
private:
/** Fills the passed scale data and increment data for category scaling. */
void calculateExplicitIncrementAndScaleForCategory(
- ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
- ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
bool bAutoMinimum, bool bAutoMaximum ) const;
/** Fills the passed scale data and increment data for logarithmic scaling. */
void calculateExplicitIncrementAndScaleForLogarithmic(
- ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
- ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
bool bAutoMinimum, bool bAutoMaximum ) const;
/** Fills the passed scale data and increment data for linear scaling. */
void calculateExplicitIncrementAndScaleForLinear(
- ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale,
- ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement,
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
+ bool bAutoMinimum, bool bAutoMaximum ) const;
+
+ /** Fills the passed scale data and increment data for date-time axis. */
+ void calculateExplicitIncrementAndScaleForDateTimeAxis(
+ ExplicitScaleData& rExplicitScale,
+ ExplicitIncrementData& rExplicitIncrement,
bool bAutoMinimum, bool bAutoMaximum ) const;
private:
@@ -111,6 +123,9 @@ private:
bool m_bExpandIfValuesCloseToBorder; /// true = Expand if values are too close to the borders.
bool m_bExpandWideValuesToZero; /// true = Expand wide spread values to zero.
bool m_bExpandNarrowValuesTowardZero; /// true = Expand narrow range toward zero (add half of range).
+ sal_Int32 m_nTimeResolution;// a constant out of ::com::sun::star::chart::TimeUnit
+
+ Date m_aNullDate;
};
//.............................................................................
diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx
index e884af865d6e..f4fd12547118 100644
--- a/chart2/source/view/inc/VCoordinateSystem.hxx
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -31,9 +31,8 @@
#include "ScaleAutomatism.hxx"
#include "ThreeDHelper.hxx"
#include "ExplicitCategoriesProvider.hxx"
+#include "chartview/ExplicitScaleValues.hxx"
-#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
-#include <com/sun/star/chart2/ExplicitScaleData.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include "comphelper/implementationreference.hxx"
#include <com/sun/star/awt/Rectangle.hpp>
@@ -63,7 +62,7 @@ public:
static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
- virtual void SAL_CALL initPlottingTargets(
+ virtual void initPlottingTargets(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xLogicTarget
, const ::com::sun::star::uno::Reference<
@@ -83,16 +82,16 @@ public:
virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
, const ::com::sun::star::awt::Size& rPageResolution );
- ::com::sun::star::chart2::ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
- ::com::sun::star::chart2::ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
ExplicitCategoriesProvider* getExplicitCategoriesProvider();
// returns a coplete scale set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
- ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ::std::vector< ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
// returns a coplete increment set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
- ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
+ ::std::vector< ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
@@ -101,8 +100,8 @@ public:
void prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
- , const ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
- , const ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement );
+ , const ExplicitScaleData& rExplicitScale
+ , const ExplicitIncrementData& rExplicitIncrement );
void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
@@ -143,8 +142,6 @@ protected: //methods
VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
- void prepareScaleAutomatism( ScaleAutomatism& rScaleAutomatism, double fMin, double fMax, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
-
rtl::OUString createCIDForAxis( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XAxis >& xAxis
, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
@@ -194,11 +191,11 @@ protected: //member
tVAxisMap m_aAxisMap;
private:
- ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData > m_aExplicitScales;
- ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitIncrementData > m_aExplicitIncrements;
+ std::vector< ExplicitScaleData > m_aExplicitScales;
+ std::vector< ExplicitIncrementData > m_aExplicitIncrements;
- typedef std::map< tFullAxisIndex, ::com::sun::star::chart2::ExplicitScaleData > tFullExplicitScaleMap;
- typedef std::map< tFullAxisIndex, ::com::sun::star::chart2::ExplicitIncrementData > tFullExplicitIncrementMap;
+ typedef std::map< tFullAxisIndex, ExplicitScaleData > tFullExplicitScaleMap;
+ typedef std::map< tFullAxisIndex, ExplicitIncrementData > tFullExplicitIncrementMap;
tFullExplicitScaleMap m_aSecondaryExplicitScales;
tFullExplicitIncrementMap m_aSecondaryExplicitIncrements;
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index 93aba58dbec4..62d61cb17269 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -81,6 +81,10 @@ public:
getModel() const;
void setCategoryXAxis();
+ void setXValues( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >& xValues );
+ void setXValuesIfNone( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSequence >& xValues );
void setParticle( const rtl::OUString& rSeriesParticle );
void setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex );
void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx
index 5df198c2f539..6bcef92111ef 100644
--- a/chart2/source/view/inc/VDiagram.hxx
+++ b/chart2/source/view/inc/VDiagram.hxx
@@ -56,7 +56,7 @@ public: //methods
, sal_Int32 nDimension=3, sal_Bool bPolar=sal_False );
virtual ~VDiagram();
- void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ void init( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xLogicTarget
, const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xFinalTarget
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index 6b6b06437542..8147c3443ec6 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -174,8 +174,7 @@ public:
)
*/
- virtual void SAL_CALL addSecondaryValueScale( const
- ::com::sun::star::chart2::ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
+ virtual void addSecondaryValueScale( const ExplicitScaleData& rScale, sal_Int32 nAxisIndex )
throw (::com::sun::star::uno::RuntimeException);
//-------------------------------------------------------------------------
@@ -197,6 +196,9 @@ public:
virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+ virtual long calculateTimeResolutionOnXAxis();
+ virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate );
+
//------
void getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximum ) const;
@@ -379,12 +381,14 @@ protected: //methods
, const VDataSeries& rVDataSeries
, sal_Int32 nIndex
, bool bVertical
+ , double* pfScaledLogicX
);
virtual void createErrorBar_Y( const ::com::sun::star::drawing::Position3D& rUnscaledLogicPosition
, VDataSeries& rVDataSeries, sal_Int32 nPointIndex
, const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShapes >& xTarget );
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , double* pfScaledLogicX=0 );
virtual void createRegressionCurvesShapes( VDataSeries& rVDataSeries
, const ::com::sun::star::uno::Reference<
@@ -425,6 +429,8 @@ protected: //member
::std::vector< ::std::vector< VDataSeriesGroup > > m_aZSlots;
bool m_bCategoryXAxis;//true->xvalues are indices (this would not be necessary if series for category chart wouldn't have x-values)
+ long m_nTimeResolution;
+ Date m_aNullDate;
::std::auto_ptr< NumberFormatterWrapper > m_apNumberFormatterWrapper;
AxesNumberFormats m_aAxesNumberFormats;//direct numberformats on axes, if empty ask the data series instead
@@ -439,7 +445,7 @@ protected: //member
bool m_bPointsWereSkipped;
private: //member
- typedef std::map< sal_Int32 , ::com::sun::star::chart2::ExplicitScaleData > tSecondaryValueScales;
+ typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales;
tSecondaryValueScales m_aSecondaryValueScales;
typedef std::map< sal_Int32 , PlottingPositionHelper* > tSecondaryPosHelperMap;
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index c997f9ee483d..60e880ab311e 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -65,52 +65,17 @@ ChartItemPool::ChartItemPool():
SvULongs aTmp;
ppPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,aTmp);
ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
-
- ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
-// ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem;
- ppPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,FALSE);
- ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE, SCHATTR_TEXT_ORDER);
-
- ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MIN);
- ppPoolDefaults[SCHATTR_Y_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MIN);
- ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MAX);
- ppPoolDefaults[SCHATTR_Y_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MAX);
- ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_MAIN);
- ppPoolDefaults[SCHATTR_Y_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_MAIN);
- ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_HELP);
- ppPoolDefaults[SCHATTR_Y_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_HELP);
- ppPoolDefaults[SCHATTR_Y_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_LOGARITHM);
- ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_ORIGIN);
- ppPoolDefaults[SCHATTR_Y_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_ORIGIN);
-
- ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MIN);
- ppPoolDefaults[SCHATTR_X_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MIN);
- ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MAX);
- ppPoolDefaults[SCHATTR_X_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MAX);
- ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_MAIN);
- ppPoolDefaults[SCHATTR_X_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_MAIN);
- ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_HELP);
- ppPoolDefaults[SCHATTR_X_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_HELP);
- ppPoolDefaults[SCHATTR_X_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_LOGARITHM);
- ppPoolDefaults[SCHATTR_X_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_ORIGIN);
- ppPoolDefaults[SCHATTR_X_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_ORIGIN);
-
- ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MIN);
- ppPoolDefaults[SCHATTR_Z_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MIN);
- ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MAX);
- ppPoolDefaults[SCHATTR_Z_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MAX);
- ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_MAIN);
- ppPoolDefaults[SCHATTR_Z_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_MAIN);
- ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_HELP);
- ppPoolDefaults[SCHATTR_Z_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_HELP);
- ppPoolDefaults[SCHATTR_Z_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_LOGARITHM);
- ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_ORIGIN);
- ppPoolDefaults[SCHATTR_Z_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_ORIGIN);
-
- ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_X);
ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0);
ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE);
+ //legend
+ ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
+
+ //text
+ ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0);
+ ppPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,sal_False);
+
+ //statistic
ppPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START] = new SfxBoolItem (SCHATTR_STAT_AVERAGE);
ppPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START] = new SvxChartKindErrorItem (CHERROR_NONE, SCHATTR_STAT_KIND_ERROR);
ppPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT);
@@ -121,9 +86,6 @@ ChartItemPool::ChartItemPool():
ppPoolDefaults[SCHATTR_STAT_RANGE_POS - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_POS, String());
ppPoolDefaults[SCHATTR_STAT_RANGE_NEG - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_NEG, String());
- ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0);
- ppPoolDefaults[SCHATTR_TEXT_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_OVERLAP,FALSE);
-
ppPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_DEEP, 0);
ppPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_3D, 0);
ppPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL, 0);
@@ -137,37 +99,43 @@ ChartItemPool::ChartItemPool():
ppPoolDefaults[SCHATTR_AXIS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS,2); //2 = Y-Achse!!!
+ //axis scale
+ ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_REALNUMBER);
+ ppPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,0);
ppPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN);
ppPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN);
ppPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX);
ppPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX);
ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN);
ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN);
+ ppPoolDefaults[SCHATTR_AXIS_MAIN_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,2);
ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP);
-// ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_HELP);
- // type changed from double to sal_Int32
ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0);
+ ppPoolDefaults[SCHATTR_AXIS_HELP_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,2);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_TIME_RESOLUTION - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION);
+ ppPoolDefaults[SCHATTR_AXIS_TIME_RESOLUTION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,2);
ppPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM);
+ ppPoolDefaults[SCHATTR_AXIS_AUTO_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS);
+ ppPoolDefaults[SCHATTR_AXIS_ALLOW_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS);
ppPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN);
ppPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN);
+ //axis position
ppPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER);
- ppPoolDefaults[SCHATTR_AXIS_NUMFMT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMT,0);
- ppPoolDefaults[SCHATTR_AXIS_NUMFMTPERCENT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMTPERCENT,11);
- ppPoolDefaults[SCHATTR_AXIS_SHOWAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,0);
- ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,0);
- ppPoolDefaults[SCHATTR_AXIS_SHOWMAINGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWMAINGRID,0);
- ppPoolDefaults[SCHATTR_AXIS_SHOWHELPGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWHELPGRID,0);
- ppPoolDefaults[SCHATTR_AXIS_TOPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_TOPDOWN,0);
ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0);
- ppPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,0);
-
ppPoolDefaults[SCHATTR_AXIS_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_POSITION,0);
ppPoolDefaults[SCHATTR_AXIS_POSITION_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE);
ppPoolDefaults[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0);
ppPoolDefaults[SCHATTR_AXIS_LABEL_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0);
ppPoolDefaults[SCHATTR_AXIS_MARK_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0);
+ //axis label
+ ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,0);
+ ppPoolDefaults[SCHATTR_AXIS_LABEL_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE, SCHATTR_AXIS_LABEL_ORDER);
+ ppPoolDefaults[SCHATTR_AXIS_LABEL_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP,sal_False);
+ ppPoolDefaults[SCHATTR_AXIS_LABEL_BREAK - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK, sal_False );
+
+ //--
ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH);
ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,0);
ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,0);
@@ -176,21 +144,21 @@ ChartItemPool::ChartItemPool():
// new for New Chart
ppPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_OVERLAP,0);
ppPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0);
- ppPoolDefaults[SCHATTR_BAR_CONNECT - SCHATTR_START] = new SfxBoolItem(SCHATTR_BAR_CONNECT, FALSE);
+ ppPoolDefaults[SCHATTR_BAR_CONNECT - SCHATTR_START] = new SfxBoolItem(SCHATTR_BAR_CONNECT, sal_False);
ppPoolDefaults[SCHATTR_NUM_OF_LINES_FOR_BAR - SCHATTR_START] = new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 );
ppPoolDefaults[SCHATTR_SPLINE_ORDER - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 );
ppPoolDefaults[SCHATTR_SPLINE_RESOLUTION - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 );
ppPoolDefaults[SCHATTR_DIAGRAM_STYLE - SCHATTR_START] = new SvxChartStyleItem( CHSTYLE_2D_COLUMN, SCHATTR_DIAGRAM_STYLE );
- ppPoolDefaults[SCHATTR_TEXTBREAK - SCHATTR_START] = new SfxBoolItem( SCHATTR_TEXTBREAK, FALSE );
- ppPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, FALSE);
- ppPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE);
+ ppPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, sal_False);
ppPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SfxInt32Item( SCHATTR_STARTING_ANGLE, 90 );
- ppPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, FALSE );
+ ppPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, sal_False );
ppPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0);
ppPoolDefaults[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,aTmp);
+ ppPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True);
ppPoolDefaults[SCHATTR_AXIS_FOR_ALL_SERIES - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0);
+
ppPoolDefaults[SCHATTR_REGRESSION_TYPE - SCHATTR_START] = new SvxChartRegressItem (CHREGRESS_NONE, SCHATTR_REGRESSION_TYPE);
ppPoolDefaults[SCHATTR_REGRESSION_SHOW_EQUATION - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, 0);
ppPoolDefaults[SCHATTR_REGRESSION_SHOW_COEFF - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, 0);
@@ -200,7 +168,7 @@ ChartItemPool::ChartItemPool():
**************************************************************************/
pItemInfos = new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1];
- USHORT i;
+ sal_uInt16 i;
for( i = SCHATTR_START; i <= SCHATTR_END; i++ )
{
pItemInfos[i - SCHATTR_START]._nSID = 0;
@@ -229,8 +197,8 @@ ChartItemPool::~ChartItemPool()
delete[] pItemInfos;
- const USHORT nMax = SCHATTR_END - SCHATTR_START + 1;
- for( USHORT i=0; i<nMax; ++i )
+ const sal_uInt16 nMax = SCHATTR_END - SCHATTR_START + 1;
+ for( sal_uInt16 i=0; i<nMax; ++i )
{
SetRefCount(*ppPoolDefaults[i], 0);
delete ppPoolDefaults[i];
@@ -244,7 +212,7 @@ SfxItemPool* ChartItemPool::Clone() const
return new ChartItemPool(*this);
}
-SfxMapUnit ChartItemPool::GetMetric(USHORT /* nWhich */) const
+SfxMapUnit ChartItemPool::GetMetric(sal_uInt16 /* nWhich */) const
{
return SFX_MAPUNIT_100TH_MM;
}
diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx
index b8ee9910ce2d..10d30e9d2cf4 100644
--- a/chart2/source/view/main/ChartItemPool.hxx
+++ b/chart2/source/view/main/ChartItemPool.hxx
@@ -46,7 +46,7 @@ protected:
public:
virtual SfxItemPool* Clone() const;
- SfxMapUnit GetMetric( USHORT nWhich ) const;
+ SfxMapUnit GetMetric( sal_uInt16 nWhich ) const;
/// creates a pure chart item pool
static SfxItemPool* CreateChartItemPool();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 390c1890154e..ad20a557756c 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -31,6 +31,7 @@
#include "ChartView.hxx"
#include "chartview/DrawModelWrapper.hxx"
+#include "NumberFormatterWrapper.hxx"
#include "ViewDefines.hxx"
#include "VDiagram.hxx"
#include "VTitle.hxx"
@@ -56,6 +57,7 @@
#include "ControllerLockGuard.hxx"
#include "BaseGFXHelper.hxx"
#include "DataSeriesHelper.hxx"
+#include "DateHelper.hxx"
#include <comphelper/scopeguard.hxx>
#include <boost/bind.hpp>
@@ -78,7 +80,6 @@
#include <com/sun/star/chart/ChartAxisPosition.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
-#include <com/sun/star/chart2/ExplicitSubIncrement.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -201,7 +202,7 @@ void SAL_CALL ChartView::initialize( const uno::Sequence< uno::Any >& aArguments
m_pDrawModelWrapper = ::boost::shared_ptr< DrawModelWrapper >( new DrawModelWrapper( m_xCC ) );
m_xShapeFactory = m_pDrawModelWrapper->getShapeFactory();
m_xDrawPage = m_pDrawModelWrapper->getMainDrawPage();
- StartListening( m_pDrawModelWrapper->getSdrModel(), FALSE /*bPreventDups*/ );
+ StartListening( m_pDrawModelWrapper->getSdrModel(), sal_False /*bPreventDups*/ );
// \--
}
}
@@ -210,7 +211,7 @@ ChartView::~ChartView()
{
if( m_pDrawModelWrapper.get() )
{
- EndListening( m_pDrawModelWrapper->getSdrModel(), FALSE /*bAllDups*/ );
+ EndListening( m_pDrawModelWrapper->getSdrModel(), sal_False /*bAllDups*/ );
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
m_pDrawModelWrapper.reset();
}
@@ -472,7 +473,7 @@ private:
};
AxisUsage::AxisUsage()
- : aScaleAutomatism(AxisHelper::createDefaultScale())
+ : aScaleAutomatism(AxisHelper::createDefaultScale(),Date())
{
}
@@ -563,7 +564,7 @@ public:
~SeriesPlotterContainer();
void initializeCooSysAndSeriesPlotter( const uno::Reference< frame::XModel >& xChartModel );
- void initAxisUsageList();
+ void initAxisUsageList(const Date& rNullDate);
void doAutoScaling( const uno::Reference< frame::XModel >& xChartModel );
void updateScalesAndIncrementsOnAxes();
void setScalesFromCooSysToPlotter();
@@ -581,13 +582,15 @@ private:
std::vector< VCoordinateSystem* >& m_rVCooSysList;
::std::map< uno::Reference< XAxis >, AxisUsage > m_aAxisUsageList;
sal_Int32 m_nMaxAxisIndex;
- bool m_bChartTypeUsesShiftedXAxisTicksPerDefault;
+ bool m_bChartTypeUsesShiftedCategoryPositionPerDefault;
+ sal_Int32 m_nDefaultDateNumberFormat;
};
SeriesPlotterContainer::SeriesPlotterContainer( std::vector< VCoordinateSystem* >& rVCooSysList )
: m_rVCooSysList( rVCooSysList )
, m_nMaxAxisIndex(0)
- , m_bChartTypeUsesShiftedXAxisTicksPerDefault(false)
+ , m_bChartTypeUsesShiftedCategoryPositionPerDefault(false)
+ , m_nDefaultDateNumberFormat(0)
{
}
@@ -625,6 +628,10 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
return;
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+ uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is() && xChartDoc->hasInternalDataProvider()
+ && DiagramHelper::isSupportingDateAxis( xDiagram ) )
+ m_nDefaultDateNumberFormat=DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
if(!nDimensionCount)
@@ -682,7 +689,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
if(nT==0)
- m_bChartTypeUsesShiftedXAxisTicksPerDefault = ChartTypeHelper::shiftTicksAtXAxisPerDefault( xChartType );
+ m_bChartTypeUsesShiftedCategoryPositionPerDefault = ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( xChartType );
bool bExcludingPositioning = DiagramPositioningMode_EXCLUDING == DiagramHelper::getDiagramPositioningMode( xDiagram );
VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount, bExcludingPositioning );
@@ -793,7 +800,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
}
}
-void SeriesPlotterContainer::initAxisUsageList()
+void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
{
m_aAxisUsageList.clear();
size_t nC;
@@ -803,8 +810,10 @@ void SeriesPlotterContainer::initAxisUsageList()
for(sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
{
uno::Reference< XCoordinateSystem > xCooSys = pVCooSys->getModel();
- if( nDimensionIndex >= xCooSys->getDimension() )
+ sal_Int32 nDimensionCount = xCooSys->getDimension();
+ if( nDimensionIndex >= nDimensionCount )
continue;
+ bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), nDimensionCount, nDimensionIndex );
const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
{
@@ -813,7 +822,20 @@ void SeriesPlotterContainer::initAxisUsageList()
if( xAxis.is())
{
if(m_aAxisUsageList.find(xAxis)==m_aAxisUsageList.end())
- m_aAxisUsageList[xAxis].aScaleAutomatism = ScaleAutomatism(xAxis->getScaleData());
+ {
+ chart2::ScaleData aSourceScale = xAxis->getScaleData();
+ ExplicitCategoriesProvider* pExplicitCategoriesProvider = pVCooSys->getExplicitCategoriesProvider();
+ if( nDimensionIndex==0 )
+ AxisHelper::checkDateAxis( aSourceScale, pExplicitCategoriesProvider, bChartTypeAllowsDateAxis );
+ if( (aSourceScale.AxisType == AxisType::CATEGORY && m_bChartTypeUsesShiftedCategoryPositionPerDefault)
+ || (aSourceScale.AxisType==AxisType::CATEGORY && pExplicitCategoriesProvider && pExplicitCategoriesProvider->hasComplexCategories() )
+ || aSourceScale.AxisType == AxisType::DATE
+ || aSourceScale.AxisType == AxisType::SERIES )
+ aSourceScale.ShiftedCategoryPosition = true;
+ else
+ aSourceScale.ShiftedCategoryPosition = false;
+ m_aAxisUsageList[xAxis].aScaleAutomatism = ScaleAutomatism(aSourceScale,rNullDate);
+ }
AxisUsage& rAxisUsage = m_aAxisUsageList[xAxis];
rAxisUsage.addCoordinateSystem(pVCooSys,nDimensionIndex,nAxisIndex);
}
@@ -886,6 +908,11 @@ void SeriesPlotterContainer::setNumberFormatsFromAxes()
{
aAxesNumberFormats.setFormat( nNumberFormatKey, nDimensionIndex, nAxisIndex );
}
+ else if( nDimensionIndex==0 )
+ {
+ //provide a default date format for date axis with own data
+ aAxesNumberFormats.setFormat( m_nDefaultDateNumberFormat, nDimensionIndex, nAxisIndex );
+ }
}
}
catch( lang::IndexOutOfBoundsException& e )
@@ -936,13 +963,7 @@ void SeriesPlotterContainer::doAutoScaling( const uno::Reference< frame::XModel
rAxisUsage.aScaleAutomatism.calculateExplicitScaleAndIncrement( aExplicitScale, aExplicitIncrement );
for( nC=0; nC < aVCooSysList_X.size(); nC++)
- {
- ExplicitCategoriesProvider* pExplicitCategoriesProvider = aVCooSysList_X[nC]->getExplicitCategoriesProvider();
-
- if( m_bChartTypeUsesShiftedXAxisTicksPerDefault || (aExplicitScale.AxisType==AxisType::CATEGORY && pExplicitCategoriesProvider && pExplicitCategoriesProvider->hasComplexCategories() ) )
- aExplicitIncrement.ShiftedPosition = true;
aVCooSysList_X[nC]->setExplicitScaleAndIncrement( 0, nAxisIndex, aExplicitScale, aExplicitIncrement );
- }
for( nC=0; nC < aVCooSysList_Z.size(); nC++)
aVCooSysList_Z[nC]->setExplicitScaleAndIncrement( 2, nAxisIndex, aExplicitScale, aExplicitIncrement );
}
@@ -1027,7 +1048,6 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno::
aExplicitScaleDest.Orientation = aExplicitScaleSource.Orientation;
aExplicitScaleDest.Scaling = aExplicitScaleSource.Scaling;
- aExplicitScaleDest.Breaks = aExplicitScaleSource.Breaks;
aExplicitScaleDest.AxisType = aExplicitScaleSource.AxisType;
aExplicitIncrementDest.BaseValue = aExplicitIncrementSource.BaseValue;
@@ -1065,7 +1085,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno::
bAutoMinorInterval = !( aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() );
if( bAutoMinorInterval )
{
- if( aExplicitIncrementDest.SubIncrements.getLength() && aExplicitIncrementSource.SubIncrements.getLength() )
+ if( !aExplicitIncrementDest.SubIncrements.empty() && !aExplicitIncrementSource.SubIncrements.empty() )
aExplicitIncrementDest.SubIncrements[0].IntervalCount =
aExplicitIncrementSource.SubIncrements[0].IntervalCount;
}
@@ -1380,7 +1400,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
// - prepare list of all axis and how they are used
- rSeriesPlotterContainer.initAxisUsageList();
+ Date aNullDate = NumberFormatterWrapper( uno::Reference< util::XNumberFormatsSupplier >( m_xChartModel, uno::UNO_QUERY ) ).getNullDate();
+ rSeriesPlotterContainer.initAxisUsageList(aNullDate);
rSeriesPlotterContainer.doAutoScaling( m_xChartModel );
rSeriesPlotterContainer.setScalesFromCooSysToPlotter();
rSeriesPlotterContainer.setNumberFormatsFromAxes();
@@ -1663,6 +1684,31 @@ sal_Bool ChartView::getExplicitValuesForAxis(
{
rExplicitScale = pVCooSys->getExplicitScale(nDimensionIndex,nAxisIndex);
rExplicitIncrement = pVCooSys->getExplicitIncrement(nDimensionIndex,nAxisIndex);
+ if( rExplicitScale.ShiftedCategoryPosition )
+ {
+ //remove 'one' from max
+ if( rExplicitScale.AxisType == ::com::sun::star::chart2::AxisType::DATE )
+ {
+ Date aMaxDate(rExplicitScale.NullDate); aMaxDate += static_cast<long>(::rtl::math::approxFloor(rExplicitScale.Maximum));
+ //for explicit scales with shifted categories we need one interval more
+ switch( rExplicitScale.TimeResolution )
+ {
+ case ::com::sun::star::chart::TimeUnit::DAY:
+ aMaxDate--;break;
+ case ::com::sun::star::chart::TimeUnit::MONTH:
+ aMaxDate = DateHelper::GetDateSomeMonthsAway(aMaxDate,-1);
+ break;
+ case ::com::sun::star::chart::TimeUnit::YEAR:
+ aMaxDate = DateHelper::GetDateSomeYearsAway(aMaxDate,-1);
+ break;
+ }
+ rExplicitScale.Maximum = aMaxDate - rExplicitScale.NullDate;
+ }
+ else if( rExplicitScale.AxisType == ::com::sun::star::chart2::AxisType::CATEGORY )
+ rExplicitScale.Maximum -= 1.0;
+ else if( rExplicitScale.AxisType == ::com::sun::star::chart2::AxisType::SERIES )
+ rExplicitScale.Maximum -= 1.0;
+ }
return sal_True;
}
return sal_False;
@@ -1791,166 +1837,15 @@ bool lcl_getPropertySwapXAndYAxis( const uno::Reference< XDiagram >& xDiagram )
}
-sal_Int32 lcl_getExplicitNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis
- , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
- , bool bSearchForParallelAxisIfNothingIsFound )
-{
- sal_Int32 nNumberFormatKey(0);
- Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
- if( xProp.is() && !( xProp->getPropertyValue( C2U( "NumberFormat" ) ) >>= nNumberFormatKey ) )
- {
- bool bPercentFormatSet = false;
- //check wether we have a percent scale -> use percent format
- if( xNumberFormatsSupplier.is() )
- {
- ScaleData aData = xAxis->getScaleData();
- if( aData.AxisType==AxisType::PERCENT )
- {
- sal_Int32 nPercentFormat = ExplicitValueProvider::getPercentNumberFormat( xNumberFormatsSupplier );
- if( nPercentFormat != -1 )
- {
- nNumberFormatKey = nPercentFormat;
- bPercentFormatSet = true;
- }
- }
- }
-
- if( !bPercentFormatSet )
- {
- typedef ::std::map< sal_Int32, sal_Int32 > tNumberformatFrequency;
- tNumberformatFrequency aKeyMap;
-
- bool bNumberFormatKeyFoundViaAttachedData = false;
- sal_Int32 nAxisIndex = 0;
- sal_Int32 nDimensionIndex = 1;
-
- try
- {
- Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW );
- if( xCTCnt.is() )
- {
- AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
- ::rtl::OUString aRoleToMatch;
- if( nDimensionIndex == 0 )
- aRoleToMatch = C2U("values-x");
- Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
- for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
- {
- if( nDimensionIndex != 0 )
- aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
- Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
- for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
- {
- Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]);
- Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
-
- if( nDimensionIndex == 1 )
- {
- //only take those series into accoutn that are attached to this axis
- sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
- if( nAttachedAxisIndex != nAxisIndex )
- continue;
- }
-
- Sequence< Reference< data::XLabeledDataSequence > > aLabeledSeq( xSource->getDataSequences());
- for( sal_Int32 nLSeqIdx=0; nLSeqIdx<aLabeledSeq.getLength(); ++nLSeqIdx )
- {
- if(!aLabeledSeq[nLSeqIdx].is())
- continue;
- Reference< data::XDataSequence > xSeq( aLabeledSeq[nLSeqIdx]->getValues());
- if(!xSeq.is())
- continue;
- Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
- ::rtl::OUString aRole;
- bool bTakeIntoAccount =
- ( xSeqProp.is() && (aRoleToMatch.getLength() > 0) &&
- (xSeqProp->getPropertyValue(C2U("Role")) >>= aRole ) &&
- aRole.equals( aRoleToMatch ));
-
- if( bTakeIntoAccount )
- {
- sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
- // initialize the value
- if( aKeyMap.find( nKey ) == aKeyMap.end())
- aKeyMap[ nKey ] = 0;
- // increase frequency
- aKeyMap[ nKey ] = (aKeyMap[ nKey ] + 1);
- }
- }
- }
- }
- }
- }
- catch( const uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
-
- if( ! aKeyMap.empty())
- {
- sal_Int32 nMaxFreq = 0;
- // find most frequent key
- for( tNumberformatFrequency::const_iterator aIt = aKeyMap.begin();
- aIt != aKeyMap.end(); ++aIt )
- {
- OSL_TRACE( "NumberFormatKey %d appears %d times", (*aIt).first, (*aIt).second );
- // all values must at least be 1
- if( (*aIt).second > nMaxFreq )
- {
- nNumberFormatKey = (*aIt).first;
- bNumberFormatKeyFoundViaAttachedData = true;
- nMaxFreq = (*aIt).second;
- }
- }
- }
-
- if( bSearchForParallelAxisIfNothingIsFound )
- {
- //no format is set to this axis and no data is set to this axis
- //--> try to obtain the format from the parallel y-axis
- if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
- {
- sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
- Reference< XAxis > xParallelAxis( AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem ) );
- nNumberFormatKey = lcl_getExplicitNumberFormatKeyForAxis( xParallelAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier, false );
- }
- }
- }
- }
- return nNumberFormatKey;
-}
-
sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
const Reference< chart2::XAxis >& xAxis
, const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
, const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
{
- return lcl_getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier
+ return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xNumberFormatsSupplier
, true /*bSearchForParallelAxisIfNothingIsFound*/ );
}
-sal_Int32 ExplicitValueProvider::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
-{
- sal_Int32 nRet=-1;
- Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() );
- if( xNumberFormats.is() )
- {
- sal_Bool bCreate = sal_True;
- const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
- Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT,
- rLocaleDataWrapper.getLocale(), bCreate );
- if( aKeySeq.getLength() )
- {
- nRet = aKeySeq[0];
- }
- }
- return nRet;
-}
-
-
sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
const uno::Reference< XDataSeries >& xSeries,
@@ -2003,7 +1898,7 @@ sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabe
return nFormat;
if( !(xSeriesOrPointProp->getPropertyValue(C2U( "PercentageNumberFormat" )) >>= nFormat) )
{
- nFormat = ExplicitValueProvider::getPercentNumberFormat( xNumberFormatsSupplier );
+ nFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier );
}
if(nFormat<0)
nFormat=0;
@@ -2599,7 +2494,7 @@ void ChartView::createShapes()
// /--
::vos::OGuard aSolarGuard( Application::GetSolarMutex());
// #i12587# support for shapes in chart
- m_pDrawModelWrapper->getSdrModel().EnableUndo( FALSE );
+ m_pDrawModelWrapper->getSdrModel().EnableUndo( sal_False );
m_pDrawModelWrapper->clearMainDrawPage();
// \--
}
@@ -2763,7 +2658,7 @@ void ChartView::createShapes()
if ( m_pDrawModelWrapper )
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- m_pDrawModelWrapper->getSdrModel().EnableUndo( TRUE );
+ m_pDrawModelWrapper->getSdrModel().EnableUndo( sal_True );
}
#if OSL_DEBUG_LEVEL > 0
diff --git a/chart2/source/view/main/ChartView.hxx b/chart2/source/view/main/ChartView.hxx
index 476adae03674..76c1ce5c4858 100644
--- a/chart2/source/view/main/ChartView.hxx
+++ b/chart2/source/view/main/ChartView.hxx
@@ -103,8 +103,8 @@ public:
// ___ExplicitValueProvider___
virtual sal_Bool getExplicitValuesForAxis(
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
- , ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale
- , ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement );
+ , ExplicitScaleData& rExplicitScale
+ , ExplicitIncrementData& rExplicitIncrement );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
getShapeForCID( const rtl::OUString& rObjectCID );
diff --git a/chart2/source/view/main/Clipping.cxx b/chart2/source/view/main/Clipping.cxx
index e61096e5a0ba..7eced29eb271 100644
--- a/chart2/source/view/main/Clipping.cxx
+++ b/chart2/source/view/main/Clipping.cxx
@@ -86,7 +86,7 @@ bool lcl_CLIPt(double fDenom,double fNum, double & fTE, double & fTL)
}
/** @descr The line given by it's two endpoints rP0 and rP1 is clipped at the rectangle
- rRectangle. If there is at least a part of it visible then TRUE is returned and
+ rRectangle. If there is at least a part of it visible then sal_True is returned and
the endpoints of that part are stored in rP0 and rP1. The points rP0 and rP1
may have the same coordinates.
@param rP0 Start point of the line to clip. Modified to contain a start point inside
@@ -95,7 +95,7 @@ bool lcl_CLIPt(double fDenom,double fNum, double & fTE, double & fTL)
the clipping area if possible.
@param rRectangle Clipping area.
@return If the line lies completely or partly inside the clipping area then TRUE
- is returned. If the line lies completely outside then FALSE is returned and rP0 and
+ is returned. If the line lies completely outside then sal_False is returned and rP0 and
rP1 are left unmodified.
*/
bool lcl_clip2d(B2DTuple& rPoint0, B2DTuple& rPoint1, const B2DRectangle& rRectangle)
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index 83544d6a8f2b..a23041ada673 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -135,7 +135,7 @@ DrawModelWrapper::DrawModelWrapper(
SfxItemPool* pMasterPool = &GetItemPool();
pMasterPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
- pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, TRUE) );
+ pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, sal_True) );
pMasterPool->SetPoolDefaultItem(Svx3DPercentDiagonalItem (5));
SfxItemPool* pPool = pMasterPool;
@@ -374,8 +374,8 @@ SdrObject* DrawModelWrapper::getNamedSdrObject( const String& rObjectCID, SdrObj
{
if(!pSearchList || rObjectCID.Len()==0)
return 0;
- ULONG nCount = pSearchList->GetObjCount();
- for( ULONG nN=0; nN<nCount; nN++ )
+ sal_uLong nCount = pSearchList->GetObjCount();
+ for( sal_uLong nN=0; nN<nCount; nN++ )
{
SdrObject* pObj = pSearchList->GetObj(nN);
if(!pObj)
diff --git a/chart2/source/view/main/PlotterBase.cxx b/chart2/source/view/main/PlotterBase.cxx
index 08f43dc7064d..8a71f45b4dbb 100644
--- a/chart2/source/view/main/PlotterBase.cxx
+++ b/chart2/source/view/main/PlotterBase.cxx
@@ -56,8 +56,7 @@ PlotterBase::PlotterBase( sal_Int32 nDimensionCount )
{
}
- void SAL_CALL PlotterBase
-::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
+void PlotterBase::initPlotter( const uno::Reference< drawing::XShapes >& xLogicTarget
, const uno::Reference< drawing::XShapes >& xFinalTarget
, const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
, const rtl::OUString& rCID )
@@ -77,11 +76,9 @@ PlotterBase::~PlotterBase()
delete m_pShapeFactory;
}
-void SAL_CALL PlotterBase::setScales( const uno::Sequence< ExplicitScaleData >& rScales
- , sal_Bool bSwapXAndYAxis )
- throw (uno::RuntimeException)
+void PlotterBase::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
{
- DBG_ASSERT(m_nDimension<=rScales.getLength(),"Dimension of Plotter does not fit two dimension of given scale sequence");
+ DBG_ASSERT(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
}
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index b5d39b2f898f..e257581d664b 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -32,12 +32,14 @@
#include "ViewDefines.hxx"
#include "Linear3DTransformation.hxx"
#include "VPolarTransformation.hxx"
-
#include "ShapeFactory.hxx"
#include "PropertyMapper.hxx"
+#include "DateHelper.hxx"
+
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/drawing/DoubleSequence.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
-#include <com/sun/star/chart2/AxisType.hpp>
#include <rtl/math.hxx>
@@ -57,6 +59,12 @@ PlottingPositionHelper::PlottingPositionHelper()
, m_nYResolution( 1000 )
, m_nZResolution( 1000 )
, m_bMaySkipPointsInRegressionCalculation( true )
+ , m_bDateAxis(false)
+ , m_nTimeResolution( ::com::sun::star::chart::TimeUnit::DAY )
+ , m_aNullDate(30,12,1899)
+ , m_fScaledCategoryWidth(1.0)
+ , m_bAllowShiftXAxisPos(false)
+ , m_bAllowShiftZAxisPos(false)
{
}
PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper& rSource )
@@ -68,6 +76,12 @@ PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper& rS
, m_nYResolution( rSource.m_nYResolution )
, m_nZResolution( rSource.m_nZResolution )
, m_bMaySkipPointsInRegressionCalculation( rSource.m_bMaySkipPointsInRegressionCalculation )
+ , m_bDateAxis( rSource.m_bDateAxis )
+ , m_nTimeResolution( rSource.m_nTimeResolution )
+ , m_aNullDate( rSource.m_aNullDate )
+ , m_fScaledCategoryWidth( rSource.m_fScaledCategoryWidth )
+ , m_bAllowShiftXAxisPos( rSource.m_bAllowShiftXAxisPos )
+ , m_bAllowShiftZAxisPos( rSource.m_bAllowShiftZAxisPos )
{
}
@@ -95,13 +109,13 @@ void PlottingPositionHelper::setTransformationSceneToScreen( const drawing::Homo
m_xTransformationLogicToScene = NULL;
}
-void PlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleData >& rScales, sal_Bool bSwapXAndYAxis )
+void PlottingPositionHelper::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
{
m_aScales = rScales;
m_bSwapXAndY = bSwapXAndYAxis;
m_xTransformationLogicToScene = NULL;
}
-const uno::Sequence< ExplicitScaleData >& PlottingPositionHelper::getScales() const
+const std::vector< ExplicitScaleData >& PlottingPositionHelper::getScales() const
{
return m_aScales;
}
@@ -129,8 +143,8 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
AxisOrientation nZAxisOrientation = m_aScales[2].Orientation;
//apply scaling
- doLogicScaling( &MinX, &MinY, &MinZ );
- doLogicScaling( &MaxX, &MaxY, &MaxZ);
+ doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
+ doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
if(m_bSwapXAndY)
{
@@ -176,9 +190,9 @@ uno::Reference< XTransformation > PlottingPositionHelper::getTransformationScale
drawing::Position3D PlottingPositionHelper::transformLogicToScene(
double fX, double fY, double fZ, bool bClip ) const
{
- if(bClip)
- this->clipLogicValues( &fX,&fY,&fZ );
this->doLogicScaling( &fX,&fY,&fZ );
+ if(bClip)
+ this->clipScaledLogicValues( &fX,&fY,&fZ );
return this->transformScaledLogicToScene( fX, fY, fZ, false );
}
@@ -254,8 +268,8 @@ void PlottingPositionHelper::clipScaledLogicValues( double* pX, double* pY, doub
double MaxZ = getLogicMaxZ();
//apply scaling
- doLogicScaling( &MinX, &MinY, &MinZ );
- doLogicScaling( &MaxX, &MaxY, &MaxZ);
+ doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
+ doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
if(pX)
{
@@ -291,8 +305,8 @@ basegfx::B2DRectangle PlottingPositionHelper::getScaledLogicClipDoubleRect() con
double MaxZ = getLogicMaxZ();
//apply scaling
- doLogicScaling( &MinX, &MinY, &MinZ );
- doLogicScaling( &MaxX, &MaxY, &MaxZ);
+ doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
+ doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
basegfx::B2DRectangle aRet( MinX, MaxY, MaxX, MinY );
return aRet;
@@ -355,7 +369,7 @@ void PolarPlottingPositionHelper::setTransformationSceneToScreen( const drawing:
PlottingPositionHelper::setTransformationSceneToScreen( rMatrix);
m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
}
-void PolarPlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleData >& rScales, sal_Bool bSwapXAndYAxis )
+void PolarPlottingPositionHelper::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
{
PlottingPositionHelper::setScales( rScales, bSwapXAndYAxis );
m_aUnitCartesianToScene =impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene );
@@ -365,7 +379,7 @@ void PolarPlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleD
{
::basegfx::B3DHomMatrix aRet;
- if( !m_aScales.getLength() )
+ if( m_aScales.empty() )
return aRet;
double fTranslate =1.0;
@@ -640,6 +654,41 @@ double PlottingPositionHelper::getBaseValueY() const
return m_aScales[1].Origin;
}
+void PlottingPositionHelper::setTimeResolution( long nTimeResolution, const Date& rNullDate )
+{
+ m_nTimeResolution = nTimeResolution;
+ m_aNullDate = rNullDate;
+
+ //adapt category width
+ double fCategoryWidth = 1.0;
+ if( !m_aScales.empty() )
+ {
+ if( m_aScales[0].AxisType == ::com::sun::star::chart2::AxisType::DATE )
+ {
+ m_bDateAxis = true;
+ if( nTimeResolution == ::com::sun::star::chart::TimeUnit::YEAR )
+ {
+ const double fMonthCount = 12.0;//todo: this depends on the DateScaling and must be adjusted in case we use more generic calendars in future
+ fCategoryWidth = fMonthCount;
+ }
+ }
+ }
+ setScaledCategoryWidth(fCategoryWidth);
+}
+
+void PlottingPositionHelper::setScaledCategoryWidth( double fScaledCategoryWidth )
+{
+ m_fScaledCategoryWidth = fScaledCategoryWidth;
+}
+void PlottingPositionHelper::AllowShiftXAxisPos( bool bAllowShift )
+{
+ m_bAllowShiftXAxisPos = bAllowShift;
+}
+void PlottingPositionHelper::AllowShiftZAxisPos( bool bAllowShift )
+{
+ m_bAllowShiftZAxisPos = bAllowShift;
+}
+
/*
// ____ XTransformation ____
uno::Sequence< double > SAL_CALL PolarPlottingPositionHelper::transform(
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index 8bb6a11b4baf..2b9512d4af2a 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -352,6 +352,22 @@ void VDataSeries::setCategoryXAxis()
m_bAllowPercentValueInDataLabel = true;
}
+void VDataSeries::setXValues( const Reference< chart2::data::XDataSequence >& xValues )
+{
+ m_aValues_X.clear();
+ m_aValues_X.init( xValues );
+ m_bAllowPercentValueInDataLabel = true;
+}
+
+void VDataSeries::setXValuesIfNone( const Reference< chart2::data::XDataSequence >& xValues )
+{
+ if( m_aValues_X.is() )
+ return;
+
+ m_aValues_X.init( xValues );
+ lcl_clearIfNoValuesButTextIsContained( m_aValues_X, xValues );
+}
+
void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
{
m_nGlobalSeriesIndex = nGlobalSeriesIndex;
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 9a011498991b..fbc74bad05a5 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -632,7 +632,7 @@ VLegend::VLegend(
// ----------------------------------------
-void SAL_CALL VLegend::init(
+void VLegend::init(
const Reference< drawing::XShapes >& xTargetPage,
const Reference< lang::XMultiServiceFactory >& xFactory,
const Reference< frame::XModel >& xModel )
diff --git a/chart2/source/view/main/VLegend.hxx b/chart2/source/view/main/VLegend.hxx
index 9587b50f71e7..4534a350f4f4 100644
--- a/chart2/source/view/main/VLegend.hxx
+++ b/chart2/source/view/main/VLegend.hxx
@@ -56,7 +56,7 @@ public:
::com::sun::star::uno::XComponentContext > & xContext,
const std::vector< LegendEntryProvider* >& rLegendEntryProviderList );
- void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ void init( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTargetPage,
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& xFactory,
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index f62142735b7c..c2aa01163b17 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -65,7 +65,7 @@ VTitle::~VTitle()
{
}
-void SAL_CALL VTitle::init(
+void VTitle::init(
const uno::Reference< drawing::XShapes >& xTargetPage
, const uno::Reference< lang::XMultiServiceFactory >& xFactory
, const rtl::OUString& rCID )
diff --git a/chart2/source/view/main/VTitle.hxx b/chart2/source/view/main/VTitle.hxx
index 8a6e7d6e4f16..e097ecd3bbcc 100644
--- a/chart2/source/view/main/VTitle.hxx
+++ b/chart2/source/view/main/VTitle.hxx
@@ -47,7 +47,7 @@ public:
::com::sun::star::chart2::XTitle > & xTitle );
virtual ~VTitle();
- void SAL_CALL init( const ::com::sun::star::uno::Reference<
+ void init( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTargetPage
, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
, const rtl::OUString& rCID );
diff --git a/chart2/source/view/main/makefile.mk b/chart2/source/view/main/makefile.mk
index ec9c99f2a898..8675930aa107 100644
--- a/chart2/source/view/main/makefile.mk
+++ b/chart2/source/view/main/makefile.mk
@@ -43,7 +43,6 @@ ENABLE_EXCEPTIONS= TRUE
SLOFILES = \
$(SLO)$/ChartItemPool.obj \
$(SLO)$/DrawModelWrapper.obj \
- $(SLO)$/NumberFormatterWrapper.obj \
$(SLO)$/PropertyMapper.obj \
$(SLO)$/Stripe.obj \
$(SLO)$/VLineProperties.obj \